http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java deleted file mode 100644 index 6666a53..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java +++ /dev/null @@ -1,313 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Executor; -import java.util.concurrent.RejectedExecutionException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.activation.DataHandler; -import javax.jws.WebService; -import javax.security.auth.Subject; -import javax.xml.namespace.QName; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import org.apache.cxf.Bus; -import org.apache.cxf.attachment.AttachmentImpl; -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.io.CachedOutputStream; -import org.apache.cxf.message.Attachment; -import org.apache.cxf.message.Exchange; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.phase.PhaseInterceptorChain; -import org.apache.cxf.service.model.BindingOperationInfo; -import org.apache.cxf.transport.MessageObserver; -import org.apache.cxf.workqueue.AutomaticWorkQueue; -import org.apache.cxf.workqueue.WorkQueueManager; -import org.apache.cxf.ws.addressing.EndpointReferenceType; -import org.apache.cxf.wsdl.EndpointReferenceUtils; -import org.apache.servicemix.nmr.api.Channel; -import org.apache.servicemix.nmr.api.Endpoint; -import org.apache.servicemix.nmr.api.NMR; -import org.apache.servicemix.nmr.api.Pattern; -import org.apache.servicemix.nmr.api.Reference; -import org.apache.servicemix.nmr.api.Status; - -public class NMRConduitOutputStream extends CachedOutputStream { - - private static final Logger LOG = LogUtils.getL7dLogger(NMRConduitOutputStream.class); - - private Message message; - private boolean isOneWay; - private Channel channel; - private NMRConduit conduit; - private EndpointReferenceType target; - private boolean hasLoggedAsyncWarning; - - public NMRConduitOutputStream(Message m, NMR nmr, EndpointReferenceType target, - NMRConduit conduit) { - message = m; - this.channel = nmr.createChannel(); - this.conduit = conduit; - this.target = target; - - } - - @Override - protected void doFlush() throws IOException { - - } - - @Override - protected void doClose() throws IOException { - isOneWay = message.getExchange().isOneWay(); - commitOutputMessage(); - if (target != null) { - target.getClass(); - } - } - - private void syncInvoke(org.apache.servicemix.nmr.api.Exchange xchng) throws Exception { - try { - if (!isOneWay) { - channel.sendSync(xchng); - Source content = null; - org.apache.servicemix.nmr.api.Message nm = null; - if (xchng.getFault(false) != null) { - content = xchng.getFault().getBody(Source.class); - nm = xchng.getFault(); - } else { - content = xchng.getOut().getBody(Source.class); - nm = xchng.getOut(); - } - Message inMessage = new MessageImpl(); - message.getExchange().setInMessage(inMessage); - InputStream ins = NMRMessageHelper.convertMessageToInputStream(content); - if (ins == null) { - throw new IOException(new org.apache.cxf.common.i18n.Message("UNABLE.RETRIEVE.MESSAGE", LOG).toString()); - } - inMessage.setContent(InputStream.class, ins); - //copy attachments - Collection<Attachment> cxfAttachmentList = new ArrayList<Attachment>(); - for (Map.Entry<String, Object> ent : nm.getAttachments().entrySet()) { - cxfAttachmentList.add(new AttachmentImpl(ent.getKey(), (DataHandler) ent.getValue())); - } - inMessage.setAttachments(cxfAttachmentList); - - //copy properties - for (Map.Entry<String, Object> ent : nm.getHeaders().entrySet()) { - if (!ent.getKey().equals(Message.REQUESTOR_ROLE)) { - inMessage.put(ent.getKey(), ent.getValue()); - } - } - - //copy securitySubject - inMessage.put(NMRTransportFactory.NMR_SECURITY_SUBJECT, nm.getSecuritySubject()); - - conduit.getMessageObserver().onMessage(inMessage); - - xchng.setStatus(Status.Done); - channel.send(xchng); - } else { - channel.sendSync(xchng); - } - } finally { - channel.close(); - } - - } - - private void asynInvokeWithWorkQueue(final org.apache.servicemix.nmr.api.Exchange exchange) throws Exception { - Runnable runnable = new Runnable() { - public void run() { - try { - syncInvoke(exchange); - } catch (Throwable e) { - ((PhaseInterceptorChain)message.getInterceptorChain()).abort(); - message.setContent(Exception.class, e); - ((PhaseInterceptorChain)message.getInterceptorChain()).unwind(message); - MessageObserver mo = message.getInterceptorChain().getFaultObserver(); - if (mo == null) { - mo = message.getExchange().get(MessageObserver.class); - } - mo.onMessage(message); - } - } - }; - - try { - Executor ex = message.getExchange().get(Executor.class); - if (ex != null) { - message.getExchange().put(Executor.class.getName() - + ".USING_SPECIFIED", Boolean.TRUE); - ex.execute(runnable); - } else { - WorkQueueManager mgr = message.getExchange().get(Bus.class) - .getExtension(WorkQueueManager.class); - AutomaticWorkQueue qu = mgr.getNamedWorkQueue("nmr-conduit"); - if (qu == null) { - qu = mgr.getAutomaticWorkQueue(); - } - // need to set the time out somewhere - qu.execute(runnable); - } - } catch (RejectedExecutionException rex) { - if (!hasLoggedAsyncWarning) { - LOG.warning("Executor rejected background task to retrieve the response. Suggest increasing the workqueue settings."); - hasLoggedAsyncWarning = true; - } - LOG.info("Executor rejected background task to retrieve the response, running on current thread."); - syncInvoke(exchange); - } - - } - - private void commitOutputMessage() throws IOException { - try { - Member member = (Member) message.get(Method.class.getName()); - Class<?> clz = member.getDeclaringClass(); - Exchange exchange = message.getExchange(); - BindingOperationInfo bop = exchange.get(BindingOperationInfo.class); - - LOG.fine(new org.apache.cxf.common.i18n.Message("INVOKE.SERVICE", LOG).toString() + clz); - - WebService ws = clz.getAnnotation(WebService.class); - assert ws != null; - QName interfaceName = new QName(ws.targetNamespace(), ws.name()); - QName serviceName; - String address = null; - String portName = null; - if (target != null) { - serviceName = EndpointReferenceUtils.getServiceName(target, conduit.getBus()); - address = EndpointReferenceUtils.getAddress(target); - portName = EndpointReferenceUtils.getPortName(target); - } else { - serviceName = message.getExchange().get(org.apache.cxf.service.Service.class).getName(); - } - - LOG.fine(new org.apache.cxf.common.i18n.Message("CREATE.MESSAGE.EXCHANGE", LOG).toString() + serviceName); - org.apache.servicemix.nmr.api.Exchange xchng; - if (isOneWay) { - xchng = channel.createExchange(Pattern.InOnly); - } else if (bop.getOutput() == null) { - xchng = channel.createExchange(Pattern.RobustInOnly); - } else { - xchng = channel.createExchange(Pattern.InOut); - } - - org.apache.servicemix.nmr.api.Message inMsg = xchng.getIn(); - LOG.fine(new org.apache.cxf.common.i18n.Message("EXCHANGE.ENDPOINT", LOG).toString() + serviceName); - LOG.fine("setup message contents on " + inMsg); - inMsg.setBody(getMessageContent(message)); - //copy attachments - if (message != null && message.getAttachments() != null) { - for (Attachment att : message.getAttachments()) { - inMsg.addAttachment(att.getId(), att - .getDataHandler()); - } - } - - //copy properties - for (Map.Entry<String, Object> ent : message.entrySet()) { - //check if value is Serializable, and if value is Map or collection, - //just exclude it since the entry of it may not be Serializable as well - if (ent.getValue() instanceof Serializable - && !(ent.getValue() instanceof Map) - && !(ent.getValue() instanceof Collection)) { - inMsg.setHeader(ent.getKey(), ent.getValue()); - } - } - - // we need to copy the protocol headers - Map<String, List<String>> protocolHeaders = (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS); - if (protocolHeaders != null) { - for (Map.Entry<String, List<String>> ent : protocolHeaders.entrySet()) { - if (ent.getValue().size() > 0) { - // here we just put the first header value - inMsg.setHeader(ent.getKey(), ent.getValue().get(0)); - } - } - } - - //copy securitySubject - inMsg.setSecuritySubject((Subject) message.get(NMRTransportFactory.NMR_SECURITY_SUBJECT)); - - LOG.fine("service for exchange " + serviceName); - - Map<String,Object> refProps = new HashMap<String,Object>(); - if (interfaceName != null) { - refProps.put(Endpoint.INTERFACE_NAME, interfaceName.toString()); - } - if (serviceName != null) { - refProps.put(Endpoint.SERVICE_NAME, serviceName.toString()); - } - - if (address != null && address.startsWith("nmr:")) { - if (address.indexOf("?") > 0) { - refProps.put(Endpoint.NAME, address.substring(4, address.indexOf("?"))); - } else { - refProps.put(Endpoint.NAME, address.substring(4)); - } - } else { - if (portName != null) { - refProps.put(Endpoint.NAME, portName); - } - } - Reference ref = channel.getNMR().getEndpointRegistry().lookup(refProps); - xchng.setTarget(ref); - xchng.setOperation(bop.getName()); - LOG.fine("sending message"); - if (message.getExchange().isSynchronous()) { - syncInvoke(xchng); - } else { - asynInvokeWithWorkQueue(xchng); - } - - } catch (IOException e) { - throw e; - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage(), e); - throw new IOException(e.toString()); - } - - } - - private Source getMessageContent(Message message2) throws IOException { - return new StreamSource(this.getInputStream()); - - } - - @Override - protected void onWrite() throws IOException { - - } - -}
http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java deleted file mode 100644 index 805a5b0..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.activation.DataHandler; -import javax.xml.namespace.QName; -import javax.xml.transform.Source; - -import org.apache.cxf.attachment.AttachmentImpl; -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.message.Attachment; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.transport.AbstractConduit; -import org.apache.cxf.transport.AbstractDestination; -import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.MessageObserver; -import org.apache.cxf.ws.addressing.EndpointReferenceType; -import org.apache.cxf.wsdl.EndpointReferenceUtils; -import org.apache.servicemix.nmr.api.Channel; -import org.apache.servicemix.nmr.api.Endpoint; -import org.apache.servicemix.nmr.api.Exchange; -import org.apache.servicemix.nmr.api.NMR; -import org.apache.servicemix.nmr.api.Pattern; -import org.apache.servicemix.nmr.api.ServiceMixException; -import org.apache.servicemix.nmr.api.Status; - -public class NMRDestination extends AbstractDestination implements Endpoint { - - private static final Logger LOG = LogUtils.getL7dLogger(NMRDestination.class); - private NMR nmr; - private Channel channel; - private Map<String, Object> properties; - - public NMRDestination(EndpointInfo info, NMR nmr) { - super(getTargetReference(info, null), info); - this.nmr = nmr; - this.properties = new HashMap<String, Object>(); - String address = info.getAddress(); - if (address != null && address.indexOf(Endpoint.RUN_AS_SUBJECT) >= 0) { - String asSubject = address.substring(address.indexOf(Endpoint.RUN_AS_SUBJECT) - + Endpoint.RUN_AS_SUBJECT.length() + 1); - this.properties.put(Endpoint.RUN_AS_SUBJECT, asSubject); - } - if (address != null && address.startsWith("nmr:")) { - if (address.indexOf("?") > 0) { - this.properties.put(Endpoint.NAME, address.substring(4, address.indexOf("?"))); - } else { - this.properties.put(Endpoint.NAME, address.substring(4)); - } - } else { - this.properties.put(Endpoint.NAME, info.getName().toString()); - } - - this.properties.put(Endpoint.SERVICE_NAME, info.getService().getName().toString()); - this.properties.put(Endpoint.INTERFACE_NAME, info.getInterface().getName().toString()); - - if (address.indexOf("?") > 0) { - String[] props = address.substring(address.indexOf("?") + 1).split("&"); - for (String prop : props) { - if (prop.indexOf("=") > 0) { - String key = prop.substring(0, prop.indexOf("=")); - String val = prop.substring(prop.indexOf("=") + 1); - if (key.equals("synchronous")) { - key = Endpoint.CHANNEL_SYNC_DELIVERY; - } - this.properties.put(key, val); - } - } - } - } - - public void setChannel(Channel dc) { - this.channel = dc; - } - - public Channel getChannel() { - return this.channel; - } - - protected Logger getLogger() { - return LOG; - } - - /** - * @param inMessage the incoming message - * @return the inbuilt backchannel - */ - protected Conduit getInbuiltBackChannel(Message inMessage) { - return new BackChannelConduit(EndpointReferenceUtils.getAnonymousEndpointReference(), inMessage); - } - - public void shutdown() { - } - - public void deactivate() { - nmr.getEndpointRegistry().unregister(this, properties); - } - - public void activate() { - nmr.getEndpointRegistry().register(this, properties); - } - - public void process(Exchange exchange) { - if (exchange == null || exchange.getStatus() != Status.Active) { - return; - } - if (exchange.getPattern() == Pattern.InOnly || exchange.getPattern() == Pattern.RobustInOnly) { - exchange.setStatus(Status.Done); - getChannel().send(exchange); - } - QName opName = exchange.getOperation(); - getLogger().fine("dispatch method: " + opName); - - org.apache.servicemix.nmr.api.Message nm = exchange.getIn(); - try { - - MessageImpl inMessage = new MessageImpl(); - inMessage.put(Exchange.class, exchange); - - final InputStream in = NMRMessageHelper.convertMessageToInputStream(nm.getBody(Source.class)); - inMessage.setContent(InputStream.class, in); - // copy attachments - Collection<Attachment> cxfAttachmentList = new ArrayList<Attachment>(); - for (Map.Entry<String, Object> ent : nm.getAttachments().entrySet()) { - cxfAttachmentList.add(new AttachmentImpl(ent.getKey(), (DataHandler)ent.getValue())); - } - inMessage.setAttachments(cxfAttachmentList); - - // copy properties and setup the cxf protocol header - Map<String, List<String>> protocolHeaders = new TreeMap<String, List<String>>( - String.CASE_INSENSITIVE_ORDER); - inMessage.put(Message.PROTOCOL_HEADERS, protocolHeaders); - - for (Map.Entry<String, Object> ent : nm.getHeaders().entrySet()) { - if (!ent.getKey().equals(Message.REQUESTOR_ROLE)) { - inMessage.put(ent.getKey(), ent.getValue()); - } - if (ent.getValue() instanceof String) { - List<String> value = new ArrayList<String>(); - value.add((String)ent.getValue()); - protocolHeaders.put(ent.getKey(), value); - } - } - - // copy securitySubject - inMessage.put(NMRTransportFactory.NMR_SECURITY_SUBJECT, nm.getSecuritySubject()); - - inMessage.setDestination(this); - getMessageObserver().onMessage(inMessage); - - } catch (Exception ex) { - getLogger().log(Level.SEVERE, - new org.apache.cxf.common.i18n.Message("ERROR.PREPARE.MESSAGE", getLogger()) - .toString(), ex); - throw new ServiceMixException(ex); - } - } - - protected class BackChannelConduit extends AbstractConduit { - - protected Message inMessage; - protected NMRDestination nmrDestination; - - BackChannelConduit(EndpointReferenceType ref, Message message) { - super(ref); - inMessage = message; - } - - /** - * Register a message observer for incoming messages. - * - * @param observer the observer to notify on receipt of incoming - */ - public void setMessageObserver(MessageObserver observer) { - // shouldn't be called for a back channel conduit - } - - /** - * Send an outbound message, assumed to contain all the name-value mappings of the corresponding input - * message (if any). - * - * @param message the message to be sent. - */ - public void prepare(Message message) throws IOException { - // setup the message to be send back - Channel dc = channel; - message.put(Exchange.class, inMessage.get(Exchange.class)); - NMRTransportFactory.removeUnusedInterceptprs(message); - message.setContent(OutputStream.class, new NMRDestinationOutputStream(inMessage, message, dc)); - - } - - protected Logger getLogger() { - return LOG; - } - - } - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java deleted file mode 100644 index 4da734a..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.util.Collection; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.security.auth.Subject; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.stream.StreamSource; - -import org.w3c.dom.Document; - -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.io.CachedOutputStream; -import org.apache.cxf.message.Attachment; -import org.apache.cxf.message.Message; -import org.apache.servicemix.nmr.api.Channel; -import org.apache.servicemix.nmr.api.Exchange; - -public class NMRDestinationOutputStream extends CachedOutputStream { - - private static final Logger LOG = LogUtils.getL7dLogger(NMRDestinationOutputStream.class); - private Message inMessage; - private Message outMessage; - private Channel channel; - - public NMRDestinationOutputStream(Message m, - Message outM, - Channel dc) { - super(); - inMessage = m; - outMessage = outM; - channel = dc; - } - - @Override - protected void doFlush() throws IOException { - // so far do nothing - } - - @Override - protected void doClose() throws IOException { - commitOutputMessage(); - } - - @Override - protected void onWrite() throws IOException { - // so far do nothing - } - - private void commitOutputMessage() throws IOException { - try { - if (inMessage.getExchange().isOneWay()) { - return; - } else { - InputStream bais = getInputStream(); - Exchange xchng = inMessage.get(Exchange.class); - if (inMessage.getExchange().getOutFaultMessage() != null - && inMessage.getExchange().getOutFaultMessage().getContent(Exception.class) != null) { - //check if there is an OutFaultMessage and Exception here first and return the Error fast - Exception ex = inMessage.getExchange().getOutFaultMessage().getContent(Exception.class); - if (ex instanceof org.apache.cxf.interceptor.Fault) { - org.apache.cxf.interceptor.Fault f = (org.apache.cxf.interceptor.Fault)ex; - if (!f.hasDetails()) { - xchng.setError(f); - } - } else { - xchng.setError(ex); - } - channel.send(xchng); - return; - } - - StreamSource ss = new StreamSource(bais); - - LOG.fine(new org.apache.cxf.common.i18n.Message("CREATE.NORMALIZED.MESSAGE", LOG).toString()); - if (inMessage.getExchange().getOutFaultMessage() != null) { - Exception ex = inMessage.getContent(Exception.class); - if (ex instanceof org.apache.cxf.interceptor.Fault) { - org.apache.cxf.interceptor.Fault f = (org.apache.cxf.interceptor.Fault) inMessage.getContent(Exception.class); - if (!f.hasDetails()) { - xchng.setError(f); - } - } else { - xchng.setError(ex); - } - // As the fault is already marshalled by the fault handler - xchng.getFault().setBody(ss); - } else { - //copy attachments - if (outMessage != null && outMessage.getAttachments() != null) { - for (Attachment att : outMessage.getAttachments()) { - xchng.getOut().addAttachment(att.getId(), att - .getDataHandler()); - } - } - - //copy properties - for (Map.Entry<String, Object> ent : outMessage.entrySet()) { - //check if value is Serializable, and if value is Map or collection, - //just exclude it since the entry of it may not be Serializable as well - if (ent.getValue() instanceof Serializable - && !(ent.getValue() instanceof Map) - && !(ent.getValue() instanceof Collection)) { - xchng.getOut().setHeader(ent.getKey(), ent.getValue()); - } - } - - //copy securitySubject - xchng.getOut().setSecuritySubject((Subject) outMessage.get(NMRTransportFactory.NMR_SECURITY_SUBJECT)); - xchng.getOut().setBody(ss); - } - LOG.fine(new org.apache.cxf.common.i18n.Message("POST.DISPATCH", LOG).toString()); - channel.send(xchng); - } - } catch (Exception ex) { - LOG.log(Level.SEVERE, new org.apache.cxf.common.i18n.Message("ERROR.SEND.MESSAGE", LOG).toString(), ex); - } - } - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRMessageHelper.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRMessageHelper.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRMessageHelper.java deleted file mode 100644 index 676ebe1..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRMessageHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.Source; - -import org.apache.cxf.io.CachedOutputStream; -import org.apache.cxf.staxutils.StaxUtils; - - - -public final class NMRMessageHelper { - - - private NMRMessageHelper() { - // complete - } - - public static InputStream convertMessageToInputStream(Source src) throws IOException { - CachedOutputStream cos = new CachedOutputStream(); - try { - StaxUtils.copy(src, cos); - return cos.getInputStream(); - } catch (XMLStreamException e) { - IOException ioe = new IOException(e.getMessage()); - ioe.initCause(e); - throw ioe; - } finally { - try { - cos.close(); - } catch (Exception ex) { - //ignore - } - } - } -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRTransportFactory.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRTransportFactory.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRTransportFactory.java deleted file mode 100644 index b67b617..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRTransportFactory.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import javax.annotation.PostConstruct; - -import org.apache.cxf.Bus; -import org.apache.cxf.configuration.Configurer; -import org.apache.cxf.interceptor.Interceptor; -import org.apache.cxf.message.Message; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.transport.AbstractTransportFactory; -import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.ConduitInitiator; -import org.apache.cxf.transport.ConduitInitiatorManager; -import org.apache.cxf.transport.Destination; -import org.apache.cxf.transport.DestinationFactory; -import org.apache.cxf.transport.DestinationFactoryManager; -import org.apache.cxf.ws.addressing.EndpointReferenceType; -import org.apache.servicemix.nmr.api.Endpoint; -import org.apache.servicemix.nmr.api.NMR; -import org.apache.servicemix.nmr.api.ServiceMixException; - -public class NMRTransportFactory extends AbstractTransportFactory implements ConduitInitiator, - DestinationFactory { - - public static final String TRANSPORT_ID = "http://cxf.servicemix.apache.org/transport/nmr"; - public static String NMR_SECURITY_SUBJECT = "NMR_SECURITY_SUBJECT"; - - private NMR nmr; - private Bus bus; - private final Map<String, NMRDestination> destinationMap = new HashMap<String, NMRDestination>(); - - private Collection<String> activationNamespaces; - - public void setBus(Bus b) { - bus = b; - } - - public Bus getBus() { - return bus; - } - - public Set<String> getUriPrefixes() { - return Collections.singleton("nmr"); - } - - public NMR getNmr() { - return nmr; - } - - public void setNmr(NMR nmr) { - this.nmr = nmr; - } - - @PostConstruct - void registerWithBindingManager() { - if (null == bus) { - return; - } - ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class); - if (null != cim && null != activationNamespaces) { - for (String ns : activationNamespaces) { - cim.registerConduitInitiator(ns, this); - } - } - DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); - if (null != dfm && null != activationNamespaces) { - for (String ns : activationNamespaces) { - dfm.registerDestinationFactory(ns, this); - } - } - } - - - - - public Conduit getConduit(EndpointInfo targetInfo) throws IOException { - return getConduit(targetInfo, null); - } - - public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException { - Conduit conduit = new NMRConduit(target, nmr); - Configurer configurer = bus.getExtension(Configurer.class); - if (null != configurer) { - configurer.configureBean(conduit); - } - return conduit; - } - - public Destination getDestination(EndpointInfo ei) throws IOException { - NMRDestination destination = new NMRDestination(ei, nmr); - Configurer configurer = bus.getExtension(Configurer.class); - if (null != configurer) { - configurer.configureBean(destination); - } - String address = ei.getAddress(); - String endpointName = ""; - if (address != null && address.startsWith("nmr:")) { - if (address.indexOf("?") > 0) { - endpointName = address.substring(4, address.indexOf("?")); - } else { - endpointName = address.substring(4); - } - } else { - endpointName = ei.getName().toString(); - } - - - try { - putDestination(endpointName + ei.getService().getName().toString() - + ei.getInterface().getName().toString(), destination); - } catch (ServiceMixException e) { - throw new IOException(e.getMessage()); - } - return destination; - } - - public void putDestination(String epName, NMRDestination destination) throws ServiceMixException { - if (destinationMap.containsKey(epName)) { - throw new ServiceMixException("NMRDestination for Endpoint " - + epName + " already be created"); - } else { - destinationMap.put(epName, destination); - } - } - - public NMRDestination getDestination(String epName) { - return destinationMap.get(epName); - } - - public void removeDestination(String epName) { - destinationMap.remove(epName); - } - - public static void removeUnusedInterceptprs(Message message) { - if (message.getInterceptorChain() != null) { - for (Interceptor interceptor : message.getInterceptorChain()) { - if (interceptor.getClass().getName().equals( - "org.apache.cxf.interceptor.AttachmentOutInterceptor")) { - message.getInterceptorChain().remove(interceptor); - } - } - } - } - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/wsdl11/NMRTransportPlugin.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/wsdl11/NMRTransportPlugin.java b/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/wsdl11/NMRTransportPlugin.java deleted file mode 100644 index ad97246..0000000 --- a/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/wsdl11/NMRTransportPlugin.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr.wsdl11; - -import java.util.Map; - -import javax.wsdl.Port; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.xml.namespace.QName; - -import org.apache.servicemix.cxf.transport.nmr.AddressType; -import org.apache.cxf.wsdl.AbstractWSDLPlugin; -import org.apache.servicemix.cxf.transport.nmr.NMRTransportFactory; - -public class NMRTransportPlugin extends AbstractWSDLPlugin { - - - - public ExtensibilityElement createExtension(Map<String, Object> args) throws WSDLException { - AddressType jbiAddress = null; - jbiAddress = (AddressType)registry.createExtension(Port.class, - new QName(NMRTransportFactory.TRANSPORT_ID, "address")); - return jbiAddress; - } - -} - http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/resources/META-INF/cxf/transport/nmr/cxf-transport-nmr.xml ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/resources/META-INF/cxf/transport/nmr/cxf-transport-nmr.xml b/cxf/cxf-transport-nmr/src/main/resources/META-INF/cxf/transport/nmr/cxf-transport-nmr.xml deleted file mode 100644 index 40b53c0..0000000 --- a/cxf/cxf-transport-nmr/src/main/resources/META-INF/cxf/transport/nmr/cxf-transport-nmr.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:osgi="http://www.springframework.org/schema/osgi" - xsi:schemaLocation=" -http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd -http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - - <bean class="org.apache.servicemix.cxf.transport.nmr.NMRTransportFactory" - id="org.apache.servicemix.cxf.transport.nmr.NMRTransportFactory" - lazy-init="true"> - <property name="bus" ref="cxf"/> - <property name="nmr"> - <osgi:reference interface="org.apache.servicemix.nmr.api.NMR"/> - </property> - <property name="transportIds"> - <list> - <value>http://cxf.servicemix.apache.org/transport/nmr</value> - <value>http://cxf.servicemix.apache.org/transport/nmr/configuration</value> - </list> - </property> - </bean> - -</beans> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/Messages.properties ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/Messages.properties b/cxf/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/Messages.properties deleted file mode 100644 index a976b16..0000000 --- a/cxf/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/Messages.properties +++ /dev/null @@ -1,46 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -NOT.IMPLEMENTED=not yet implemented -INVOKE.SERVICE=invoking service\t -CREATE.MESSAGE.EXCHANGE=create message exchange svc:\t -EXCHANGE.ENDPOINT=exchange endpoint:\t -NO.MESSAGE=no message yet -UNABLE.RETRIEVE.MESSAGE=unable to retrieve message -CONTEXT.MUST.BE=context must be of type JBIOutputStreamMessageContext -RECEIVED.MESSAGE=received message:\t -ACTIVE.JBI.SERVER.TRANSPORT=activating JBI server transport -BUILDING.DOCUMENT=building document from bytes -CREATE.NORMALIZED.MESSAGE=creating NormalizedMessage -POST.DISPATCH=postDispatch sending out message to NWR -ERROR.SEND.MESSAGE=error sending Out message -DISPATCH.MESSAGE.ON.CALLBACK=dispatching message on callback:\t -ERROR.PREPARE.MESSAGE=error preparing message -RECEIVE.THREAD.START=JBIServerTransport message receiving thread started -DISPATCH.TO.SU=dispatching to CXF service unit -NO.SU.FOUND=no CXFServiceUnit found -ERROR.DISPATCH.THREAD=error running dispatch thread -JBI.SERVER.TRANSPORT.MESSAGE.PROCESS.THREAD.EXIT=JBIServerTransport message processing thread exiting -CONFIG.DELIVERY.CHANNEL=configuring DeliveryChannel:\t -CONFIG.SU.MANAGER=configuring ServiceUnitManager:\t -JBI.TRANSPORT.FACTORY.NOT.INITIALIZED=JBITransportFactory is not properly initialized -SU.MANAGER=CXFServiceUnitManager:\t -DELIVERY.CHANNEL=DeliveryChannel:\t -JBI.TRANSPORT.FACTORY.NOT.FULLY.INITIALIZED=JBITransport factory not fully initialized -CREATE.SERVER.TRANSPORT=creating JBI server transport -CREATE.CLIENT.TRANSPORT=creating JBI client transport http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xjb ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xjb b/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xjb deleted file mode 100644 index b5feaa3..0000000 --- a/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xjb +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<jaxb:bindings version="1.0" - xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" - jaxb:extensionBindingPrefixes="xjc"> - <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema"> - <jaxb:schemaBindings> - <jaxb:package name="org.apache.cxf.wsdl"/> - </jaxb:schemaBindings> - <jaxb:globalBindings generateIsSetMethod="true"/> - </jaxb:bindings> - <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema/xs:complexType[@name='tExtensibilityElement']"> - <jaxb:class implClass="org.apache.cxf.wsdl.TExtensibilityElementImpl"/> - </jaxb:bindings> -</jaxb:bindings> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xsd ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xsd b/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xsd deleted file mode 100644 index 0100142..0000000 --- a/cxf/cxf-transport-nmr/src/main/resources/schemas/wsdl/nmr.xsd +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:nmr="http://cxf.servicemix.apache.org/transport/nmr" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - targetNamespace="http://cxf.servicemix.apache.org/transport/nmr" - elementFormDefault="qualified" - xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"> - - <xs:import namespace="http://schemas.xmlsoap.org/wsdl/" - schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" /> - - - <xs:element name="address" type="nmr:AddressType"/> - <xs:complexType name="AddressType"> - <xs:complexContent> - <xs:extension base="wsdl:tExtensibilityElement"> - <xs:attribute name="location" type="xs:string"> - <xs:annotation> - <xs:documentation> - nmr dummy location - </xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:extension> - </xs:complexContent> - </xs:complexType> - -</xs:schema> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/AbstractJBITest.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/AbstractJBITest.java b/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/AbstractJBITest.java deleted file mode 100644 index 250f845..0000000 --- a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/AbstractJBITest.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - - -import java.io.IOException; -import java.io.OutputStream; - - -import junit.framework.Assert; -import org.apache.cxf.Bus; -import org.apache.cxf.BusFactory; -import org.apache.cxf.message.Exchange; -import org.apache.cxf.message.ExchangeImpl; -import org.apache.cxf.message.Message; -import org.apache.cxf.service.model.BindingOperationInfo; -import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.MessageObserver; -import org.apache.cxf.ws.addressing.EndpointReferenceType; -import org.apache.servicemix.nmr.api.NMR; -import org.easymock.classextension.EasyMock; -import org.easymock.classextension.IMocksControl; -import org.junit.After; -import org.junit.Before; - - -public abstract class AbstractJBITest extends Assert { - - protected Bus bus; - protected EndpointReferenceType target; - protected MessageObserver observer; - protected Message inMessage; - protected IMocksControl control; - protected NMR nmr; - protected NMRTransportFactory nmrTransportFactory; - - @Before - public void setUp() { - BusFactory bf = BusFactory.newInstance(); - bus = bf.createBus(); - BusFactory.setDefaultBus(bus); - nmrTransportFactory = new NMRTransportFactory(); - nmrTransportFactory.setBus(bus); - nmrTransportFactory.registerWithBindingManager(); - control = EasyMock.createNiceControl(); - } - - @After - public void tearDown() { - bus.shutdown(true); - if (System.getProperty("cxf.config.file") != null) { - System.clearProperty("cxf.config.file"); - } - - } - - protected NMRConduit setupJBIConduit(boolean send, boolean decoupled) throws IOException { - if (decoupled) { - // setup the reference type - } else { - target = control.createMock(EndpointReferenceType.class); - } - nmr = control.createMock(NMR.class); - nmrTransportFactory.setNmr(nmr); - //NMRConduit jbiConduit = new NMRConduit(bus, target, nmr); - NMRConduit jbiConduit = (NMRConduit) nmrTransportFactory.getConduit(null, target); - - if (send) { - // setMessageObserver - observer = new MessageObserver() { - public void onMessage(Message m) { - inMessage = m; - } - }; - jbiConduit.setMessageObserver(observer); - } - - return jbiConduit; - } - - protected void sendoutMessage(Conduit conduit, Message message, Boolean isOneWay) throws IOException { - - Exchange exchange = new ExchangeImpl(); - exchange.setOneWay(isOneWay); - message.setExchange(exchange); - exchange.setInMessage(message); - BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); - exchange.put(BindingOperationInfo.class, boi); - try { - conduit.prepare(message); - } catch (IOException ex) { - assertFalse("NMRConduit can't perpare to send out message", false); - ex.printStackTrace(); - } - OutputStream os = message.getContent(OutputStream.class); - assertTrue("The OutputStream should not be null ", os != null); - os.write("HelloWorld".getBytes()); - os.close(); - } - - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/Greeter.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/Greeter.java b/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/Greeter.java deleted file mode 100644 index 9a6c15e..0000000 --- a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/Greeter.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - -@WebService(targetNamespace = "http://apache.org/hello_world_soap_http", name = "Greeter") - -public interface Greeter { - - @ResponseWrapper(localName = "testDocLitFaultResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.TestDocLitFaultResponse") - @RequestWrapper(localName = "testDocLitFault", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.TestDocLitFault") - @WebMethod - public void testDocLitFault( - @WebParam(name = "faultType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - java.lang.String faultType - ); - - @ResponseWrapper(localName = "sayHiResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.SayHiResponse") - @RequestWrapper(localName = "sayHi", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.SayHi") - @WebResult(name = "responseType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - @WebMethod - public java.lang.String sayHi(); - - @ResponseWrapper(localName = "testNillableResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.TestNillableResponse") - @RequestWrapper(localName = "testNillable", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.TestNillable") - @WebResult(name = "responseType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - @WebMethod - public java.lang.String testNillable( - @WebParam(name = "NillElem", targetNamespace = "http://apache.org/hello_world_soap_http/types") - java.lang.String nillElem, - @WebParam(name = "intElem", targetNamespace = "http://apache.org/hello_world_soap_http/types") - int intElem - ); - - @ResponseWrapper(localName = "greetMeLaterResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeLaterResponse") - @RequestWrapper(localName = "greetMeLater", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeLater") - @WebResult(name = "responseType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - @WebMethod - public java.lang.String greetMeLater( - @WebParam(name = "requestType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - long requestType - ); - - @ResponseWrapper(localName = "greetMeSometimeResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeSometimeResponse") - @RequestWrapper(localName = "greetMeSometime", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeSometime") - @WebResult(name = "responseType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - @WebMethod - public java.lang.String greetMeSometime( - @WebParam(name = "requestType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - java.lang.String requestType - ); - - @Oneway - @RequestWrapper(localName = "greetMeOneWay", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeOneWay") - @WebMethod - public void greetMeOneWay( - @WebParam(name = "requestType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - java.lang.String requestType - ); - - @ResponseWrapper(localName = "greetMeResponse", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMeResponse") - @RequestWrapper(localName = "greetMe", targetNamespace = "http://apache.org/hello_world_soap_http/types", className = "org.apache.hello_world_soap_http.types.GreetMe") - @WebResult(name = "responseType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - @WebMethod - public java.lang.String greetMe( - @WebParam(name = "requestType", targetNamespace = "http://apache.org/hello_world_soap_http/types") - java.lang.String requestType - ); -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitTest.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitTest.java b/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitTest.java deleted file mode 100644 index 4757e14..0000000 --- a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.logging.Logger; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.message.ExchangeImpl; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.service.model.BindingMessageInfo; -import org.apache.cxf.service.model.BindingOperationInfo; -import org.apache.cxf.staxutils.StaxUtils; -import org.apache.servicemix.nmr.api.Channel; -import org.apache.servicemix.nmr.api.EndpointRegistry; -import org.apache.servicemix.nmr.api.Exchange; -import org.apache.servicemix.nmr.api.Pattern; -import org.easymock.classextension.EasyMock; -import org.junit.Test; - -public class NMRConduitTest extends AbstractJBITest { - static final Logger LOG = LogUtils.getLogger(NMRConduitTest.class); - - - @Test - public void testPrepare() throws Exception { - LOG.info("test prepare"); - NMRConduit conduit = setupJBIConduit(false, false); - Message message = new MessageImpl(); - try { - conduit.prepare(message); - } catch (Exception ex) { - ex.printStackTrace(); - } - assertNotNull(message.getContent(OutputStream.class)); - assertTrue(message.getContent(OutputStream.class) instanceof NMRConduitOutputStream); - } - - @Test - public void testSendOut() throws Exception { - LOG.info("test send"); - NMRConduit conduit = setupJBIConduit(true, false); - Message message = new MessageImpl(); - Class<org.apache.servicemix.cxf.transport.nmr.Greeter> greeterCls - = org.apache.servicemix.cxf.transport.nmr.Greeter.class; - message.put(Method.class.getName(), greeterCls.getMethod("sayHi")); - Map<String, List<String>> protocolHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); - List<String> value = new ArrayList<String>(); - value.add("value"); - protocolHeaders.put("myHeader", value); - message.put(Message.PROTOCOL_HEADERS, protocolHeaders); - - - org.apache.cxf.message.Exchange exchange = new ExchangeImpl(); - exchange.setOneWay(false); - message.setExchange(exchange); - exchange.setInMessage(message); - BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); - BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class); - EasyMock.expect(boi.getOutput()).andReturn(bmi); - exchange.put(BindingOperationInfo.class, boi); - Channel channel = control.createMock(Channel.class); - EasyMock.expect(nmr.createChannel()).andReturn(channel); - Exchange xchg = control.createMock(Exchange.class); - EasyMock.expect(channel.createExchange(Pattern.InOut)).andReturn(xchg); - org.apache.servicemix.nmr.api.Message inMsg = control.createMock(org.apache.servicemix.nmr.api.Message.class); - EasyMock.expect(xchg.getIn()).andReturn(inMsg); - // just need to make sure the customer header is set - inMsg.setHeader("myHeader", "value"); - EasyMock.expectLastCall(); - EndpointRegistry endpoints = control.createMock(EndpointRegistry.class); - EasyMock.expect(channel.getNMR()).andReturn(nmr); - EasyMock.expect(nmr.getEndpointRegistry()).andReturn(endpoints); - org.apache.servicemix.nmr.api.Message outMsg = control.createMock(org.apache.servicemix.nmr.api.Message.class); - EasyMock.expect(xchg.getOut()).andReturn(outMsg); - - Source source = new StreamSource(new ByteArrayInputStream( - "<message>TestHelloWorld</message>".getBytes())); - EasyMock.expect(outMsg.getBody(Source.class)).andReturn(source); - EasyMock.expect(xchg.getOut()).andReturn(outMsg); - EasyMock.expect(outMsg.getAttachments()).andReturn(new HashMap<String, Object>()); - EasyMock.expect(outMsg.getHeaders()).andReturn(new HashMap<String, Object>()); - control.replay(); - try { - conduit.prepare(message); - } catch (IOException ex) { - assertFalse("JMSConduit can't perpare to send out message", false); - ex.printStackTrace(); - } - OutputStream os = message.getContent(OutputStream.class); - assertTrue("The OutputStream should not be null ", os != null); - os.write("HelloWorld".getBytes()); - os.close(); - control.verify(); - // check the customer protocol header - //assertEquals("Should get the customer header here.", "value", headers.get("myHeader")); - InputStream is = inMessage.getContent(InputStream.class); - assertNotNull(is); - XMLStreamReader reader = StaxUtils.createXMLStreamReader(is, null); - assertNotNull(reader); - reader.nextTag(); - - String reponse = reader.getElementText(); - assertEquals("The reponse date should be equals", reponse, "TestHelloWorld"); - } -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java ---------------------------------------------------------------------- diff --git a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java b/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java deleted file mode 100644 index d1fd230..0000000 --- a/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.servicemix.cxf.transport.nmr; - -import java.io.ByteArrayInputStream; -import java.security.AccessController; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.security.auth.Subject; -import javax.xml.namespace.QName; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; - -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.message.Exchange; -import org.apache.cxf.message.ExchangeImpl; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.service.model.InterfaceInfo; -import org.apache.cxf.service.model.ServiceInfo; -import org.apache.cxf.transport.MessageObserver; -import org.apache.servicemix.nmr.api.Channel; -import org.apache.servicemix.nmr.api.Endpoint; -import org.apache.servicemix.nmr.api.EndpointRegistry; -import org.apache.servicemix.nmr.api.Pattern; -import org.apache.servicemix.nmr.api.Status; -import org.apache.servicemix.nmr.api.security.UserPrincipal; -import org.apache.servicemix.nmr.api.service.ServiceHelper; -import org.apache.servicemix.nmr.core.ServiceMix; -import org.easymock.EasyMock; - - -import org.junit.Test; - -public class NMRDestinationTest extends AbstractJBITest { - static final Logger LOG = LogUtils.getLogger(NMRDestinationTest.class); - @Test - public void testDestination() throws Exception { - LOG.info("JBI destination test"); - } - - @Test - public void testOutputStreamSubstitutionDoesntCauseExceptionInDoClose() throws Exception { - //Create enough of the object structure to get through the code. - org.apache.servicemix.nmr.api.Message normalizedMessage = control.createMock(org.apache.servicemix.nmr.api.Message.class); - Channel channel = control.createMock(Channel.class); - Exchange exchange = new ExchangeImpl(); - exchange.setOneWay(false); - Message message = new MessageImpl(); - message.setExchange(exchange); - - - org.apache.servicemix.nmr.api.Exchange messageExchange = control.createMock(org.apache.servicemix.nmr.api.Exchange.class); - EasyMock.expect(messageExchange.getOut()).andReturn(normalizedMessage).times(2); - message.put(org.apache.servicemix.nmr.api.Exchange.class, messageExchange); - channel.send(messageExchange); - EasyMock.replay(channel); - - NMRDestinationOutputStream jbiOS = new NMRDestinationOutputStream(message, new MessageImpl(), channel); - - //Create array of more than what is in threshold in CachedOutputStream, - //though the threshold in CachedOutputStream should be made protected - //perhaps so it can be referenced here in case it ever changes. - int targetLength = 64 * 1025; - StringBuffer sb = new StringBuffer(); - sb.append("<root>"); - while (sb.length() < targetLength) { - sb.append("<dummy>some xml</dummy>"); - } - sb.append("</root>"); - byte[] testBytes = sb.toString().getBytes(); - - jbiOS.write(testBytes); - jbiOS.doClose(); - - //Verify send method was called. - EasyMock.verify(channel); - } - - - @Test - public void testNMRDestination() throws Exception { - EndpointInfo ei = new EndpointInfo(); - ei.setAddress("nmr:dummy"); - ei.setName(new QName("http://test", "endpoint")); - ServiceInfo si = new ServiceInfo(); - si.setName(new QName("http://test", "service")); - InterfaceInfo interInfo = new InterfaceInfo(si, new QName("http://test", "interface")); - si.setInterface(interInfo); - ei.setService(si); - org.apache.servicemix.nmr.api.NMR nmr = control.createMock(org.apache.servicemix.nmr.api.NMR.class); - nmrTransportFactory.setNmr(nmr); - NMRDestination destination = (NMRDestination) nmrTransportFactory.getDestination(ei); - assertNotNull(destination); - String destName = "dummy" + ei.getService().getName().toString() - + ei.getInterface().getName().toString(); - try { - nmrTransportFactory.putDestination(destName, destination); - fail(); - } catch (Exception e) { - //should catch exception here since try put duplicated destination - } - assertEquals(destination, nmrTransportFactory.getDestination(destName)); - nmrTransportFactory.removeDestination(destName); - nmrTransportFactory.putDestination(destName, destination); - - org.apache.servicemix.nmr.api.Exchange xchg = control.createMock(org.apache.servicemix.nmr.api.Exchange.class); - - org.apache.servicemix.nmr.api.Message inMsg = control.createMock(org.apache.servicemix.nmr.api.Message.class); - EasyMock.expect(xchg.getStatus()).andReturn(Status.Active); - EasyMock.expect(xchg.getIn()).andReturn(inMsg); - EasyMock.expect(inMsg.getAttachments()).andReturn(new HashMap<String, Object>()); - Map<String, Object> nmrHeaders = new HashMap<String, Object>(); - nmrHeaders.put("hello", "world"); - EasyMock.expect(inMsg.getHeaders()).andReturn(nmrHeaders); - Source source = new StreamSource(new ByteArrayInputStream( - "<message>TestHelloWorld</message>".getBytes())); - EasyMock.expect(inMsg.getBody(Source.class)).andReturn(source); - EndpointRegistry endpoints = control.createMock(EndpointRegistry.class); - EasyMock.expect(nmr.getEndpointRegistry()).andReturn(endpoints); - EasyMock.expect(nmrTransportFactory.getNmr().getEndpointRegistry()).andReturn(endpoints); - control.replay(); - observer = new MessageObserver() { - public void onMessage(Message m) { - inMessage = m; - } - }; - destination.setMessageObserver(observer); - destination.process(xchg); - assertNotNull(inMessage); - @SuppressWarnings("unchecked") - Map<String, List<String>> protocolHeaders = (Map<String, List<String>>)inMessage.get(Message.PROTOCOL_HEADERS); - assertEquals("We should get a right protocol headers", "world", protocolHeaders.get("hello").get(0)); - } - - @Test - public void testNMRDestinationRunAsSubjct() throws Exception { - ServiceMix smx = new ServiceMix(); - smx.init(); - nmr = smx; - EndpointInfo ei = new EndpointInfo(); - ei.setAddress("nmr:dumy?RUN_AS_SUBJECT=true"); - ei.setName(new QName("http://test", "endpoint")); - ServiceInfo si = new ServiceInfo(); - si.setName(new QName("http://test", "service")); - InterfaceInfo interInfo = new InterfaceInfo(si, new QName("http://test", "interface")); - si.setInterface(interInfo); - ei.setService(si); - nmrTransportFactory.setNmr(nmr); - NMRDestination destination = (NMRDestination) nmrTransportFactory.getDestination(ei); - destination.activate(); - - assertNotNull(destination); - - Subject subject = new Subject(); - subject.getPrincipals().add(new UserPrincipal("ffang")); - - Channel channel = nmr.createChannel(); - org.apache.servicemix.nmr.api.Exchange exchange = channel.createExchange(Pattern.InOut); - exchange.setTarget( - nmr.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, "dumy"))); - exchange.getIn().setSecuritySubject(subject); - Source source = new StreamSource(new ByteArrayInputStream( - "<message>TestHelloWorld</message>".getBytes())); - exchange.getIn().setBody(source); - observer = new MessageObserver() { - public void onMessage(Message m) { - inMessage = m; - Subject receivedSubject = - (Subject)inMessage.get(NMRTransportFactory.NMR_SECURITY_SUBJECT); - assertNotNull(receivedSubject); - assertEquals(receivedSubject.getPrincipals().size(), 1); - assertEquals(receivedSubject.getPrincipals().iterator().next().getName(), "ffang"); - Subject onBefalfsubject = Subject.getSubject(AccessController.getContext()); - assertNotNull(onBefalfsubject); - assertEquals(onBefalfsubject, receivedSubject); - } - }; - destination.setMessageObserver(observer); - channel.send(exchange); - Thread.sleep(2000); - assertNotNull(inMessage); - } -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/cxf/pom.xml ---------------------------------------------------------------------- diff --git a/cxf/pom.xml b/cxf/pom.xml deleted file mode 100644 index 20f7efd..0000000 --- a/cxf/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.servicemix</groupId> - <artifactId>parent</artifactId> - <version>4.6.0-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> - </parent> - - <groupId>org.apache.servicemix.cxf</groupId> - <artifactId>cxf</artifactId> - <packaging>pom</packaging> - <name>Apache ServiceMix :: Features :: CXF Support</name> - - <modules> - <module>cxf-transport-nmr</module> - <module>cxf-binding-nmr</module> - </modules> - -</project> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/README.txt ---------------------------------------------------------------------- diff --git a/examples/README.txt b/examples/README.txt deleted file mode 100644 index 8237ef4..0000000 --- a/examples/README.txt +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -WELCOME TO THE SERVICEMIX EXAMPLES -================================== - -Camel Examples -============== - -- camel-osgi - Deploys a Camel EIP route as an OSGi bundle. Configuration makes use - of the OSGi Configuration Admin service and Spring property placeholders, - and the example demonstrates how to deploy the properties file from the - ServiceMix console. - -- camel-blueprint - Deploys a Camel EIP route as an OSGi bundle. Configuration makes use - of the OSGi Configuration Admin service and uses a Blueprint XML file to - start the Camel routes. - -CXF examples -============ - -- cxf-jaxrs - Creates a RESTful JAX-RS web service using CXF and exposes it using - the OSGi HTTP service. - -- cxf-osgi - Creates a web service using CXF and Spring-DM, and exposes it through - the OSGi HTTP service. - -- cxf-ws-addressing - Uses CXF to create a web service enabled for WS-Addressing, and exposes - it through the OSGi HTTP service. - -- cxf-ws-rm - Uses CXF to create a web service enabled for WS-ReliableMessaging, and exposes - it through the OSGi HTTP service. - -- cxf-ws-security - Uses CXF to create a web service enabled for WS-Security, and exposes - it through the OSGi HTTP service. It includes a custom CallbackHandler implementation - to show you how to implement your own authentication logic. - -ActiveMQ Examples -================= - -- activemq-camel-blueprint - Deploys Camel EIP routes as an OSGi bundle using Blueprint. These routes - make use of an ActiveMQ queue hosted on the local broker deployed in ServiceMix. - -Karaf examples -============== - -- branding - Builds the artifacts that allow you to re-brand Apache Karaf - (as e.g. we did in Apache ServiceMix). - -- dump - Demo that deploys a simple service into the OSGi Service Registry - using a Blueprint XML file. - -- web - Embeds Apache Karaf in a web application. - - -Prerequisites for Running the Examples -========================================= - -Java Development Kit (JDK) --------------------------- -You must have JDK 1.6 or higher installed on your machine to -run the ServiceMix examples. - -Apache Maven ------------- -The examples use Apache Maven for building code. You must install -Maven 2.2.1 or higher and add the Maven bin/ directory to your PATH -if you want to build any of the examples. - -If you have not used Maven before, the first time you use it to -build one of the examples, it downloads a lot of JARs to a local -repository on your machine. The next time you run Maven it uses the -locally stored JARs where possible. - -To download and find out more about Maven, visit: - http://maven.apache.org - -ServiceMix Container --------------------- -You must have ServiceMix up and running. To start the ServiceMix -container, run the following command: - - <servicemix_home>/bin/servicemix (on UNIX) - <servicemix_home>\bin\servicemix (on Windows) - - -ServiceMix Features Facility -============================ -Several of the examples make use of the ServiceMix features facility. -A feature is a named, versioned collection of OSGi bundles that work -together to provide some functionality. The details of what makes up -a feature are contained in a features definition file. The ServiceMix -console includes a features subshell that provides commands to enable -you to add and remove features, and to point to feature repositories. -If you add a feature, ServiceMix uses the details provided in -the features definition file to load and activate all of the -required bundles that are not already present in the container. - -ServiceMix includes a number of features that make the running of -the examples quick and easy. Each feature enables you to use a single -command to install the example bundle and any bundles that the example -depends on. - -To view a list of the features that are already installed, enter -the following command in the ServiceMix console: - - features:list - -To view a list of the features that are used by the examples, enter -the following command in the ServiceMix console: - - features:list | grep examples - -To view the repository URLs currently associated with the features -facility, enter the following command in the ServiceMix console: - - features:listUrl - -To view the contents of the features definition file that includes -definitions for each of the features used by the examples, enter the -following command in the ServiceMix console: - - cat mvn:org.apache.servicemix/apache-servicemix/${version}/xml/features - -For more information about the features facility, see the ServiceMix -documentation.
