1 31 package org.objectweb.proactive.core.rmi; 32 33 public class ClassServerHelper { 34 35 38 protected ClassServer currentClassServer; 39 protected String classpath; 40 protected boolean shouldCreateClassServer = true; 41 42 public ClassServerHelper() { 46 if ((System.getSecurityManager() == null) && 47 !("false".equals(System.getProperty("proactive.securitymanager")))) { 48 System.setSecurityManager(new java.rmi.RMISecurityManager ()); 49 } 50 } 51 52 public String getClasspath() { 56 return classpath; 57 } 58 59 public void setClasspath(String v) { 60 classpath = v; 61 } 62 63 public int getClassServerPortNumber() { 64 if (currentClassServer == null) { 65 return -1; 66 } 67 return currentClassServer.getServerSocketPort(); 68 } 69 70 public boolean shouldCreateClassServer() { 71 return shouldCreateClassServer; 72 } 73 74 public void setShouldCreateClassServer(boolean v) { 75 shouldCreateClassServer = v; 76 } 77 78 public synchronized void initializeClassServer() throws java.io.IOException { 79 if (!shouldCreateClassServer) { 80 return; } 82 if (currentClassServer != null) { 83 return; } 85 if (classpath == null) { 86 currentClassServer = new ClassFileServer(); 87 } else { 88 currentClassServer = new ClassFileServer(classpath); 89 } 90 System.setProperty("java.rmi.server.codebase", 91 "http://" + currentClassServer.getHostname() + ":" + 92 currentClassServer.getServerSocketPort() + "/"); 93 } 94 95 } 99 | Popular Tags |