1 package org.objectweb.celtix.bus.ws.rm; 2 3 import java.lang.reflect.Method ; 4 5 import org.objectweb.celtix.bindings.AbstractBindingBase; 6 import org.objectweb.celtix.bindings.DataBindingCallback; 7 import org.objectweb.celtix.bindings.Request; 8 import org.objectweb.celtix.bus.jaxws.JAXBDataBindingCallback; 9 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, SourceSequence seq) { 22 23 super(b, t, b.createObjectContext()); 24 25 if (seq.getTarget() != null) { 26 ContextUtils.storeTo(seq.getTarget(), getObjectMessageContext()); 27 } 28 29 ContextUtils.storeUsingAddressing(true, getObjectMessageContext()); 30 31 getObjectMessageContext().setRequestorRole(true); 32 33 AddressingProperties maps = new AddressingPropertiesImpl(); 34 AttributedURIType actionURI = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType(); 35 actionURI.setValue(RMUtils.getRMConstants().getTerminateSequenceAction()); 36 maps.setAction(actionURI); 37 ContextUtils.storeMAPs(maps, getObjectMessageContext(), true, true, true, true); 38 39 setMessageParameters(seq); 40 41 setOneway(true); 42 } 43 44 public static Method getMethod() { 45 Method method = null; 46 try { 47 method = OutOfBandProtocolMessages.class.getMethod( 48 METHOD_NAME, 49 new Class [] {TerminateSequenceType.class}); 50 } catch (NoSuchMethodException ex) { 51 ex.printStackTrace(); 52 } 53 return method; 54 } 55 56 public static String getOperationName() { 57 return OPERATION_NAME; 58 } 59 60 public static DataBindingCallback createDataBindingCallback() { 61 Method method = getMethod(); 62 return new JAXBDataBindingCallback(method, DataBindingCallback.Mode.PARTS, null); 63 } 64 65 private void setMessageParameters(AbstractSequenceImpl seq) { 66 67 TerminateSequenceType ts = RMUtils.getWSRMFactory().createTerminateSequenceType(); 68 ts.setIdentifier(seq.getIdentifier()); 69 70 getObjectMessageContext().setMessageObjects(new Object [] {ts}); 71 } 72 } 73 | Popular Tags |