mx4j/src/tools/mx4j/tools/remote/soap SOAPConnectionPivot.java,1.4,1.5

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

Modified Files:
	SOAPConnectionPivot.java 
Log Message:
+ Fixed retrieval of JMXServiceURL in case of default HTTP/HTTPS ports
+ Fixed wrong code when looking up the connection manager

Index: SOAPConnectionPivot.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/soap/SOAPConnectionPivot.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SOAPConnectionPivot.java	25 Dec 2003 22:42:19 -0000	1.4
--- SOAPConnectionPivot.java	18 Jul 2004 21:09:33 -0000	1.5
***************
*** 14,18 ****
  import java.util.Map;
  import java.util.Set;
- 
  import javax.management.Attribute;
  import javax.management.AttributeList;
--- 14,17 ----
***************
*** 35,42 ****
  
  import mx4j.tools.remote.Connection;
  import org.apache.axis.MessageContext;
  
  /**
-  *
   * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
--- 34,41 ----
  
  import mx4j.tools.remote.Connection;
+ import mx4j.tools.remote.ConnectionManager;
  import org.apache.axis.MessageContext;
  
  /**
   * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
***************
*** 45,49 ****
  {
     private final Map connections = new HashMap();
-    private SOAPConnectionManager connectionManager;
  
     public String connect(Object credentials) throws IOException, SecurityException
--- 44,47 ----
***************
*** 52,63 ****
  
        // Lookup the ConnectionManager
!       synchronized (this)
!       {
!          if (connectionManager == null)
!          {
!             connectionManager = SOAPConnectorServer.find(address);
!             if (connectionManager == null) throw new IOException("Could not find ConnectionManager. Make sure a SOAPConnectorServer is in classloader scope and bound at this address " + address);
!          }
!       }
        Connection connection = connectionManager.connect(credentials);
        String id = connection.getConnectionId();
--- 50,55 ----
  
        // Lookup the ConnectionManager
!       ConnectionManager connectionManager = SOAPConnectorServer.find(address);
!       if (connectionManager == null) throw new IOException("Could not find ConnectionManager. Make sure a SOAPConnectorServer is in classloader scope and bound at this address " + address);
        Connection connection = connectionManager.connect(credentials);
        String id = connection.getConnectionId();
***************
*** 77,81 ****
        String url = (String)context.getProperty(MessageContext.TRANS_URL);
        JMXServiceURL temp = new JMXServiceURL("service:jmx:" + url);
!       return new JMXServiceURL("soap", "localhost", temp.getPort(), temp.getURLPath());
     }
  
--- 69,84 ----
        String url = (String)context.getProperty(MessageContext.TRANS_URL);
        JMXServiceURL temp = new JMXServiceURL("service:jmx:" + url);
!       int port = temp.getPort();
!       if ("http".equals(temp.getProtocol()) && port == 0)
!       {
!          // Default HTTP port, set it to 80
!          port = 80;
!       }
!       else if ("https".equals(temp.getProtocol()) && port == 0)
!       {
!          // Default HTTPS port, set it to 443
!          port = 443;
!       }
!       return new JMXServiceURL("soap", null, port, temp.getURLPath());
     }
  
***************
*** 118,126 ****
     public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature, Subject delegate)
             throws ReflectionException,
!            InstanceAlreadyExistsException,
!            MBeanRegistrationException,
!            MBeanException,
!            NotCompliantMBeanException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 121,129 ----
     public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature, Subject delegate)
             throws ReflectionException,
!                   InstanceAlreadyExistsException,
!                   MBeanRegistrationException,
!                   MBeanException,
!                   NotCompliantMBeanException,
!                   IOException
     {
        SOAPConnection connection = findConnection();
***************
*** 130,139 ****
     public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature, Subject delegate)
             throws ReflectionException,
!            InstanceAlreadyExistsException,
!            MBeanRegistrationException,
!            MBeanException,
!            NotCompliantMBeanException,
!            InstanceNotFoundException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 133,142 ----
     public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature, Subject delegate)
             throws ReflectionException,
!                   InstanceAlreadyExistsException,
!                   MBeanRegistrationException,
!                   MBeanException,
!                   NotCompliantMBeanException,
!                   InstanceNotFoundException,
!                   IOException
     {
        SOAPConnection connection = findConnection();
***************
*** 179,186 ****
     public Object getAttribute(ObjectName name, String attribute, Subject delegate)
             throws MBeanException,
!            AttributeNotFoundException,
!            InstanceNotFoundException,
!            ReflectionException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 182,189 ----
     public Object getAttribute(ObjectName name, String attribute, Subject delegate)
             throws MBeanException,
!                   AttributeNotFoundException,
!                   InstanceNotFoundException,
!                   ReflectionException,
!                   IOException
     {
        SOAPConnection connection = findConnection();
***************
*** 197,205 ****
     public void setAttribute(ObjectName name, Attribute attribute, Subject delegate)
             throws InstanceNotFoundException,
!            AttributeNotFoundException,
!            InvalidAttributeValueException,
!            MBeanException,
!            ReflectionException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 200,208 ----
     public void setAttribute(ObjectName name, Attribute attribute, Subject delegate)
             throws InstanceNotFoundException,
!                   AttributeNotFoundException,
!                   InvalidAttributeValueException,
!                   MBeanException,
!                   ReflectionException,
!                   IOException
     {
        SOAPConnection connection = findConnection();
***************
*** 209,214 ****
     public AttributeList setAttributes(ObjectName name, AttributeList attributes, Subject delegate)
             throws InstanceNotFoundException,
!            ReflectionException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 212,217 ----
     public AttributeList setAttributes(ObjectName name, AttributeList attributes, Subject delegate)
             throws InstanceNotFoundException,
!                   ReflectionException,
!                   IOException
     {
        SOAPConnection connection = findConnection();
***************
*** 218,224 ****
     public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature, Subject delegate)
             throws InstanceNotFoundException,
!            MBeanException,
!            ReflectionException,
!            IOException
     {
        SOAPConnection connection = findConnection();
--- 221,227 ----
     public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature, Subject delegate)
             throws InstanceNotFoundException,
!                   MBeanException,
!                   ReflectionException,
!                   IOException
     {
        SOAPConnection connection = findConnection();



-------------------------------------------------------
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.