You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2006/10/26 10:40:17 UTC

svn commit: r467917 - in /incubator/cxf/trunk/integration/jbi: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cxf/ src/main/java/org/apache/cxf/jbi/ src/main/java/org/apache/cxf/jbi/org/ src/main/...

Author: ffang
Date: Thu Oct 26 01:40:16 2006
New Revision: 467917

URL: http://svn.apache.org/viewvc?view=rev&rev=467917
Log:
[CXF-38] JBI Integration -- phase 1

Added:
    incubator/cxf/trunk/integration/jbi/src/
    incubator/cxf/trunk/integration/jbi/src/main/
    incubator/cxf/trunk/integration/jbi/src/main/java/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/org/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties   (with props)
    incubator/cxf/trunk/integration/jbi/src/main/resources/
    incubator/cxf/trunk/integration/jbi/src/test/
    incubator/cxf/trunk/integration/jbi/src/test/java/
    incubator/cxf/trunk/integration/jbi/src/test/resources/
Modified:
    incubator/cxf/trunk/integration/jbi/pom.xml

Modified: incubator/cxf/trunk/integration/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/pom.xml?view=diff&rev=467917&r1=467916&r2=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/pom.xml (original)
+++ incubator/cxf/trunk/integration/jbi/pom.xml Thu Oct 26 01:40:16 2006
@@ -52,11 +52,20 @@
             <artifactId>cxf-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+	<dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-management</artifactId>
