soapinvocationhandler.java

来自「jmx codeJava源码」· Java 代码 · 共 46 行

JAVA
46
字号

package book.jmx.examples;

import java.util.*;
import java.net.*;
import java.lang.reflect.*;
import java.rmi.*;
import electric.registry.*;


public class SOAPInvocationHandler 
    implements InvocationHandler, SOAPConnectorConstants {

  // the remote interface
  private MBeanServerInvoker invoker = null;
  
  public SOAPInvocationHandler(Properties props) 
      throws RegistryException {
          
    System.setProperty("electric.xml.io.serialize", "yes");
    
    // retrieve the connection properties
    String host = props.getProperty(HOST, "localhost");
    String port = props.getProperty(PORT, "8085");
    String name = props.getProperty(NAME);
    String path = props.getProperty(PATH, "");
    
    // retrieve the stub
    String url = "http://" + host + ":" + port + "/" + path + "/" + name;
    invoker = (MBeanServerInvoker)Registry.bind(url, MBeanServerInvoker.class);
        
  }   
    
  public Object invoke(Object proxy, Method method,
                       Object[] args) throws Throwable {
                       
    String methodName = method.getName();

    MethodInvocation mi = new MethodInvocation(method);
    mi.setParams(args);

    return invoker.invoke(mi);
  }
  
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?