You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2007/02/25 20:57:05 UTC
svn commit: r511585 [4/10] - in /webservices/axis2/trunk/java/modules/kernel:
src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/wsdl/
src/org/apache/axis2/builder/ src/org/apache/axis2/cluster/
src/org/apache/axis2/context/ src/org/apach...
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Sun Feb 25 11:56:59 2007
@@ -1,120 +1,120 @@
-package org.apache.axis2.deployment;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.repository.util.ArchiveReader;
-import org.apache.axis2.deployment.repository.util.DeploymentFileData;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.i18n.Messages;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*
-*
-*/
-public class ModuleDeployer implements Deployer {
-
- private static final Log log = LogFactory.getLog(ModuleDeployer.class);
- private AxisConfiguration axisConfig;
-
-
- public ModuleDeployer() {
- }
-
- public ModuleDeployer(AxisConfiguration axisConfig) {
- this.axisConfig = axisConfig;
- }
-
- //To initialize the deployer
- public void init(ConfigurationContext configCtx) {
- this.axisConfig = configCtx.getAxisConfiguration();
- }
- //Will process the file and add that to axisConfig
-
- public void deploy(DeploymentFileData deploymentFileData) {
- ArchiveReader archiveReader = new ArchiveReader();
- String moduleStatus = "";
- StringWriter errorWriter = new StringWriter();
- boolean explodedDir = deploymentFileData.getFile().isDirectory();
- try {
- deploymentFileData.setClassLoader(explodedDir,
- axisConfig.getModuleClassLoader());
- AxisModule metaData = new AxisModule();
- metaData.setModuleClassLoader(deploymentFileData.getClassLoader());
- metaData.setParent(axisConfig);
- archiveReader.readModuleArchive(deploymentFileData, metaData, explodedDir,
- axisConfig);
- metaData.setFileName(deploymentFileData.getFile().toURL());
- DeploymentEngine.addNewModule(metaData, axisConfig);
- log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
- metaData.getName().getLocalPart()));
- } catch (DeploymentException e) {
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
- deploymentFileData.getName(),
- e.getMessage()),
- e);
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- e.printStackTrace(error_ptintWriter);
- moduleStatus = "Error:\n" + errorWriter.toString();
- } catch (AxisFault axisFault) {
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
- deploymentFileData.getName(),
- axisFault.getMessage()),
- axisFault);
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- axisFault.printStackTrace(error_ptintWriter);
- moduleStatus = "Error:\n" + errorWriter.toString();
- } catch (MalformedURLException e) {
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
- deploymentFileData.getName(),
- e.getMessage()),
- e);
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- e.printStackTrace(error_ptintWriter);
- moduleStatus = "Error:\n" + errorWriter.toString();
- } catch (Throwable t) {
- if (log.isInfoEnabled()) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
- deploymentFileData.getName(),
- t.getMessage()),
- t);
- }
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- t.printStackTrace(error_ptintWriter);
- moduleStatus = "Error:\n" + errorWriter.toString();
- } finally {
- if (moduleStatus.startsWith("Error:")) {
- axisConfig.getFaultyModules().put(DeploymentEngine.getAxisServiceName(
- deploymentFileData.getName()), moduleStatus);
- }
- }
- }
-
- public void setDirectory(String directory) {}
-
- public void setExtension(String extension) {}
-
- public void unDeploy(String fileName) {}
-}
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* 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.
+*
+*
+*/
+public class ModuleDeployer implements Deployer {
+
+ private static final Log log = LogFactory.getLog(ModuleDeployer.class);
+ private AxisConfiguration axisConfig;
+
+
+ public ModuleDeployer() {
+ }
+
+ public ModuleDeployer(AxisConfiguration axisConfig) {
+ this.axisConfig = axisConfig;
+ }
+
+ //To initialize the deployer
+ public void init(ConfigurationContext configCtx) {
+ this.axisConfig = configCtx.getAxisConfiguration();
+ }
+ //Will process the file and add that to axisConfig
+
+ public void deploy(DeploymentFileData deploymentFileData) {
+ ArchiveReader archiveReader = new ArchiveReader();
+ String moduleStatus = "";
+ StringWriter errorWriter = new StringWriter();
+ boolean explodedDir = deploymentFileData.getFile().isDirectory();
+ try {
+ deploymentFileData.setClassLoader(explodedDir,
+ axisConfig.getModuleClassLoader());
+ AxisModule metaData = new AxisModule();
+ metaData.setModuleClassLoader(deploymentFileData.getClassLoader());
+ metaData.setParent(axisConfig);
+ archiveReader.readModuleArchive(deploymentFileData, metaData, explodedDir,
+ axisConfig);
+ metaData.setFileName(deploymentFileData.getFile().toURL());
+ DeploymentEngine.addNewModule(metaData, axisConfig);
+ log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
+ metaData.getName().getLocalPart()));
+ } catch (DeploymentException e) {
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(),
+ e.getMessage()),
+ e);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ e.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } catch (AxisFault axisFault) {
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(),
+ axisFault.getMessage()),
+ axisFault);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ axisFault.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } catch (MalformedURLException e) {
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(),
+ e.getMessage()),
+ e);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ e.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } catch (Throwable t) {
+ if (log.isInfoEnabled()) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(),
+ t.getMessage()),
+ t);
+ }
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ t.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } finally {
+ if (moduleStatus.startsWith("Error:")) {
+ axisConfig.getFaultyModules().put(DeploymentEngine.getAxisServiceName(
+ deploymentFileData.getName()), moduleStatus);
+ }
+ }
+ }
+
+ public void setDirectory(String directory) {}
+
+ public void setExtension(String extension) {}
+
+ public void unDeploy(String fileName) {}
+}
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Sun Feb 25 11:56:59 2007
@@ -1,246 +1,246 @@
-package org.apache.axis2.deployment;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.repository.util.DeploymentFileData;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.util.Loader;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.ws.java2wsdl.AnnotationConstants;
-import org.codehaus.jam.*;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*
-*
-*/
-public class POJODeployer implements Deployer {
-
- private ConfigurationContext configCtx;
-
- //To initialize the deployer
- public void init(ConfigurationContext configCtx) {
- this.configCtx = configCtx;
- }//Will process the file and add that to axisConfig
-
- public void deploy(DeploymentFileData deploymentFileData) {
- ClassLoader threadClassLoader = null;
- try {
- threadClassLoader = Thread.currentThread().getContextClassLoader();
- String extension = deploymentFileData.getType();
- if (".class".equals(extension)) {
- File file = deploymentFileData.getFile();
- if (file != null) {
- File parentFile = file.getParentFile();
- DeploymentClassLoader classLoader = new DeploymentClassLoader(new URL[]{parentFile.toURL()},
- configCtx.getAxisConfiguration().getSystemClassLoader(), true);
- Thread.currentThread().setContextClassLoader(classLoader);
- String className = file.getName();
- className = className.replaceAll(".class", "");
- JamServiceFactory factory = JamServiceFactory.getInstance();
- JamServiceParams jam_service_parms = factory.createServiceParams();
- jam_service_parms.addClassLoader(classLoader);
- jam_service_parms.includeClass(className);
- JamService service = factory.createService(jam_service_parms);
- JamClassIterator jClassIter = service.getClasses();
- while (jClassIter.hasNext()) {
- JClass jclass = (JClass) jClassIter.next();
- if (jclass.getQualifiedName().equals(className)) {
- /**
- * Schema genertaion done in two stage 1. Load all the methods and
- * create type for methods parameters (if the parameters are Bean
- * then it will create Complex types for those , and if the
- * parameters are simple type which decribe in SimpleTypeTable
- * nothing will happen) 2. In the next stage for all the methods
- * messages and port types will be creteated
- */
- boolean callJaxWs = false;
- JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
- if (annotation != null) {
- String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
- if (wsdlLocation != null && !"".equals(wsdlLocation)) {
- callJaxWs = true;
- }
- }
- if (callJaxWs) {
- Class claxx = Class.forName(
- "org.apache.axis2.jaxws.description.DescriptionFactory");
- Method mthod = claxx.getMethod(
- "createServiceDescriptionFromServiceImpl",
- new Class[]{Class.class, AxisService.class});
- Class pojoClass = Loader.loadClass(classLoader, className);
- AxisService axisService = new AxisService(className);
- axisService.setName(className);
- mthod.invoke(claxx, new Object[]{pojoClass, axisService});
- configCtx.getAxisConfiguration().addService(axisService);
- } else {
- HashMap messageReciverMap = new HashMap();
- Class inOnlyMessageReceiver = Loader.loadClass(
- "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
- MessageReceiver messageReceiver =
- (MessageReceiver) inOnlyMessageReceiver.newInstance();
- messageReciverMap.put(
- WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
- messageReceiver);
- Class inoutMessageReceiver = Loader.loadClass(
- "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
- MessageReceiver inOutmessageReceiver =
- (MessageReceiver) inoutMessageReceiver.newInstance();
- messageReciverMap.put(
- WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
- inOutmessageReceiver);
- AxisService axisService = AxisService.createService(className,
- configCtx.getAxisConfiguration(),
- messageReciverMap, null, null, classLoader);
- configCtx.getAxisConfiguration().addService(axisService);
- }
- }
- }
- }
-
- } else if (".jar".equals(extension)) {
- ArrayList classList;
- FileInputStream fin = null;
- ZipInputStream zin = null;
- try {
- fin = new FileInputStream(deploymentFileData.getAbsolutePath());
- zin = new ZipInputStream(fin);
- ZipEntry entry;
- classList = new ArrayList();
- while ((entry = zin.getNextEntry()) != null) {
- String name = entry.getName();
- if (name.endsWith(".class")) {
- classList.add(name);
- }
- }
- zin.close();
- fin.close();
- } catch (Exception e) {
- throw new DeploymentException(e);
- } finally {
- if (zin != null) {
- zin.close();
- }
- if (fin != null) {
- fin.close();
- }
- }
- ArrayList axisServiceList = new ArrayList();
- for (int i = 0; i < classList.size(); i++) {
- String className = (String) classList.get(i);
- DeploymentClassLoader classLoader = new DeploymentClassLoader(new URL[]{deploymentFileData.getFile().toURL()},
- configCtx.getAxisConfiguration().getSystemClassLoader(), true);
- Thread.currentThread().setContextClassLoader(classLoader);
- className = className.replaceAll(".class", "");
- className = className.replaceAll("/", ".");
- JamServiceFactory factory = JamServiceFactory.getInstance();
- JamServiceParams jam_service_parms = factory.createServiceParams();
- jam_service_parms.addClassLoader(classLoader);
- jam_service_parms.includeClass(className);
- JamService service = factory.createService(jam_service_parms);
- JamClassIterator jClassIter = service.getClasses();
- while (jClassIter.hasNext()) {
- JClass jclass = (JClass) jClassIter.next();
- if (jclass.getQualifiedName().equals(className)) {
- /**
- * Schema genertaion done in two stage 1. Load all the methods and
- * create type for methods parameters (if the parameters are Bean
- * then it will create Complex types for those , and if the
- * parameters are simple type which decribe in SimpleTypeTable
- * nothing will happen) 2. In the next stage for all the methods
- * messages and port types will be creteated
- */
- boolean callJaxWs = false;
- JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
- if (annotation != null) {
- String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
- if (wsdlLocation != null && !"".equals(wsdlLocation)) {
- callJaxWs = true;
- }
- } else {
- continue;
- }
- if (callJaxWs) {
- Class claxx = Class.forName(
- "org.apache.axis2.jaxws.description.DescriptionFactory");
- Method mthod = claxx.getMethod(
- "createServiceDescriptionFromServiceImpl",
- new Class[]{Class.class, AxisService.class});
- Class pojoClass = Loader.loadClass(classLoader, className);
- AxisService axisService = new AxisService(className);
- axisService.setName(className);
- mthod.invoke(claxx, new Object[]{pojoClass, axisService});
- axisServiceList.add(axisService);
- } else {
- HashMap messageReciverMap = new HashMap();
- Class inOnlyMessageReceiver = Loader.loadClass(
- "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
- MessageReceiver messageReceiver =
- (MessageReceiver) inOnlyMessageReceiver.newInstance();
- messageReciverMap.put(
- WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
- messageReceiver);
- Class inoutMessageReceiver = Loader.loadClass(
- "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
- MessageReceiver inOutmessageReceiver =
- (MessageReceiver) inoutMessageReceiver.newInstance();
- messageReciverMap.put(
- WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
- inOutmessageReceiver);
- AxisService axisService = AxisService.createService(className,
- configCtx.getAxisConfiguration(),
- messageReciverMap, null, null, classLoader);
- axisServiceList.add(axisService);
- }
- }
- }
- }
- AxisServiceGroup serviceGroup = new AxisServiceGroup();
- serviceGroup.setServiceGroupName(deploymentFileData.getServiceName());
- for (int i = 0; i < axisServiceList.size(); i++) {
- AxisService axisService = (AxisService) axisServiceList.get(i);
- serviceGroup.addService(axisService);
- }
- configCtx.getAxisConfiguration().addServiceGroup(serviceGroup);
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (threadClassLoader != null) {
- Thread.currentThread().setContextClassLoader(threadClassLoader);
- }
- }
- }
-
- public void setDirectory(String directory) {
- }
-
- public void setExtension(String extension) {
- }
-
- public void unDeploy(String fileName) {
- }
-}
-
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.util.Loader;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.ws.java2wsdl.AnnotationConstants;
+import org.codehaus.jam.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* 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.
+*
+*
+*/
+public class POJODeployer implements Deployer {
+
+ private ConfigurationContext configCtx;
+
+ //To initialize the deployer
+ public void init(ConfigurationContext configCtx) {
+ this.configCtx = configCtx;
+ }//Will process the file and add that to axisConfig
+
+ public void deploy(DeploymentFileData deploymentFileData) {
+ ClassLoader threadClassLoader = null;
+ try {
+ threadClassLoader = Thread.currentThread().getContextClassLoader();
+ String extension = deploymentFileData.getType();
+ if (".class".equals(extension)) {
+ File file = deploymentFileData.getFile();
+ if (file != null) {
+ File parentFile = file.getParentFile();
+ DeploymentClassLoader classLoader = new DeploymentClassLoader(new URL[]{parentFile.toURL()},
+ configCtx.getAxisConfiguration().getSystemClassLoader(), true);
+ Thread.currentThread().setContextClassLoader(classLoader);
+ String className = file.getName();
+ className = className.replaceAll(".class", "");
+ JamServiceFactory factory = JamServiceFactory.getInstance();
+ JamServiceParams jam_service_parms = factory.createServiceParams();
+ jam_service_parms.addClassLoader(classLoader);
+ jam_service_parms.includeClass(className);
+ JamService service = factory.createService(jam_service_parms);
+ JamClassIterator jClassIter = service.getClasses();
+ while (jClassIter.hasNext()) {
+ JClass jclass = (JClass) jClassIter.next();
+ if (jclass.getQualifiedName().equals(className)) {
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Bean
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+ boolean callJaxWs = false;
+ JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
+ if (annotation != null) {
+ String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
+ if (wsdlLocation != null && !"".equals(wsdlLocation)) {
+ callJaxWs = true;
+ }
+ }
+ if (callJaxWs) {
+ Class claxx = Class.forName(
+ "org.apache.axis2.jaxws.description.DescriptionFactory");
+ Method mthod = claxx.getMethod(
+ "createServiceDescriptionFromServiceImpl",
+ new Class[]{Class.class, AxisService.class});
+ Class pojoClass = Loader.loadClass(classLoader, className);
+ AxisService axisService = new AxisService(className);
+ axisService.setName(className);
+ mthod.invoke(claxx, new Object[]{pojoClass, axisService});
+ configCtx.getAxisConfiguration().addService(axisService);
+ } else {
+ HashMap messageReciverMap = new HashMap();
+ Class inOnlyMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
+ MessageReceiver messageReceiver =
+ (MessageReceiver) inOnlyMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ Class inoutMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+ MessageReceiver inOutmessageReceiver =
+ (MessageReceiver) inoutMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
+ inOutmessageReceiver);
+ AxisService axisService = AxisService.createService(className,
+ configCtx.getAxisConfiguration(),
+ messageReciverMap, null, null, classLoader);
+ configCtx.getAxisConfiguration().addService(axisService);
+ }
+ }
+ }
+ }
+
+ } else if (".jar".equals(extension)) {
+ ArrayList classList;
+ FileInputStream fin = null;
+ ZipInputStream zin = null;
+ try {
+ fin = new FileInputStream(deploymentFileData.getAbsolutePath());
+ zin = new ZipInputStream(fin);
+ ZipEntry entry;
+ classList = new ArrayList();
+ while ((entry = zin.getNextEntry()) != null) {
+ String name = entry.getName();
+ if (name.endsWith(".class")) {
+ classList.add(name);
+ }
+ }
+ zin.close();
+ fin.close();
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ } finally {
+ if (zin != null) {
+ zin.close();
+ }
+ if (fin != null) {
+ fin.close();
+ }
+ }
+ ArrayList axisServiceList = new ArrayList();
+ for (int i = 0; i < classList.size(); i++) {
+ String className = (String) classList.get(i);
+ DeploymentClassLoader classLoader = new DeploymentClassLoader(new URL[]{deploymentFileData.getFile().toURL()},
+ configCtx.getAxisConfiguration().getSystemClassLoader(), true);
+ Thread.currentThread().setContextClassLoader(classLoader);
+ className = className.replaceAll(".class", "");
+ className = className.replaceAll("/", ".");
+ JamServiceFactory factory = JamServiceFactory.getInstance();
+ JamServiceParams jam_service_parms = factory.createServiceParams();
+ jam_service_parms.addClassLoader(classLoader);
+ jam_service_parms.includeClass(className);
+ JamService service = factory.createService(jam_service_parms);
+ JamClassIterator jClassIter = service.getClasses();
+ while (jClassIter.hasNext()) {
+ JClass jclass = (JClass) jClassIter.next();
+ if (jclass.getQualifiedName().equals(className)) {
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Bean
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+ boolean callJaxWs = false;
+ JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
+ if (annotation != null) {
+ String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
+ if (wsdlLocation != null && !"".equals(wsdlLocation)) {
+ callJaxWs = true;
+ }
+ } else {
+ continue;
+ }
+ if (callJaxWs) {
+ Class claxx = Class.forName(
+ "org.apache.axis2.jaxws.description.DescriptionFactory");
+ Method mthod = claxx.getMethod(
+ "createServiceDescriptionFromServiceImpl",
+ new Class[]{Class.class, AxisService.class});
+ Class pojoClass = Loader.loadClass(classLoader, className);
+ AxisService axisService = new AxisService(className);
+ axisService.setName(className);
+ mthod.invoke(claxx, new Object[]{pojoClass, axisService});
+ axisServiceList.add(axisService);
+ } else {
+ HashMap messageReciverMap = new HashMap();
+ Class inOnlyMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
+ MessageReceiver messageReceiver =
+ (MessageReceiver) inOnlyMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ Class inoutMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+ MessageReceiver inOutmessageReceiver =
+ (MessageReceiver) inoutMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
+ inOutmessageReceiver);
+ AxisService axisService = AxisService.createService(className,
+ configCtx.getAxisConfiguration(),
+ messageReciverMap, null, null, classLoader);
+ axisServiceList.add(axisService);
+ }
+ }
+ }
+ }
+ AxisServiceGroup serviceGroup = new AxisServiceGroup();
+ serviceGroup.setServiceGroupName(deploymentFileData.getServiceName());
+ for (int i = 0; i < axisServiceList.size(); i++) {
+ AxisService axisService = (AxisService) axisServiceList.get(i);
+ serviceGroup.addService(axisService);
+ }
+ configCtx.getAxisConfiguration().addServiceGroup(serviceGroup);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (threadClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(threadClassLoader);
+ }
+ }
+ }
+
+ public void setDirectory(String directory) {
+ }
+
+ public void setExtension(String extension) {
+ }
+
+ public void unDeploy(String fileName) {
+ }
+}
+
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Sun Feb 25 11:56:59 2007
@@ -346,7 +346,7 @@
OMElement dataLocatorElement =
service_element.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT));
if (dataLocatorElement != null) {
- processDataLocatorConfig(dataLocatorElement, service);
+ processDataLocatorConfig(dataLocatorElement, service);
}
} catch (XMLStreamException e) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java Sun Feb 25 11:56:59 2007
@@ -1,156 +1,156 @@
-package org.apache.axis2.deployment;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.repository.util.ArchiveReader;
-import org.apache.axis2.deployment.repository.util.DeploymentFileData;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.DependencyManager;
-import org.apache.axis2.i18n.Messages;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*
-*
-*/
-public class ServiceDeployer implements Deployer {
- private static final Log log = LogFactory.getLog(ServiceDeployer.class);
- private AxisConfiguration axisConfig;
- private ConfigurationContext configCtx;
-
- //To initialize the deployer
- public void init(ConfigurationContext configCtx) {
- this.configCtx = configCtx;
- this.axisConfig = this.configCtx.getAxisConfiguration();
- }
-
- //Will process the file and add that to axisConfig
-
- public void deploy(DeploymentFileData deploymentFileData) {
- boolean explodedDir = deploymentFileData.getFile().isDirectory();
- ArchiveReader archiveReader;
- StringWriter errorWriter = new StringWriter();
- archiveReader = new ArchiveReader();
- String serviceStatus = "";
- try {
- deploymentFileData.setClassLoader(explodedDir,
- axisConfig.getServiceClassLoader());
- HashMap wsdlservice = archiveReader.processWSDLs(deploymentFileData);
- if (wsdlservice != null && wsdlservice.size() > 0) {
- Iterator services = wsdlservice.values().iterator();
- while (services.hasNext()) {
- AxisService service = (AxisService) services.next();
- Iterator operations = service.getOperations();
- while (operations.hasNext()) {
- AxisOperation axisOperation = (AxisOperation) operations.next();
- axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
- }
- }
- }
- AxisServiceGroup sericeGroup = new AxisServiceGroup(axisConfig);
- sericeGroup.setServiceGroupClassLoader(
- deploymentFileData.getClassLoader());
- ArrayList serviceList = archiveReader.processServiceGroup(
- deploymentFileData.getAbsolutePath(), deploymentFileData,
- sericeGroup, explodedDir, wsdlservice,
- configCtx);
- DeploymentEngine.addServiceGroup(sericeGroup,
- serviceList,
- deploymentFileData.getFile().toURL(),
- deploymentFileData,
- axisConfig);
- log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
- deploymentFileData.getName()));
- } catch (DeploymentException de) {
- de.printStackTrace();
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
- deploymentFileData.getName(),
- de.getMessage()),
- de);
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- de.printStackTrace(error_ptintWriter);
- serviceStatus = "Error:\n" + errorWriter.toString();
- } catch (AxisFault axisFault) {
- log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
- deploymentFileData.getName(),
- axisFault.getMessage()),
- axisFault);
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- axisFault.printStackTrace(error_ptintWriter);
- serviceStatus = "Error:\n" + errorWriter.toString();
- } catch (Exception e) {
- if (log.isInfoEnabled()) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- e.printStackTrace(pw);
- log.info(Messages.getMessage(
- DeploymentErrorMsgs.INVALID_SERVICE,
- deploymentFileData.getName(),
- sw.getBuffer().toString()));
- }
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- e.printStackTrace(error_ptintWriter);
- serviceStatus = "Error:\n" + errorWriter.toString();
- } catch (Throwable t) {
- if (log.isInfoEnabled()) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- log.info(Messages.getMessage(
- DeploymentErrorMsgs.INVALID_SERVICE,
- deploymentFileData.getName(),
- sw.getBuffer().toString()));
- }
- PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
- t.printStackTrace(error_ptintWriter);
- serviceStatus = "Error:\n" + errorWriter.toString();
- } finally {
- if (serviceStatus.startsWith("Error:")) {
- axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(),
- serviceStatus);
- }
- }
- }
-
- public void setDirectory(String directory) {
- }
-
- public void setExtension(String extension) {
- }
-
- public void unDeploy(String fileName) {
- try {
- fileName = DeploymentEngine.getAxisServiceName(fileName);
- AxisServiceGroup serviceGroup = axisConfig.removeServiceGroup(fileName);
- configCtx.removeServiceGroupContext(serviceGroup);
- log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED,
- fileName));
- } catch (AxisFault axisFault) {
- //May be a faulty service
- axisConfig.removeFaultyService(fileName);
- }
- }
-}
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.DependencyManager;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* 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.
+*
+*
+*/
+public class ServiceDeployer implements Deployer {
+ private static final Log log = LogFactory.getLog(ServiceDeployer.class);
+ private AxisConfiguration axisConfig;
+ private ConfigurationContext configCtx;
+
+ //To initialize the deployer
+ public void init(ConfigurationContext configCtx) {
+ this.configCtx = configCtx;
+ this.axisConfig = this.configCtx.getAxisConfiguration();
+ }
+
+ //Will process the file and add that to axisConfig
+
+ public void deploy(DeploymentFileData deploymentFileData) {
+ boolean explodedDir = deploymentFileData.getFile().isDirectory();
+ ArchiveReader archiveReader;
+ StringWriter errorWriter = new StringWriter();
+ archiveReader = new ArchiveReader();
+ String serviceStatus = "";
+ try {
+ deploymentFileData.setClassLoader(explodedDir,
+ axisConfig.getServiceClassLoader());
+ HashMap wsdlservice = archiveReader.processWSDLs(deploymentFileData);
+ if (wsdlservice != null && wsdlservice.size() > 0) {
+ Iterator services = wsdlservice.values().iterator();
+ while (services.hasNext()) {
+ AxisService service = (AxisService) services.next();
+ Iterator operations = service.getOperations();
+ while (operations.hasNext()) {
+ AxisOperation axisOperation = (AxisOperation) operations.next();
+ axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
+ }
+ }
+ }
+ AxisServiceGroup sericeGroup = new AxisServiceGroup(axisConfig);
+ sericeGroup.setServiceGroupClassLoader(
+ deploymentFileData.getClassLoader());
+ ArrayList serviceList = archiveReader.processServiceGroup(
+ deploymentFileData.getAbsolutePath(), deploymentFileData,
+ sericeGroup, explodedDir, wsdlservice,
+ configCtx);
+ DeploymentEngine.addServiceGroup(sericeGroup,
+ serviceList,
+ deploymentFileData.getFile().toURL(),
+ deploymentFileData,
+ axisConfig);
+ log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+ deploymentFileData.getName()));
+ } catch (DeploymentException de) {
+ de.printStackTrace();
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
+ deploymentFileData.getName(),
+ de.getMessage()),
+ de);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ de.printStackTrace(error_ptintWriter);
+ serviceStatus = "Error:\n" + errorWriter.toString();
+ } catch (AxisFault axisFault) {
+ log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
+ deploymentFileData.getName(),
+ axisFault.getMessage()),
+ axisFault);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ axisFault.printStackTrace(error_ptintWriter);
+ serviceStatus = "Error:\n" + errorWriter.toString();
+ } catch (Exception e) {
+ if (log.isInfoEnabled()) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ log.info(Messages.getMessage(
+ DeploymentErrorMsgs.INVALID_SERVICE,
+ deploymentFileData.getName(),
+ sw.getBuffer().toString()));
+ }
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ e.printStackTrace(error_ptintWriter);
+ serviceStatus = "Error:\n" + errorWriter.toString();
+ } catch (Throwable t) {
+ if (log.isInfoEnabled()) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ log.info(Messages.getMessage(
+ DeploymentErrorMsgs.INVALID_SERVICE,
+ deploymentFileData.getName(),
+ sw.getBuffer().toString()));
+ }
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ t.printStackTrace(error_ptintWriter);
+ serviceStatus = "Error:\n" + errorWriter.toString();
+ } finally {
+ if (serviceStatus.startsWith("Error:")) {
+ axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(),
+ serviceStatus);
+ }
+ }
+ }
+
+ public void setDirectory(String directory) {
+ }
+
+ public void setExtension(String extension) {
+ }
+
+ public void unDeploy(String fileName) {
+ try {
+ fileName = DeploymentEngine.getAxisServiceName(fileName);
+ AxisServiceGroup serviceGroup = axisConfig.removeServiceGroup(fileName);
+ configCtx.removeServiceGroupContext(serviceGroup);
+ log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED,
+ fileName));
+ } catch (AxisFault axisFault) {
+ //May be a faulty service
+ axisConfig.removeFaultyService(fileName);
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java Sun Feb 25 11:56:59 2007
@@ -31,7 +31,7 @@
public class URLBasedAxisConfigurator extends DeploymentEngine implements AxisConfigurator {
- private static final Log log = LogFactory.getLog(URLBasedAxisConfigurator.class);
+ private static final Log log = LogFactory.getLog(URLBasedAxisConfigurator.class);
private URL axis2xml;
private URL repositoy;
@@ -95,7 +95,7 @@
}
}
} else {
- loadServicesFromUrl(repositoy);
+ loadServicesFromUrl(repositoy);
}
} catch (MalformedURLException e) {
log.info(e);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java Sun Feb 25 11:56:59 2007
@@ -1,84 +1,84 @@
-package org.apache.axis2.deployment.resolver;
-
-import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.xml.sax.InputSource;
-
-import javax.wsdl.xml.WSDLLocator;
-import java.net.URI;
-import java.io.*;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*
-*
-*/
-public class WarBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator {
- protected static final Log log = LogFactory
- .getLog(WarBasedWSDLLocator.class);
-
- private InputStream baseInputStream;
- private URI lastImportLocation;
- private String baseURI;
- private ClassLoader classLoader;
-
- public WarBasedWSDLLocator(String baseURI, ClassLoader classLoader, InputStream baseInputStream) {
- this.baseURI = baseURI;
- this.baseInputStream = baseInputStream;
- this.classLoader = classLoader;
- }
-
- public InputSource getBaseInputSource() {
- return new InputSource(baseInputStream);
- }
-
- /**
- * @param parentLocation
- * @param importLocation
- */
- public InputSource getImportInputSource(String parentLocation, String importLocation) {
- lastImportLocation = URI.create(parentLocation).resolve(importLocation);
-
- if (isAbsolute(importLocation)) {
- return super.resolveEntity(
- null, importLocation, parentLocation);
- } else {
- String searchingStr = lastImportLocation.toString();
- return new InputSource(classLoader.getResourceAsStream(searchingStr));
- }
- }
-
- /**
- * As for the zip there is no point in returning
- * a base URI
- */
- public String getBaseURI() {
- // we don't care
- return baseURI;
- }
-
- /**
- * returns the latest import
- */
- public String getLatestImportURI() {
- //we don't care about this either
- return lastImportLocation.toString();
- }
-
- public void close() {
- //TODO: FIXME:
- }
+package org.apache.axis2.deployment.resolver;
+
+import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.xml.WSDLLocator;
+import java.net.URI;
+import java.io.*;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* 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.
+*
+*
+*/
+public class WarBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator {
+ protected static final Log log = LogFactory
+ .getLog(WarBasedWSDLLocator.class);
+
+ private InputStream baseInputStream;
+ private URI lastImportLocation;
+ private String baseURI;
+ private ClassLoader classLoader;
+
+ public WarBasedWSDLLocator(String baseURI, ClassLoader classLoader, InputStream baseInputStream) {
+ this.baseURI = baseURI;
+ this.baseInputStream = baseInputStream;
+ this.classLoader = classLoader;
+ }
+
+ public InputSource getBaseInputSource() {
+ return new InputSource(baseInputStream);
+ }
+
+ /**
+ * @param parentLocation
+ * @param importLocation
+ */
+ public InputSource getImportInputSource(String parentLocation, String importLocation) {
+ lastImportLocation = URI.create(parentLocation).resolve(importLocation);
+
+ if (isAbsolute(importLocation)) {
+ return super.resolveEntity(
+ null, importLocation, parentLocation);
+ } else {
+ String searchingStr = lastImportLocation.toString();
+ return new InputSource(classLoader.getResourceAsStream(searchingStr));
+ }
+ }
+
+ /**
+ * As for the zip there is no point in returning
+ * a base URI
+ */
+ public String getBaseURI() {
+ // we don't care
+ return baseURI;
+ }
+
+ /**
+ * returns the latest import
+ */
+ public String getLatestImportURI() {
+ //we don't care about this either
+ return lastImportLocation.toString();
+ }
+
+ public void close() {
+ //TODO: FIXME:
+ }
}
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java Sun Feb 25 11:56:59 2007
@@ -1,59 +1,59 @@
-package org.apache.axis2.deployment.resolver;
-
-import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.xml.sax.InputSource;
-
-import java.net.URI;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*
-*
-*/
-public class WarFileBasedURIResolver extends DefaultURIResolver {
-
- protected static final Log log = LogFactory
- .getLog(WarFileBasedURIResolver.class);
-
- private ClassLoader classLoader;
-
- public WarFileBasedURIResolver(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- public InputSource resolveEntity(
- String targetNamespace,
- String schemaLocation,
- String baseUri) {
- //no issue with
- if (isAbsolute(schemaLocation)) {
- return super.resolveEntity(
- targetNamespace, schemaLocation, baseUri);
- } else {
- //validate
- if ((baseUri == null || "".equals(baseUri)) && schemaLocation.startsWith("..")) {
- throw new RuntimeException(
- "Unsupported schema location " + schemaLocation);
- }
-
- URI lastImportLocation = URI.create(baseUri).resolve(schemaLocation);
- String searchingStr = lastImportLocation.toString();
- return new InputSource(classLoader.getResourceAsStream(searchingStr));
- }
- }
-}
-
+package org.apache.axis2.deployment.resolver;
+
+import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
+
+import java.net.URI;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* 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.
+*
+*
+*/
+public class WarFileBasedURIResolver extends DefaultURIResolver {
+
+ protected static final Log log = LogFactory
+ .getLog(WarFileBasedURIResolver.class);
+
+ private ClassLoader classLoader;
+
+ public WarFileBasedURIResolver(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public InputSource resolveEntity(
+ String targetNamespace,
+ String schemaLocation,
+ String baseUri) {
+ //no issue with
+ if (isAbsolute(schemaLocation)) {
+ return super.resolveEntity(
+ targetNamespace, schemaLocation, baseUri);
+ } else {
+ //validate
+ if ((baseUri == null || "".equals(baseUri)) && schemaLocation.startsWith("..")) {
+ throw new RuntimeException(
+ "Unsupported schema location " + schemaLocation);
+ }
+
+ URI lastImportLocation = URI.create(baseUri).resolve(schemaLocation);
+ String searchingStr = lastImportLocation.toString();
+ return new InputSource(classLoader.getResourceAsStream(searchingStr));
+ }
+ }
+}
+
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Sun Feb 25 11:56:59 2007
@@ -211,7 +211,7 @@
private HashMap dataLocatorClassNames;
private AxisDataLocatorImpl defaultDataLocator;
// Define search sequence for datalocator based on Data Locator types.
- LocatorType[] availableDataLocatorTypes = new LocatorType[]{LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL,LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL, LocatorType.DEFAULT_AXIS};
+ LocatorType[] availableDataLocatorTypes = new LocatorType[]{LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL,LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL, LocatorType.DEFAULT_AXIS};
// name of the binding used : use in codegeneration
private String bindingName;
@@ -744,8 +744,8 @@
try {
Definition definition = (Definition) wsld4jdefinition.getValue();
if (isModifyUserWSDLPortAddress()) {
- setPortAddress(definition);
- }
+ setPortAddress(definition);
+ }
WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
writer.writeWSDL(definition, out);
} catch (WSDLException e) {
@@ -850,9 +850,9 @@
if (wsld4jdefinition != null) {
try {
Definition definition = (Definition) wsld4jdefinition.getValue();
- if (isModifyUserWSDLPortAddress()){
- setPortAddress(definition);
- }
+ if (isModifyUserWSDLPortAddress()){
+ setPortAddress(definition);
+ }
WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
writer.writeWSDL(definition, out);
} catch (WSDLException e) {
@@ -869,7 +869,7 @@
}
private void setPortAddress(Definition definition) throws AxisFault {
- setPortAddress(definition,null);
+ setPortAddress(definition,null);
}
private void setPortAddress(Definition definition,String requestIP) throws AxisFault {
@@ -883,11 +883,11 @@
for (int i = 0; i < list.size(); i++) {
Object extensibilityEle = list.get(i);
if (extensibilityEle instanceof SOAPAddress) {
- if (requestIP==null) {
- ((SOAPAddress) extensibilityEle).setLocationURI(getEPRs()[0]);
- } else {
- ((SOAPAddress) extensibilityEle).setLocationURI(getEPRs(requestIP)[0]);
- }
+ if (requestIP==null) {
+ ((SOAPAddress) extensibilityEle).setLocationURI(getEPRs()[0]);
+ } else {
+ ((SOAPAddress) extensibilityEle).setLocationURI(getEPRs(requestIP)[0]);
+ }
}
}
}
@@ -895,36 +895,36 @@
}
private void getWSDL(OutputStream out, String[] serviceURL,
- String servicePath) throws AxisFault {
- if (this.wsdlFound) {
-
- // Retrieve WSDL using the same data retrieval path for GetMetadata request.
- DataRetrievalRequest request = new DataRetrievalRequest();
- request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL);
- request.putOutputForm(OutputForm.INLINE_FORM);
-
+ String servicePath) throws AxisFault {
+ if (this.wsdlFound) {
+
+ // Retrieve WSDL using the same data retrieval path for GetMetadata request.
+ DataRetrievalRequest request = new DataRetrievalRequest();
+ request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL);
+ request.putOutputForm(OutputForm.INLINE_FORM);
+
MessageContext context = new MessageContext();
- context.setAxisService(this);
- context.setTo(new EndpointReference(serviceURL[0]));
-
+ context.setAxisService(this);
+ context.setTo(new EndpointReference(serviceURL[0]));
+
Data[] result = getData(request, context);
- OMElement wsdlElement;
- if (result != null && result[0] != null) {
- wsdlElement = (OMElement) (result[0].getData());
- try {
- wsdlElement.serialize(out);
- out.flush();
- out.close();
- } catch (Exception e) {
- throw new AxisFault(e);
- }
- }
-
- } else {
- printWSDLError(out);
- }
+ OMElement wsdlElement;
+ if (result != null && result[0] != null) {
+ wsdlElement = (OMElement) (result[0].getData());
+ try {
+ wsdlElement.serialize(out);
+ out.flush();
+ out.close();
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ }
- }
+ } else {
+ printWSDLError(out);
+ }
+
+ }
private void printWSDLError(OutputStream out) throws AxisFault {
try {
@@ -1990,7 +1990,7 @@
/**
* By default the port address in user WSDLs is modified, set
- * the following parameter to override this behaviour
+ * the following parameter to override this behaviour
* <parameter name="modifyUserWSDLPortAddress">false</parameter>
*/
public boolean isModifyUserWSDLPortAddress() {
@@ -2048,60 +2048,60 @@
*/
public Data[] getData(DataRetrievalRequest request,
- MessageContext msgContext) throws AxisFault {
-
- Data[] data = null;
- String dialect = request.getDialect();
- AxisDataLocator dataLocator = null;
- int nextDataLocatorIndex = 0;
- int totalLocators = availableDataLocatorTypes.length;
- for (int i = 0; i < totalLocators; i++) {
- dataLocator = getDataLocator(availableDataLocatorTypes[i], dialect);
- if (dataLocator != null) {
- nextDataLocatorIndex = i + 1;
- break;
- }
- }
-
- data = dataLocator.getData(request, msgContext);
- // Null means Data Locator not understood request. Automatically find
- // Data Locator in the hierarchy to process the request.
- if (data == null) {
- if (nextDataLocatorIndex < totalLocators) {
- data = bubbleupDataLocators(nextDataLocatorIndex, request,
- msgContext);
- }
-
- }
- return data;
- }
+ MessageContext msgContext) throws AxisFault {
+
+ Data[] data = null;
+ String dialect = request.getDialect();
+ AxisDataLocator dataLocator = null;
+ int nextDataLocatorIndex = 0;
+ int totalLocators = availableDataLocatorTypes.length;
+ for (int i = 0; i < totalLocators; i++) {
+ dataLocator = getDataLocator(availableDataLocatorTypes[i], dialect);
+ if (dataLocator != null) {
+ nextDataLocatorIndex = i + 1;
+ break;
+ }
+ }
+
+ data = dataLocator.getData(request, msgContext);
+ // Null means Data Locator not understood request. Automatically find
+ // Data Locator in the hierarchy to process the request.
+ if (data == null) {
+ if (nextDataLocatorIndex < totalLocators) {
+ data = bubbleupDataLocators(nextDataLocatorIndex, request,
+ msgContext);
+ }
+
+ }
+ return data;
+ }
/*
* To search the next Data Locator from the available Data Locators that understood
* the data retrieval request.
*/
private Data[] bubbleupDataLocators(int nextIndex,
- DataRetrievalRequest request, MessageContext msgContext)
- throws AxisFault {
- Data[] data = null;
- if (nextIndex < availableDataLocatorTypes.length) {
- AxisDataLocator dataLocator = getDataLocator(
- availableDataLocatorTypes[nextIndex], request.getDialect());
- nextIndex++;
- if (dataLocator != null) {
- data = dataLocator.getData(request, msgContext);
- if (data==null){
- data = bubbleupDataLocators(nextIndex, request, msgContext);
- }
- else return data;
-
- }
- else data = bubbleupDataLocators(nextIndex, request, msgContext);
-
-
- }
- return data;
- }
+ DataRetrievalRequest request, MessageContext msgContext)
+ throws AxisFault {
+ Data[] data = null;
+ if (nextIndex < availableDataLocatorTypes.length) {
+ AxisDataLocator dataLocator = getDataLocator(
+ availableDataLocatorTypes[nextIndex], request.getDialect());
+ nextIndex++;
+ if (dataLocator != null) {
+ data = dataLocator.getData(request, msgContext);
+ if (data==null){
+ data = bubbleupDataLocators(nextIndex, request, msgContext);
+ }
+ else return data;
+
+ }
+ else data = bubbleupDataLocators(nextIndex, request, msgContext);
+
+
+ }
+ return data;
+ }
/**
* Save data Locator configured at service level for this Axis Service
@@ -2120,104 +2120,104 @@
* Get data locator instance based on the LocatorType and dialect.
*/
private AxisDataLocator getDataLocator(LocatorType locatorType, String dialect) throws AxisFault {
- AxisDataLocator locator = null;
+ AxisDataLocator locator = null;
if (locatorType == LocatorType.SERVICE_DIALECT)
- locator = getServiceDataLocator( dialect);
+ locator = getServiceDataLocator( dialect);
else if (locatorType == LocatorType.SERVICE_LEVEL)
- locator = getServiceDataLocator( DRConstants.SERVICE_LEVEL);
+ locator = getServiceDataLocator( DRConstants.SERVICE_LEVEL);
else if (locatorType == LocatorType.GLOBAL_DIALECT)
- locator = getGlobalDataLocator( dialect);
+ locator = getGlobalDataLocator( dialect);
else if (locatorType == LocatorType.GLOBAL_LEVEL)
- locator = getGlobalDataLocator( DRConstants.GLOBAL_LEVEL);
+ locator = getGlobalDataLocator( DRConstants.GLOBAL_LEVEL);
else if (locatorType == LocatorType.DEFAULT_AXIS)
- locator = getDefaultDataLocator();
+ locator = getDefaultDataLocator();
else
- locator = getDefaultDataLocator();
+ locator = getDefaultDataLocator();
- return locator;
+ return locator;
}
-
+
// Return default Axis2 Data Locator
private AxisDataLocator getDefaultDataLocator() throws DataRetrievalException {
- if (defaultDataLocator == null)
- defaultDataLocator = new AxisDataLocatorImpl(this);
-
- defaultDataLocator.loadServiceData();
-
- return defaultDataLocator;
- }
+ if (defaultDataLocator == null)
+ defaultDataLocator = new AxisDataLocatorImpl(this);
+
+ defaultDataLocator.loadServiceData();
+
+ return defaultDataLocator;
+ }
- /*
- * Checks if service level data locator configured for specified dialect.
- * Returns an instance of the data locator if exists, and null otherwise.
- */
- private AxisDataLocator getServiceDataLocator(String dialect)
- throws AxisFault {
- AxisDataLocator locator = null;
- locator = (AxisDataLocator)dataLocators.get(dialect);
- if (locator == null) {
- String className = (String)dataLocatorClassNames.get(dialect);
- if (className != null) {
- locator = loadDataLocator(className);
- dataLocators.put(dialect, locator);
- }
+ /*
+ * Checks if service level data locator configured for specified dialect.
+ * Returns an instance of the data locator if exists, and null otherwise.
+ */
+ private AxisDataLocator getServiceDataLocator(String dialect)
+ throws AxisFault {
+ AxisDataLocator locator = null;
+ locator = (AxisDataLocator)dataLocators.get(dialect);
+ if (locator == null) {
+ String className = (String)dataLocatorClassNames.get(dialect);
+ if (className != null) {
+ locator = loadDataLocator(className);
+ dataLocators.put(dialect, locator);
+ }
- }
+ }
- return locator;
+ return locator;
- }
+ }
- /*
- * Checks if global level data locator configured for specified dialect.
- * @param dialect- an absolute URI represents the Dialect i.e. WSDL, Policy, Schema or
+ /*
+ * Checks if global level data locator configured for specified dialect.
+ * @param dialect- an absolute URI represents the Dialect i.e. WSDL, Policy, Schema or
* "GlobalLevel" for non-dialect Global level data locator.
- * Returns an instance of the data locator if exists, and null otherwise.
- */
-
- public AxisDataLocator getGlobalDataLocator(String dialect)
- throws AxisFault {
- AxisConfiguration axisConfig = getAxisConfiguration();
- AxisDataLocator locator = null;
- if (axisConfig != null) {
- locator = axisConfig.getDataLocator(dialect);
- if (locator == null) {
- String className = axisConfig.getDataLocatorClassName(dialect);
- if (className != null) {
- locator = loadDataLocator(className);
- axisConfig.addDataLocator(dialect, locator);
- }
- }
+ * Returns an instance of the data locator if exists, and null otherwise.
+ */
+
+ public AxisDataLocator getGlobalDataLocator(String dialect)
+ throws AxisFault {
+ AxisConfiguration axisConfig = getAxisConfiguration();
+ AxisDataLocator locator = null;
+ if (axisConfig != null) {
+ locator = axisConfig.getDataLocator(dialect);
+ if (locator == null) {
+ String className = axisConfig.getDataLocatorClassName(dialect);
+ if (className != null) {
+ locator = loadDataLocator(className);
+ axisConfig.addDataLocator(dialect, locator);
+ }
+ }
}
- return locator;
+ return locator;
- }
+ }
protected AxisDataLocator loadDataLocator(String className)
- throws AxisFault {
+ throws AxisFault {
- AxisDataLocator locator = null;
+ AxisDataLocator locator = null;
- try {
- Class dataLocator;
- dataLocator = Class.forName(className, true, serviceClassLoader);
- locator = (AxisDataLocator) dataLocator.newInstance();
- } catch (ClassNotFoundException e) {
- throw new AxisFault(e);
- } catch (IllegalAccessException e) {
- throw new AxisFault(e);
- } catch (InstantiationException e) {
- throw new AxisFault(e);
+ try {
+ Class dataLocator;
+ dataLocator = Class.forName(className, true, serviceClassLoader);
+ locator = (AxisDataLocator) dataLocator.newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new AxisFault(e);
+ } catch (IllegalAccessException e) {
+ throw new AxisFault(e);
+ } catch (InstantiationException e) {
+ throw new AxisFault(e);
- }
+ }
- return locator;
- }
+ return locator;
+ }
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org