01: package org.objectweb.celtix.bus.ws.rm;
02:
03: import java.lang.reflect.Method;
04:
05: import org.objectweb.celtix.bindings.AbstractBindingBase;
06: import org.objectweb.celtix.bindings.DataBindingCallback;
07: import org.objectweb.celtix.bindings.Request;
08: import org.objectweb.celtix.bus.jaxws.JAXBDataBindingCallback;
09: import org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl;
10: import org.objectweb.celtix.bus.ws.addressing.ContextUtils;
11: import org.objectweb.celtix.transports.Transport;
12: import org.objectweb.celtix.ws.addressing.AddressingProperties;
13: import org.objectweb.celtix.ws.addressing.AttributedURIType;
14: import org.objectweb.celtix.ws.rm.TerminateSequenceType;
15:
16: public class TerminateSequenceRequest extends Request {
17:
18: private static final String METHOD_NAME = "terminateSequence";
19: private static final String OPERATION_NAME = "TerminateSequence";
20:
21: public TerminateSequenceRequest(AbstractBindingBase b, Transport t,
22: SourceSequence seq) {
23:
24: super (b, t, b.createObjectContext());
25:
26: if (seq.getTarget() != null) {
27: ContextUtils.storeTo(seq.getTarget(),
28: getObjectMessageContext());
29: }
30:
31: ContextUtils.storeUsingAddressing(true,
32: getObjectMessageContext());
33:
34: getObjectMessageContext().setRequestorRole(true);
35:
36: AddressingProperties maps = new AddressingPropertiesImpl();
37: AttributedURIType actionURI = ContextUtils.WSA_OBJECT_FACTORY
38: .createAttributedURIType();
39: actionURI.setValue(RMUtils.getRMConstants()
40: .getTerminateSequenceAction());
41: maps.setAction(actionURI);
42: ContextUtils.storeMAPs(maps, getObjectMessageContext(), true,
43: true, true, true);
44:
45: setMessageParameters(seq);
46:
47: setOneway(true);
48: }
49:
50: public static Method getMethod() {
51: Method method = null;
52: try {
53: method = OutOfBandProtocolMessages.class.getMethod(
54: METHOD_NAME,
55: new Class[] { TerminateSequenceType.class });
56: } catch (NoSuchMethodException ex) {
57: ex.printStackTrace();
58: }
59: return method;
60: }
61:
62: public static String getOperationName() {
63: return OPERATION_NAME;
64: }
65:
66: public static DataBindingCallback createDataBindingCallback() {
67: Method method = getMethod();
68: return new JAXBDataBindingCallback(method,
69: DataBindingCallback.Mode.PARTS, null);
70: }
71:
72: private void setMessageParameters(AbstractSequenceImpl seq) {
73:
74: TerminateSequenceType ts = RMUtils.getWSRMFactory()
75: .createTerminateSequenceType();
76: ts.setIdentifier(seq.getIdentifier());
77:
78: getObjectMessageContext()
79: .setMessageObjects(new Object[] { ts });
80: }
81: }
|