Author: objectiser
Date: 2011-01-10 10:40:23 -0500 (Mon, 10 Jan 2011)
New Revision: 1227
Added:
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigFactory.java
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfig.java
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigFactory.java
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigImpl.java
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigFactory.java
Removed:
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java
dsp/trunk/api/src/main/java/org/jboss/soa/dwsp/
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigImpl.java
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigLocator.java
Modified:
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfig.java
dsp/trunk/jboss/src/main/resources/META-INF/jboss-beans.xml
dsp/trunk/samples/example-deployer/deployer/resources/WEB-INF/classes/dsp.properties
dsp/trunk/samples/example-deployer/deployer/src/org/jboss/soa/dsp/example/WSDeployer.java
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java
Log:
Refactored dsp to simplify the server config API and use consistent property/class naming
across tomcat and jboss environments.
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfig.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfig.java 2011-01-10
01:13:01 UTC (rev 1226)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfig.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -19,29 +19,26 @@
import java.io.File;
/**
- * Interface to container independent config
+ * Interface to server independent config.
*
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
*/
-public interface ServerConfig
-{
- String getImplementationTitle();
+public interface ServerConfig {
+
+ /**
+ * This method returns the server's temp directory. This directory
+ * will be used to create the deployable archive before actual
+ * deployment.
+ *
+ * @return The temp directory
+ */
+ public File getServerTempDir();
- String getImplementationVersion();
-
- File getServerTempDir();
-
- File getServerDataDir();
-
- String getWebServiceHost();
-
- int getWebServicePort();
-
- int getWebServiceSecurePort();
-
- String getClusterNodeName();
-
- String getUddiNodeName();
-
+ /**
+ * This method returns the directory where the deployable archive
+ * should be placed.
+ *
+ * @return The deployment directory
+ */
+ public File getServerDeployDir();
+
}
\ No newline at end of file
Copied: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigFactory.java
(from rev 1176,
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java)
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigFactory.java
(rev 0)
+++
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigFactory.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Red Hat, Inc
+ *
+ * Licensed 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.jboss.soa.dsp.server;
+
+import org.jboss.soa.dsp.server.ServerConfig;
+
+/**
+ * Factory used to return an instance of the server configuration.
+ *
+ */
+public interface ServerConfigFactory {
+
+ /**
+ * This method returns an instance of the server configuration.
+ *
+ * @return The service configuration
+ */
+ public ServerConfig getServerConfig();
+
+}
\ No newline at end of file
Deleted: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java
===================================================================
---
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc
- *
- * Licensed 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.jboss.soa.dsp.server;
-
-import org.jboss.soa.dsp.server.ServerConfig;
-
-/**
- * Factory used to return an instance of the server configuration.
- *
- */
-public interface ServerConfigLocator {
-
- /**
- * This method returns an instance of the server configuration.
- *
- * @return The service configuration
- */
- public ServerConfig getServerConfig();
-
-}
\ No newline at end of file
Added:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfig.java
===================================================================
--- dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfig.java
(rev 0)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfig.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.soa.dsp.server.jboss;
+
+import java.io.File;
+
+import org.jboss.soa.dsp.server.ServerConfig;
+
+public interface JBossServerConfig extends ServerConfig {
+
+ String getImplementationTitle();
+
+ String getImplementationVersion();
+
+ File getServerDataDir();
+
+ String getWebServiceHost();
+
+ int getWebServicePort();
+
+ int getWebServiceSecurePort();
+
+ String getClusterNodeName();
+
+ String getUddiNodeName();
+
+}
Copied:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigFactory.java
(from rev 1176,
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java)
===================================================================
---
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigFactory.java
(rev 0)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigFactory.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010 Red Hat, Inc
+ *
+ * Licensed 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.jboss.soa.dsp.server.jboss;
+
+import org.jboss.soa.dsp.server.ServerConfig;
+
+
+/**
+ * Factory to container independent config
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Heiko.Braun(a)jboss.com
+ *
+ * @since 08-May-2006
+ */
+public class JBossServerConfigFactory implements
org.jboss.soa.dsp.server.ServerConfigFactory
+{
+ /** The default bean name */
+ public static String BEAN_NAME = "org.jboss.soa.dsp:service=ServerConfig";
+
+ public static JBossServerConfig createServerConfig()
+ {
+ return new KernelAwareSPIFactory().getKernelProvidedSPI(
+ BEAN_NAME, JBossServerConfig.class
+ );
+ }
+
+ public ServerConfig getServerConfig() {
+ return(createServerConfig());
+ }
+}
\ No newline at end of file
Copied:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigImpl.java
(from rev 1151,
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigImpl.java)
===================================================================
---
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigImpl.java
(rev 0)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/JBossServerConfigImpl.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2010 Red Hat, Inc
+ *
+ * Licensed 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.jboss.soa.dsp.server.jboss;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.soa.dsp.server.ServerConfig;
+import org.jboss.util.id.GUID;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.io.File;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Set;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBossServerConfigImpl implements JBossServerConfig
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ // The MBeanServer
+ private MBeanServer mbeanServer;
+
+ private final static String UNDEFINED_HOSTNAME = "undefined.host";
+
+ // The webservice host name that will be used when updating the wsdl
+ private String webServiceHost = UNDEFINED_HOSTNAME;
+ // The webservice port that will be used when updating the wsdl
+ private int webServicePort;
+ // The webservice port that will be used when updating the wsdl
+ private int webServiceSecurePort;
+
+ private static String nonClusteredServerName=new GUID().toString();
+
+ private String clusterNodeName;
+
+ public JBossServerConfigImpl()
+ {
+ }
+
+ public MBeanServer getMbeanServer()
+ {
+ return mbeanServer;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public String getImplementationTitle()
+ {
+ return "jbossas-riftsaw";
+ }
+
+ public String getImplementationVersion()
+ {
+ return "5.x";
+ }
+
+ public File getServerTempDir()
+ {
+ try
+ {
+ ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ File dir = (File)getMbeanServer().getAttribute(oname, "ServerTempDir");
+ return dir;
+ }
+ catch (JMException e)
+ {
+ return null;
+ }
+ }
+
+ public File getHomeDir()
+ {
+ try
+ {
+ ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ File dir = (File)getMbeanServer().getAttribute(oname, "HomeDir");
+ return dir;
+ }
+ catch (JMException e)
+ {
+ return null;
+ }
+ }
+
+ public File getServerDataDir()
+ {
+ try
+ {
+ ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ File dir = (File)getMbeanServer().getAttribute(oname, "ServerDataDir");
+ return dir;
+ }
+ catch (JMException e)
+ {
+ return null;
+ }
+ }
+
+ public File getServerDeployDir() {
+ return(getServerDataDir());
+ }
+
+ public String getWebServiceHost()
+ {
+ return webServiceHost;
+ }
+
+ public void setWebServiceHost(String host) throws UnknownHostException
+ {
+ if (host == null || host.trim().length() == 0)
+ {
+ log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
+ host = UNDEFINED_HOSTNAME;
+ }
+ if ("0.0.0.0".equals(host))
+ {
+ InetAddress localHost = InetAddress.getLocalHost();
+ log.debug("Using local host: " + localHost.getHostName());
+ host = localHost.getHostName();
+ }
+ this.webServiceHost = host;
+ }
+
+ public void setWebServicePort(int port)
+ {
+ this.webServicePort = port;
+ }
+
+ public void setWebServiceSecurePort(int port)
+ {
+ this.webServiceSecurePort = port;
+ }
+
+ public int getWebServicePort()
+ {
+ if (webServicePort <= 0)
+ webServicePort = getConnectorPort("HTTP/1.1", false);
+
+ int localPort = webServicePort;
+ if (localPort <= 0)
+ {
+ // Do not initialize webServicePort with the default, the connector port may become
available later
+ log.warn("Unable to calculate 'WebServicePort', using default
'8080'");
+ localPort = 8080;
+ }
+
+ return localPort;
+ }
+
+
+ public int getWebServiceSecurePort()
+ {
+ if (webServiceSecurePort <= 0)
+ webServiceSecurePort = getConnectorPort("HTTP/1.1", true);
+
+ int localPort = webServiceSecurePort;
+ if (localPort <= 0)
+ {
+ // Do not initialize webServiceSecurePort with the default, the connector port may
become available later
+ log.warn("Unable to calculate 'WebServiceSecurePort', using default
'8443'");
+ localPort = 8443;
+ }
+
+ return localPort;
+ }
+
+ private int getConnectorPort(final String protocol, final boolean secure)
+ {
+ int port = -1;
+
+ try
+ {
+ ObjectName connectors = new ObjectName("jboss.web:type=Connector,*");
+
+ Set connectorNames = getMbeanServer().queryNames(connectors, null);
+ for (Object current : connectorNames)
+ {
+ ObjectName currentName = (ObjectName)current;
+
+ try
+ {
+ int connectorPort = (Integer)getMbeanServer().getAttribute(currentName,
"port");
+ boolean connectorSecure = (Boolean)getMbeanServer().getAttribute(currentName,
"secure");
+ String connectorProtocol = (String)getMbeanServer().getAttribute(currentName,
"protocol");
+
+
+ if (protocol.equals(connectorProtocol) && secure == connectorSecure)
+ {
+ if (port > -1)
+ {
+ log.warn("Found multiple connectors for protocol='" +
protocol + "' and secure='" + secure + "', using first port
found '" + port + "'");
+ }
+ else
+ {
+ port = connectorPort;
+ }
+ }
+ }
+ catch (AttributeNotFoundException ignored)
+ {
+ }
+ }
+
+ return port;
+ }
+ catch (JMException e)
+ {
+ return -1;
+ }
+ }
+
+ public String getClusterNodeName() {
+ if (this.clusterNodeName == null || "".equals(this.clusterNodeName.trim()))
{
+ return nonClusteredServerName;
+ }
+ return this.clusterNodeName;
+ }
+
+ public void setClusterNodeName(String clusterNodeName) {
+ this.clusterNodeName = clusterNodeName;
+ }
+
+
+ public String getUddiNodeName() {
+ return this.getWebServiceHost() + "-" + this.getWebServicePort();
+ }
+
+}
Deleted:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java
===================================================================
---
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc
- *
- * Licensed 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.jboss.soa.dsp.server.jboss;
-
-import org.jboss.soa.dsp.server.ServerConfig;
-
-
-/**
- * Factory to container independent config
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Heiko.Braun(a)jboss.com
- *
- * @since 08-May-2006
- */
-public class ServerConfigFactory implements org.jboss.soa.dsp.server.ServerConfigLocator
-{
- /** The default bean name */
- public static String BEAN_NAME = "org.jboss.soa.dsp:service=ServerConfig";
-
- public static ServerConfig createServerConfig()
- {
- return new KernelAwareSPIFactory().getKernelProvidedSPI(
- BEAN_NAME, ServerConfig.class
- );
- }
-
- public ServerConfig getServerConfig() {
- return(createServerConfig());
- }
-}
\ No newline at end of file
Deleted:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigImpl.java
===================================================================
---
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigImpl.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigImpl.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -1,247 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc
- *
- * Licensed 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.jboss.soa.dsp.server.jboss;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.soa.dsp.server.ServerConfig;
-import org.jboss.util.id.GUID;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.io.File;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Set;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class ServerConfigImpl implements ServerConfig
-{
- protected final Log log = LogFactory.getLog(getClass());
-
- // The MBeanServer
- private MBeanServer mbeanServer;
-
- private final static String UNDEFINED_HOSTNAME = "undefined.host";
-
- // The webservice host name that will be used when updating the wsdl
- private String webServiceHost = UNDEFINED_HOSTNAME;
- // The webservice port that will be used when updating the wsdl
- private int webServicePort;
- // The webservice port that will be used when updating the wsdl
- private int webServiceSecurePort;
-
- private static String nonClusteredServerName=new GUID().toString();
-
- private String clusterNodeName;
-
- public ServerConfigImpl()
- {
- }
-
- public MBeanServer getMbeanServer()
- {
- return mbeanServer;
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public String getImplementationTitle()
- {
- return "jbossas-riftsaw";
- }
-
- public String getImplementationVersion()
- {
- return "5.x";
- }
-
- public File getServerTempDir()
- {
- try
- {
- ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
- File dir = (File)getMbeanServer().getAttribute(oname, "ServerTempDir");
- return dir;
- }
- catch (JMException e)
- {
- return null;
- }
- }
-
- public File getHomeDir()
- {
- try
- {
- ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
- File dir = (File)getMbeanServer().getAttribute(oname, "HomeDir");
- return dir;
- }
- catch (JMException e)
- {
- return null;
- }
- }
-
- public File getServerDataDir()
- {
- try
- {
- ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
- File dir = (File)getMbeanServer().getAttribute(oname, "ServerDataDir");
- return dir;
- }
- catch (JMException e)
- {
- return null;
- }
- }
-
- public String getWebServiceHost()
- {
- return webServiceHost;
- }
-
- public void setWebServiceHost(String host) throws UnknownHostException
- {
- if (host == null || host.trim().length() == 0)
- {
- log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
- host = UNDEFINED_HOSTNAME;
- }
- if ("0.0.0.0".equals(host))
- {
- InetAddress localHost = InetAddress.getLocalHost();
- log.debug("Using local host: " + localHost.getHostName());
- host = localHost.getHostName();
- }
- this.webServiceHost = host;
- }
-
- public void setWebServicePort(int port)
- {
- this.webServicePort = port;
- }
-
- public void setWebServiceSecurePort(int port)
- {
- this.webServiceSecurePort = port;
- }
-
- public int getWebServicePort()
- {
- if (webServicePort <= 0)
- webServicePort = getConnectorPort("HTTP/1.1", false);
-
- int localPort = webServicePort;
- if (localPort <= 0)
- {
- // Do not initialize webServicePort with the default, the connector port may become
available later
- log.warn("Unable to calculate 'WebServicePort', using default
'8080'");
- localPort = 8080;
- }
-
- return localPort;
- }
-
-
- public int getWebServiceSecurePort()
- {
- if (webServiceSecurePort <= 0)
- webServiceSecurePort = getConnectorPort("HTTP/1.1", true);
-
- int localPort = webServiceSecurePort;
- if (localPort <= 0)
- {
- // Do not initialize webServiceSecurePort with the default, the connector port may
become available later
- log.warn("Unable to calculate 'WebServiceSecurePort', using default
'8443'");
- localPort = 8443;
- }
-
- return localPort;
- }
-
- private int getConnectorPort(final String protocol, final boolean secure)
- {
- int port = -1;
-
- try
- {
- ObjectName connectors = new ObjectName("jboss.web:type=Connector,*");
-
- Set connectorNames = getMbeanServer().queryNames(connectors, null);
- for (Object current : connectorNames)
- {
- ObjectName currentName = (ObjectName)current;
-
- try
- {
- int connectorPort = (Integer)getMbeanServer().getAttribute(currentName,
"port");
- boolean connectorSecure = (Boolean)getMbeanServer().getAttribute(currentName,
"secure");
- String connectorProtocol = (String)getMbeanServer().getAttribute(currentName,
"protocol");
-
-
- if (protocol.equals(connectorProtocol) && secure == connectorSecure)
- {
- if (port > -1)
- {
- log.warn("Found multiple connectors for protocol='" +
protocol + "' and secure='" + secure + "', using first port
found '" + port + "'");
- }
- else
- {
- port = connectorPort;
- }
- }
- }
- catch (AttributeNotFoundException ignored)
- {
- }
- }
-
- return port;
- }
- catch (JMException e)
- {
- return -1;
- }
- }
-
- public String getClusterNodeName() {
- if (this.clusterNodeName == null || "".equals(this.clusterNodeName.trim()))
{
- return nonClusteredServerName;
- }
- return this.clusterNodeName;
- }
-
- public void setClusterNodeName(String clusterNodeName) {
- this.clusterNodeName = clusterNodeName;
- }
-
-
- public String getUddiNodeName() {
- return this.getWebServiceHost() + "-" + this.getWebServicePort();
- }
-
-}
Modified: dsp/trunk/jboss/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- dsp/trunk/jboss/src/main/resources/META-INF/jboss-beans.xml 2011-01-10 01:13:01 UTC
(rev 1226)
+++ dsp/trunk/jboss/src/main/resources/META-INF/jboss-beans.xml 2011-01-10 15:40:23 UTC
(rev 1227)
@@ -15,7 +15,7 @@
ServerConfig
-->
<bean name="org.jboss.soa.dsp:service=ServerConfig"
- class="org.jboss.soa.dsp.server.jboss.ServerConfigImpl">
+ class="org.jboss.soa.dsp.server.jboss.JBossServerConfigImpl">
<property name="mbeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
<property
name="webServiceHost">${jboss.bind.address}</property>
</bean>
Modified:
dsp/trunk/samples/example-deployer/deployer/resources/WEB-INF/classes/dsp.properties
===================================================================
---
dsp/trunk/samples/example-deployer/deployer/resources/WEB-INF/classes/dsp.properties 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/samples/example-deployer/deployer/resources/WEB-INF/classes/dsp.properties 2011-01-10
15:40:23 UTC (rev 1227)
@@ -1,8 +1,8 @@
# JBOSS APPLICATION SERVER
-dsp.server.config.locator = org.jboss.soa.dsp.server.jboss.ServerConfigFactory
+dsp.server.config.factory = org.jboss.soa.dsp.server.jboss.JBossServerConfigFactory
dsp.service.deployer = org.jboss.soa.dsp.deployer.jboss.JBossServiceDeployer
# APACHE TOMCAT
-#dsp.server.config.locator = org.jboss.soa.dsp.server.tomcat.TomcatServerConfigLocator
+#dsp.server.config.factory = org.jboss.soa.dsp.server.tomcat.TomcatServerConfigFactory
#dsp.service.deployer = org.jboss.soa.dsp.deployer.tomcat.TomcatServiceDeployer
Modified:
dsp/trunk/samples/example-deployer/deployer/src/org/jboss/soa/dsp/example/WSDeployer.java
===================================================================
---
dsp/trunk/samples/example-deployer/deployer/src/org/jboss/soa/dsp/example/WSDeployer.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/samples/example-deployer/deployer/src/org/jboss/soa/dsp/example/WSDeployer.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -39,7 +39,7 @@
private static java.util.logging.Logger
_log=java.util.logging.Logger.getLogger(WSDeployer.class.getPackage().getName());
- private static final String DSP_SERVER_CONFIG_LOCATOR =
"dsp.server.config.locator";
+ private static final String DSP_SERVER_CONFIG_FACTORY =
"dsp.server.config.factory";
private static final String DSP_SERVICE_DEPLOYER = "dsp.service.deployer";
public WSDeployer() {
@@ -130,22 +130,22 @@
ResourceBundle res=ResourceBundle.getBundle("dsp");
if (res != null) {
- String locator=res.getString(DSP_SERVER_CONFIG_LOCATOR);
+ String factory=res.getString(DSP_SERVER_CONFIG_FACTORY);
- if (locator != null) {
+ if (factory != null) {
try {
- Class<?> cls=Class.forName(locator);
+ Class<?> cls=Class.forName(factory);
- org.jboss.soa.dsp.server.ServerConfigLocator scl=
- (org.jboss.soa.dsp.server.ServerConfigLocator)cls.newInstance();
+ org.jboss.soa.dsp.server.ServerConfigFactory scf=
+ (org.jboss.soa.dsp.server.ServerConfigFactory)cls.newInstance();
- ret = scl.getServerConfig();
+ ret = scf.getServerConfig();
} catch(Exception e) {
- _log.log(Level.SEVERE, "Failed to get server config from locator
'"+locator+"'", e);
+ _log.log(Level.SEVERE, "Failed to get server config from factory
'"+factory+"'", e);
}
} else {
- _log.severe("Failed to find server locator property
'"+DSP_SERVER_CONFIG_LOCATOR+"'");
+ _log.severe("Failed to find server config factory property
'"+DSP_SERVER_CONFIG_FACTORY+"'");
}
} else {
_log.severe("Unable to find dsp.properties");
Modified:
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java
===================================================================
---
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -69,7 +69,7 @@
context = context.substring(0, ind);
}
- File deployDir=new File(serverConfig.getServerDataDir(), context);
+ File deployDir=new File(serverConfig.getServerDeployDir(), context);
return(deployDir);
}
Added:
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigFactory.java
===================================================================
---
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigFactory.java
(rev 0)
+++
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigFactory.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2010 Red Hat, Inc
+ *
+ * Licensed 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.jboss.soa.dsp.server.tomcat;
+
+import java.io.File;
+
+import org.jboss.soa.dsp.server.ServerConfig;
+
+public class TomcatServerConfigFactory implements
org.jboss.soa.dsp.server.ServerConfigFactory {
+
+ public ServerConfig getServerConfig() {
+ ServerConfig ret=new ServerConfig() {
+
+ protected File getTomcatRoot() {
+ String path=System.getenv("CATALINA_HOME");
+
+ if (path == null) {
+ return(null);
+ }
+
+ return(new File(path));
+ }
+
+ public File getServerTempDir() {
+ File tomcat=getTomcatRoot();
+ if (tomcat == null) {
+ return(null);
+ }
+ return(new java.io.File(tomcat, "temp"));
+ }
+
+ public File getServerDeployDir() {
+ File tomcat=getTomcatRoot();
+ if (tomcat == null) {
+ return(null);
+ }
+ return(new java.io.File(tomcat, "webapps"));
+ }
+ };
+
+ return(ret);
+ }
+
+}
Deleted:
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigLocator.java
===================================================================
---
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigLocator.java 2011-01-10
01:13:01 UTC (rev 1226)
+++
dsp/trunk/tomcat/src/main/java/org/jboss/soa/dsp/server/tomcat/TomcatServerConfigLocator.java 2011-01-10
15:40:23 UTC (rev 1227)
@@ -1,96 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc
- *
- * Licensed 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.jboss.soa.dsp.server.tomcat;
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.soa.dsp.server.ServerConfig;
-import org.jboss.soa.dsp.server.ServerConfigLocator;
-
-public class TomcatServerConfigLocator implements ServerConfigLocator {
-
- private static final Log log = LogFactory.getLog(TomcatServerConfigLocator.class);
-
- public ServerConfig getServerConfig() {
- ServerConfig ret=new ServerConfig() {
-
- public String getImplementationTitle() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getImplementationVersion() {
- return("1.0");
- }
-
- protected File getTomcatRoot() {
- String path=System.getenv("CATALINA_HOME");
-
- if (path == null) {
- return(null);
- }
-
- return(new File(path));
- }
-
- public File getServerTempDir() {
- File tomcat=getTomcatRoot();
- if (tomcat == null) {
- return(null);
- }
- return(new java.io.File(tomcat, "temp"));
- }
-
- public File getServerDataDir() {
- File tomcat=getTomcatRoot();
- if (tomcat == null) {
- return(null);
- }
- return(new java.io.File(tomcat, "webapps"));
- }
-
- public String getWebServiceHost() {
- return("http://localhost");
- }
-
- public int getWebServicePort() {
- return 8080;
- }
-
- public int getWebServiceSecurePort() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public String getClusterNodeName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getUddiNodeName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- };
-
- return(ret);
- }
-
-}