[jbossws-commits] JBossWS SVN: r17069 - in common/trunk/src/main/java/org/jboss/ws/common: management and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Dec 13 10:13:24 EST 2012


Author: alessio.soldano at jboss.com
Date: 2012-12-13 10:13:24 -0500 (Thu, 13 Dec 2012)
New Revision: 17069

Modified:
   common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
   common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
   common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3576] Centralize ServerConfig retrieval into AbstractServerConfig


Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java	2012-12-11 18:24:53 UTC (rev 17068)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java	2012-12-13 15:13:24 UTC (rev 17069)
@@ -33,14 +33,12 @@
 import org.jboss.ws.api.annotation.WebContext;
 import org.jboss.ws.common.Messages;
 import org.jboss.ws.common.integration.AbstractDeploymentAspect;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.ws.common.management.AbstractServerConfig;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.deployment.HttpEndpoint;
 import org.jboss.wsf.spi.deployment.Service;
 import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
 import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
@@ -52,6 +50,7 @@
  * A deployer that assigns the endpoint address. 
  *
  * @author Thomas.Diesler at jboss.org
+ * @author alessio.soldano at jboss.com
  * @since 19-May-2007
  */
 public class EndpointAddressDeploymentAspect extends AbstractDeploymentAspect
@@ -64,21 +63,10 @@
       if (contextRoot == null)
          throw Messages.MESSAGES.cannotObtainContextRoot(dep.getSimpleName());
       
-      // TODO: remove this hack - review API
-      String protocol = (String)service.getProperty("protocol");
-      String host = (String)service.getProperty("host");
-      
       PortValue port = new PortValue((Integer)service.getProperty("port"), null);
-      
-      if (protocol == null)
-      {
-         SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
-         ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
-         ServerConfig serverConfig = spi.getServerConfig();
-
-         host = serverConfig.getWebServiceHost();
-         port.setServerConfig(serverConfig);
-      }
+      ServerConfig serverConfig = AbstractServerConfig.getServerIntegrationServerConfig();
+      port.setServerConfig(serverConfig);
+      String host = serverConfig.getWebServiceHost();
       Map<String, Endpoint> endpointsMap = new HashMap<String, Endpoint>();
       List<Endpoint> deleteList = new LinkedList<Endpoint>();
       for (Endpoint ep : service.getEndpoints())
@@ -97,7 +85,7 @@
             if (urlPattern.endsWith("/*"))
                urlPattern = urlPattern.substring(0, urlPattern.length() - 2);
    
-            protocol = confidential ? "https://" : "http://";
+            String protocol = confidential ? "https://" : "http://";
             String address = protocol + hostAndPort + (contextRoot.equals("/") && urlPattern.startsWith("/") ? "" : contextRoot) + urlPattern;
             httpEp.setAddress(address);
             //JBWS-2957: EJB3 binds the same endpoint class to multiple beans at multiple JNDI locations;

Modified: common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java	2012-12-11 18:24:53 UTC (rev 17068)
+++ common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java	2012-12-13 15:13:24 UTC (rev 17069)
@@ -39,6 +39,7 @@
 import org.jboss.wsf.spi.WSFException;
 import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
 import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
 import org.jboss.wsf.spi.management.StackConfig;
 import org.jboss.wsf.spi.management.StackConfigFactory;
 import org.jboss.wsf.spi.management.WebServerInfo;
@@ -78,6 +79,9 @@
    private final List<ClientConfig> clientConfigs = Collections.synchronizedList(new ArrayList<ClientConfig>(2));
    // The default endpoint configs, if any
    private final List<EndpointConfig> endpointConfigs = Collections.synchronizedList(new ArrayList<EndpointConfig>(3));
+   
+   // The server integration classloader' ServerConfig instance reference
+   private static ServerConfig serverConfig;
 
    public MBeanServer getMbeanServer()
    {
@@ -215,6 +219,17 @@
       }
    }
    
+   public static synchronized ServerConfig getServerIntegrationServerConfig()
+   {
+       if (serverConfig == null)
+       {
+           final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+           SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+           serverConfig = spiProvider.getSPI(ServerConfigFactory.class, cl).getServerConfig();
+       }
+       return serverConfig;
+   }
+   
    public String getImplementationTitle()
    {
       return stackConfig.getImplementationTitle();

Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java	2012-12-11 18:24:53 UTC (rev 17068)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java	2012-12-13 15:13:24 UTC (rev 17069)
@@ -21,7 +21,7 @@
  */
 package org.jboss.ws.common.utils;
 
-import static org.jboss.ws.common.Loggers.DEPLOYMENT_LOGGER;;
+import static org.jboss.ws.common.Loggers.DEPLOYMENT_LOGGER;
 import static org.jboss.ws.common.Messages.MESSAGES;
 import static org.jboss.ws.common.integration.WSHelper.isJseDeployment;
 import static org.jboss.ws.common.integration.WSHelper.isWarArchive;
@@ -45,11 +45,9 @@
 
 import org.jboss.ws.common.DOMUtils;
 import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.ws.common.management.AbstractServerConfig;
 import org.jboss.wsf.spi.deployment.ArchiveDeployment;
 import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
 import org.w3c.dom.Element;
 
 /**
@@ -77,8 +75,7 @@
       serverConfig = dep.getAttachment(ServerConfig.class);
       if (serverConfig == null)
       {
-         SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-         serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+         serverConfig = AbstractServerConfig.getServerIntegrationServerConfig();
       }
       
       if (isJseDeployment(dep) || isWarArchive(dep))



More information about the jbossws-commits mailing list