User: cgjung
Date: 01/12/05 03:00:27
Modified: jboss.net/src/main/org/jboss/net/axis/server
AxisService.java Constants.java
Log:
adopted Jules fixURL hack until the next jdk patch will come out ;-)
got AxisService to run again under new mbean state model
and latest deployer changes (mbean-ref).
Revision Changes Path
1.4 +430 -367
contrib/jboss.net/src/main/org/jboss/net/axis/server/AxisService.java
Index: AxisService.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jboss.net/src/main/org/jboss/net/axis/server/AxisService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AxisService.java 2001/11/12 06:36:49 1.3
+++ AxisService.java 2001/12/05 11:00:26 1.4
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: AxisService.java,v 1.3 2001/11/12 06:36:49 d_jencks Exp $
+// $Id: AxisService.java,v 1.4 2001/12/05 11:00:26 cgjung Exp $
package org.jboss.net.axis.server;
@@ -62,379 +62,442 @@
* A deployer service that installs and manages Axis within JMX.
* @created 27. September 2001
* @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
+ * Change notes:
+ * <ul>
+ * <li> 28.11.01: CGJ, Adapted to jboss3.0 single-phase mbean startup<li>
+ * <li> 28.11.01: CGJ, Fixed zip-cache problem (sort of)<li>
+ * </ul>
*/
-public class AxisService extends DeployerMBeanSupport implements AxisServiceMBean,
MBeanRegistration, Constants {
-
- /** the name registered */
- ObjectName _name=null;
-
- /** this is where the axis "web-application" has been installed */
- String myUrl=null;
-
- /** Axis administration helper, keeps no state, i think */
- final Admin admin=new Admin();
-
- /** the axis engines */
- final static Map axisServerMap=new HashMap();
-
- /** default */
- public AxisService() {
- // we fake internationalisation if it is not globally catered
- if(category.getResourceBundle()==null)
- category.setResourceBundle(new DefaultResourceBundle());
- }
-
- //----------------------------------------------------------------------------
- // 'name' interface
- //----------------------------------------------------------------------------
-
- public ObjectName getObjectName(MBeanServer server, ObjectName name)
- throws MalformedObjectNameException {
- // accept name proposal from JMX in order
- // to allow several instances
- if(name==null) {
- _name=new ObjectName(DOMAIN+":"+TYPE+"="+getName());
- } else {
- _name=name;
- }
- return _name;
- }
-
- /** return just the proper name part */
- public String getName() {
- return NAME;
- }
-
- //----------------------------------------------------------------------------
- // 'service' interface
- //----------------------------------------------------------------------------
-
- /** some status methods*/
-
- boolean initialised=false;
-
- protected boolean isInitialised() {
- return initialised;
- }
-
- protected void setInitialised(boolean flag) {
- initialised=flag;
- }
-
- /** starts the associated AxisEngine */
- protected void ensureService() throws Exception {
-
- synchronized(AxisService.class) {
- // each engine must have a different context
- if(axisServerMap.get(rootContext)!=null)
- throw new Exception(AXIS_SERVER_CONTEXT_OCCUPIED);
-
- // find the global config file in classpath
- URL resource=getClass().
- getClassLoader().getResource(AXIS_CONFIGURATION_FILE);
-
- if(resource==null) {
- category.l7dlog(Priority.WARN,COULD_NOT_FIND_AXIS_CONFIGURATION_0,
- new Object[]{AXIS_CONFIGURATION_FILE},null);
- throw new Exception(COULD_NOT_FIND_AXIS_CONFIGURATION_0);
- }
-
- // Set the base path for the AxisServer to our WEB-INF directory
- axisServerMap.put(getRootContext(),new ClassLoaderAwareAxisServer(new
XMLResourceProvider(resource)));
- }
- }
-
-
- /** start service = register Axis servlet in WebContainer */
- protected void startService() throws Exception {
- if (!isInitialised()) {
- ensureService();
- setInitialised(true);
- } else
- category.warn(AXIS_ALREADY_INITIALIZED);
- super.startService();
-
- // we find out through which URLClassLoader we have been loaded
- ClassLoader myLoader=getClass().getClassLoader();
-
- // there must be also the servlet spec as a resource somewhere
- URL web_descriptor=myLoader.getResource(AXIS_DEPLOYMENT_DESCRIPTOR);
-
- if(web_descriptor==null)
- throw new Exception(AXIS_DEPLOYMENT_DESCRIPTOR_NOT_FOUND);
-
- // its there, so we open it prophylactically
- InputStream input=web_descriptor.openStream();
-
- try{
- //next we build the deployment structure that should
- //persuade the web-server to run the axis servlet under
- //our root context
- File appDir=
- new File(getDeployDir()+AXIS_DEPLOY_DIR+"/"+getRootContext()+"/");
- // and this is how it looks in stringified URL notation
- myUrl=appDir.toURL().toString();
- // the target where the deployemnt descriptor goes to
- File target=
- new File(appDir+WEB_DEPLOYMENT_DESCRIPTOR);
- // create intermediate directories if not yet existing
- target.getParentFile().mkdirs();
- // this is the output stream for writing the descriptor into
- FileOutputStream output=new FileOutputStream(target);
- try {
- copy(input, output);
- } finally {
- output.close();
- }
- } finally {
- input.close();
- }
-
- // we use the root context as URL infix
- String rootContext="/"+getRootContext()+"/*";
-
- category.l7dlog(Priority.INFO,ABOUT_TO_DEPLOY_0_UNDER_CONTEXT_1,new
Object[] {myUrl,rootContext},null);
-
- // Call the appropriate deployer through the JMX server
- Object webApplication=
- getServer().invoke(new ObjectName(getWarDeployerName()),
- DEPLOY_METHOD_NAME, new Object[]{rootContext,myUrl},
- new String[] {STRING_CLASS_NAME,STRING_CLASS_NAME});
- }
-
- /** what to do to stop axis temporarily --> undeploy the servlet */
- protected void stopService() {
- super.stopService();
- try {
- // undeploy axis servlet
- category.l7dlog(Priority.INFO,ABOUT_TO_UNDEPLOY_0,new
Object[]{myUrl},null);
+public class AxisService extends DeployerMBeanSupport implements AxisServiceMBean,
MBeanRegistration, Constants
+{
+
+ /** the name registered */
+ ObjectName _name=null;
+
+ /** this is where the axis "web-application" has been installed */
+ String myUrl=null;
+
+ /** Axis administration helper, keeps no state, i think */
+ final Admin admin=new Admin();
+
+ /** the axis engines */
+ final static Map axisServerMap=new HashMap();
+
+ /** default */
+ public AxisService()
+ {
+ // we fake internationalisation if it is not globally catered
+ if(log.getCategory().getResourceBundle()==null)
+ log.getCategory().setResourceBundle(new DefaultResourceBundle());
+ }
+
+ //----------------------------------------------------------------------------
+ // 'name' interface
+ //----------------------------------------------------------------------------
+
+ public ObjectName getObjectName(MBeanServer server, ObjectName name)
+ throws MalformedObjectNameException
+ {
+ // accept name proposal from JMX in order
+ // to allow several instances
+ if(name==null)
+ {
+ _name=new ObjectName(DOMAIN+":"+TYPE+"="+getName());
+ } else
+ {
+ _name=name;
+ }
+ return _name;
+ }
+
+ /** return just the proper name part */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ //----------------------------------------------------------------------------
+ // 'service' interface
+ //----------------------------------------------------------------------------
+
+ /** starts the associated AxisEngine */
+ protected void ensureService() throws Exception
+ {
+
+ synchronized(AxisService.class)
+ {
+ // each engine must have a different context
+ if(axisServerMap.get(rootContext)!=null)
+ throw new Exception(AXIS_SERVER_CONTEXT_OCCUPIED);
+
+ // find the global config file in classpath
+ URL resource=getClass().
+ getClassLoader().getResource(AXIS_CONFIGURATION_FILE);
- // Call the appropriate deployer through the JMX server
- Object webApplication=
- getServer().invoke(new ObjectName(getWarDeployerName()),
- UNDEPLOY_METHOD_NAME, new Object[]{myUrl},new String[]
{STRING_CLASS_NAME});
- } catch (Exception e) {
- category.error(COULD_NOT_STOP_AXIS, e);
- } finally {
- myUrl=null;
- }
- if (isInitialised()) {
- synchronized(AxisService.class) {
- ((AxisServer) axisServerMap.get(getRootContext())).stop();
- axisServerMap.remove(getRootContext());
- }
- // who knows what to do here
- setInitialised(false);
- }
- else
- category.warn(AXIS_ALREADY_DESTROYED);
- }
-
-
- //----------------------------------------------------------------------------
- // static helper that relates contexts and axis engines
- //----------------------------------------------------------------------------
-
- /** return the engine if initialised */
- public static synchronized AxisServer getAxisServer(String context) {
- return (AxisServer) axisServerMap.get(context);
- }
-
- //----------------------------------------------------------------------------
- // war deployer plug
- //----------------------------------------------------------------------------
-
- protected String warDeployerName=null;
-
- public String getWarDeployerName() {
- return warDeployerName;
- }
-
- public void setWarDeployerName(String name) {
- category.l7dlog(Priority.INFO,SET_WAR_DEPLOYER_0,new Object[]{name},null);
- warDeployerName=name;
- }
-
- //----------------------------------------------------------------------------
- // root context plug
- //----------------------------------------------------------------------------
-
- protected String rootContext=DEFAULT_ROOT_CONTEXT;
-
- public String getRootContext() {
- return rootContext;
- }
-
- /** the root context must be constant for the lifetime of the service */
- public void setRootContext(String name) throws Exception {
- if(isInitialised())
- throw new Exception(CANNOT_CHANGE_ROOT_CONTEXT);
-
- category.l7dlog(Priority.INFO,SET_ROOT_CONTEXT_0,new Object[]{name},null);
- rootContext=name;
- }
-
- //----------------------------------------------------------------------------
- // Deployer interface
- //----------------------------------------------------------------------------
-
- /** we accept .wsr files */
- public FilenameFilter getDeployableFilter() {
- return new FilenameFilter() {
- public boolean accept(File dir, String filename) {
- filename=filename.toLowerCase();
- return filename.endsWith(WSR_FILE_EXTENSION);
- }
- };
- }
-
- /** deploys a given descriptor file, we & axis expect the classes
- * needed to do this in the context classloader of the
- * calling thread
- */
- protected Element deployDescriptor(URL url, ClassLoader loader) throws
DeploymentException {
-
- category.l7dlog(Priority.INFO,ABOUT_TO_DEPLOY_AXIS_0,new Object[]
{url},null);
-
- // remember classloader
- ClassLoader previous=Thread.currentThread().getContextClassLoader();
-
- try{
- InitialContext iniCtx = new InitialContext();
- Context envCtx=null;
-
- // create a new naming context java:comp/env
- try{
- // enter the apartment
- Thread.currentThread().setContextClassLoader(loader);
- envCtx = (Context) iniCtx.lookup("java:comp");
- envCtx = envCtx.createSubcontext("env");
- } finally {
- // enter the apartment
- Thread.currentThread().setContextClassLoader(previous);
- }
-
- // we create a new message context
- // connected to our singleton servlet
- MessageContext msgContext = new MessageContext((AxisServer)
axisServerMap.get(getRootContext()));
- // parse the stuff into a dom
- Document doc = XMLUtils.newDocument( url.openStream() );
- // the original command
- Element root=doc.getDocumentElement();
- // the deployment command document
- Document deployDoc=XMLUtils.newDocument();
- // create command
- Element deploy=deployDoc.createElementNS("m","deploy");
- deploy.setAttributeNS("xmlns","m","AdminService");
- // and insert the nodes from the original document
- // and sort out the ejb-ref extensions
- NodeList children=root.getChildNodes();
- for(int count=0;count<children.getLength();count++) {
- Node actNode=children.item(count);
- if(actNode instanceof Element && ((Element)
actNode).getTagName().equals("ejb-ref")) {
- try{
- String
refName=MetaData.getElementContent(MetaData.getUniqueChild((Element)actNode,"ejb-ref-name"));
- String
linkName=MetaData.getElementContent(MetaData.getUniqueChild((Element)actNode,"ejb-link"));
- if(refName==null)
- throw new
DeploymentException(this.EJB_REF_MUST_HAVE_UNIQUE_NAME);
- if(linkName==null)
- throw new
DeploymentException(this.EJB_REF_MUST_HAVE_UNIQUE_LINK);
-
- Util.bind(envCtx, refName, new LinkRef(linkName));
- } catch(org.jboss.ejb.DeploymentException e) {
- throw new
DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
- }
- } else {
- deploy.appendChild(deployDoc.importNode(actNode,true));
- }
- }
- // insert command into document
- deployDoc.appendChild(deploy);
-
- try {
- Thread.currentThread().setContextClassLoader(loader);
- // and run the axis administrator
- admin.AdminService(msgContext, deployDoc);
- return root;
- } catch(AxisFault e) {
- throw new DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
- } finally {
- Thread.currentThread().setContextClassLoader(previous);
- }
- } catch(IOException e) {
- throw new DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
- } catch(NamingException e) {
+ if(resource==null)
+ {
+
log.getCategory().l7dlog(Priority.WARN,COULD_NOT_FIND_AXIS_CONFIGURATION_0,
+ new Object[]
+ {AXIS_CONFIGURATION_FILE},null);
+ throw new Exception(COULD_NOT_FIND_AXIS_CONFIGURATION_0);
+ }
+
+ // Set the base path for the AxisServer to our WEB-INF directory
+ axisServerMap.put(getRootContext(),new ClassLoaderAwareAxisServer(new
XMLResourceProvider(resource)));
+ }
+ }
+
+ /** start service = initialise axis engine & register Axis servlet in
WebContainer */
+ public void startService() throws Exception
+ {
+ // call the common deployer start code
+ super.startService();
+ // set up the axis engine
+ ensureService();
+
+ // we find out through which URLClassLoader we have been loaded
+ ClassLoader myLoader=getClass().getClassLoader();
+
+ // and get our web deployment descriptor through the
+ // zip-cache faker
+ URL resource=fixURL(myLoader.getResource(AXIS_DEPLOYMENT_DESCRIPTOR));
+
+ if(resource==null)
+ {
+ log.getCategory().l7dlog(Priority.ERROR,COULD_NOT_DEPLOY_DESCRIPTOR,new
Object[0],null);
+ throw new Exception(COULD_NOT_DEPLOY_DESCRIPTOR);
+ }
+
+ // there must be also the servlet spec as a resource somewhere
+ InputStream input=resource.openStream();
+
+ try
+ {
+ //next we build the deployment structure that should
+ //persuade the web-server to run the axis servlet under
+ //our root context
+ File appDir=
+ new File(getDeployDir()+AXIS_DEPLOY_DIR+"/"+getRootContext()+"/");
+ // and this is how it looks in stringified URL notation
+ myUrl=appDir.toURL().toString();
+ // the target where the deployemnt descriptor goes to
+ File target=
+ new File(appDir+WEB_DEPLOYMENT_DESCRIPTOR);
+ // create intermediate directories if not yet existing
+ target.getParentFile().mkdirs();
+ // this is the output stream for writing the descriptor into
+ FileOutputStream output=new FileOutputStream(target);
+ try
+ {
+ copy(input, output);
+ } finally
+ {
+ output.close();
+ }
+ } finally
+ {
+ input.close();
+ }
+
+
+ // we use the root context as URL infix
+ String rootContext="/"+getRootContext()+"/*";
+
+ log.getCategory().l7dlog(Priority.INFO,ABOUT_TO_DEPLOY_0_UNDER_CONTEXT_1,new
Object[]
+ {myUrl,rootContext},null);
+
+ // Call the appropriate deployer through the JMX server
+ Object webApplication=
+ getServer().invoke(new ObjectName(getWarDeployerName()),
+ DEPLOY_METHOD_NAME, new Object[]
+ {rootContext,myUrl},
+ new String[]
+ {STRING_CLASS_NAME,STRING_CLASS_NAME});
+ }
+
+ /** what to do to stop axis temporarily --> undeploy the servlet */
+ public void stopService()
+ {
+ try
+ {
+ // undeploy axis servlet
+ log.getCategory().l7dlog(Priority.INFO,ABOUT_TO_UNDEPLOY_0,new Object[]
+ {myUrl},null);
+
+ // Call the appropriate deployer through the JMX server
+ Object webApplication=
+ getServer().invoke(new ObjectName(getWarDeployerName()),
+ UNDEPLOY_METHOD_NAME, new Object[]
+ {myUrl},new String[]
+ {STRING_CLASS_NAME});
+ } catch (Exception e)
+ {
+ log.getCategory().error(COULD_NOT_STOP_AXIS, e);
+ } finally
+ {
+ synchronized(AxisService.class)
+ {
+ ((AxisServer) axisServerMap.get(getRootContext())).stop();
+ axisServerMap.remove(getRootContext());
+ }
+ super.stopService();
+ myUrl=null;
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ // static helper that relates contexts and axis engines
+ //----------------------------------------------------------------------------
+
+ /** return the engine if initialised */
+ public static synchronized AxisServer getAxisServer(String context)
+ {
+ return (AxisServer) axisServerMap.get(context);
+ }
+
+ //----------------------------------------------------------------------------
+ // war deployer plug
+ //----------------------------------------------------------------------------
+
+ protected String warDeployerName=null;
+
+ public String getWarDeployerName()
+ {
+ return warDeployerName;
+ }
+
+ public void setWarDeployerName(String name)
+ {
+ log.getCategory().l7dlog(Priority.INFO,SET_WAR_DEPLOYER_0,new Object[]
+ {name},null);
+ warDeployerName=name;
+ }
+
+ //----------------------------------------------------------------------------
+ // root context plug
+ //----------------------------------------------------------------------------
+
+ protected String rootContext=DEFAULT_ROOT_CONTEXT;
+
+ public String getRootContext()
+ {
+ return rootContext;
+ }
+
+ /** the root context must be constant for the lifetime of the service */
+ public void setRootContext(String name) throws Exception
+ {
+ log.getCategory().l7dlog(Priority.INFO,SET_ROOT_CONTEXT_0,new Object[]
+ {name},null);
+ rootContext=name;
+ }
+
+ //----------------------------------------------------------------------------
+ // Deployer interface
+ //----------------------------------------------------------------------------
+
+ /** we accept .wsr files */
+ public FilenameFilter getDeployableFilter()
+ {
+ return new FilenameFilter()
+ {
+ public boolean accept(File dir, String filename)
+ {
+ filename=filename.toLowerCase();
+ return filename.endsWith(WSR_FILE_EXTENSION);
+ }
+ };
+ }
+
+ /** deploys a given descriptor file, we & axis expect the classes
+ * needed to do this in the context classloader of the
+ * calling thread
+ */
+ protected Element deployDescriptor(URL url, ClassLoader loader) throws
DeploymentException
+ {
+
+ log.getCategory().l7dlog(Priority.INFO,ABOUT_TO_DEPLOY_AXIS_0,new Object[]
+ {url},null);
+
+ // remember classloader
+ ClassLoader previous=Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ InitialContext iniCtx = new InitialContext();
+ Context envCtx=null;
+
+ // create a new naming context java:comp/env
+ try
+ {
+ // enter the apartment
+ Thread.currentThread().setContextClassLoader(loader);
+ envCtx = (Context) iniCtx.lookup("java:comp");
+ envCtx = envCtx.createSubcontext("env");
+ } finally
+ {
+ // enter the apartment
+ Thread.currentThread().setContextClassLoader(previous);
+ }
+
+ // we create a new message context
+ // connected to our singleton servlet
+ MessageContext msgContext = new MessageContext((AxisServer)
axisServerMap.get(getRootContext()));
+ // parse the stuff into a dom
+ Document doc = XMLUtils.newDocument( url.openStream() );
+ // the original command
+ Element root=doc.getDocumentElement();
+ // the deployment command document
+ Document deployDoc=XMLUtils.newDocument();
+ // create command
+ Element deploy=deployDoc.createElementNS("m","deploy");
+ deploy.setAttributeNS("xmlns","m","AdminService");
+ // and insert the nodes from the original document
+ // and sort out the ejb-ref extensions
+ NodeList children=root.getChildNodes();
+ for(int count=0;count<children.getLength();count++)
+ {
+ Node actNode=children.item(count);
+ if(actNode instanceof Element && ((Element)
actNode).getTagName().equals("ejb-ref"))
+ {
+ String
refName=MetaData.getElementContent(MetaData.getUniqueChild((Element)actNode,"ejb-ref-name"));
+ String
linkName=MetaData.getElementContent(MetaData.getUniqueChild((Element)actNode,"ejb-link"));
+ if(refName==null)
+ throw new DeploymentException(this.EJB_REF_MUST_HAVE_UNIQUE_NAME);
+ if(linkName==null)
+ throw new DeploymentException(this.EJB_REF_MUST_HAVE_UNIQUE_LINK);
+
+ Util.bind(envCtx, refName, new LinkRef(linkName));
+ } else
+ {
+ deploy.appendChild(deployDoc.importNode(actNode,true));
+ }
+ }
+ // insert command into document
+ deployDoc.appendChild(deploy);
+
+ try
+ {
+ Thread.currentThread().setContextClassLoader(loader);
+ // and run the axis administrator
+ admin.AdminService(msgContext, deployDoc);
+ return root;
+ } catch(AxisFault e)
+ {
throw new DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
- }
- }
-
- /** undeploys a given app */
- protected void undeploy(URL url, Object info)
- throws DeploymentException {
- // we create a new message context
- MessageContext msgContext = new MessageContext((AxisServer)
axisServerMap.get(getRootContext()));
- // this was the deployment command
- Element root=(Element) info;
- // from which we extract an undeployment counterpart
- Document undeployDoc=XMLUtils.newDocument();
- Element undeploy=undeployDoc.createElementNS("m","undeploy");
- undeploy.setAttributeNS("xmlns","m","AdminService");
- // all service and handler entries are copied for
- // that purpose
- NodeList children=root.getElementsByTagName("service");
- for(int count=0;count<children.getLength();count++) {
- Node actNode=children.item(count);
- undeploy.appendChild(undeployDoc.importNode(actNode,true));
- }
- children=root.getElementsByTagName("handler");
- for(int count=0;count<children.getLength();count++) {
- Node actNode=children.item(count);
- undeploy.appendChild(undeployDoc.importNode(actNode,true));
- }
- // put command into document
- undeployDoc.appendChild(undeploy);
-
- try{
- // and call the administrator
- admin.AdminService(msgContext,undeployDoc);
- } catch(AxisFault e) {
- throw new DeploymentException(COULD_NOT_UNDEPLOY,e);
- }
- }
+ } finally
+ {
+ Thread.currentThread().setContextClassLoader(previous);
+ }
+ } catch(IOException e)
+ {
+ throw new DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
+ } catch(NamingException e)
+ {
+ throw new DeploymentException(COULD_NOT_DEPLOY_DESCRIPTOR,e);
+ }
+ }
+
+ /** undeploys a given app */
+ protected void undeploy(URL url, Object info)
+ throws DeploymentException
+ {
+ // we create a new message context
+ MessageContext msgContext = new MessageContext((AxisServer)
axisServerMap.get(getRootContext()));
+ // this was the deployment command
+ Element root=(Element) info;
+ // from which we extract an undeployment counterpart
+ Document undeployDoc=XMLUtils.newDocument();
+ Element undeploy=undeployDoc.createElementNS("m","undeploy");
+ undeploy.setAttributeNS("xmlns","m","AdminService");
+ // all service and handler entries are copied for
+ // that purpose
+ NodeList children=root.getElementsByTagName("service");
+ for(int count=0;count<children.getLength();count++)
+ {
+ Node actNode=children.item(count);
+ undeploy.appendChild(undeployDoc.importNode(actNode,true));
+ }
+ children=root.getElementsByTagName("handler");
+ for(int count=0;count<children.getLength();count++)
+ {
+ Node actNode=children.item(count);
+ undeploy.appendChild(undeployDoc.importNode(actNode,true));
+ }
+ // put command into document
+ undeployDoc.appendChild(undeploy);
+
+ try
+ {
+ // and call the administrator
+ admin.AdminService(msgContext,undeployDoc);
+ } catch(AxisFault e)
+ {
+ throw new DeploymentException(COULD_NOT_UNDEPLOY,e);
+ }
+ }
+
+ /** deploys a given file/directory/descriptor */
+ protected Object deploy(URL url) throws DeploymentException
+ {
+
+ if(url.getFile().toLowerCase().endsWith(XML_FILE_EXTENSION))
+ {
+ // pure file deployment
+ return deployDescriptor(url,new URLClassLoader(new URL[0],
+ Thread.currentThread().getContextClassLoader()));
+ } else
+ {
+ // wsr archive deployment
+ try
+ {
+ // copy the archive
+ URL copy=getLocalCopy(url,new DeploymentInfo(url)).toURL();
+
+ // and install new classloader apartment
+ URLClassLoader newClassLoader=new URLClassLoader(new URL[]
+ {copy},
+ Thread.currentThread().getContextClassLoader());
+
+ // extract the deployment descriptor from the file
+ URL
deploymentDescriptor=newClassLoader.getResource(WEB_SERVICE_DESCRIPTOR);
+
+ // and deploy the pure descriptor
+ if(deploymentDescriptor!=null)
+ return deployDescriptor(deploymentDescriptor,newClassLoader);
+ else
+ throw new DeploymentException(NO_VALID_WEB_SERVICE_DESCRIPTOR);
+
+
+ } catch(IOException e)
+ {
+ throw new DeploymentException(COULD_NOT_COPY_URL);
+ }
+
+ }
+ }
+
+ //
+ // Some helper methods
+ //
+
+ /** work around broken JarURLConnection caching... thx Jules for the hack ;-) */
+ private URL fixURL(URL url) throws MalformedURLException
+ {
+ String urlString=url.toString();
+ //determine the last slash
+ int index=urlString.lastIndexOf(":")+1;
+ // no slash, we take the last protocol or drive id
+ if(index==0) {
+ // we cannot fix this
+ return url;
+ } else {
+ return new URL(urlString.substring(0,index)+
+ "/."+urlString.substring(index));
+ }
+ }
- /** deploys a given file/directory/descriptor */
- protected Object deploy(URL url) throws DeploymentException {
-
- if(url.getFile().toLowerCase().endsWith(XML_FILE_EXTENSION)) {
- // pure file deployment
- return deployDescriptor(url,new URLClassLoader(new URL[0],
- Thread.currentThread().getContextClassLoader()));
- } else {
- // wsr archive deployment
- try{
- // copy the archive
- URL copy=getLocalCopy(url,null).toURL();
-
- // and install new classloader apartment
- URLClassLoader newClassLoader=new URLClassLoader(new URL[] {copy},
- Thread.currentThread().getContextClassLoader());
-
- // extract the deployment descriptor from the file
- URL
deploymentDescriptor=newClassLoader.getResource(WEB_SERVICE_DESCRIPTOR);
-
- // and deploy the pure descriptor
- if(deploymentDescriptor!=null)
- return deployDescriptor(deploymentDescriptor,newClassLoader);
- else
- throw new DeploymentException(NO_VALID_WEB_SERVICE_DESCRIPTOR);
-
-
- } catch(IOException e) {
- throw new DeploymentException(COULD_NOT_COPY_URL);
- }
-
- }
- }
-}
+
+}
\ No newline at end of file
1.3 +2 -4
contrib/jboss.net/src/main/org/jboss/net/axis/server/Constants.java
Index: Constants.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jboss.net/src/main/org/jboss/net/axis/server/Constants.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Constants.java 2001/10/07 20:06:11 1.2
+++ Constants.java 2001/12/05 11:00:26 1.3
@@ -6,7 +6,7 @@
*/
-// $Id: Constants.java,v 1.2 2001/10/07 20:06:11 cgjung Exp $
+// $Id: Constants.java,v 1.3 2001/12/05 11:00:26 cgjung Exp $
package org.jboss.net.axis.server;
@@ -14,7 +14,7 @@
* Some Constants for the axis package
* @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a>
* @created 28. September 2001
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public interface Constants {
@@ -38,14 +38,12 @@
static final String AXIS_CONFIGURATION_FILE="axis-config.xml";
static final String WEB_SERVICE_DESCRIPTOR="META-INF/web-service.xml";
- static final String AXIS_ALREADY_INITIALIZED="Axis has already been
initialised.";
static final String AXIS_DEPLOYMENT_DESCRIPTOR_NOT_FOUND="The axis deployment
descriptor is lacking in the service archive!";
static final String ABOUT_TO_DEPLOY_0_UNDER_CONTEXT_1="About to deploy axis web
application from {0} under context {1}.";
static final String AXIS_ALREADY_STARTED="Axis has already been started.";
static final String ABOUT_TO_UNDEPLOY_0="About to undeploy axis web application
from {0}.";
static final String COULD_NOT_STOP_AXIS="Could not correctly stop Axis.";
static final String AXIS_ALREADY_STOPPED="Axis has already been stopped.";
- static final String AXIS_ALREADY_DESTROYED="Axis has already been destroyed.";
static final String SET_WAR_DEPLOYER_0="Seting WarDeployerName to {0}.";
static final String SET_ROOT_CONTEXT_0="Seting RootContext to {0}.";
static final String ABOUT_TO_DEPLOY_AXIS_0="About to deploy axis descriptor
{0}.";
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development