You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/10/08 19:29:38 UTC

svn commit: r582901 - in /incubator/cxf/branches/2.0.x-fixes: ./ distribution/src/main/release/samples/integration/jca/inbound/ integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ integration/jca/src/main/java/org/apache/cxf/jca/cxf/...

Author: dkulp
Date: Mon Oct  8 10:29:35 2007
New Revision: 582901

URL: http://svn.apache.org/viewvc?rev=582901&view=rev
Log:
Merged revisions 579522 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r579522 | ningjiang | 2007-09-26 04:59:58 -0400 (Wed, 26 Sep 2007) | 1 line
  
  CXF-1047 applied the patch of writing EJBInvoker to publish the EJB servant, thanks Jeff
........

Added:
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBEndpoint.java
      - copied unchanged from r579522, incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBEndpoint.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBInvoker.java
      - copied unchanged from r579522, incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBInvoker.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBServantConfig.java
      - copied unchanged from r579522, incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBServantConfig.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/servant/EJBServantConfigTest.java
      - copied unchanged from r579522, incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/EJBServantConfigTest.java
Removed:
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/AbstractServant.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/CXFConnectEJBServant.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/servant/EJBServant.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/integration/jca/inbound/build.xml
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceBean.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/JCABusFactory.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/rar/META-INF/ra.xml
    incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/integration/jca/inbound/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/integration/jca/inbound/build.xml?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/integration/jca/inbound/build.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/integration/jca/inbound/build.xml Mon Oct  8 10:29:35 2007
@@ -70,7 +70,7 @@
             <fileset dir="${cxf.home}/lib">
                 <include name="*annotation*" />
                 <include name="*ws-metadata*" />
-                <include name="activation*" />
+                <include name="*activation*" />
                 <include name="jaxb*" />
                 <include name="stax*" />
                 <include name="jsr181*" />
@@ -155,7 +155,7 @@
     -->
     <target name="activate" description="updates ejb_servants.properties for demo " unless="GreeterBean">
         <property name="servant.definition"
-          value="GreeterBean={http://apache.org/hello_world_soap_http}Greeter@file:"/>
+          value="GreeterBean={http://apache.org/hello_world_soap_http}Greeter@"/>
         <echo message="updating ${servants.props.file}" />
 
         <echo file="${servants.props.file}" append="true">

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceBean.java?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceBean.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceBean.java Mon Oct  8 10:29:35 2007
@@ -42,8 +42,9 @@
     public static final String DEFAULT_MONITOR_POLL_INTERVAL = "120";    
     public static final String EJB_SERVICE_PROPERTIES_URL = "ejb.service.properties.url";
     public static final String MONITOR_EJB_SERVICE_PROPERTIES = "monitor.ejb.service.properties";