@@ -68,7 +77,22 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        
+
+	<dependency>
+            <groupId>servicemix</groupId>
+            <artifactId>servicemix-jbi</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>servicemix</groupId>
+                    <artifactId>jaxp</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+       
+
+ 
         <dependency>
             <groupId>com.sun.xml.messaging.saaj</groupId>
             <artifactId>saaj-impl</artifactId>

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,35 @@
+/**
+ * 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.cxf.jbi;
+
+import javax.jbi.component.ComponentContext;
+
+/**
+ * Defines a service consumer to be started by the Celtix Service
+ * Engine.
+ * 
+ */
+public interface ServiceConsumer extends Runnable { 
+
+    void stop();
+    void setComponentContext(ComponentContext componentCtx);
+
+} 

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/ServiceConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,61 @@
+/**
+ * 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.cxf.jbi.se;
+
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Bootstrap;
+import javax.jbi.component.InstallationContext;
+import javax.management.ObjectName;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+
+public class CXFBootstrap implements Bootstrap {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFBootstrap.class);
+
+    // Implementation of javax.jbi.component.Bootstrap
+
+      
+    public final ObjectName getExtensionMBeanName() {
+        return null;
+    }
+
+    public final void cleanUp() throws JBIException {
+        LOG.info(new Message("BOOTSTRAP.CLEANUP", LOG).toString());
+      
+    }
+
+    public final void onInstall() throws JBIException {
+        LOG.info(new Message("BOOTSTRAP.ONINSTALL", LOG).toString());
+
+    }
+
+    public final void onUninstall() throws JBIException {
+        LOG.info(new Message("BOOTSTRAP.ONUNINSTALL", LOG).toString());
+    }
+
+    public final void init(final InstallationContext argCtx) throws JBIException {
+        LOG.info(new Message("BOOTSTRAP.INIT", LOG).toString());
+    }
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFBootstrap.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,155 @@
+/**
+ * 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.cxf.jbi.se;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Component;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.component.ComponentLifeCycle;
+import javax.jbi.component.ServiceUnitManager;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.management.ObjectName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jbi.se.state.AbstractServiceEngineStateMachine;
+import org.apache.cxf.jbi.se.state.ServiceEngineStateFactory;
+import org.apache.cxf.jbi.se.state.ServiceEngineStateMachine;
+
+
+/** A JBI component.  Initializes the Celtix JBI transport
+ */
+public class CXFServiceEngine implements ComponentLifeCycle, Component {
+    
+    public static final String JBI_TRANSPORT_ID = "http://celtix.object.org/transport/jbi";
+    
+    
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFServiceEngine.class);
+    
+    
+   
+    private ServiceEngineStateFactory stateFactory = ServiceEngineStateFactory.getInstance();
+    
+    public CXFServiceEngine() {
+        stateFactory.setCurrentState(stateFactory.getShutdownState());
+    }
+    
+    // Implementation of javax.jbi.component.ComponentLifeCycle
+    
+    public final ObjectName getExtensionMBeanName() {
+        return null;
+    }
+    
+    public final void shutDown() throws JBIException {
+        try {
+            LOG.info(new Message("SE.SHUTDOWN", LOG).toString());
+            stateFactory.getCurrentState().changeState(ServiceEngineStateMachine.SEOperation.shutdown, null);
+        } catch (Throwable ex) { 
+            LOG.log(Level.SEVERE, ex.getMessage(), ex);
+            throw new JBIException(ex);
+        } 
+    }
+    
+    public final void init(ComponentContext componentContext) throws JBIException {
+        try {
+            stateFactory.getCurrentState().changeState(
+                ServiceEngineStateMachine.SEOperation.init, componentContext);
+        } catch (Throwable ex) { 
+            LOG.log(Level.SEVERE, new Message("SE.FAILED.INIT.BUS", LOG).toString(), ex);
+            throw new JBIException(ex);
+        } 
+    }
+    
+    
+    
+    
+    
+    public final void start() throws JBIException {
+        try { 
+            LOG.info(new Message("SE.STARTUP", LOG).toString());
+            stateFactory.getCurrentState().changeState(ServiceEngineStateMachine.SEOperation.start, null);
+        } catch (Exception ex) {
+            LOG.log(Level.SEVERE, ex.getMessage(), ex);
+            throw new JBIException(ex);
+        }
+    }
+    
+    public final void stop() throws JBIException {
+        try {
+            LOG.info(new Message("SE.STOP", LOG).toString());
+            stateFactory.getCurrentState().changeState(ServiceEngineStateMachine.SEOperation.stop, null);
+        } catch (Exception ex) {
+            LOG.log(Level.SEVERE, ex.getMessage(), ex);
+            throw new JBIException(ex);
+        }
+    }
+    
+    // Implementation of javax.jbi.component.Component
+    
+    public final ComponentLifeCycle getLifeCycle() {
+        LOG.fine("CeltixServiceEngine returning life cycle");
+        return this;
+    }
+    
+    public final ServiceUnitManager getServiceUnitManager() {
+        LOG.fine("CeltixServiceEngine return service unit manager");
+        return AbstractServiceEngineStateMachine.getSUManager();
+    }
+    
+    public final Document getServiceDescription(final ServiceEndpoint serviceEndpoint) {
+        Document doc = 
+            AbstractServiceEngineStateMachine.getSUManager().getServiceDescription(serviceEndpoint);
+        LOG.fine("CeltixServiceEngine returning service description: " + doc);
+        return doc;
+    }
+    
+    public final boolean isExchangeWithConsumerOkay(final ServiceEndpoint ep, 
+                                                    final MessageExchange exchg) {
+        
+        LOG.fine("isExchangeWithConsumerOkay: endpoint: " + ep 
+                 + " exchange: " + exchg);
+        return true;
+    }
+    
+    public final boolean isExchangeWithProviderOkay(final ServiceEndpoint ep, 
+                                                    final MessageExchange exchng) {
+        LOG.fine("isExchangeWithConsumerOkay: endpoint: " + ep 
+                 + " exchange: " + exchng);
+        return true;
+    }
+    
+    public final ServiceEndpoint resolveEndpointReference(final DocumentFragment documentFragment) {
+        return null;
+    }
+    
+    
+    
+    
+    
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceEngine.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,323 @@
+/**
+ * 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.cxf.jbi.se;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.EndpointUtils;
+import org.apache.cxf.jbi.ServiceConsumer;
+
+/**
+ * Wraps a Celtix service or client.
+ */
+public class CXFServiceUnit {
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFServiceUnit.class);
+    
+    private final Bus bus; 
+    
+    private Object serviceImplementation; 
+    private ServiceConsumer serviceConsumer; 
+    private EndpointImpl endpoint;
+    private final String rootPath; 
+    private final ClassLoader parentLoader;
+    private boolean isProvider;
+    private QName serviceName; 
+    private String endpointName;
+    private ServiceEndpoint ref;
+    
+    public CXFServiceUnit(Bus b, String path, ComponentClassLoader parent) {
+        
+        URL url = null; 
+        try { 
+            url = new File(path + File.separator).toURL();
+            
+        } catch (MalformedURLException ex) {
+            LOG.log(Level.SEVERE, new Message("SU.FAILED.INIT", LOG).toString(), ex);
+        } 
+        bus = b;
+        rootPath = path;
+        parent.addResource(url);
+        parentLoader = parent;
+        parseJbiDescriptor(); 
+    }
+    
+    public boolean isServiceProvider() { 
+        return isProvider;
+    } 
+    
+    public void stop(ComponentContext ctx) {
+        if (ref != null) {
+            try {
+                ctx.deactivateEndpoint(ref);
+            } catch (JBIException e) {
+                LOG.severe(new Message("SU.FAILED.DEACTIVE.ENDPOINT", LOG).toString() 
+                           + ref + e);
+            }
+        } else {
+            serviceConsumer.stop();
+        }
+    }
+    
+    public void start(ComponentContext ctx, CXFServiceUnitManager serviceUnitManager) {
+        if (isServiceProvider()) { 
+            LOG.info(new Message("SU.START.PROVIDER", LOG).toString());
+            ref = null;
+            try {
+                ref = ctx.activateEndpoint(getServiceName(), getEndpointName());
+            } catch (JBIException e) {
+                LOG.severe(new Message("SU.FAIED.ACTIVE.ENDPOINT", LOG).toString() + e);
+            } 
+            LOG.info("activated endpoint: " + ref.getEndpointName() 
+                     + " service: " + ref.getServiceName());
+            serviceUnitManager.putServiceEndpoint(ref, this);
+            
+        } else {
+            LOG.info(new Message("SU.START.CONSUMER", LOG).toString());
+            new Thread(serviceConsumer).start();
+        }
+    }
+    
+    public QName getServiceName() { 
+        
+        QName ret = null; 
+        
+        if (isServiceProvider()) { 
+            if (serviceName == null) { 
+                WebService ws = (WebService)serviceImplementation.getClass().getAnnotation(WebService.class);
+                serviceName = new QName(ws.targetNamespace(), ws.serviceName());
+            }
+            ret = serviceName;
+        } else {
+            WebService ws;
+            WebServiceClassFinder finder = new WebServiceClassFinder(rootPath, parentLoader);
+            Collection<Class<?>> classes = null;
+            try {
+                classes = finder.findWebServiceInterface();
+            } catch (MalformedURLException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } 
+            if (classes.size() > 0) {
+                Class<?> clz = classes.iterator().next();
+                ws = clz.getAnnotation(WebService.class);
+                serviceName = new QName(ws.targetNamespace(), ws.serviceName());
+                ret = serviceName;
+            }
+        }
+        return ret;
+    } 
+    
+    public String getEndpointName() { 
+        return endpointName;
+    } 
+    
+    public void prepare(ComponentContext ctx) { 
+        
+        try { 
+            WebServiceClassFinder finder = new WebServiceClassFinder(rootPath, parentLoader);
+            Collection<Class<?>> classes = finder.findWebServiceClasses(); 
+            if (classes.size() > 0) {
+                LOG.info(new Message("SU.PUBLISH.ENDPOINT", LOG).toString());
+                isProvider = true;
+                Class<?> clz = classes.iterator().next();
+                serviceImplementation = clz.newInstance();
+                if (EndpointUtils.isValidImplementor(serviceImplementation)) {
+                    createProviderConfiguration();
+                    
+                    endpoint = new EndpointImpl(bus, serviceImplementation, "null");
+                    //dummy endpoint to publish on
+                    endpoint.publish("http://foo/bar/baz");
+                    
+                }
+                
+            } else {
+                createConsumerConfiguration();
+                classes = finder.findServiceConsumerClasses();
+                Class<?> clz = classes.iterator().next();
+                serviceConsumer = (ServiceConsumer)clz.newInstance();
+                serviceConsumer.setComponentContext(ctx);
+                
+            }
+        } catch (Exception ex) { 
+                      
+            if (ex.getCause() != null) { 
+                ex = (Exception)ex.getCause();
+            } 
+   
+            LOG.log(Level.SEVERE, new Message("SU.FAILED.PUBLISH.ENDPOINT", LOG).toString(), ex);
+        } 
+    } 
+    
+    
+    public ClassLoader getClassLoader() { 
+        return parentLoader;
+    } 
+    
+    
+    Document getWsdlAsDocument() { 
+        
+        Document doc = null;
+        try { 
+            WebService ws = null;
+            WebServiceClassFinder finder = new WebServiceClassFinder(rootPath, parentLoader);
+            Collection<Class<?>> classes = finder.findWebServiceInterface(); 
+            if (classes.size() > 0) {
+                Class<?> clz = classes.iterator().next();
+                ws = clz.getAnnotation(WebService.class);
+            }
+            if (ws != null) { 
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                doc = builder.parse(ws.wsdlLocation());
+                
+            } else { 
+                LOG.severe(new Message("SU.COULDNOT.GET.ANNOTATION", LOG).toString());
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } 
+        return doc;
+    } 
+    
+    
+    
+    
+    
+    private void parseJbiDescriptor() { 
+        
+        // right now, all we are interested in is an endpoint name
+        // from the jbi dd.
+        File metaInf = new File(rootPath, "META-INF");
+        File jbiXml = new File(metaInf, "jbi.xml");
+        try { 
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document doc = builder.parse(jbiXml.toURL().toString());
+            
+            Element providesEl = (Element)findNode(doc.getDocumentElement(), "provides");
+            Element consumersEl = (Element)findNode(doc.getDocumentElement(), "consumes");
+            if (providesEl != null) {
+                endpointName = providesEl.getAttribute("endpoint-name");
+            } else if (consumersEl != null) {
+                endpointName = consumersEl.getAttribute("endpoint-name");
+            }
+        } catch (Exception ex) { 
+            LOG.log(Level.SEVERE, "error parsing " + jbiXml, ex);
+        } 
+        
+    } 
+    
+    
+    private Node findNode(Node root, String name) { 
+        
+        if (name.equals(root.getNodeName())) {
+            return root;
+        } 
+        
+        NodeList children = root.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) { 
+            Node child = children.item(i);
+            Node found = findNode(child, name);
+            if (found != null) { 
+                return found;
+            } 
+        } 
+        return null;
+    } 
+    
+    private void createProviderConfiguration() {
+        //String oldConfiguration = System.getProperty("celtix.config.file");
+        File metaInfDir = new File(rootPath, "META-INF");
+        File celtixConfig = new File(metaInfDir, "celtix-server.xml"); 
+        if (celtixConfig.exists()) { 
+            try {
+                System.setProperty("celtix.config.file", celtixConfig.toURL().toString());
+            } catch (MalformedURLException e) {
+                e.printStackTrace();
+            }
+            LOG.info(new Message("SE.SET.CONFIGURATION", LOG) + System.getProperty("celtix.config.file"));
+        } else { 
+            LOG.severe(new Message("SE.NOT.FOUND.CONFIGURATION", LOG).toString() + metaInfDir);
+        } 
+        
+        /*Configuration busCfg = bus.getConfiguration();
+        if (null == busCfg) {
+            return;
+        }
+
+        String id = getServiceName().toString();
+        ConfigurationBuilder cb = ConfigurationBuilderFactory.getBuilder(null);
+        cb.buildConfiguration(EndpointImpl.ENDPOINT_CONFIGURATION_URI, id, busCfg);
+        System.setProperty("celtix.config.file", oldConfiguration);*/
+    }
+    
+    private void createConsumerConfiguration() {
+        //String oldConfiguration = System.getProperty("celtix.config.file");
+        File metaInfDir = new File(rootPath, "META-INF");
+        File celtixConfig = new File(metaInfDir, "celtix-client.xml"); 
+        if (celtixConfig.exists()) { 
+            try {
+                System.setProperty("celtix.config.file", celtixConfig.toURL().toString());
+            } catch (MalformedURLException e) {
+                e.printStackTrace();
+            }
+            LOG.info(new Message("SE.SET.CONFIGURATION", LOG) + System.getProperty("celtix.config.file"));
+        } else { 
+            LOG.severe(new Message("SE.NOT.FOUND.CONFIGURATION", LOG).toString() + metaInfDir);
+        } 
+        
+        /*Configuration busCfg = bus.getConfiguration();
+        if (null == busCfg) {
+            return;
+        }
+        String id = getServiceName().toString() + "/" + getEndpointName();
+        ConfigurationBuilder cb = ConfigurationBuilderFactory.getBuilder(null);
+        cb.buildConfiguration(ServiceImpl.PORT_CONFIGURATION_URI, id, busCfg);
+        System.setProperty("celtix.config.file", oldConfiguration);*/
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,254 @@
+/**
+ * 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.cxf.jbi.se;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.component.ServiceUnitManager;
+import javax.jbi.management.DeploymentException;
+import javax.jbi.servicedesc.ServiceEndpoint;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+
+/** Manage deployment of service units to the Celtix service engine
+ * 
+ */
+public class CXFServiceUnitManager implements ServiceUnitManager {
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFServiceUnitManager.class);
+    
+    private ComponentContext ctx; 
+    private final Map<String, CXFServiceUnit> serviceUnits 
+        = new HashMap<String, CXFServiceUnit>();
+    private final Map<ServiceEndpoint, CXFServiceUnit> csuMap 
+        = new HashMap<ServiceEndpoint, CXFServiceUnit>();
+    
+    private final Bus bus;
+    private final ComponentClassLoader componentParentLoader; 
+    
+    public CXFServiceUnitManager(Bus b, ComponentContext c, ComponentClassLoader loader) {
+        ctx = c;
+        bus = b;
+        componentParentLoader = loader;
+    }
+    
+    // Implementation of javax.jbi.component.ServiceUnitManager
+    
+    public final void shutDown(final String suName) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.SHUTDOWN", LOG) + suName);
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+        if (!serviceUnits.containsKey(suName)) {
+            throw new DeploymentException(new Message("UNDEPLOYED.SU", LOG).toString() + suName);
+        }
+        serviceUnits.remove(suName);
+    }
+    
+    public final String deploy(final String suName, final String suRootPath) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.DEPLOY", LOG) + suName + " path: " + suRootPath);
+        
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+        if (serviceUnits.containsKey(suName)) {
+            throw new DeploymentException(new Message("DUPLICATED.SU", LOG) + suName);
+        }
+        
+        if (suRootPath == null) {
+            throw new DeploymentException(new Message("SU.ROOT.NULL", LOG).toString());
+        } 
+        if (suRootPath.length() == 0) {
+            throw new DeploymentException(new Message("SU.ROOT.EMPTY", LOG).toString());
+        }
+        
+        String msg =  "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+            + "<jbi-task xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\" "  
+            +  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " 
+            +  "version=\"1.0\" " 
+            +  "xsi:schemaLocation=\"http://java.sun.com/xml/ns/jbi/management-message " 
+            +  "./managementMessage.xsd\">"
+            + "<jbi-task-result>"
+            + "<frmwk-task-result>" 
+            + "<frmwk-task-result-details>" 
+            + "<task-result-details>" 
+            + "<task-id>deploy</task-id>" 
+            + "<task-result>SUCCESS</task-result>" 
+            + "</task-result-details>" 
+            + "<locale>en_US</locale>" 
+            + "</frmwk-task-result-details>"
+            + "<is-cause-framework>YES</is-cause-framework>"
+            + "</frmwk-task-result>"
+            + "<component-task-result>"
+            + "<component-name>" + ctx.getComponentName() + "</component-name>"
+            + "<component-task-result-details>"
+            + "<task-result-details>"
+            + "<task-id>deploy</task-id>"
+            + "<task-result>SUCCESS</task-result>"
+            + "</task-result-details>"
+            + "</component-task-result-details>"
+            + "</component-task-result>"
+            + "</jbi-task-result>"
+            + "</jbi-task>";
+        
+        return msg;
+    }
+    
+    public final String undeploy(final String suName, final String suRootPath) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.UNDEPLOY", LOG) + suName + " path: " + suRootPath);
+        
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+                
+        if (suRootPath == null) {
+            throw new DeploymentException(new Message("SU.ROOT.NULL", LOG).toString());
+        } 
+        if (suRootPath.length() == 0) {
+            throw new DeploymentException(new Message("SU.ROOT.EMPTY", LOG).toString());
+        }
+        
+        
+        String msg =  "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+            + "<jbi-task xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\" "  
+            +  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " 
+            +  "version=\"1.0\" " 
+            +  "xsi:schemaLocation=\"http://java.sun.com/xml/ns/jbi/management-message " 
+            +  "./managementMessage.xsd\">"
+            + "<jbi-task-result>"
+            + "<frmwk-task-result>" 
+            + "<frmwk-task-result-details>" 
+            + "<task-result-details>" 
+            + "<task-id>undeploy</task-id>" 
+            + "<task-result>SUCCESS</task-result>" 
+            + "</task-result-details>" 
+            + "<locale>en_US</locale>" 
+            + "</frmwk-task-result-details>" 
+            + "</frmwk-task-result>"
+            + "<component-task-result>"
+            + "<component-name>" + ctx.getComponentName() + "</component-name>"
+            + "<component-task-result-details>"
+            + "<task-result-details>"
+            + "<task-id>undeploy</task-id>"
+            + "<task-result>SUCCESS</task-result>"
+            + "</task-result-details>"
+            + "</component-task-result-details>"
+            + "</component-task-result>"
+            + "</jbi-task-result>"
+            + "</jbi-task>";
+        serviceUnits.remove(suName);
+        return msg;
+    }
+    
+    public final void init(final String suName, final String suRootPath) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.INIT", LOG) + suName + " path: " + suRootPath);
+     
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+                
+        if (suRootPath == null) {
+            throw new DeploymentException(new Message("SU.ROOT.NULL", LOG).toString());
+        } 
+        if (suRootPath.length() == 0) {
+            throw new DeploymentException(new Message("SU.ROOT.EMPTY", LOG).toString());
+        }
+        
+        try { 
+            Thread.currentThread().setContextClassLoader(componentParentLoader);
+            CXFServiceUnit csu = new CXFServiceUnit(bus, suRootPath, componentParentLoader);
+            csu.prepare(ctx);
+            serviceUnits.put(suName, csu);    
+        } catch (Exception ex) { 
+            ex.printStackTrace();
+            throw new DeploymentException(ex);
+        }
+    }
+    
+    public final void start(final String suName) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.START", LOG) + suName);
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+        if (!serviceUnits.containsKey(suName)) {
+            throw new DeploymentException(new Message("UNDEPLOYED.SU", LOG) + suName);
+        }
+        
+        CXFServiceUnit csu = serviceUnits.get(suName); 
+        assert csu != null;
+        csu.start(ctx, this); 
+    }
+    
+    public void putServiceEndpoint(ServiceEndpoint ref, CXFServiceUnit csu) {
+        csuMap.put(ref, csu);
+    }
+    
+    public final CXFServiceUnit getServiceUnitForEndpoint(ServiceEndpoint ep) { 
+        return csuMap.get(ep);
+    } 
+    
+    public final void stop(final String suName) throws DeploymentException {
+        LOG.info(new Message("SU.MANAGER.STOP", LOG) + suName);
+        if (suName == null) {
+            throw new DeploymentException(new Message("SU.NAME.NULL", LOG).toString());
+        } 
+        if (suName.length() == 0) {
+            throw new DeploymentException(new Message("SU.NAME.EMPTY", LOG).toString());
+        }
+        if (!serviceUnits.containsKey(suName)) {
+            throw new DeploymentException(new Message("UNDEPLOYED.SU", LOG) + suName);
+        }
+        serviceUnits.get(suName).stop(ctx);
+    }
+    
+    Document getServiceDescription(final ServiceEndpoint serviceEndpoint) { 
+        Document ret = null;
+        
+        if (csuMap.keySet().contains(serviceEndpoint)) { 
+            CXFServiceUnit csu = csuMap.get(serviceEndpoint);
+            ret = csu.getWsdlAsDocument();
+        } 
+        return ret;
+    } 
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnitManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,35 @@
+/**
+ * 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.cxf.jbi.se;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class ComponentClassLoader extends URLClassLoader {
+
+    public ComponentClassLoader(URL[] urls, ClassLoader parent) {
+        super(urls, parent);
+    }
+    
+    public void addResource(URL url) {
+        addURL(url);
+    }
+   
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/ComponentClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties Thu Oct 26 01:40:16 2006
@@ -0,0 +1,39 @@
+BOOTSTRAP.CLEANUP=Bootstrap.cleanUp called
+BOOTSTRAP.ONINSTALL=Bootstrap.onInstall called
+BOOTSTRAP.ONUNINSTALL=Bootstrap.onUninstall called
+BOOTSTRAP.INIT=Bootstrap.init called
+SE.SHUTDOWN=Shutting down CXFServiceEngine
+SE.SET.CONFIGURATION=set CXF configuration to:
+SE.NOT.FOUND.CONFIGURATION=could not find CXF configuration in\t
+SE.INSTALL.ROOT=CXF Service Engine installation root:
+SE.INIT.COMPLETE=CXFServiceEngine init complete
+SE.FAILED.INIT.BUS=failed to initilialize bus
+SE.INIT.BUS=initialising bus
+SE.INIT.BUS.COMPLETE=init bus complete
+SE.STARTUP=CXFServiceEngine starting
+SE.STARTUP.COMPLETE=CXFServiceEngine startup complete
+SE.STOP=CXFServiceEngine stopped
+SE.FAILED.REGISTER.TRANSPORT.FACTORY=failed to register JBI transport factory
+SE.FAILED.CLASSLOADER=failed to construct component classloader
+SU.FAILED.INIT=failed to initialize service unit
+SU.FAILED.DEACTIVE.ENDPOINT=failed to deactive Endpoint
+SU.START.PROVIDER=starting provider
+SU.FAIED.ACTIVE.ENDPOINT=failed to active Endpoint
+SU.START.CONSUMER=starting consumer
+SU.PUBLISH.ENDPOINT=publishing endpoint
+SU.FAILED.PUBLISH.ENDPOINT=failed to publish endpoint
+SU.COULDNOT.GET.ANNOTATION=could not get WebService annotation from\t
+SU.MANAGER.SHUTDOWN=SU Manager shutdown\t
+SU.NAME.NULL=service unit name shouldn't be null
+SU.NAME.EMPTY=service unit name shouldn't be empty
+SU.STATE=\tstate is incorrect for shutdown
+SU.MANAGER.DEPLOY=SU Manager deploy\t
+SU.MANAGER.UNDEPLOY=SU Manager undeploy\t
+SU.MANAGER.INIT=SU Manager init\t
+SU.MANAGER.START=SU Manager start\t
+SU.MANAGER.STOP=SU Manager stop\t  
+FAILED.LOAD.CLASS=failed to load class:\t
+DUPLICATED.SU=duplicated SU:\t
+SU.ROOT.NULL=su root path shouldn't be null
+SU.ROOT.EMPTY=su root path shouldn't be empty
+UNDEPLOYED.SU= undeployed SU:\t   
\ No newline at end of file

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,133 @@
+/**
+ * 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.cxf.jbi.se;
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jbi.ServiceConsumer;
+
+public class WebServiceClassFinder {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(WebServiceClassFinder.class);
+    private final String rootPath;
+    private final ClassLoader parent;
+
+    public WebServiceClassFinder(String argRootPath, ClassLoader loader) {
+        if (argRootPath.endsWith(File.separator)) {
+            argRootPath = argRootPath.substring(0, argRootPath.length() - 2);
+        }
+        rootPath = argRootPath;
+        parent = loader;
+    }
+
+    public Collection<Class<?>> findServiceConsumerClasses() throws MalformedURLException {
+        return find(new Matcher() {
+            public boolean accept(Class<?> clz) {
+                return ServiceConsumer.class.isAssignableFrom(clz)
+                       && (clz.getModifiers() & Modifier.ABSTRACT) == 0;
+            }
+        });
+    }
+
+    public Collection<Class<?>> findWebServiceClasses() throws MalformedURLException {
+
+        return find(new Matcher() {
+            public boolean accept(Class<?> clz) {
+                return clz.getAnnotation(WebService.class) != null
+                       && (clz.getModifiers() & Modifier.ABSTRACT) == 0;
+            }
+        });
+    }
+    
+    public Collection<Class<?>> findWebServiceInterface() throws MalformedURLException {
+
+        return find(new Matcher() {
+            public boolean accept(Class<?> clz) {
+                return clz.getAnnotation(WebService.class) != null
+                       && (clz.getModifiers() & Modifier.INTERFACE) == Modifier.INTERFACE;
+            }
+        });
+    }
+
+    private Collection<Class<?>> find(Matcher matcher) throws MalformedURLException {
+        List<Class<?>> classes = new ArrayList<Class<?>>();
+
+        File root = new File(rootPath);
+        URL[] urls = {root.toURL()};
+        URLClassLoader loader = new URLClassLoader(urls, parent);
+
+        find(root, loader, classes, matcher);
+        return classes;
+    }
+
+    private void find(File dir, ClassLoader loader, Collection<Class<?>> classes, Matcher matcher) {
+
+        File[] files = dir.listFiles();
+        for (File f : files) {
+            if (f.toString().endsWith(".class")) {
+                Class<?> clz = loadClass(loader, f);
+                if (matcher.accept(clz)) {
+                    classes.add(clz);
+                }
+            } else if (f.isDirectory()) {
+                find(f, loader, classes, matcher);
+            }
+        }
+    }
+
+    private Class<?> loadClass(ClassLoader loader, File classFile) {
+
+        String fileName = classFile.toString();
+        String className = fileName.substring(rootPath.length());
+        className = className.substring(0, className.length() - ".class".length())
+            .replace(File.separatorChar, '.');
+        if (className.startsWith(".")) {
+            // ServiceMix and OpenESB are little different with rootPath, so here className may be begin
+            // with "."
+            className = className.substring(1, className.length());
+        }
+        try {
+            return loader.loadClass(className);
+        } catch (ClassNotFoundException ex) {
+            LOG.severe(new Message("FAILED.LOAD.CLASS", LOG) + className);
+        }
+        return null;
+    }
+
+    interface Matcher {
+        boolean accept(Class<?> clz);
+    }
+
+    
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/WebServiceClassFinder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,90 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+//import java.util.logging.Level;
+//import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+//import org.apache.cxf.common.i18n.Message;
+//import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jbi.se.CXFServiceUnitManager;
+//import org.apache.cxf.jbi.transport.JBITransportFactory;
+
+public abstract class AbstractServiceEngineStateMachine implements ServiceEngineStateMachine {
+
+    static final String CELTIX_CONFIG_FILE = "celtix-config.xml";
+    static final String PROVIDER_PROP = "javax.xml.ws.spi.Provider";
+    static CXFServiceUnitManager suManager;
+    static ComponentContext ctx;
+    static Bus bus;
+    //private static final Logger LOG = LogUtils.getL7dLogger(AbstractServiceEngineStateMachine.class);
+    //private static final String JBI_TRANSPORT_ID = "http://celtix.object.org/transport/jbi";
+      
+   
+
+    public void changeState(SEOperation operation, ComponentContext context) throws JBIException {
+        
+    }
+
+    void configureJBITransportFactory(DeliveryChannel chnl, CXFServiceUnitManager mgr)
+        throws BusException { 
+        //getTransportFactory().setDeliveryChannel(chnl);
+    }
+
+
+    /*JBITransportFactory getTransportFactory() throws BusException { 
+        assert bus != null;
+    
+        try { 
+            JBITransportFactory transportFactory = 
+                (JBITransportFactory)bus.getTransportFactoryManager()
+                    .getTransportFactory(JBI_TRANSPORT_ID);
+        
+            return transportFactory;
+        } catch (BusException ex) { 
+            LOG.log(Level.SEVERE, new Message("SE.FAILED.INIT.BUS", LOG).toString(), ex);
+            throw ex;
+        }
+    }
+    
+    void registerJBITransport(Bus argBus, CeltixServiceUnitManager mgr) throws JBIException { 
+        try { 
+           
+            getTransportFactory().init(argBus);
+            getTransportFactory().setServiceUnitManager(mgr);
+        } catch (Exception ex) {
+            throw new JBIException(new Message("SE.FAILED.REGISTER.TRANSPORT.FACTORY", 
+                                               LOG).toString(), ex);
+        }
+    }*/ 
+    
+    public static CXFServiceUnitManager getSUManager() {
+        return suManager;
+    }
+    
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/AbstractServiceEngineStateMachine.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties Thu Oct 26 01:40:16 2006
@@ -0,0 +1,39 @@
+BOOTSTRAP.CLEANUP=Bootstrap.cleanUp called
+BOOTSTRAP.ONINSTALL=Bootstrap.onInstall called
+BOOTSTRAP.ONUNINSTALL=Bootstrap.onUninstall called
+BOOTSTRAP.INIT=Bootstrap.init called
+SE.SHUTDOWN=Shutting down CeltixServiceEngine
+SE.SET.CONFIGURATION=set CXF configuration to:
+SE.NOT.FOUND.CONFIGURATION=could not find CXF configuration in\t
+SE.INSTALL.ROOT=CXF Service Engine installation root:
+SE.INIT.COMPLETE=CXFServiceEngine init complete
+SE.FAILED.INIT.BUS=failed to initilialize bus
+SE.INIT.BUS=initialising bus
+SE.INIT.BUS.COMPLETE=init bus complete
+SE.STARTUP=CXFServiceEngine starting
+SE.STARTUP.COMPLETE=CXFServiceEngine startup complete
+SE.STOP=CXFServiceEngine stopped
+SE.FAILED.REGISTER.TRANSPORT.FACTORY=failed to register JBI transport factory
+SE.FAILED.CLASSLOADER=failed to construct component classloader
+SU.FAILED.INIT=failed to initialize service unit
+SU.FAILED.DEACTIVE.ENDPOINT=failed to deactive Endpoint
+SU.START.PROVIDER=starting provider
+SU.FAIED.ACTIVE.ENDPOINT=failed to active Endpoint
+SU.START.CONSUMER=starting consumer
+SU.PUBLISH.ENDPOINT=publishing endpoint
+SU.FAILED.PUBLISH.ENDPOINT=failed to publish endpoint
+SU.COULDNOT.GET.ANNOTATION=could not get WebService annotation from\t
+SU.MANAGER.SHUTDOWN=SU Manager shutdown\t
+SU.NAME.NULL=service unit name shouldn't be null
+SU.NAME.EMPTY=service unit name shouldn't be empty
+SU.STATE=\tstate is incorrect for shutdown
+SU.MANAGER.DEPLOY=SU Manager deploy\t
+SU.MANAGER.UNDEPLOY=SU Manager undeploy\t
+SU.MANAGER.INIT=SU Manager init\t
+SU.MANAGER.START=SU Manager start\t
+SU.MANAGER.STOP=SU Manager stop\t  
+FAILED.LOAD.CLASS=failed to load class:\t
+DUPLICATED.SU=duplicated SU:\t
+SU.ROOT.NULL=su root path shouldn't be null
+SU.ROOT.EMPTY=su root path shouldn't be empty
+UNDEPLOYED.SU= undeployed SU:\t   
\ No newline at end of file

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,138 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+
+//import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jbi.se.CXFServiceUnitManager;
+import org.apache.cxf.jbi.se.ComponentClassLoader;
+//import org.apache.cxf.jbi.se.state.ServiceEngineStateMachine.SEOperation;
+
+public class ServiceEngineShutdown extends AbstractServiceEngineStateMachine {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(ServiceEngineShutdown.class);
+    
+       
+    public void changeState(SEOperation operation, ComponentContext context) throws JBIException {
+        LOG.info("in shutdown state");
+        if (operation == SEOperation.init) {
+            initSE(context);
+            ServiceEngineStateFactory.getInstance().setCurrentState(
+                ServiceEngineStateFactory.getInstance().getStopState());
+        } else if (operation == SEOperation.shutdown) {
+            throw new JBIException("This JBI component is already shutdown");
+        } else if (operation == SEOperation.stop) {
+            throw new JBIException("This operation is unsupported, cannot stop a shutdown JBI component");
+        } else if (operation == SEOperation.start) {
+            throw new JBIException("Cannot start a shutdown JBI component directly, need init first");
+        }
+    }
+
+    private void initSE(ComponentContext context) throws JBIException {
+        
+        try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            
+            System.setProperty(PROVIDER_PROP, "org.objectweb.celtix.bus.jaxws.spi.ProviderImpl");
+            ctx = context;
+            if (ctx == null) {
+                return;
+            }
+            String installRoot = ctx.getInstallRoot();
+            File metaInfDir = new File(installRoot, "META-INF");
+            File celtixConfig = new File(metaInfDir, CELTIX_CONFIG_FILE); 
+            
+            if (celtixConfig.exists()) { 
+                System.setProperty("celtix.config.file", celtixConfig.toURL().toString());
+                LOG.info(new Message("SE.SET.CONFIGURATION", LOG) + System.getProperty("celtix.config.file"));
+            } else { 
+                LOG.severe(new Message("SE.NOT.FOUND.CONFIGURATION", LOG).toString() + metaInfDir);
+            } 
+            
+            ComponentClassLoader loader = createClassLoader();
+            
+            initializeBus();
+            suManager = new CXFServiceUnitManager(bus, ctx, loader);
+            //registerJBITransport(bus, suManager);
+            
+            LOG.info(new Message("SE.INSTALL.ROOT", LOG) + installRoot);
+            LOG.info(new Message("SE.INIT.COMPLETE", LOG).toString());
+            
+        } catch (Throwable e) {
+            throw new JBIException(e);
+        }
+    }
+    
+    private void initializeBus() throws JBIException { 
+        
+        try { 
+            LOG.info(new Message("SE.INIT.BUS", LOG).toString());
+            //bus = Bus.init();
+            LOG.info(new Message("SE.INIT.BUS.COMPLETE", LOG).toString());
+        } catch (Exception ex) { 
+            LOG.log(Level.SEVERE, new Message("SE.FAILED.INIT.BUS", LOG).toString(), ex);
+            throw new JBIException(ex);
+        } 
+    } 
+    
+
+    private ComponentClassLoader createClassLoader() throws JBIException { 
+        
+        try { 
+            
+            File root = new File(ctx.getInstallRoot());
+            File[] jars = root.listFiles(new FilenameFilter() {
+                public boolean accept(File f, String name) { 
+                    return name.endsWith(".jar");
+                }
+            });
+            URL[] urls;
+            if (jars.length == 0) {
+                urls = new URL[0];
+            } else {
+                urls = new URL[jars.length];
+                int i = 0;
+                for (File jar : jars) { 
+                    urls[i] = jar.toURL();
+                    i++;
+                }
+            }
+            
+            return new ComponentClassLoader(urls, getClass().getClassLoader());
+        } catch (MalformedURLException ex) { 
+            throw new JBIException(new Message("SE.FAILED.CLASSLOADER", LOG).toString(), ex);
+        } 
+    } 
+    
+    
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineShutdown.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,52 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+
+import javax.jbi.component.ComponentContext;
+
+import org.apache.cxf.common.logging.LogUtils;
+//import org.apache.cxf.jbi.se.state.ServiceEngineStateMachine.SEOperation;
+
+public class ServiceEngineStart extends AbstractServiceEngineStateMachine {
+
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(ServiceEngineStart.class);
+    
+    
+    public void changeState(SEOperation operation, ComponentContext context) throws JBIException {
+        LOG.info("in start state");
+        if (operation == SEOperation.stop) {
+            ServiceEngineStateFactory.getInstance().setCurrentState(
+                ServiceEngineStateFactory.getInstance().getStopState());
+        } else if (operation == SEOperation.start) {
+            throw new JBIException("This JBI component is already started");
+        } else if (operation == SEOperation.init) {
+            throw new JBIException("This operation is unsupported, cannot init a started JBI component");
+        } else if (operation == SEOperation.shutdown) {
+            throw new JBIException("Cannot shutdown a started JBI component directly");
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStart.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,65 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+public final class ServiceEngineStateFactory {
+
+   
+    
+    private static ServiceEngineStateFactory factory;
+    private ServiceEngineStateMachine currentState;
+    
+    private ServiceEngineStateMachine stop = new ServiceEngineStop();
+    private ServiceEngineStateMachine start = new ServiceEngineStart();
+    private ServiceEngineStateMachine shutdown = new ServiceEngineShutdown();
+    
+    private ServiceEngineStateFactory() {
+        
+    }
+      
+        
+    public static synchronized ServiceEngineStateFactory getInstance() {
+        if (factory == null) {
+            factory = new ServiceEngineStateFactory();
+        }
+        return factory;
+    }
+    
+    public ServiceEngineStateMachine getCurrentState() {
+        return currentState;
+    }
+    
+    public void setCurrentState(ServiceEngineStateMachine state) {
+        currentState = state;
+    }
+    
+    public ServiceEngineStateMachine getShutdownState() {
+        return shutdown; 
+    }
+    
+    public ServiceEngineStateMachine getStopState() {
+        return stop; 
+    }
+    
+    public ServiceEngineStateMachine getStartState() {
+        return start; 
+    }
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,35 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+
+
+public interface ServiceEngineStateMachine {
+
+    enum SEOperation {
+        start, stop, init, shutdown
+    };
+    
+    void changeState(SEOperation operation, ComponentContext context) throws JBIException;
+    
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStateMachine.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,69 @@
+/**
+ * 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.cxf.jbi.se.state;
+
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+
+
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+//import org.apache.cxf.jbi.se.state.ServiceEngineStateMachine.SEOperation;
+
+public class ServiceEngineStop extends AbstractServiceEngineStateMachine {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(ServiceEngineStop.class);
+    
+    public void changeState(SEOperation operation, ComponentContext context) throws JBIException {
+        LOG.info("in stop state");
+        if (operation == SEOperation.start) {
+            startSE();
+            ServiceEngineStateFactory.getInstance().setCurrentState(
+                ServiceEngineStateFactory.getInstance().getStartState());
+        } else if (operation == SEOperation.shutdown) {
+            ServiceEngineStateFactory.getInstance().setCurrentState(
+                ServiceEngineStateFactory.getInstance().getShutdownState());
+        } else if (operation == SEOperation.init) {
+            throw new JBIException("This operation is unsupported, cannot init a stopped JBI component");
+        } else if (operation == SEOperation.stop) {
+            throw new JBIException("Cannot stop a JBI component which is already stopped");
+        }
+    }
+
+    private void startSE() throws JBIException {
+        try {
+            if (ctx == null) {
+                return;
+            }
+            DeliveryChannel chnl = ctx.getDeliveryChannel();
+            configureJBITransportFactory(chnl, suManager); 
+            LOG.info(new Message("SE.STARTUP.COMPLETE", LOG).toString());
+            
+        } catch (Throwable e) {
+            throw new JBIException(e);
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/state/ServiceEngineStop.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,62 @@
+/**
+ * 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.cxf.jbi.transport;
+
+import java.io.IOException;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+public class JBIConduit implements Conduit {
+
+    public void send(Message message) throws IOException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void close(Message message) throws IOException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public EndpointReferenceType getTarget() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Destination getBackChannel() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void close() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setMessageObserver(MessageObserver observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,53 @@
+/**
+ * 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.cxf.jbi.transport;
+
+import java.io.IOException;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+public class JBIDestination implements Destination {
+
+    public EndpointReferenceType getAddress() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Conduit getBackChannel(Message inMessage, Message partialResponse, EndpointReferenceType address)
+        throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void shutdown() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setMessageObserver(MessageObserver observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java?view=auto&rev=467917
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java (added)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java Thu Oct 26 01:40:16 2006
@@ -0,0 +1,51 @@
+/**
+ * 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.cxf.jbi.transport;
+
+import java.io.IOException;
+
+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.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+public class JBITransportFactory extends AbstractTransportFactory implements ConduitInitiator,
+    DestinationFactory {
+
+    public Conduit getConduit(EndpointInfo targetInfo) throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Conduit getConduit(EndpointInfo localInfo, EndpointReferenceType target) throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Destination getDestination(EndpointInfo ei) throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties?view=auto&rev=467917
==============================================================================
    (empty)

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain