Author: objectiser
Date: 2010-12-02 07:05:03 -0500 (Thu, 02 Dec 2010)
New Revision: 1176
Added:
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java
dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/classes/
dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/classes/dsp.properties
Modified:
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java
dsp/trunk/samples/deployer/lib/dsp-api-1.0.0-SNAPSHOT.jar
dsp/trunk/samples/deployer/lib/dsp-jboss-1.0.0-SNAPSHOT.jar
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPExampleForm.java
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DeployStore.java
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/WSDeployer.java
Log:
Made the DSP example deployer target platform independent, configured through a property
file.
Added: 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
(rev 0)
+++
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/server/ServerConfigLocator.java 2010-12-02
12:05:03 UTC (rev 1176)
@@ -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 ServerConfigLocator {
+
+ /**
+ * This method returns an instance of the server configuration.
+ *
+ * @return The service configuration
+ */
+ public ServerConfig getServerConfig();
+
+}
\ No newline at end of file
Modified:
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 2010-12-02
03:38:19 UTC (rev 1175)
+++
dsp/trunk/jboss/src/main/java/org/jboss/soa/dsp/server/jboss/ServerConfigFactory.java 2010-12-02
12:05:03 UTC (rev 1176)
@@ -27,15 +27,19 @@
*
* @since 08-May-2006
*/
-public class ServerConfigFactory
+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 getServerConfig()
+ public static ServerConfig createServerConfig()
{
return new KernelAwareSPIFactory().getKernelProvidedSPI(
BEAN_NAME, ServerConfig.class
);
}
+
+ public ServerConfig getServerConfig() {
+ return(createServerConfig());
+ }
}
\ No newline at end of file
Modified: dsp/trunk/samples/deployer/lib/dsp-api-1.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified: dsp/trunk/samples/deployer/lib/dsp-jboss-1.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified:
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPExampleForm.java
===================================================================
---
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPExampleForm.java 2010-12-02
03:38:19 UTC (rev 1175)
+++
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPExampleForm.java 2010-12-02
12:05:03 UTC (rev 1176)
@@ -1,19 +1,18 @@
/*
- * 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.
+ * 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.example;
Modified:
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DeployStore.java
===================================================================
---
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DeployStore.java 2010-12-02
03:38:19 UTC (rev 1175)
+++
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DeployStore.java 2010-12-02
12:05:03 UTC (rev 1176)
@@ -1,19 +1,18 @@
/*
- * 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.
+ * 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.example;
Modified:
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/WSDeployer.java
===================================================================
---
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/WSDeployer.java 2010-12-02
03:38:19 UTC (rev 1175)
+++
dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/WSDeployer.java 2010-12-02
12:05:03 UTC (rev 1176)
@@ -18,15 +18,16 @@
import java.io.File;
import java.net.URL;
+import java.util.ResourceBundle;
import java.util.UUID;
+import java.util.logging.Level;
import javax.xml.namespace.QName;
import org.jboss.soa.dsp.EndpointMetaData;
import org.jboss.soa.dsp.ServiceEndpointReference;
-import org.jboss.soa.dsp.deployer.jboss.JBossServiceDeployer;
+import org.jboss.soa.dsp.deployer.ServiceDeployer;
import org.jboss.soa.dsp.server.ServerConfig;
-import org.jboss.soa.dsp.server.jboss.ServerConfigFactory;
import org.jboss.soa.dsp.ws.BaseWebServiceEndpoint;
import org.jboss.soa.dsp.ws.DeploymentBuilder;
import org.jboss.soa.dsp.ws.WSDLParser;
@@ -35,6 +36,11 @@
public class WSDeployer {
+ 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_SERVICE_DEPLOYER = "dsp.service.deployer";
+
public WSDeployer() {
}
@@ -58,11 +64,11 @@
javax.wsdl.Service
service=(javax.wsdl.Service)wsdl.getServices().values().iterator().next();
- System.out.println("SERVICE="+service);
+ _log.info("SERVICE="+service);
javax.wsdl.Port port=(javax.wsdl.Port)service.getPorts().values().iterator().next();
- System.out.println("PORT="+port);
+ _log.info("PORT="+port);
EndpointMetaData metaData=new EndpointMetaData(service.getQName(),
port.getName(), new QName("http://www.example.org",
"ProcessId"),
@@ -72,9 +78,9 @@
providerFactory.createProvider(metaData, wsdlRef, cl,
null, ExampleWebServiceFactory.class);
- System.out.println("PROVIDER="+providerImpl);
+ _log.info("PROVIDER="+providerImpl);
- ServerConfig serverConfig=ServerConfigFactory.getServerConfig();
+ ServerConfig serverConfig=getServerConfig();
File warArchive = new DeploymentBuilder(serverConfig)
.setEndpoint(metaData.getEndpointId())
@@ -82,26 +88,85 @@
.setProvider(providerImpl)
.build();
- System.out.println("War Archive="+warArchive);
+ _log.info("War Archive="+warArchive);
URL serviceUrl = new
WSDLParser(wsdlRef.getDefinition()).getServiceLocationURL(metaData.getServiceName(),
metaData.getPortName());
- System.out.println("Service URL="+serviceUrl);
+ _log.info("Service URL="+serviceUrl);
- JBossServiceDeployer deployer=new JBossServiceDeployer();
+ ServiceDeployer deployer=getServiceDeployer();
ServiceEndpointReference ref=deployer.deploy(metaData, providerImpl.getClass(),
serviceUrl, cl, warArchive);
- System.out.println("DEPLOYED endpoint ref="+ref);
+ _log.info("DEPLOYED endpoint ref="+ref);
return(ref);
}
public void undeploy(ServiceEndpointReference ref) throws Exception {
- JBossServiceDeployer deployer=new JBossServiceDeployer();
+ ServiceDeployer deployer=getServiceDeployer();
deployer.undeploy(ref);
}
+
+ protected ServerConfig getServerConfig() {
+ ServerConfig ret=null;
+
+ // Get service config factory class from properties file
+ ResourceBundle res=ResourceBundle.getBundle("dsp");
+
+ if (res != null) {
+ String locator=res.getString(DSP_SERVER_CONFIG_LOCATOR);
+
+ if (locator != null) {
+ try {
+ Class<?> cls=Class.forName(locator);
+
+ org.jboss.soa.dsp.server.ServerConfigLocator scl=
+ (org.jboss.soa.dsp.server.ServerConfigLocator)cls.newInstance();
+
+ ret = scl.getServerConfig();
+
+ } catch(Exception e) {
+ _log.log(Level.SEVERE, "Failed to get server config from locator
'"+locator+"'", e);
+ }
+ } else {
+ _log.severe("Failed to find server locator property
'"+DSP_SERVER_CONFIG_LOCATOR+"'");
+ }
+ } else {
+ _log.severe("Unable to find dsp.properties");
+ }
+
+ return(ret);
+ }
+
+ protected ServiceDeployer getServiceDeployer() {
+ ServiceDeployer ret=null;
+
+ // Get service config factory class from properties file
+ ResourceBundle res=ResourceBundle.getBundle("dsp");
+
+ if (res != null) {
+ String deployer=res.getString(DSP_SERVICE_DEPLOYER);
+
+ if (deployer != null) {
+ try {
+ Class<?> cls=Class.forName(deployer);
+
+ ret = (ServiceDeployer)cls.newInstance();
+
+ } catch(Exception e) {
+ _log.log(Level.SEVERE, "Failed to get service deployer
'"+deployer+"'", e);
+ }
+ } else {
+ _log.severe("Failed to find service deployer property
'"+DSP_SERVICE_DEPLOYER+"'");
+ }
+ } else {
+ _log.severe("Unable to find dsp.properties");
+ }
+
+ return(ret);
+ }
}
Added: dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/classes/dsp.properties
===================================================================
--- dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/classes/dsp.properties
(rev 0)
+++ dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/classes/dsp.properties 2010-12-02
12:05:03 UTC (rev 1176)
@@ -0,0 +1,2 @@
+dsp.server.config.locator = org.jboss.soa.dsp.server.jboss.ServerConfigFactory
+dsp.service.deployer = org.jboss.soa.dsp.deployer.jboss.JBossServiceDeployer
\ No newline at end of file