-    public static final String MONITOR_POLL_INTERVAL = "monitor.poll.interval";   
-    private static final long serialVersionUID = -9186743162164946039L;
+    public static final String MONITOR_POLL_INTERVAL = "monitor.poll.interval"; 
+    public static final String EJB_SERVANT_BASE_URL = "ejb.servant.base.url";
+    
 
     static {
         // first use of log, default init if necessary
@@ -74,7 +75,7 @@
 
     public void setProperty(String propName, String propValue) {
         if (!DEFAULT_VALUE_STRING.equals(propValue)) {
-            LOG.log(Level.CONFIG, "SETTING_PROPERTY", new Object[] {propName, propValue});
+            LOG.log(Level.FINE, "SETTING_PROPERTY", new Object[] {propName, propValue});
             getPluginProps().setProperty(propName, propValue);
         }
         if (LOG_LEVEL.equals(propName)) {
@@ -104,7 +105,7 @@
         try {
             url = createURL(spec, msg);
             url.openStream();
-            LOG.config("Validated url=" + url);
+            LOG.fine("Validated url=" + url);
         } catch (IOException ioe) {
             throw new ResourceAdapterInternalException(msg, ioe);
         }

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/JCABusFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/JCABusFactory.java?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/JCABusFactory.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/JCABusFactory.java Mon Oct  8 10:29:35 2007
@@ -21,55 +21,36 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
 import java.net.URL;
-import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
-import java.util.StringTokenizer;
+import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.resource.ResourceException;
-import javax.rmi.PortableRemoteObject;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxb.JAXBDataBinding;
-import org.apache.cxf.jaxws.JAXWSMethodInvoker;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException;
 import org.apache.cxf.jca.core.resourceadapter.UriHandlerInit;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.apache.cxf.jca.servant.EJBEndpoint;
+import org.apache.cxf.jca.servant.EJBServantConfig;
 
 
 public class JCABusFactory {
     
     private static final Logger LOG = LogUtils.getL7dLogger(JCABusFactory.class);
-
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JCABusFactory.class);
+    
     private Bus bus;
-    private BusFactory bf;
     private List<Server> servantsCache = new ArrayList<Server>();
-    private InitialContext jndiContext;
     private ClassLoader appserverClassLoader;
     private ManagedConnectionFactoryImpl mcf;
     private Object raBootstrapContext;
@@ -81,27 +62,16 @@
     protected String[] getBusArgs() throws ResourceException {
         //There is only setting up the BUSID        
         String busId = mcf.getConfigurationScope();
-        LOG.fine("BUSid=" + busId);
 
         String busArgs[] = new String[2];
         busArgs[0] = "-BUSid";
         busArgs[1] = busId;
         return busArgs;
-    }
-
-    protected Bus createCXFBus() throws ResourceException {
-        try {
-            bf = BusFactory.newInstance();
-            bus = bf.createBus();
-        } catch (Exception ex) {
-            throw new ResourceAdapterInternalException("Failed to initialize cxf runtime", ex);
-        }
-        return bus;
-    }    
+    }   
     
     protected synchronized void init() throws ResourceException {
-        LOG.info("Initializing the CXF Bus ...");
         
+        LOG.info("Initializing the CXF Bus ...");
         new UriHandlerInit();
         ClassLoader original = Thread.currentThread().getContextClassLoader();
         try {
@@ -112,15 +82,16 @@
             
             //TODO Check for the managed connection factory properties
             //TODO We may need get the configuration file from properties 
-            //mcf.validateProperties();     
-            bus = createCXFBus();
+            
+            BusFactory bf = BusFactory.newInstance();
+            bus = bf.createBus();
             initializeServants();
         } catch (Exception ex) {
             if (ex instanceof ResourceAdapterInternalException) {
                 throw (ResourceException)ex;
             } else {
-                ex.printStackTrace();
-                throw new ResourceAdapterInternalException("Failed to initialize connector runtime", ex);
+                throw new ResourceAdapterInternalException(
+                                  new Message("FAIL_TO_INITIALIZE_JCABUSFACTORY", BUNDLE).toString(), ex);
             }
         } finally {
             Thread.currentThread().setContextClassLoader(original);
@@ -128,211 +99,67 @@
     }
 
     
-    void initializeServants() throws ResourceException {
+    protected void initializeServants() throws ResourceException {
         if (isMonitorEJBServicePropertiesEnabled()) {            
-            LOG.info("ejb service properties update enabled. ");
+            LOG.info("Ejb service properties auto-detect enabled. ");
             startPropertiesMonitorThread();
         } else {            
             URL propsUrl = mcf.getEJBServicePropertiesURLInstance();
             if (propsUrl != null) {
-                initialiseServantsFromProperties(loadProperties(propsUrl), false);
+                initializeServantsFromProperties(loadProperties(propsUrl));
             }
         }
     }
     
-    void initialiseServantsFromProperties(Properties ejbServants, boolean abortOnFailure)
-        throws ResourceException {
-        // Props format: jndi name = service string
-        //
-        // java:/ejbs/A={http:/a/b/b}SoapService@http://localost:wsdls/a.wsdl
-
-        try {
-            jndiContext = new InitialContext();
-        } catch (NamingException ne) {
-            throw new ResourceAdapterInternalException(
-                      "Failed to construct InitialContext for EJBServant(s) jndi lookup, reason: "
-                       + ne, ne);
-        }
-
+    private void initializeServantsFromProperties(Properties ejbServants) throws ResourceException {
+        
         deregisterServants(bus);
-
-        LOG.info("Initializing EJB endpoints...");
-       
-        Enumeration keys = ejbServants.keys();
-
-        while (keys.hasMoreElements()) {
-            String jndiName = (String)keys.nextElement();
-            String serviceName = (String)ejbServants.getProperty(jndiName);
-            LOG.fine("Found ejb endpoint: jndi name=" + jndiName + ", wsdl service=" + serviceName);
-            
-            try {
-                initializeServant(jndiName, serviceName);      
-            } catch (ResourceException re) {
-                LOG.warning("Error initializing servant with jndi name " 
-                            + jndiName + " and service name "
-                            + serviceName + " Exception:"
-                            + re.getMessage());
-                if (abortOnFailure) {
-                    throw re;
-                }
-            }
-        }
-    }
-    
-    void initializeServant(String jndiName, String serviceName) throws ResourceException {
-
-        Server servant = null;
-        EJBObject ejb = null;
-        QName serviceQName = null;
-        String nameSpace = "";
-        String interfaceName = "";
-        String packageName = "";
-        Class interfaceClass = null;
-        ClassLoader ejbClassLoader = null;
-        ClassLoader currentThreadContextClassLoader = null;
-        try {
-            if ("".equals(serviceName)) {
-                throw new ResourceAdapterInternalException(
-                              "A WSDL service QName must be specified as the value of the EJB JNDI name key: "
-                              + jndiName);
-            } else {
-                serviceQName = serviceQNameFromString(serviceName);
-
-                serviceQNameFromString(serviceName);
-                
-                // Get ejbObject
-                ejb = getEJBObject(jndiName); 
-                ejbClassLoader = ejb.getClass().getClassLoader();
-
-                //NOTE we can use the ejbClassLoader to load WSDL
-                currentThreadContextClassLoader = Thread.currentThread().getContextClassLoader();
-                Thread.currentThread().setContextClassLoader(ejbClassLoader);
-                               
-                Thread.currentThread().setContextClassLoader(currentThreadContextClassLoader);
-
-                nameSpace = serviceQName.getNamespaceURI();
-                packageName = PackageUtils.parsePackageName(nameSpace, null);
-                
-                // Get interface of ejbObject
-                interfaceName = jndiName.substring(0, jndiName.length() - 4);
-                interfaceName = packageName + "." + interfaceName;
-
-                interfaceClass = Class.forName(interfaceName);
-                
-                // NOTE We can check the annoation to descide which kind of frontend we will use
-                // Almostly we just need to use the jax-ws frontend
-                // If we have wsdl , then wsdl first,
-                // else code first
+        LOG.info("Initializing EJB endpoints from properties file...");
+        
+        try {           
+            Enumeration keys = ejbServants.keys();
+            while (keys.hasMoreElements()) {
+                String theJNDIName = (String)keys.nextElement();
+                String value = (String)ejbServants.get(theJNDIName);
+                EJBServantConfig config = new EJBServantConfig(theJNDIName, value);
+                EJBEndpoint ejbEndpoint = new EJBEndpoint(config);
+                ejbEndpoint.setEjbServantBaseURL(mcf.getEJBServantBaseURL());
+                Server servant = ejbEndpoint.publish();
                 
-                servant = publishServantWithoutWSDL(ejb, jndiName, nameSpace, interfaceClass);
+                synchronized (servantsCache) {
+                    if (servant != null) {
+                        servantsCache.add(servant);
+                    }
+                }
             }
         } catch (Exception e) {
-            throw new ResourceAdapterInternalException(e.getMessage());
-        }
-        synchronized (servantsCache) {
-            if (servant != null) {
-                servantsCache.add(servant);
-            }
-        }
-    }
-    
-    public Server publishServantWithoutWSDL(EJBObject ejb, String jndiName,
-                                            String nameSpace, Class interfaceClass) 
-        throws Exception {
-
-        String hostName = "";
-        try {
-            InetAddress addr = InetAddress.getLocalHost();
-            //hostName = addr.getHostName();
-            hostName = addr.getCanonicalHostName();
-        } catch (UnknownHostException e) {
             e.printStackTrace();
+            throw new ResourceException(new Message("FAIL_TO_START_EJB_SERVANTS", BUNDLE).toString(), e);
         }
-        String address = "http://" + hostName + ":9999/" + jndiName;
-
-        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
-        Service service = createService(interfaceClass, bean);
-        
-        // REVISIT this is easy to be replace by EJBMethodInvoker
-        service.setInvoker(new JAXWSMethodInvoker(ejb));
-
-        ServerFactoryBean svrFactory = new ServerFactoryBean();
-
-        return createServer(svrFactory, bean, address);
-
         
     }
-
-    protected Service createService(Class interfaceClass, ReflectionServiceFactoryBean serviceFactory) 
-        throws JAXBException {
-        serviceFactory.setDataBinding(new JAXBDataBinding());
-        serviceFactory.setBus(bus);
-        serviceFactory.setServiceClass(interfaceClass);
-        
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("test", "test");
-        serviceFactory.setProperties(props);
-        
-        return serviceFactory.create();
-    }
     
-    protected Server createServer(ServerFactoryBean serverFactory, 
-                                  ReflectionServiceFactoryBean serviceFactory, 
-                                  String address) {
-        serverFactory.setAddress(address);
-        serverFactory.setTransportId("http://schemas.xmlsoap.org/soap/http");
-        serverFactory.setServiceFactory(serviceFactory);
-        serverFactory.setBus(bus);
-
-        return serverFactory.create();
-    }
-   
-    private EJBObject getEJBObject(String jndi) throws BusException {
-        try {
-            EJBHome home = getEJBHome(jndiContext, jndi);
-
-//      ejbHomeClassLoader = home.getClass().getClassLoader();
-
-            Method createMethod = home.getClass().getMethod("create", new Class[0]);
 
-            return (EJBObject) createMethod.invoke(home, new Object[0]);
-        } catch (NamingException e) {
-            throw new BusException(e);
-        } catch (NoSuchMethodException e) {
-            throw new BusException(e);
-        } catch (IllegalAccessException e) {
-            throw new BusException(e);
-        } catch (InvocationTargetException itex) {
-            Throwable thrownException = itex.getTargetException();
-            throw new BusException(thrownException);
-        }
-    }
-    
-    protected EJBHome getEJBHome(Context ejbContext, String jndiName) throws NamingException {
-        Object obj = ejbContext.lookup(jndiName);
-        return (EJBHome) PortableRemoteObject.narrow(obj, EJBHome.class);
-    }
-
-    void startPropertiesMonitorThread() throws ResourceException {
+    private void startPropertiesMonitorThread() throws ResourceException {
         Integer pollIntervalInteger = mcf.getEJBServicePropertiesPollInterval();
         int pollInterval = pollIntervalInteger.intValue();
-        LOG.info("ejb service properties poll interval is : " + pollInterval + " seconds");
+        
+        LOG.info("Ejb service properties poll interval is : [" + pollInterval + " seconds]");
+        
         EJBServicePropertiesMonitorRunnable r = new EJBServicePropertiesMonitorRunnable(pollInterval);
         Thread t = new Thread(r);
         t.setDaemon(true);
         t.start();
     }
 
-    boolean isMonitorEJBServicePropertiesEnabled() throws ResourceException {
+    private boolean isMonitorEJBServicePropertiesEnabled() throws ResourceException {
         boolean retVal = false;
 
         if (mcf.getMonitorEJBServiceProperties().booleanValue()) {
             URL url = mcf.getEJBServicePropertiesURLInstance();
             if (url == null) {
                 throw new ResourceAdapterInternalException(
-                           "MonitorEJBServiceProperties property is set to true,"
-                           + " but EJBServicePropertiesURL is not set. " 
-                           + "Both properties must be set to enable monitoring.");
+                                  new Message("EJB_SERVANT_PROPERTIES_IS_NULL", BUNDLE).toString());
             }
             retVal = isFileURL(url);
         }
@@ -344,20 +171,18 @@
         return url != null && "file".equals(url.getProtocol());
     }
 
-    protected void deregisterServants(Bus aBus) {
+    private void deregisterServants(Bus aBus) {
         synchronized (servantsCache) {
-            if (!servantsCache.isEmpty()) {
-                Iterator<Server> servants = servantsCache.iterator();
-                while (servants.hasNext()) {
-                    Server servant = servants.next();
-                    servant.stop();                    
-                }
-                servantsCache.clear();
+            for (Server servant : servantsCache) {
+                //REVISIT: seems using server.stop() doesn't release resource properly.
+                servant.stop();
+                LOG.info("Shutdown the EJB Endpoint: " + servant.getEndpoint().getEndpointInfo().getName());
             }
+            servantsCache.clear();
         }
     }
     
-    Properties loadProperties(URL propsUrl) throws ResourceException {
+    protected Properties loadProperties(URL propsUrl) throws ResourceException {
         Properties props = null;
         InputStream istream = null;
 
@@ -365,106 +190,22 @@
 
         try {
             istream = propsUrl.openStream();
-        } catch (IOException ioe) {
-            throw new ResourceAdapterInternalException("Failed to openStream to URL, value=" + propsUrl
-                                                       + ", reason:" + ioe, ioe);
-        }
-
-        try {
             props = new Properties();
             props.load(istream);
-        } catch (IOException ioe) {
-            props = null;
-            throw new ResourceAdapterInternalException("Failed to load properties from " + propsUrl, ioe);
-        } finally {
-            try {
-                istream.close();
-            } catch (IOException ignored) {
-                //do nothing here
-            }
-        }
-
-        return props;
-    }
-    
-    QName serviceQNameFromString(String qns) throws ResourceAdapterInternalException {
-        String lp = null;
-        String nameSpace = null;
-
-        // String re = "(\[(.*)\])?([^\@]+)(@?(.*))??";
-        // String[] qna = qns.split("(\[?+[^\]]*\])([^@])@?+(.*)");
-
-        try {
-            StringTokenizer st = new StringTokenizer(qns, "{},@", true);
-            while (st.hasMoreTokens()) {
-                String t = st.nextToken();
-                if ("{".equals(t)) {
-                    nameSpace = st.nextToken();
-                    st.nextToken();
-                    // consume '}'
-                } else if (",".equals(t)) {
-                    st.nextToken();
-                    // consume 'portName'
-                } else if ("@".equals(t)) {
-                    st.nextToken();
-                    // consume 'wsdlLoc'
-                } else {
-                    lp = t;
-                }
-            }
-        } catch (java.util.NoSuchElementException nsee) {
+        } catch (IOException e) {
             throw new ResourceAdapterInternalException(
-                       "Incomplete QName, string is not in expected format: "
-                       + "[{namespace}]local part[@ wsdl location url]. value:"
-                       + qns, nsee);
-        }
-        LOG.fine("QN=" + qns + ", ns=" + nameSpace + ", lp=" + lp);
-        return new QName(nameSpace, lp);
-    }
-    
-    String portNameFromString(String qns) throws ResourceAdapterInternalException {
-        String portName = null;
-        try {
-            StringTokenizer st = new StringTokenizer(qns, ",@", true);
-            while (st.hasMoreTokens()) {
-                String t = st.nextToken();
-                if (",".equals(t)) {
-                    if (portName != null) {
-                        throw new ResourceAdapterInternalException(
-                                   "portName already set, string is not in expected format:"
-                                   + " [{namespace}]serviceName[,portName][@ wsdl location url]. value:"
-                                   + qns);
-                    }
-
-                    portName = st.nextToken();
-
-                    if ("@".equals(portName)) {
-                        throw new ResourceAdapterInternalException(
-                                   "Empty portName, string is not in expected format: "
-                                   + "[{namespace}]serviceName[,portName][@ wsdl location url]. value:"
-                                   + qns);
-                    }
+                       new Message("FAIL_TO_LOAD_EJB_SERVANT_PROPERTIES", BUNDLE, propsUrl).toString(), e);
+        } finally {
+            if (istream != null) {
+                try {
+                    istream.close();
+                } catch (IOException e) {
+                    //DO Nothing
                 }
             }
-        } catch (java.util.NoSuchElementException nsee) {
-            throw new ResourceAdapterInternalException(
-                       "Incomplete QName, string is not in expected format: "
-                       + "[{namespace}]serviceName[,portName][@ wsdl location url]. value:"
-                       + qns, nsee);
         }
-        return portName;
-    }
 
-    String wsdlLocFromString(String qns) {
-        String wloc = null;
-        StringTokenizer st = new StringTokenizer(qns, "@", true);
-        while (st.hasMoreTokens()) {
-            String t = st.nextToken();
-            if ("@".equals(t)) {
-                wloc = st.nextToken();
-            }
-        }
-        return wloc;
+        return props;
     }
     
 
@@ -480,10 +221,6 @@
         this.appserverClassLoader = classLoader;
     }
 
-    public InitialContext getInitialContext() {
-        return jndiContext;
-    }
-
     public Object getBootstrapContext() {
         return raBootstrapContext;
     }
@@ -502,7 +239,7 @@
         init();
     }
     
-    class EJBServicePropertiesMonitorRunnable implements Runnable {
+    private class EJBServicePropertiesMonitorRunnable implements Runnable {
         private long previousModificationTime;
         private final int pollIntervalSeconds;
         private final File propsFile;
@@ -521,19 +258,18 @@
             do {
                 try {
                     if (isPropertiesFileModified()) {
-                        LOG.info("ejbServicePropertiesFile modified, initialising/updating servants");
-                        initialiseServantsFromProperties(loadProperties(propsFile.toURI().toURL()), false);
+                        LOG.info("ejbServicePropertiesFile modified, initializing/updating servants");
+                        initializeServantsFromProperties(loadProperties(propsFile.toURI().toURL()));
                     }
                     Thread.sleep(pollIntervalSeconds * 1000);
                 } catch (Exception e) {
                     LOG.info("MonitorThread: failed to initialiseServantsFromProperties "
-                              + "with properties absolute path="
-                              + propsFile.getAbsolutePath() + ", reason: " + e.toString());
+                              + "with properties absolute path=" + propsFile.getAbsolutePath());
                 }
             } while (continuing);
         }
 
-        protected boolean isPropertiesFileModified() throws ResourceException {
+        protected boolean isPropertiesFileModified() {
             boolean fileModified = false;
             if (propsFile.exists()) {
                 long currentModificationTime = propsFile.lastModified();
@@ -550,6 +286,8 @@
     protected void setBootstrapContext(Object ctx) {
         raBootstrapContext = ctx;
     }
+    
+    
 
     
 }

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java Mon Oct  8 10:29:35 2007
@@ -20,6 +20,7 @@
 
 import java.net.URL;
 import java.util.Properties;
+import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
 import javax.resource.ResourceException;
@@ -30,6 +31,8 @@
 
 import org.apache.cxf.Bus;
 //import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionFactoryImpl;
 import org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionImpl;
@@ -40,6 +43,8 @@
     implements CXFManagedConnectionFactory {
 
     private static final Logger LOG = LogUtils.getL7dLogger(ManagedConnectionFactoryImpl.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ManagedConnectionFactoryImpl.class);
+    
     protected JCABusFactory jcaBusFactory;
 
     public ManagedConnectionFactoryImpl() {
@@ -104,6 +109,14 @@
     public URL getEJBServicePropertiesURLInstance() throws ResourceException {
         return getPropsURL(getEJBServicePropertiesURL());
     }
+    
+    public String getEJBServantBaseURL() throws ResourceException {
+        return getPluginProps().getProperty(EJB_SERVANT_BASE_URL);
+    }
+    
+    public void setEJBServantBaseURL(String url) throws ResourceException {
+        setProperty(EJB_SERVANT_BASE_URL, url);
+    }
 
     // compliance: WL9 checks
     // need to ensure multiple instances with same config properties are equal
@@ -114,15 +127,15 @@
     }
 
     public Object createConnectionFactory() throws ResourceException {
-        throw new ResourceAdapterInternalException("Non-Managed usage is not supported, "
-                        + "use createConnectionFactory with a ConnectionManager argument");
+        throw new ResourceAdapterInternalException(
+                           new Message("NON_MANAGED_CONNECTION_IS_NOT_SUPPORTED", BUNDLE).toString());
     }
 
     public Object createConnectionFactory(ConnectionManager connMgr) throws ResourceException {
         LOG.info("connManager=" + connMgr);
         if (connMgr == null) {
-            throw new ResourceAdapterInternalException("Non-Managed usage is not supported, " 
-                        + "the ConnectionManager argument can not be null");
+            throw new ResourceAdapterInternalException(
+                            new Message("NON_MANAGED_CONNECTION_IS_NOT_SUPPORTED", BUNDLE).toString());
         }
         init(connMgr.getClass().getClassLoader());
         LOG.fine("Setting AppServer classloader in jcaBusFactory. " + connMgr.getClass().getClassLoader());

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties Mon Oct  8 10:29:35 2007
@@ -22,3 +22,8 @@
 IS_NOT_AN_INTERFACE = The [{0}] is not an interface.
 FAILED_TO_GET_CXF_CONNECTION = Failed to get the CXF Connection with connection parameters: {0}
 ASSOCIATED_ERROR = Error in associating connection.
+FAIL_TO_LOAD_EJB_SERVANT_PROPERTIES = Failed to load EJBServant properties file: {0}
+FAIL_TO_START_EJB_SERVANTS = Failed to start ejb servants.
+EJB_SERVANT_PROPERTIES_IS_NULL = MonitorEJBServiceProperties property is set to true, but EJBServicePropertiesURL is not set, Both properties must be set to enable monitoring.
+FAIL_TO_INITIALIZE_JCABUSFACTORY = Failed to initialize JCABusFactory.
+NON_MANAGED_CONNECTION_IS_NOT_SUPPORTED = Non Managed Connection is not supported, use createConnectionFactory with a ConnectionManager argument.
\ No newline at end of file

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/rar/META-INF/ra.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/rar/META-INF/ra.xml?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/rar/META-INF/ra.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/main/rar/META-INF/ra.xml Mon Oct  8 10:29:35 2007
@@ -68,6 +68,11 @@
           <config-property-type>java.lang.Integer</config-property-type>
           <config-property-value>30</config-property-value>
         </config-property>
+        <config-property>
+          <config-property-name>EJBServantBaseURL</config-property-name>
+          <config-property-type>java.lang.String</config-property-type>
+          <config-property-value>http://localhost:9999</config-property-value>
+        </config-property>
         <connectionfactory-interface>org.apache.cxf.connector.CXFConnectionFactory</connectionfactory-interface>
         <connectionfactory-impl-class>org.apache.cxf.jca.cxf.ConnectionFactoryImpl</connectionfactory-impl-class>
         <connection-interface>org.apache.cxf.connector.Connection</connection-interface>

Modified: incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java?rev=582901&r1=582900&r2=582901&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java Mon Oct  8 10:29:35 2007
@@ -21,38 +21,15 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
-//import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Properties;
-// import java.util.ResourceBundle;
 
 import javax.resource.ResourceException;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
-// import org.apache.cxf.BusException;
-// import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.binding.soap.SoapBindingFactory;
-import org.apache.cxf.binding.soap.SoapTransportFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxws.JAXWSMethodInvoker;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.test.AbstractCXFTest;
-import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.transport.local.LocalTransportFactory;
-import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.cxf.wsdl11.WSDLManagerImpl;
-// import org.apache.cxf.jca.cxf.test.DummyBus;
 import org.easymock.classextension.EasyMock;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class JCABusFactoryTest extends AbstractCXFTest {
@@ -81,199 +58,6 @@
     }
 
 
-//     public void testBusInitGetProps() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-       
-//         assertEquals("bus not yet initialized", DummyBus.getInitializeCount(), 0);
-
-        
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         jcaBusFactory.create(null, null);
-
-//         assertEquals("bus initialized ", DummyBus.getInitializeCount(), 1);
-       
-//     }
-
-//     public void testInitBusThrowsException() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         final Exception thrown = new BusException(new Message("tested bus exception!", 
-//                                                               (ResourceBundle)null, new Object[]{}));
-
-//         ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
-//         try {
-//             ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-           
-//             JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-//             // do this for MockObject creation
-//             Thread.currentThread().setContextClassLoader(jcaBusFactory.getClass().getClassLoader());
-//             // DummyBus.setThrowException(true);
-            
-                       
-//             try {
-//                 jcaBusFactory.create(null, null);
-//                 fail("did not get expected resource exception");
-//             } catch (ResourceException re) {
-//                 System.out.println("*************************");
-//                 System.out.println(" exception: " + re.getMessage());
-//                 System.out.println("*************************");
-//                 assertTrue("cause is set", re.getCause() != null);
-//                 assertEquals("cause is expected type", thrown.getClass(), re.getCause().getClass());
-//             }
-
-//             assertEquals("init was called once", 1, DummyBus.getInitializeCount());
-
-//         } finally {
-//             Thread.currentThread().setContextClassLoader(originalCl);
-//         }
-//     }
-
-//     public void testInitBusSetsThreadContextClassLoader() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
-//         try {
-//             ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-          
-//             JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-//             // do this for MockObject creation
-//             Thread.currentThread().setContextClassLoader(jcaBusFactory.getClass().getClassLoader());
-
-//             Class dummyBusClass = Class.forName(DummyBus.class.getName(), true, jcaBusFactory.getClass()
-//                 .getClassLoader());
-//             // initialise here while thread context classloader is correct
-//             dummyBusClass.newInstance();
-
-//             jcaBusFactory.create(null, null);
-
-         
-//             assertEquals("init was called once", 1, DummyBus.getInitializeCount());
-//             assertTrue("loader is correct in init", DummyBus.isCorrectThreadContextClassLoader());
-
-//         } finally {
-//             Thread.currentThread().setContextClassLoader(originalCl);
-//         }
-//     }
-
-    // service strings to qname localparts
-   
-
-    @Test
-    public void testValidQNameFromString() throws Exception {
-        final Object[][] ejbServantServicePorpsTestStrings =
-            new Object[][] {{"serviceName", new QName("serviceName")},
-                            {"a/b", new QName("a/b")},
-                            {"{http://somenamespace}serviceName,portName",
-                                new QName("http://somenamespace", "serviceName")},
-                            {"{http://addd}n,portName@http://a",
-                                new QName("http://addd", "n")},
-                            {"{http://somenamespace}serviceName@file:/a/b/wsdl.wsdl",
-                                new QName("http://somenamespace", "serviceName")},
-                            {"{http://somenamespace}serviceName@http://a?param=1",
-                                new QName("http://somenamespace", "serviceName")}};
-        
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePorpsTestStrings.length; i++) {
-            String val = (String)ejbServantServicePorpsTestStrings[i][0];
-            QName expected = (QName)ejbServantServicePorpsTestStrings[i][1];
-
-            assertEquals("correct qname from mapping for " + val, expected, jcaBusFactory
-                .serviceQNameFromString(val));
-        }
-    }
-
-    @Test
-    public void testInvalidQNameFromString() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        try {
-            jcaBusFactory.serviceQNameFromString("a@");
-            fail("expecte ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue(expected.getCause() instanceof java.util.NoSuchElementException);
-        }
-    }
-
-    
-
-    @Test
-    public void testWsdlLocFromString() throws Exception {
-        //service strings to wsdl urls
-        final String[][] ejbServantServicePropsTestStringsWsdlLoc = 
-            new String[][] {{"serviceName", null},
-                            {"a/b", null},
-                            {"{http://somenamespace}serviceName", null},
-                            {"{http://somenamespace}serviceName,portName@file:/a/b/wsdl.wsdl", 
-                                "file:/a/b/wsdl.wsdl"},
-                            {"{http://somenamespace}serviceName,portName@http://a?param=1",
-                                "http://a?param=1"}};
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePropsTestStringsWsdlLoc.length; i++) {
-            String val = ejbServantServicePropsTestStringsWsdlLoc[i][0];
-            String expectedUrl = ejbServantServicePropsTestStringsWsdlLoc[i][1];
-
-            assertEquals("correct wsdlLocation from mapping for " + val, expectedUrl, jcaBusFactory
-                .wsdlLocFromString(val));
-        }
-    }
-
-    
-    @Test
-    public void testPortNameFromString() throws Exception {
-        //service strings to portName
-        final String[][] ejbServantServicePropsTestStringsPortName = 
-            new String[][] {{"serviceName", null},
-                            {"a/b", null},
-                            {"{http://somenamespace}serviceName", null},
-                            {"{http://somenamespace}serviceName,portName1@file:/a/b/wsdl.wsdl",
-                                "portName1"},
-                            {"{http://somenamespace}serviceName,portName2@http://a?param=1", 
-                                "portName2"}};
-
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePropsTestStringsPortName.length; i++) {
-            String val = ejbServantServicePropsTestStringsPortName[i][0];
-            String expectedUrl = ejbServantServicePropsTestStringsPortName[i][1];
-
-            assertEquals("correct wsdlLocation from mapping for " + val, expectedUrl, jcaBusFactory
-                .portNameFromString(val));
-        }
-    }
-
-    @Test
-    public void testInvalidPortNameFromString() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        try {
-            jcaBusFactory.portNameFromString("serviceName,");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue(expected.getCause() instanceof java.util.NoSuchElementException);
-        }
-
-        try {
-            jcaBusFactory.portNameFromString("serviceName,@abc");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue("Exception message starts with Empty portName", expected.getMessage()
-                .startsWith("Empty portName"));
-        }
-
-        try {
-            jcaBusFactory.portNameFromString("serviceName,abc,uuu");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue("Exception message starts with portName already set", expected.getMessage()
-                .startsWith("portName already set"));
-        }
-    }
 
     @Test
     public void testLoadNonexistentProperties() throws Exception {
@@ -287,7 +71,8 @@
                        re.getCause() instanceof FileNotFoundException);
         }
     }
-
+    
+    @Test
     public void testInvalidMonitorConfigNoPropsURL() throws Exception {
         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
         mcf.setMonitorEJBServiceProperties(Boolean.TRUE);
@@ -303,7 +88,7 @@
         }
     }
     
-    
+    @Ignore
     @Test
     public void testInitServants() throws Exception {
         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
@@ -318,278 +103,6 @@
         
     }
     
-    @Test
-    public void testCreateService() throws Exception {
-        Bus springBus = new SpringBusFactory().createBus();
-        
-        JCABusFactory jcaBusFactory = new JCABusFactory(null);
-        jcaBusFactory.setBus(springBus);
-        
-        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
-        Service service = jcaBusFactory.createService(HelloInterface.class, bean);
-        assertEquals("test", service.get("test"));
-    }
-
-    @Test
-    public void testCreateServer() throws Exception {
-        //Bus springBus = new SpringBusFactory().createBus();
-        
-        SoapBindingFactory bindingFactory = new SoapBindingFactory();
-
-        bus.getExtension(BindingFactoryManager.class)
-            .registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
-
-        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
-
-        SoapTransportFactory soapDF = new SoapTransportFactory();
-        soapDF.setBus(bus);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
-        
-        LocalTransportFactory localTransport = new LocalTransportFactory();
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
-        dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
-
-        ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
-        extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/", localTransport);
-        
-        bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
-
-        
-        JCABusFactory jcaBusFactory = new JCABusFactory(null);
-        jcaBusFactory.setBus(bus);
-        
-        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
-        Service service = jcaBusFactory.createService(HelloInterface.class, bean);
-        assertEquals("test", service.get("test"));
-        
-        Imple im = new Imple();
-        
-        service.setInvoker(new JAXWSMethodInvoker(im));
-
-        ServerFactoryBean svrFactory = new ServerFactoryBean();
-
-        String address = "http://localhost:9999/Hello";
-        Server server = jcaBusFactory.createServer(svrFactory, bean, address);
-        assertNotNull("The server should not be null", server);
-        
-        Node res = invoke("http://localhost:9999/Hello", 
-                          LocalTransportFactory.TRANSPORT_ID,
-                          "sayHi.xml");
-        assertNotNull("We should get the result ", res);
-    }
-  
-    /*
-    public void testAddServantsCache() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        ClassLoader cl = this.getClass().getClassLoader();
-        Bus bus = jcaBusFactory.initBus(cl);
-
-        Properties props = new Properties();
-        String wsdlLocation =
-            this.getClass().getResource("resources/hello_world.wsdl").toString();
-
-        System.out.println("  in test wsdlLocation: " + wsdlLocation);
-        props.put("jndiName", "{http://apache.org/hello_world_soap_http}SOAPService@"
-                  + wsdlLocation);
-
-        assertTrue("there's no registered servants at beginning", jcaBusFactory.getRegisteredServants()
-            .isEmpty());
-        jcaBusFactory.setBus(bus);
-        jcaBusFactory.initialiseServantsFromProperties(props, true);
-       
-        javax.xml.ws.Endpoint ep = (javax.xml.ws.Endpoint) jcaBusFactory.getRegisteredServants().get(0);
-              
-        assertTrue("registered servant with the expected service name", ((javax.xml.ws.Endpoint)jcaBusFactory
-            .getRegisteredServants().get(0)).isPublished());
-        ep.stop();
-        jcaBusFactory.deregisterServants(bus);
-
-        assertTrue("servants should be deregistered", jcaBusFactory.getRegisteredServants().isEmpty());
-        bus.shutdown(true);
-    }
-    
-    */
-//     public void testInitServantsFromPropertiesWithPortName() throws Exception {
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         Bus mockBus = EasyMock.createMock(Bus.class);
-//         jcaBusFactory.setBus(mockBus);
-//         Properties props = new Properties();
-//         props.put("jndiName", "{http://objectweb.org/hello_world_soap_http}SOAPService,SoapPort@file:///");
-//         try {
-//             jcaBusFactory.initialiseServantsFromProperties(props, true);
-//         } catch (ResourceException expected) {
-//             assertTrue("reasonable message", expected.toString().indexOf("jndiName") != -1);
-//             assertTrue(expected instanceof ResourceAdapterInternalException);            
-//         }
-//     }
-
-//     public void testInitServantsFromPropertiesWithMissingWsdlLocInPropertiesAndConfig() throws Exception {
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         Bus mockBus = EasyMock.createMock(Bus.class);
-//         jcaBusFactory.setBus(mockBus);
-//         final String jndiName = "/a/b";
-//         try {
-//             Properties props = new Properties();
-//             props.put(jndiName, "{http://ns}ServiceA");
-//             jcaBusFactory.initialiseServantsFromProperties(props, true);
-//             fail("expect ex on missing wsdl loc");
-//         } catch (ResourceException expected) {
-//             assertTrue("reasonable message", expected.toString().indexOf(jndiName) != -1);
-//             assertTrue(expected instanceof ResourceAdapterInternalException);
-//             assertTrue(expected.getMessage().indexOf("ServiceA") != -1);
-//         }
-//     }
-     
-    @Test
-    public void testInitServantsFromPropertiesWithNoServiceQName() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus(mockBus);
-        final String jndiName = "/a/b";
-        try {
-            Properties props = new Properties();
-            props.put(jndiName, "");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-            fail("expect ex on missing service QName value");
-        } catch (ResourceException expected) {
-            assertTrue("reasonable message", expected.toString().indexOf(jndiName) != -1);
-        }
-    }
-
-/*  so far doesn't support wsdl file  
-    public void testInitFromPropsWithInvalidWsdlLocUrls() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-      
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@unknownprotocol:/a");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-            fail("expect ex on unknown protocol");
-        } catch (ResourceException expected) {
-            assertTrue("have a jcaBusFactorye " + expected.getCause(),
-                       expected.getCause() instanceof MalformedURLException);
-        }
-
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@a/b");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-
-            fail("expect ex on invalid format, no scheme");
-        } catch (ResourceException expected) {
-            assertTrue("have a mue " + expected.getCause(),
-                       expected.getCause() instanceof MalformedURLException);
-        }
-
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@http://nowhere.plannetx.cupoftea:9090/NoWhere");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-
-            fail("expect ex on invalid url, dud host name");
-        } catch (ResourceException expected) {
-            // resolving the URL above results in an IOException which
-            // may be UnknowHostException or something different
-            // depending on the platoform
-            assertTrue("unexpected exception received: " + expected.getCause(),
-                       expected.getCause() instanceof java.io.IOException);       
-
-        }
-          
-    }
-*/
-    
-    @Test
-    public void testInitFromPropsDoesNotThrowExceptionWhenSomethingGoesWrong() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus(mockBus);
-        Properties props = new Properties();
-        props.put("/a/b", "{http://ns}ServiceA@unknownprotocol:/a");
-        
-        jcaBusFactory.initialiseServantsFromProperties(props, false);
-           
-    }
-
-    /*
-    public void testPropertiesMonitorThreadCausesSomeFailures() throws Exception {
-        FileChannel in = null;
-        FileChannel out = null;
-        URL propFile = getClass().getResource("resources/ejb_servants_one_wrong.properties");
-        
-        File origFile = new File(propFile.toString().substring(5));
-        File tmpFile = File.createTempFile("anyname", "properties");
-        File tmpDir = tmpFile.getParentFile();
-
-        File testFile = new File(tmpDir, "otherunittest.properties");
-        if (testFile.exists()) {
-            testFile.delete();
-        }
-        assertTrue("file: " + testFile.getAbsolutePath() + " does not exist", !(testFile.exists()));
-
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        mcf.setEJBServicePropertiesURL(testFile.toURI().toURL().toString());
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus((Bus)mockBus);
-
-        JCABusFactory.EJBServicePropertiesMonitorRunnable propsRunnable =
-            jcaBusFactory.new EJBServicePropertiesMonitorRunnable(5);
-        propsRunnable.setContinue(false);        
-        propsRunnable.run();
-        //do nothing here 
-        
-        testFile.createNewFile();
-        assertTrue("file exist", testFile.exists());
-        try {
-            in = new FileInputStream(origFile).getChannel();            
-            out = new FileOutputStream(testFile).getChannel();
-            long size = in.size();
-            MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);            
-            out.write(buf);
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-
-            if (out != null) {
-                out.close();
-            }
-        }
-
-        propsRunnable.run();
-        testFile.delete();
-        
-    }
-    
-    public void testInitServantsWithBootstrapContextNotNull() throws Exception {
-        System.setProperty("test.bus.class", DummyBus.class.getName());
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        mcf.setCXFInstallDir(DummyBus.vobRoot());
-        mcf.setCXFCEURL(DummyBus.CXFCEURL);
-
-        assertEquals("bus not yet initialized", DummyBus.initializeCount, 0);
-
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        BootstrapContext bc = (BootstrapContext)MockObjectFactory.create(BootstrapContext.class);
-        assertNotNull("BootstrapContext is not null", bc);
-        jcaBusFactory.create(null, bc);
-        assertEquals("BoostrapContext set", jcaBusFactory.getBootstrapContext(), bc);
-        assertEquals("bus initialized ", DummyBus.initializeCount, 1);
-    }
-*/
    
 }