mx4j/src/tools/mx4j/tools/remote/resolver/soap SOAPResolver.java,1.6,1.7

Simone Bordet <[email protected]>
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/resolver/soap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3953/src/tools/mx4j/tools/remote/resolver/soap

Modified Files:
	SOAPResolver.java 
Log Message:
+ Removed implementation note comment (since it is now implemented)
+ Fixed deploy/undeploy in case of external web container

Index: SOAPResolver.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/resolver/soap/SOAPResolver.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SOAPResolver.java	18 Jul 2004 21:43:29 -0000	1.6
--- SOAPResolver.java	19 Jul 2004 22:21:27 -0000	1.7
***************
*** 34,60 ****
   * @version $Revision$
   */
- 
- /**
-  * TODO: IMPLEMENTATION NOTES - FIXME IF POSSIBLE
-  * The most annoying thing is that the client JMXServiceURL is not the one used to start the server,
-  * but the one *after* the server has been started. VERY annoying. Starting the server with
-  * service:jmx:soap://localhost:8080/axis/services/jmxconnector result in the client to be able to
-  * connect only with this JMXServiceURL:
-  * service:jmx:soap://localhost:8080/axis/services/jmxconnector/id/1
-  * There is a reason for that, however.
-  * First, the service has always name 'jmxconnector' (hardcoded in server-deploy.wsdd).
-  * This is due to how Axis works (or to how I have understood it works). Up to now, I've found no way to load
-  * a server-deploy.wsdd and change the name of the service. Maybe it can be done, but sure there is no simple
-  * API in the AdminClient to do that.
-  * Second, let's assume I want to deploy on the same port (say 8080) two SOAPConnectorServers. Best solution
-  * would be to specify 2 different paths in the JMXServiceURLs, say /one/jmxconnector and /two/jmxconnector
-  * (with the limitation imposed by the previous point, it must end with 'jmxconnector').
-  * To start the second, I specify SOAPConnectorServer.USE_EXTERNAL_WEB_CONTAINER to true (so I don't start again
-  * the web container on the same port), but then I have to add a servlet mapping (namely '/two/jmxconnector')
-  * to an existing servlet (since there is one pivot per application, as specified in server-deploy.wsdd).
-  * I doubt very much that any existing web container is able to add a servlet mapping without being restarted,
-  * but I could be wrong. Jetty does not seem to have this API, I tried and servlets added after start() don't get
-  * enabled, but I have to ask Greg to be sure.
-  */
  public class SOAPResolver extends ConnectionResolver
  {
--- 34,37 ----
***************
*** 64,67 ****
--- 41,45 ----
     private static final String CLIENT_WSDD = "client.wsdd";
     private static final String AXIS_DEPLOY_SERVICE = "AdminService";
+    private static final WebContainer EXTERNAL_WEB_CONTAINER = new ExternalWebContainer();
  
     // TODO: maybe worth to use weak references to hold web containers
***************
*** 145,154 ****
     {
        WebContainer webContainer = (WebContainer)server;
!       if (webContainer != null && !isDeployed(webContainer, url))
        {
!          webContainer.deploy(AxisServlet.class.getName(), url, environment);
           if (!hasDeployed(webContainer))
           {
!             // Axis has never been deployed, deploy it now
              deploy(url, environment);
           }
--- 123,132 ----
     {
        WebContainer webContainer = (WebContainer)server;
!       if (!isDeployed(webContainer, url))
        {
!          if (webContainer != null) webContainer.deploy(AxisServlet.class.getName(), url, environment);
           if (!hasDeployed(webContainer))
           {
!             // The jmxconnector web service has never been deployed, deploy it now
              deploy(url, environment);
           }
***************
*** 191,197 ****
     {
        WebContainer webContainer = (WebContainer)server;
!       if (webContainer != null && isDeployed(webContainer, address))
        {
!          // First undeploy the service, then undeploy the webContainer: otherwise the service cannot be undeployed
           removeDeployed(webContainer, address);
           if (!hasDeployed(webContainer))
--- 169,175 ----
     {
        WebContainer webContainer = (WebContainer)server;
!       if (isDeployed(webContainer, address))
        {
!          // First undeploy the jmxconnector web service, then undeploy the webContainer: otherwise the service cannot be undeployed
           removeDeployed(webContainer, address);
           if (!hasDeployed(webContainer))
***************
*** 199,203 ****
              undeploy(address, environment);
           }
!          webContainer.undeploy(AxisServlet.class.getName(), address, environment);
        }
     }
--- 177,181 ----
              undeploy(address, environment);
           }
!          if (webContainer != null) webContainer.undeploy(AxisServlet.class.getName(), address, environment);
        }
     }
***************
*** 266,269 ****
--- 244,248 ----
     private boolean isDeployed(WebContainer webContainer, JMXServiceURL url)
     {
+       if (webContainer == null) webContainer = EXTERNAL_WEB_CONTAINER;
        Set urls = (Set)deployedURLs.get(webContainer);
        if (urls == null) return false;
***************
*** 273,276 ****
--- 252,256 ----
     private boolean hasDeployed(WebContainer webContainer)
     {
+       if (webContainer == null) webContainer = EXTERNAL_WEB_CONTAINER;
        Set urls = (Set)deployedURLs.get(webContainer);
        if (urls == null) return false;
***************
*** 280,283 ****
--- 260,264 ----
     private void addDeployed(WebContainer webContainer, JMXServiceURL url)
     {
+       if (webContainer == null) webContainer = EXTERNAL_WEB_CONTAINER;
        Set urls = (Set)deployedURLs.get(webContainer);
        if (urls == null)
***************
*** 291,294 ****
--- 272,276 ----
     private void removeDeployed(WebContainer webContainer, JMXServiceURL url)
     {
+       if (webContainer == null) webContainer = EXTERNAL_WEB_CONTAINER;
        Set urls = (Set)deployedURLs.get(webContainer);
        if (urls != null)
***************
*** 298,300 ****
--- 280,306 ----
        }
     }
+ 
+    private static class ExternalWebContainer implements WebContainer
+    {
+       public void start(JMXServiceURL url, Map environment) throws IOException
+       {
+       }
+ 
+       public void stop() throws IOException
+       {
+       }
+ 
+       public void deploy(String servletClassName, JMXServiceURL url, Map environment) throws IOException
+       {
+       }
+ 
+       public void undeploy(String servletClassName, JMXServiceURL url, Map environment)
+       {
+       }
+ 
+       public String toString()
+       {
+          return "External WebContainer";
+       }
+    }
  }



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.