Author: objectiser
Date: 2010-11-17 05:07:48 -0500 (Wed, 17 Nov 2010)
New Revision: 1118
Added:
trunk/runtime/si/src/main/java/org/jboss/soa/si/ServerConfig.java
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/DeploymentBuilder.java
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderGenerator.java
Removed:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfig.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/DeploymentBuilder.java
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java
Modified:
trunk/console/integration/pom.xml
trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/SVGPlugin.java
trunk/integration-tests/pom.xml
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigFactory.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigImpl.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/TemplateWebServiceEndpoint.java
Log:
Started moving deployment mechanism to independent package.
Modified: trunk/console/integration/pom.xml
===================================================================
--- trunk/console/integration/pom.xml 2010-11-17 09:15:36 UTC (rev 1117)
+++ trunk/console/integration/pom.xml 2010-11-17 10:07:48 UTC (rev 1118)
@@ -59,6 +59,12 @@
</dependency>
<dependency>
+ <groupId>org.jboss.soa</groupId>
+ <artifactId>si</artifactId>
+ <version>${riftsaw.engine.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.soa.bpel</groupId>
<artifactId>riftsaw-bpel-store</artifactId>
</dependency>
Modified:
trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/SVGPlugin.java
===================================================================
---
trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/SVGPlugin.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/SVGPlugin.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -29,7 +29,7 @@
import org.jboss.soa.bpel.bpel2svg.BPEL2SVGUtil;
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
import org.jboss.soa.bpel.runtime.engine.ode.BPELEngineImpl;
-import org.jboss.soa.bpel.runtime.integration.ServerConfig;
+import org.jboss.soa.si.ServerConfig;
import org.jboss.soa.bpel.runtime.integration.ServerConfigFactory;
import org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface;
import org.wso2.carbon.bpel.ui.bpel2svg.SVGInterface;
Modified: trunk/integration-tests/pom.xml
===================================================================
--- trunk/integration-tests/pom.xml 2010-11-17 09:15:36 UTC (rev 1117)
+++ trunk/integration-tests/pom.xml 2010-11-17 10:07:48 UTC (rev 1118)
@@ -583,11 +583,11 @@
</systemProperties>
<testFailureIgnore>true</testFailureIgnore>
<includes>
+ <!--
<include>**/*TestCase.java</include>
<include>**/*Test.java</include>
- <!--
+ -->
<include>org/jboss/soa/bpel/tests/samples/QuickstartBPELHelloWorldTestCase.java</include>
- -->
</includes>
<!--
https://jira.jboss.org/jira/browse/RIFTSAW-34 -->
<excludes>
Deleted:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfig.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfig.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfig.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.soa.bpel.runtime.integration;
-
-import java.io.File;
-
-/**
- * Interface to container independent config
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public interface ServerConfig
-{
- String getImplementationTitle();
-
- String getImplementationVersion();
-
- File getServerTempDir();
-
- File getServerDataDir();
-
- String getWebServiceHost();
-
- int getWebServicePort();
-
- int getWebServiceSecurePort();
-
- String getClusterNodeName();
-
- String getUddiNodeName();
-
-}
\ No newline at end of file
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigFactory.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigFactory.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigFactory.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -21,7 +21,9 @@
*/
package org.jboss.soa.bpel.runtime.integration;
+import org.jboss.soa.si.ServerConfig;
+
/**
* Factory to container independent config
*
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigImpl.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigImpl.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfigImpl.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.utils.GUID;
+import org.jboss.soa.si.ServerConfig;
import javax.management.AttributeNotFoundException;
import javax.management.JMException;
@@ -73,12 +74,12 @@
public String getImplementationTitle()
{
- return "";
+ return "jbossas-riftsaw";
}
public String getImplementationVersion()
{
- return "";
+ return "5.x";
}
public File getServerTempDir()
Deleted:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/DeploymentBuilder.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/DeploymentBuilder.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/DeploymentBuilder.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.soa.bpel.runtime.ws;
-
-import org.jboss.soa.bpel.runtime.integration.ServerConfig;
-
-import java.io.*;
-
-class DeploymentBuilder
-{
- private File war;
- private File webInf;
- private File wsdlDir;
- private DeploymentBuilder instance;
-
- private ServerConfig serverConfig;
-
- public DeploymentBuilder(ServerConfig serverConfig)
- {
- this.serverConfig = serverConfig;
- }
-
- public DeploymentBuilder setEndpoint(String endpointId)
- {
- File tmpDir = new File(serverConfig.getServerTempDir(), "riftsaw");
-
- tmpDir.mkdir();
- File fakeWebApp = new File(tmpDir,
"riftsaw-"+endpointId+".war");
- File fakeWebInf = new File(fakeWebApp, "WEB-INF");
- fakeWebInf.mkdirs();
-
- // Workaround
- // See
https://jira.jboss.org/jira/browse/JBWS-2718
- File fakeWSDLDir = new File(fakeWebInf, "wsdl");
- fakeWSDLDir.mkdirs();
-
- this.war = fakeWebApp;
- this.webInf = fakeWebInf;
- this.wsdlDir = fakeWSDLDir;
-
- return this;
- }
-
- public DeploymentBuilder setWSDL(File wsdl, File root)
- {
- copy(wsdl, new File(this.wsdlDir, wsdl.getName()));
-
- // any related artifact as well (brute force, I know)
- //File parent = wsdl.getParentFile();
- //assert parent.isDirectory();
-
- FileFilter filter = new FileFilter()
- {
- public boolean accept(File f)
- {
- return (true
- /* Commented out, to ensure all appropriate artifacts are deployed
- f.getName().endsWith(".wsdl")
- || f.getName().endsWith(".xsd")
- || f.getName().endsWith(".xml")
- || f.getName().endsWith(".properties")
- || f.getName().endsWith(".jks")
- || f.getName().endsWith(".keystore")
- || f.getName().endsWith(".pem")
- || f.getName().endsWith(".chain")
- || f.isDirectory()
- */
- );
- }
- };
-
- for(File f : root.listFiles(filter))
- {
- if(f.equals(wsdl)) continue;
- copy(f, new File(this.wsdlDir, f.getName()));
- copy(f, new File(this.webInf, f.getName()));
-
-
-/* Causes problems with testcase RIFTSAW-70 on jbossws-native. Ok
- on jbossws-cxf. So just copying all artifacts to both locations
- for now.
-
- if (f.getName().endsWith(".wsdl") ||
- f.getName().endsWith(".xsd")) {
- copy(f, new File(this.wsdlDir, f.getName()));
- } else {
- copy(f, new File(this.webInf, f.getName()));
- }
-*/
- }
- return this;
- }
-
- public DeploymentBuilder setProvider(javax.xml.ws.Provider<?> provider) {
-
- // Check if jbossws-cxf.xml is present, and if so, updated the provider implementation
class attribute
- File f=new File(this.webInf, "jbossws-cxf.xml");
-
- if (f.exists()) {
- FileInputStream fis=null;
- FileOutputStream fos=null;
-
- try {
- fis=new FileInputStream(f);
-
- byte[] b=new byte[fis.available()];
- fis.read(b);
-
- String str=new String(b);
-
- fis.close();
- fis = null;
-
- if (str.indexOf("@provider@") != -1) {
- fos=new FileOutputStream(f);
-
- str = str.replaceAll("@provider@", provider.getClass().getName());
-
- fos.write(str.getBytes());
-
- fos.flush();
- fos.close();
-
- fos = null;
- } else {
- // Report error
- System.err.println("jbossws-cxf.xml file does not contain @provider@
field");
- }
-
- } catch (IOException e) {
- throw new RuntimeException("Failed to copy files", e);
- } finally {
- try {
- if (fis != null) fis.close();
- } catch (IOException e) {
- }
- try {
- if (fos != null) fos.close();
- } catch (IOException e) {
- }
- }
- }
-
- return this;
- }
-
- public File build()
- {
- return this.war;
- }
-
- public static synchronized void copy(File src, File dest)
- {
- InputStream in = null;
- OutputStream out = null;
-
- try
- {
- if (src.isDirectory())
- {
- if (!dest.exists()) {
- dest.mkdir();
- }
-
- String[] children = src.list();
- for (int i=0; i<children.length; i++) {
- copy(new File(src, children[i]),
- new File(dest, children[i]));
- }
- } else {
-
- in = new FileInputStream(src);
- out = new FileOutputStream(dest);
-
- // Copy the bits from instream to outstream
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- in.close();
- out.close();
- }
-
- }
- catch (IOException e)
- {
- throw new RuntimeException("Failed to copy files", e);
- }
- finally
- {
- try
- {
- if(in!=null) in.close();
- }
- catch (IOException e)
- {
- //
- }
-
- try
- {
- if(out!=null) out.close();
- }
- catch (IOException e)
- {
- //
- }
- }
- }
-}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -41,16 +41,16 @@
import org.jboss.soa.bpel.runtime.engine.ode.UDDIClientFactory;
import org.jboss.soa.bpel.runtime.engine.ode.UDDIRegistration;
import org.jboss.soa.bpel.runtime.integration.KernelLocator;
-import org.jboss.soa.bpel.runtime.integration.ServerConfig;
import org.jboss.soa.bpel.runtime.integration.ServerConfigFactory;
+import org.jboss.soa.si.ServerConfig;
import org.jboss.soa.si.ws.BaseWebServiceEndpoint;
+import org.jboss.soa.si.ws.DeploymentBuilder;
import org.jboss.soa.si.ws.WSDLParser;
import org.jboss.soa.si.ws.WSDLReference;
-import org.jboss.soa.si.ws.WebServiceProviderFactory;
+import org.jboss.soa.si.ws.WebServiceProviderGenerator;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
-import javax.wsdl.Definition;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.IOException;
@@ -133,7 +133,7 @@
}
// generate provider impl
- WebServiceProviderFactory providerFactory = new WebServiceProviderFactory();
+ WebServiceProviderGenerator providerFactory = new WebServiceProviderGenerator();
BaseWebServiceEndpoint providerImpl =
providerFactory.createProvider(
Copied: trunk/runtime/si/src/main/java/org/jboss/soa/si/ServerConfig.java (from rev 1113,
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/integration/ServerConfig.java)
===================================================================
--- trunk/runtime/si/src/main/java/org/jboss/soa/si/ServerConfig.java
(rev 0)
+++ trunk/runtime/si/src/main/java/org/jboss/soa/si/ServerConfig.java 2010-11-17 10:07:48
UTC (rev 1118)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.si;
+
+import java.io.File;
+
+/**
+ * Interface to container independent config
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-May-2006
+ */
+public interface ServerConfig
+{
+ String getImplementationTitle();
+
+ String getImplementationVersion();
+
+ File getServerTempDir();
+
+ File getServerDataDir();
+
+ String getWebServiceHost();
+
+ int getWebServicePort();
+
+ int getWebServiceSecurePort();
+
+ String getClusterNodeName();
+
+ String getUddiNodeName();
+
+}
\ No newline at end of file
Modified: trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java
===================================================================
---
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/BaseWebServiceEndpoint.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -40,7 +40,7 @@
* Base class for BPEL endpoints that are created through javassist.
* Represents a JAX-WS {@link javax.xml.ws.Provider} implementation.
*
- * @see org.jboss.soa.si.ws.WebServiceProviderFactory
+ * @see org.jboss.soa.si.ws.WebServiceProviderGenerator
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
Copied: trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/DeploymentBuilder.java (from
rev 1113,
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/DeploymentBuilder.java)
===================================================================
--- trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/DeploymentBuilder.java
(rev 0)
+++ trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/DeploymentBuilder.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -0,0 +1,222 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.si.ws;
+
+import org.jboss.soa.si.ServerConfig;
+
+import java.io.*;
+
+public class DeploymentBuilder
+{
+ private static final String SI = "si";
+
+ private File war;
+ private File webInf;
+ private File wsdlDir;
+ private DeploymentBuilder instance;
+
+ private ServerConfig serverConfig;
+
+ public DeploymentBuilder(ServerConfig serverConfig)
+ {
+ this.serverConfig = serverConfig;
+ }
+
+ public DeploymentBuilder setEndpoint(String endpointId)
+ {
+ File tmpDir = new File(serverConfig.getServerTempDir(), SI);
+
+ tmpDir.mkdir();
+ File fakeWebApp = new File(tmpDir, SI+"-"+endpointId+".war");
+ File fakeWebInf = new File(fakeWebApp, "WEB-INF");
+ fakeWebInf.mkdirs();
+
+ // Workaround
+ // See
https://jira.jboss.org/jira/browse/JBWS-2718
+ File fakeWSDLDir = new File(fakeWebInf, "wsdl");
+ fakeWSDLDir.mkdirs();
+
+ this.war = fakeWebApp;
+ this.webInf = fakeWebInf;
+ this.wsdlDir = fakeWSDLDir;
+
+ return this;
+ }
+
+ public DeploymentBuilder setWSDL(File wsdl, File root)
+ {
+ copy(wsdl, new File(this.wsdlDir, wsdl.getName()));
+
+ // any related artifact as well (brute force, I know)
+ //File parent = wsdl.getParentFile();
+ //assert parent.isDirectory();
+
+ FileFilter filter = new FileFilter()
+ {
+ public boolean accept(File f)
+ {
+ // Deploy all artifacts, as we don't know what might be relevant in a
+ // particular execution context
+ return (true);
+ }
+ };
+
+ for(File f : root.listFiles(filter))
+ {
+ if(f.equals(wsdl)) continue;
+ copy(f, new File(this.wsdlDir, f.getName()));
+ copy(f, new File(this.webInf, f.getName()));
+
+
+/* Causes problems with testcase RIFTSAW-70 on jbossws-native. Ok
+ on jbossws-cxf. So just copying all artifacts to both locations
+ for now.
+
+ if (f.getName().endsWith(".wsdl") ||
+ f.getName().endsWith(".xsd")) {
+ copy(f, new File(this.wsdlDir, f.getName()));
+ } else {
+ copy(f, new File(this.webInf, f.getName()));
+ }
+*/
+ }
+ return this;
+ }
+
+ public DeploymentBuilder setProvider(javax.xml.ws.Provider<?> provider) {
+
+ // Check if jbossws-cxf.xml is present, and if so, updated the provider implementation
class attribute
+ File f=new File(this.webInf, "jbossws-cxf.xml");
+
+ if (f.exists()) {
+ FileInputStream fis=null;
+ FileOutputStream fos=null;
+
+ try {
+ fis=new FileInputStream(f);
+
+ byte[] b=new byte[fis.available()];
+ fis.read(b);
+
+ String str=new String(b);
+
+ fis.close();
+ fis = null;
+
+ if (str.indexOf("@provider@") != -1) {
+ fos=new FileOutputStream(f);
+
+ str = str.replaceAll("@provider@", provider.getClass().getName());
+
+ fos.write(str.getBytes());
+
+ fos.flush();
+ fos.close();
+
+ fos = null;
+ } else {
+ // Report error
+ System.err.println("jbossws-cxf.xml file does not contain @provider@
field");
+ }
+
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to copy files", e);
+ } finally {
+ try {
+ if (fis != null) fis.close();
+ } catch (IOException e) {
+ }
+ try {
+ if (fos != null) fos.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ return this;
+ }
+
+ public File build()
+ {
+ return this.war;
+ }
+
+ public static synchronized void copy(File src, File dest)
+ {
+ InputStream in = null;
+ OutputStream out = null;
+
+ try
+ {
+ if (src.isDirectory())
+ {
+ if (!dest.exists()) {
+ dest.mkdir();
+ }
+
+ String[] children = src.list();
+ for (int i=0; i<children.length; i++) {
+ copy(new File(src, children[i]),
+ new File(dest, children[i]));
+ }
+ } else {
+
+ in = new FileInputStream(src);
+ out = new FileOutputStream(dest);
+
+ // Copy the bits from instream to outstream
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ in.close();
+ out.close();
+ }
+
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Failed to copy files", e);
+ }
+ finally
+ {
+ try
+ {
+ if(in!=null) in.close();
+ }
+ catch (IOException e)
+ {
+ //
+ }
+
+ try
+ {
+ if(out!=null) out.close();
+ }
+ catch (IOException e)
+ {
+ //
+ }
+ }
+ }
+}
Modified:
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/TemplateWebServiceEndpoint.java
===================================================================
---
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/TemplateWebServiceEndpoint.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/TemplateWebServiceEndpoint.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -34,7 +34,7 @@
* be the specific endpoint implementation. This is necessary as
* javassist does not provide a way to set a interface that uses generics.
*
- * @see org.jboss.soa.si.ws.WebServiceProviderFactory
+ * @see org.jboss.soa.si.ws.WebServiceProviderGenerator
*
*/
public class TemplateWebServiceEndpoint extends BaseWebServiceEndpoint implements
Provider<SOAPMessage>
Deleted:
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java
===================================================================
---
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java 2010-11-17
09:15:36 UTC (rev 1117)
+++
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -1,211 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.soa.si.ws;
-
-import javassist.*;
-import javassist.bytecode.AnnotationsAttribute;
-import javassist.bytecode.ClassFile;
-import javassist.bytecode.ConstPool;
-import javassist.bytecode.annotation.Annotation;
-import javassist.bytecode.annotation.EnumMemberValue;
-import javassist.bytecode.annotation.StringMemberValue;
-
-import javax.xml.namespace.QName;
-
-
-/**
- * Creates JAX-WS Provider classes using javassist.
- * These provider classes can then be deployed to JBossWS in memory.<p>
- * The javassist generated class basically just carries the meta data,
- * while the actual implementation resides in {@link
org.jboss.soa.si.ws.BaseWebServiceEndpoint}
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class WebServiceProviderFactory
-{
- private final static String PKG_PREFIX =
WebServiceProviderFactory.class.getPackage().getName()+".generated.";
-
- public BaseWebServiceEndpoint createProvider(
- QName service, String port,
- String endpointId,
- WSDLReference wsdlRef,
- ClassLoader loader,
- java.io.File handlerFile,
- Class<? extends WebServiceFactory> providerFactory
- )
- throws Exception
- {
- ClassPool pool = new ClassPool(true);
- pool.appendClassPath(new LoaderClassPath(loader));
-
- // Imports
- pool.importPackage("java.lang");
- pool.importPackage("javax.xml.ws");
- pool.importPackage("javax.jws");
-
- CtClass stringType = pool.get("java.lang.String");
-
- String implClassName = PKG_PREFIX+"WebServiceEndpoint_"+endpointId;
- //CtClass impl = pool.makeClass(implClassName);
-
- // Load an existing class representing the template for a Web Service provider
- // This was necessary, as javassist does not provide a way to set an implemented
- // interface that supports generics. Although the super class
(AbstractWebServiceEndpoint)
- // implements this Provider<SOAPMessage> interface, CXF requires the actual web
service
- // implementation class to directly define this interface. (RIFTSAW-123)
- CtClass impl =
pool.get(org.jboss.soa.si.ws.TemplateWebServiceEndpoint.class.getName());
- impl.setName(implClassName);
-
- // AbstractWebServiceEndpoint.endpointId property
- CtField idField = new CtField(stringType, "endpointId", impl);
- idField.setModifiers(Modifier.PUBLIC);
- impl.addField(idField, "\""+endpointId+"\"");
-
- // AbstractWebServiceEndpoint.serviceName property
- CtField serviceField = new CtField(stringType, "serviceName", impl);
- serviceField.setModifiers(Modifier.PUBLIC);
- impl.addField(serviceField,
"\""+service.toString()+"\"");
-
- // AbstractWebServiceEndpoint.wsdlLocation property
- CtField wsdlLocationField = new CtField(stringType, "wsdlLocation", impl);
- wsdlLocationField.setModifiers(Modifier.PUBLIC);
- impl.addField(wsdlLocationField,
"\""+wsdlRef.getWsdlURL().toExternalForm()+"\"");
-
- // AbstractWebServiceEndpoint.portName property
- CtField portNameField = new CtField(stringType, "portName", impl);
- portNameField.setModifiers(Modifier.PUBLIC);
- impl.addField(portNameField, "\""+port+"\"");
-
- // Annotations
- ClassFile classFile = impl.getClassFile();
- classFile.setVersionToJava5();
- ConstPool constantPool = classFile.getConstPool();
-
- /*
- @WebServiceProvider(
- portName="HelloPort",
- serviceName="HelloService",
-
targetNamespace="http://helloservice.org/wsdl",
- wsdlLocation="WEB-INF/wsdl/HelloService.wsdl"
- )
- @ServiceMode(value=Service.Mode.MESSAGE)
- */
- AnnotationsAttribute attr = new
- AnnotationsAttribute(constantPool, AnnotationsAttribute.visibleTag);
-
- // --
- Annotation providerAnnotation = new Annotation(
- "javax.xml.ws.WebServiceProvider", constantPool);
-
- providerAnnotation.addMemberValue(
- "serviceName",
- new StringMemberValue(service.getLocalPart(), constantPool)
- );
- providerAnnotation.addMemberValue(
- "portName",
- new StringMemberValue(port, constantPool)
- );
- providerAnnotation.addMemberValue(
- "targetNamespace",
- new StringMemberValue(service.getNamespaceURI(), constantPool)
- );
- providerAnnotation.addMemberValue(
- "wsdlLocation",
- new StringMemberValue(wsdlRef.getWsdlURL().toExternalForm(), constantPool)
- );
- attr.addAnnotation(providerAnnotation);
-
- // --
- Annotation annotation2 = new Annotation("javax.xml.ws.ServiceMode",
- constantPool);
- EnumMemberValue enumValue = new EnumMemberValue(constantPool);
- enumValue.setType("javax.xml.ws.Service$Mode");
- enumValue.setValue("MESSAGE");
- annotation2.addMemberValue("value", enumValue);
-
- attr.addAnnotation(annotation2);
-
- // Specify the web service providerdetails
- Annotation detailsAnnotation = new Annotation(
- org.jboss.soa.si.ws.WebServiceDetails.class.getName(), constantPool);
-
- detailsAnnotation.addMemberValue("factory",
- new StringMemberValue(providerFactory.getName(), constantPool));
-
- attr.addAnnotation(detailsAnnotation);
-
-
- classFile.addAttribute(attr);
-
-
- // Check if handler chain should be established
- if (handlerFile != null) {
- Annotation handlerChain = new Annotation("javax.jws.HandlerChain",
constantPool);
-
- handlerChain.addMemberValue("file",
- new StringMemberValue("/"+handlerFile.getName(), constantPool));
-
- attr.addAnnotation(handlerChain);
- }
-
-
- createStringGetter(impl, stringType, "endpointId",
"getEndpointId");
- createStringGetter(impl, stringType, "serviceName",
"getServiceName");
- createStringGetter(impl, stringType, "wsdlLocation",
"getWsdlLocation");
- createStringGetter(impl, stringType, "portName", "getPortName");
-
- // ------------
-
- // freeze
- impl.stopPruning(false);
- impl.toClass(loader);
- JavaUtils.clearBlacklists(loader);
-
- // test it
- Class clazz = loader.loadClass(implClassName);
-
- BaseWebServiceEndpoint obj = (BaseWebServiceEndpoint)clazz.newInstance();
-
- return obj;
- }
-
- private void createStringGetter(CtClass impl, CtClass stringType, String property,
String methodName)
- throws Exception
- {
- CtMethod method = new CtMethod(
- stringType, methodName,
- new CtClass[]{},
- impl
- );
-
- // Method body
- StringBuffer body = new StringBuffer();
- body.append("{");
- body.append("return this."+property+";");
- body.append("}");
-
- method.setBody(body.toString());
-
- impl.addMethod(method);
-
- }
-}
Copied:
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderGenerator.java (from
rev 1115,
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderFactory.java)
===================================================================
--- trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderGenerator.java
(rev 0)
+++
trunk/runtime/si/src/main/java/org/jboss/soa/si/ws/WebServiceProviderGenerator.java 2010-11-17
10:07:48 UTC (rev 1118)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.si.ws;
+
+import javassist.*;
+import javassist.bytecode.AnnotationsAttribute;
+import javassist.bytecode.ClassFile;
+import javassist.bytecode.ConstPool;
+import javassist.bytecode.annotation.Annotation;
+import javassist.bytecode.annotation.EnumMemberValue;
+import javassist.bytecode.annotation.StringMemberValue;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Creates JAX-WS Provider classes using javassist.
+ * These provider classes can then be deployed to JBossWS in memory.<p>
+ * The javassist generated class basically just carries the meta data,
+ * while the actual implementation resides in {@link
org.jboss.soa.si.ws.BaseWebServiceEndpoint}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class WebServiceProviderGenerator
+{
+ private final static String PKG_PREFIX =
WebServiceProviderGenerator.class.getPackage().getName()+".generated.";
+
+ public BaseWebServiceEndpoint createProvider(
+ QName service, String port,
+ String endpointId,
+ WSDLReference wsdlRef,
+ ClassLoader loader,
+ java.io.File handlerFile,
+ Class<? extends WebServiceFactory> providerFactory
+ )
+ throws Exception
+ {
+ ClassPool pool = new ClassPool(true);
+ pool.appendClassPath(new LoaderClassPath(loader));
+
+ // Imports
+ pool.importPackage("java.lang");
+ pool.importPackage("javax.xml.ws");
+ pool.importPackage("javax.jws");
+
+ CtClass stringType = pool.get("java.lang.String");
+
+ String implClassName = PKG_PREFIX+"WebServiceEndpoint_"+endpointId;
+ //CtClass impl = pool.makeClass(implClassName);
+
+ // Load an existing class representing the template for a Web Service provider
+ // This was necessary, as javassist does not provide a way to set an implemented
+ // interface that supports generics. Although the super class
(AbstractWebServiceEndpoint)
+ // implements this Provider<SOAPMessage> interface, CXF requires the actual web
service
+ // implementation class to directly define this interface. (RIFTSAW-123)
+ CtClass impl =
pool.get(org.jboss.soa.si.ws.TemplateWebServiceEndpoint.class.getName());
+ impl.setName(implClassName);
+
+ // AbstractWebServiceEndpoint.endpointId property
+ CtField idField = new CtField(stringType, "endpointId", impl);
+ idField.setModifiers(Modifier.PUBLIC);
+ impl.addField(idField, "\""+endpointId+"\"");
+
+ // AbstractWebServiceEndpoint.serviceName property
+ CtField serviceField = new CtField(stringType, "serviceName", impl);
+ serviceField.setModifiers(Modifier.PUBLIC);
+ impl.addField(serviceField,
"\""+service.toString()+"\"");
+
+ // AbstractWebServiceEndpoint.wsdlLocation property
+ CtField wsdlLocationField = new CtField(stringType, "wsdlLocation", impl);
+ wsdlLocationField.setModifiers(Modifier.PUBLIC);
+ impl.addField(wsdlLocationField,
"\""+wsdlRef.getWsdlURL().toExternalForm()+"\"");
+
+ // AbstractWebServiceEndpoint.portName property
+ CtField portNameField = new CtField(stringType, "portName", impl);
+ portNameField.setModifiers(Modifier.PUBLIC);
+ impl.addField(portNameField, "\""+port+"\"");
+
+ // Annotations
+ ClassFile classFile = impl.getClassFile();
+ classFile.setVersionToJava5();
+ ConstPool constantPool = classFile.getConstPool();
+
+ /*
+ @WebServiceProvider(
+ portName="HelloPort",
+ serviceName="HelloService",
+
targetNamespace="http://helloservice.org/wsdl",
+ wsdlLocation="WEB-INF/wsdl/HelloService.wsdl"
+ )
+ @ServiceMode(value=Service.Mode.MESSAGE)
+ */
+ AnnotationsAttribute attr = new
+ AnnotationsAttribute(constantPool, AnnotationsAttribute.visibleTag);
+
+ // --
+ Annotation providerAnnotation = new Annotation(
+ "javax.xml.ws.WebServiceProvider", constantPool);
+
+ providerAnnotation.addMemberValue(
+ "serviceName",
+ new StringMemberValue(service.getLocalPart(), constantPool)
+ );
+ providerAnnotation.addMemberValue(
+ "portName",
+ new StringMemberValue(port, constantPool)
+ );
+ providerAnnotation.addMemberValue(
+ "targetNamespace",
+ new StringMemberValue(service.getNamespaceURI(), constantPool)
+ );
+ providerAnnotation.addMemberValue(
+ "wsdlLocation",
+ new StringMemberValue(wsdlRef.getWsdlURL().toExternalForm(), constantPool)
+ );
+ attr.addAnnotation(providerAnnotation);
+
+ // --
+ Annotation annotation2 = new Annotation("javax.xml.ws.ServiceMode",
+ constantPool);
+ EnumMemberValue enumValue = new EnumMemberValue(constantPool);
+ enumValue.setType("javax.xml.ws.Service$Mode");
+ enumValue.setValue("MESSAGE");
+ annotation2.addMemberValue("value", enumValue);
+
+ attr.addAnnotation(annotation2);
+
+ // Specify the web service providerdetails
+ Annotation detailsAnnotation = new Annotation(
+ org.jboss.soa.si.ws.WebServiceDetails.class.getName(), constantPool);
+
+ detailsAnnotation.addMemberValue("factory",
+ new StringMemberValue(providerFactory.getName(), constantPool));
+
+ attr.addAnnotation(detailsAnnotation);
+
+
+ classFile.addAttribute(attr);
+
+
+ // Check if handler chain should be established
+ if (handlerFile != null) {
+ Annotation handlerChain = new Annotation("javax.jws.HandlerChain",
constantPool);
+
+ handlerChain.addMemberValue("file",
+ new StringMemberValue("/"+handlerFile.getName(), constantPool));
+
+ attr.addAnnotation(handlerChain);
+ }
+
+
+ createStringGetter(impl, stringType, "endpointId",
"getEndpointId");
+ createStringGetter(impl, stringType, "serviceName",
"getServiceName");
+ createStringGetter(impl, stringType, "wsdlLocation",
"getWsdlLocation");
+ createStringGetter(impl, stringType, "portName", "getPortName");
+
+ // ------------
+
+ // freeze
+ impl.stopPruning(false);
+ impl.toClass(loader);
+ JavaUtils.clearBlacklists(loader);
+
+ // test it
+ Class clazz = loader.loadClass(implClassName);
+
+ BaseWebServiceEndpoint obj = (BaseWebServiceEndpoint)clazz.newInstance();
+
+ return obj;
+ }
+
+ private void createStringGetter(CtClass impl, CtClass stringType, String property,
String methodName)
+ throws Exception
+ {
+ CtMethod method = new CtMethod(
+ stringType, methodName,
+ new CtClass[]{},
+ impl
+ );
+
+ // Method body
+ StringBuffer body = new StringBuffer();
+ body.append("{");
+ body.append("return this."+property+";");
+ body.append("}");
+
+ method.setBody(body.toString());
+
+ impl.addMethod(method);
+
+ }
+}