use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class ParameterProcessor method isRefElement.
private boolean isRefElement(MessagePartInfo outputPart, QName outElement) {
OperationInfo wrappedOp = outputPart.getMessageInfo().getOperation().getUnwrappedOperation();
MessagePartInfo mpart = wrappedOp.getOutput().getMessagePart(outElement);
if (mpart == null) {
return false;
}
return mpart.getProperty("isRefElement") != null;
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class PortTypeProcessor method process.
public void process(ServiceInfo serviceInfo) throws ToolException {
operationMap.clear();
JavaModel jmodel = context.get(JavaModel.class);
InterfaceInfo interfaceInfo = serviceInfo.getInterface();
if (interfaceInfo == null) {
return;
}
JavaInterface intf = getInterface(context, serviceInfo, interfaceInfo);
intf.setJavaModel(jmodel);
Element handler = (Element) context.get(ToolConstants.HANDLER_CHAIN);
intf.setHandlerChains(handler);
Collection<OperationInfo> operations = interfaceInfo.getOperations();
for (OperationInfo operation : operations) {
if (isOverloading(operation.getName())) {
LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
continue;
}
OperationProcessor operationProcessor = new OperationProcessor(context);
operationProcessor.process(intf, operation);
}
jmodel.setLocation(intf.getLocation());
jmodel.addInterface(intf.getName(), intf);
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class MethodMapperTest method testMapWrappedOperation.
@Test
public void testMapWrappedOperation() throws Exception {
OperationInfo operation = getOperation();
operation.setUnwrappedOperation(operation);
JavaMethod method = new MethodMapper().map(operation);
assertNotNull(method);
assertTrue(method.isWrapperStyle());
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class MethodMapperTest method getOperation.
private OperationInfo getOperation() {
OperationInfo operation = new OperationInfo();
operation.setName(new QName("urn:test:ns", "OperationTest"));
return operation;
}
use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.
the class ColocMessageObserver method onMessage.
public void onMessage(Message m) {
Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
ClassLoaderHolder origLoader = null;
try {
if (loader != null) {
origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
}
if (LOG.isLoggable(Level.FINER)) {
LOG.finer("Processing Message at collocated endpoint. Request message: " + m);
}
Exchange ex = new ExchangeImpl();
setExchangeProperties(ex, m);
Message inMsg = endpoint.getBinding().createMessage();
MessageImpl.copyContent(m, inMsg);
// Copy Request Context to Server inBound Message
// TODO a Context Filter Strategy required.
inMsg.putAll(m);
inMsg.put(COLOCATED, Boolean.TRUE);
inMsg.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
BindingOperationInfo boi = ex.getBindingOperationInfo();
OperationInfo oi = boi != null ? boi.getOperationInfo() : null;
if (oi != null) {
inMsg.put(MessageInfo.class, oi.getInput());
}
ex.setInMessage(inMsg);
inMsg.setExchange(ex);
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Build inbound interceptor chain.");
}
// Add all interceptors between USER_LOGICAL and INVOKE.
SortedSet<Phase> phases = new TreeSet<Phase>(bus.getExtension(PhaseManager.class).getInPhases());
ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.INVOKE);
InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
chain.add(addColocInterceptors());
inMsg.setInterceptorChain(chain);
// Convert the coloc object type if necessary
BindingOperationInfo bop = m.getExchange().getBindingOperationInfo();
OperationInfo soi = bop != null ? bop.getOperationInfo() : null;
if (soi != null && oi != null) {
if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class)) {
// converting source -> pojo
ColocUtil.convertSourceToObject(inMsg);
} else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class)) {
// converting pojo -> source
ColocUtil.convertObjectToSource(inMsg);
}
}
chain.doIntercept(inMsg);
if (soi != null && oi != null) {
if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class) && ex.getOutMessage() != null) {
// converting pojo -> source
ColocUtil.convertObjectToSource(ex.getOutMessage());
} else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class) && ex.getOutMessage() != null) {
// converting pojo -> source
ColocUtil.convertSourceToObject(ex.getOutMessage());
}
}
// Set Server OutBound Message onto InBound Exchange.
setOutBoundMessage(ex, m.getExchange());
} finally {
if (origBus != bus) {
BusFactory.setThreadDefaultBus(origBus);
}
if (origLoader != null) {
origLoader.reset();
}
}
}
Aggregations