本文整理汇总了Java中com.sun.jmx.remote.internal.IIOPHelper类的典型用法代码示例。如果您正苦于以下问题:Java IIOPHelper类的具体用法?Java IIOPHelper怎么用?Java IIOPHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IIOPHelper类属于com.sun.jmx.remote.internal包,在下文中一共展示了IIOPHelper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRMIServer
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
private RMIServer findRMIServer(JMXServiceURL directoryURL,
Map<String, Object> environment)
throws NamingException, IOException {
final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
if (isIiop) {
// Make sure java.naming.corba.orb is in the Map.
environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
}
String path = directoryURL.getURLPath();
int end = path.indexOf(';');
if (end < 0) end = path.length();
if (path.startsWith("/jndi/"))
return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
else if (path.startsWith("/stub/"))
return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
else if (path.startsWith("/ior/")) {
if (!IIOPHelper.isAvailable())
throw new IOException("iiop protocol not available");
return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
} else {
final String msg = "URL path must begin with /jndi/ or /stub/ " +
"or /ior/: " + path;
throw new MalformedURLException(msg);
}
}
示例2: encodeStubInAddress
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
/**
* Encode a stub into the JMXServiceURL.
* @param rmiServer The stub object to encode in the URL
* @param attributes A Map containing environment parameters,
* built from the Map specified at this object creation.
**/
private void encodeStubInAddress(
RMIServer rmiServer, Map<String, ?> attributes)
throws IOException {
final String protocol, host;
final int port;
if (address == null) {
if (IIOPHelper.isStub(rmiServer))
protocol = "iiop";
else
protocol = "rmi";
host = null; // will default to local host name
port = 0;
} else {
protocol = address.getProtocol();
host = (address.getHost().equals("")) ? null : address.getHost();
port = address.getPort();
}
final String urlPath = encodeStub(rmiServer, attributes);
address = new JMXServiceURL(protocol, host, port, urlPath);
}
示例3: encodeStub
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
/**
* Returns the IOR of the given rmiServer.
**/
static String encodeStub(
RMIServer rmiServer, Map<String, ?> env) throws IOException {
if (IIOPHelper.isStub(rmiServer))
return "/ior/" + encodeIIOPStub(rmiServer, env);
else
return "/stub/" + encodeJRMPStub(rmiServer, env);
}
示例4: encodeIIOPStub
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
static String encodeIIOPStub(
RMIServer rmiServer, Map<String, ?> env)
throws IOException {
try {
Object orb = IIOPHelper.getOrb(rmiServer);
return IIOPHelper.objectToString(orb, rmiServer);
} catch (RuntimeException x) {
throw newIOException(x.getMessage(), x);
}
}
示例5: toStub
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
/**
* <p>Returns an IIOP stub.</p>
* The stub might not yet be connected to the ORB. The stub will
* be serializable only if it is connected to the ORB.
* @return an IIOP stub.
* @exception IOException if the stub cannot be created - e.g the
* RMIIIOPServerImpl has not been exported yet.
**/
public Remote toStub() throws IOException {
// javax.rmi.CORBA.Stub stub =
// (javax.rmi.CORBA.Stub) PortableRemoteObject.toStub(this);
final Remote stub = IIOPHelper.toStub(this);
// java.lang.System.out.println("NON CONNECTED STUB " + stub);
// org.omg.CORBA.ORB orb =
// org.omg.CORBA.ORB.init((String[])null, (Properties)null);
// stub.connect(orb);
// java.lang.System.out.println("CONNECTED STUB " + stub);
return stub;
}
示例6: narrowIIOPServer
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
private static RMIServer narrowIIOPServer(Object objref) {
try {
return IIOPHelper.narrow(objref, RMIServer.class);
} catch (ClassCastException e) {
if (logger.traceOn())
logger.trace("narrowIIOPServer","Failed to narrow objref=" +
objref + ": " + e);
if (logger.debugOn()) logger.debug("narrowIIOPServer",e);
return null;
}
}
示例7: shadowIiopStub
import com.sun.jmx.remote.internal.IIOPHelper; //导入依赖的package包/类
private static RMIConnection shadowIiopStub(Object stub)
throws InstantiationException, IllegalAccessException {
Object proxyStub = null;
try {
proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
return proxyStubClass.newInstance();
}
});
} catch (PrivilegedActionException e) {
throw new InternalError();
}
IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub));
return (RMIConnection) proxyStub;
}