use of alma.ACSErr.Completion in project ACS by ACS-Community.
the class ResponderUtil method respond.
/**
* @param returnValue
* @param cb
* @param descIn
*/
public static void respond(int returnValue, CBlong cb, CBDescIn descIn) {
Completion completion = ResponderUtil.giveCompletion();
CBDescOut cbDescOut = ResponderUtil.giveDescOut(descIn);
cb.done(returnValue, completion, cbDescOut);
}
use of alma.ACSErr.Completion in project ACS by ACS-Community.
the class ResponderUtil method giveCompletion.
public static Completion giveCompletion() {
/* DONE: Use AcsJCompletion instead of this straightforward code
* int errorType = 0;
* int errorCode = 0;
* long timeStamp = 0L;
* ErrorTrace[] previousError = new ErrorTrace[]{};
* return new Completion(timeStamp, errorType, errorCode, previousError);
*/
Completion ret;
MyAcsJCompletion c = new MyAcsJCompletion(0, 0);
ret = c.toCorbaCompletion();
return ret;
}
use of alma.ACSErr.Completion in project ACS by ACS-Community.
the class AcsJCompletion method toCorbaCompletion.
/**
* Creates a CORBA style completion object from this Java style completion.
* If present, the attached exceptions are converted to <code>ErrorTrace</code>s.
* <p>
* This method should be used when a Java implementation (of a component etc)
* has to send an <code>AcsJCompletion</code> over Corba.
* @see #fromCorbaCompletion
*/
public Completion toCorbaCompletion() {
Completion corbaCompl = new Completion();
corbaCompl.type = getType();
corbaCompl.code = getCode();
corbaCompl.timeStamp = UTCUtility.utcJavaToOmg(getTimeStamp());
if (isError()) {
corbaCompl.previousError = new ErrorTrace[1];
corbaCompl.previousError[0] = getAcsJException().getErrorTrace();
} else {
// create empty array so that CORBA can transport the struct w/o NPE
corbaCompl.previousError = new ErrorTrace[0];
}
return corbaCompl;
}
use of alma.ACSErr.Completion in project ACS by ACS-Community.
the class CommonComparableMonitorImpl method valueChanged.
/**
* @see alma.ACS.jbaci.DataAccess.ValueChangeListener#valueChanged(alma.ACS.jbaci.DataAccess, java.lang.Object, java.lang.Object)
*/
public void valueChanged(DataAccess source, Object oldValue, Object newValue) {
if (onEveryChange) {
// if equals, return
if (oldValue.equals(newValue))
return;
} else // this code should not never be reached for non-comparable properties
if (comparableProperty.lessThanDelta(oldValue, newValue, deltaValue))
return;
// set new 'oldValue'
this.oldValue = newValue;
// TODO completion
Completion completion = CompletionUtil.generateNoErrorCompletion();
// TODO
// set monitor type and on-change code, if non-error type
//completion.code = ACSErr.ACSErrMonitorOnChange;
// ... and dispatch
dispatchAction.dispatchWorkingRequest(completion, newValue);
// TODO remove
//System.out.println("Dispatched (on-change) monitor: " + newValue);
}
use of alma.ACSErr.Completion in project ACS by ACS-Community.
the class BACIDispatchActionTest method testException.
/**
* Always throws exception.
*/
public void testException() {
Object value = new Object();
Completion completion = CompletionUtil.generateNoErrorCompletion();
CBDescIn descIn = new CBDescIn(50000, 50000, 1234);
Callback callback = new TestCallback();
TestCallbackDispatcher dispatcher = new ExceptionCallbackDispatcher();
BACIDispatchAction action = new BACIDispatchAction(callback, descIn, dispatcher);
synchronized (dispatcher) {
action.dispatchDoneRequest(completion, value);
try {
// wait
dispatcher.wait(RESPONSE_WAIT_TIME);
} catch (InterruptedException ie) {
}
}
// dummy wait (just in case there is a bug and more responses will come)
dummyWait();
// only 3 responses (retries) are expected
assertEquals(3, dispatcher.getResponseQueue().size());
// should be the same
assertEquals(dispatcher.getResponseQueue().get(0), dispatcher.getResponseQueue().get(1));
DispatchAction response = (DispatchAction) dispatcher.getResponseQueue().firstElement();
// check response
checkResponse(value, completion, descIn, callback, response);
}
Aggregations