import javax.naming.*;
import java.util.Hashtable;
import com.linar.jintegra.*;
public class ComToWebSphere
{
String defaultLogicalId = "wsejb";
String defaultDcomPort = "1350";
public ComToWebSphere()
{
}
public void registerJVMandSleep(String logicalId, String dcomPort, String corbaPort)
{
String passId = null;
int passDcomPort = -1;
if (logicalId != null && logicalId != "")
passId = logicalId;
else
passId = defaultLogicalId;
if (dcomPort != null && dcomPort != "")
passDcomPort = Integer.parseInt(dcomPort);
else
passDcomPort = Integer.parseInt(defaultDcomPort);
try {
// For COM access to objects loaded via JNDI lookup
//com.linar.jintegra.Log.logImmediately(3, System.err);
// name, instanciator, port
// Jvm.register("wsejb", new EjbInstanciator(), defaultDcomPort);
// Jvm.register("wsejb", 1350);
Jvm.register(passId, new EjbInstanciator(corbaPort), passDcomPort);
System.out.println("Bridge Started");
while (true) {
Thread.sleep(5000);
}
}
catch (Exception eX) {
System.out.println("Exception Error: " + eX.getMessage());
}
}
public static void main(String[] args)
{
ComToWebSphere bridge = new ComToWebSphere();
// logicalId, Dcom Port, Corba Port
if (args.length == 3)
bridge.registerJVMandSleep(args[0], args[1], args[2]);
else
{
if (args.length == 0)
bridge.registerJVMandSleep(bridge.getDefaultLogicalId(), bridge.getDefaultDcomPort(), null);
else
System.out.println("Usage: ComToWebSphere logicalId DCOM-PORT CORBA-PORT");
}
}
public String getDefaultLogicalId()
{
return (defaultLogicalId);
}
public String getDefaultDcomPort ()
{
return (defaultDcomPort);
}
}
|