Java Reference
In-Depth Information
L ISTING 7.13 Continued
public ServerRepositoryImpl() throws RemoteException {
if (System.getSecurityManager() == null) {
System.out.println(“new RMISecurityManager()”);
System.setSecurityManager(new RMISecurityManager());
}
try {
String name = “rmi://localhost/deployletRepository”;
Naming.rebind(name, this);
System.out.println(“Server bound with name \””+name+”\””);
} catch (Exception e) {
System.err.println(“ServerRepositoryImpl - binding: “ + e.toString() );
}
}
/**
* creates the server deploylet name based on its client counterpart address
*/
public String getDeployletName(String clientHost) {
return clientHost;
}
/**
* return the specified server deploylet or create it
*/
public Deploylet getServerDeploylet(String deployletName) {
if (repository.containsKey(deployletName) )
return (Deploylet)repository.get(deployletName);
// create it from scratch
ServerDeploylet sd = null;
try {
String name = deployletName + “-” + repository.keySet().size();
sd = new ServerDeploylet(name);
sd.applicationInstallation();
System.out.println(“ServerRepositoryImpl - added”);
} catch (Exception e) {
System.err.println(“creating ServerDeploylet: “ + deployletName);
}
repository.put(deployletName, sd);
return sd;
}
/**
* remove the given server deploylet
*/
Search WWH ::




Custom Search