use of org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:CreateSequenceResponseType with 200408 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if exposed is <code>null</code>)
*/
public static CreateSequenceResponseType convert(org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType exposed) {
if (exposed == null) {
return null;
}
CreateSequenceResponseType internal = new CreateSequenceResponseType();
internal.setAccept(convert(exposed.getAccept()));
internal.setExpires(convert(exposed.getExpires()));
internal.setIdentifier(convert(exposed.getIdentifier()));
addAll(exposed.getAny(), internal.getAny());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
use of org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType in project cxf by apache.
the class Proxy method createSequence.
public CreateSequenceResponseType createSequence(EndpointReferenceType defaultAcksTo, RelatesToType relatesTo, boolean isServer, final ProtocolVariation protocol, final Exchange exchange, Map<String, Object> context) throws RMException {
this.sequenceContext = context;
SourcePolicyType sp = reliableEndpoint.getManager().getSourcePolicy();
CreateSequenceType create = new CreateSequenceType();
String address = sp.getAcksTo();
EndpointReferenceType acksTo = null;
if (null != address) {
acksTo = RMUtils.createReference(address);
} else {
acksTo = defaultAcksTo;
}
create.setAcksTo(acksTo);
Duration d = sp.getSequenceExpiration();
if (null != d) {
Expires expires = new Expires();
expires.setValue(d);
create.setExpires(expires);
}
if (sp.isIncludeOffer()) {
OfferType offer = new OfferType();
d = sp.getOfferedSequenceExpiration();
if (null != d) {
Expires expires = new Expires();
expires.setValue(d);
offer.setExpires(expires);
}
offer.setIdentifier(reliableEndpoint.getSource().generateSequenceIdentifier());
offer.setEndpoint(acksTo);
create.setOffer(offer);
setOfferedIdentifier(offer);
}
InterfaceInfo ii = reliableEndpoint.getEndpoint(protocol).getEndpointInfo().getService().getInterface();
EncoderDecoder codec = protocol.getCodec();
RMConstants constants = codec.getConstants();
final OperationInfo oi = isServer ? ii.getOperation(constants.getCreateSequenceOnewayOperationName()) : ii.getOperation(constants.getCreateSequenceOperationName());
final Object send = codec.convertToSend(create);
if (isServer) {
LOG.fine("sending CreateSequenceRequest from server side");
Runnable r = new Runnable() {
public void run() {
try {
invoke(oi, protocol, new Object[] { send }, null, exchange);
} catch (RMException ex) {
// already logged
}
}
};
Executor ex = reliableEndpoint.getApplicationEndpoint().getExecutor();
if (ex == null) {
ex = SynchronousExecutor.getInstance();
}
ex.execute(r);
return null;
}
Object resp = invoke(oi, protocol, new Object[] { send }, context, exchange);
return codec.convertReceivedCreateSequenceResponse(resp);
}
use of org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType in project cxf by apache.
the class Servant method createSequenceResponse.
public void createSequenceResponse(CreateSequenceResponseType createResponse, ProtocolVariation protocol) {
LOG.fine("Creating sequence response");
SourceSequence seq = new SourceSequence(createResponse.getIdentifier(), protocol);
seq.setExpires(createResponse.getExpires());
Source source = reliableEndpoint.getSource();
source.addSequence(seq);
// the incoming sequence ID is either used as the requestor sequence
// (signalled by null) or associated with a corresponding sequence
// identifier
source.setCurrent(clearUnattachedIdentifier(), seq);
// if a sequence was offered and accepted, then we can add this to
// to the local destination sequence list, otherwise we have to wait for
// and incoming CreateSequence request
Identifier offeredId = reliableEndpoint.getProxy().getOfferedIdentifier();
if (null != offeredId) {
AcceptType accept = createResponse.getAccept();
if (accept != null) {
Destination dest = reliableEndpoint.getDestination();
String address = accept.getAcksTo().getAddress().getValue();
if (!RMUtils.getAddressingConstants().getNoneURI().equals(address)) {
DestinationSequence ds = new DestinationSequence(offeredId, accept.getAcksTo(), dest, protocol);
dest.addSequence(ds);
}
}
}
}
use of org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType in project cxf by apache.
the class Servant method invoke.
public Object invoke(Exchange exchange, Object o) {
LOG.fine("Invoking on RM Endpoint");
final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(exchange.getInMessage());
OperationInfo oi = exchange.getBindingOperationInfo().getOperationInfo();
if (null == oi) {
LOG.fine("No operation info.");
return null;
}
if (RM10Constants.INSTANCE.getCreateSequenceOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceOperationName().equals(oi.getName()) || RM10Constants.INSTANCE.getCreateSequenceOnewayOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceOnewayOperationName().equals(oi.getName())) {
try {
return Collections.singletonList(createSequence(exchange.getInMessage()));
} catch (RuntimeException ex) {
LOG.log(Level.WARNING, "Sequence creation rejected", ex);
SequenceFault sf = new SequenceFaultFactory(protocol.getConstants()).createCreateSequenceRefusedFault();
Endpoint e = exchange.getEndpoint();
Binding b = null == e ? null : e.getBinding();
if (null != b) {
RMManager m = reliableEndpoint.getManager();
LOG.fine("Manager: " + m);
BindingFaultFactory bff = m.getBindingFaultFactory(b);
Fault f = bff.createFault(sf, exchange.getInMessage());
// log with warning instead sever, as this may happen for some delayed messages
LogUtils.log(LOG, Level.WARNING, "SEQ_FAULT_MSG", bff.toString(f));
throw f;
}
throw new Fault(sf);
}
} else if (RM10Constants.INSTANCE.getCreateSequenceResponseOnewayOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceResponseOnewayOperationName().equals(oi.getName())) {
EncoderDecoder codec = protocol.getCodec();
CreateSequenceResponseType createResponse = codec.convertReceivedCreateSequenceResponse(getParameter(exchange.getInMessage()));
createSequenceResponse(createResponse, protocol);
} else if (RM10Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName())) {
Object tsr = terminateSequence(exchange.getInMessage());
if (tsr != null) {
return Collections.singletonList(tsr);
}
} else if (RM11Constants.INSTANCE.getCloseSequenceOperationName().equals(oi.getName())) {
return Collections.singletonList(closeSequence(exchange.getInMessage()));
}
return null;
}
use of org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:CreateSequenceResponseType with 200508 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if exposed is <code>null</code>)
*/
public static CreateSequenceResponseType convert(org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceResponseType exposed) {
if (exposed == null) {
return null;
}
CreateSequenceResponseType internal = new CreateSequenceResponseType();
internal.setAccept(convert(exposed.getAccept()));
internal.setExpires(convert(exposed.getExpires()));
internal.setIdentifier(convert(exposed.getIdentifier()));
addAll(exposed.getAny(), internal.getAny());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
Aggregations