/*
* HostingNetworkAgent.java
*
* Created on September 14, 2001, 2:26 PM
*
* Interacts with the HSP
. The HostingNetworkAgent,
* when it is constructed, gets a reference to an HSP.
* The getHSP method returns this reference.
*/
package jicos.system;
import java.rmi.*;
/** Interacts on behalf of a client to get a reference to a HostingServiceProvider.
*
* @author Peter Cappello
* @version 1.0
*/
public final class HSPAgent
{
HSP hsp;
/** Creates new HostingNetworkProvider Agent
*
* Sets a reference to a HSP
.
* @param HSPName The domain name of the HostingServiceProvider.
*/
public HSPAgent(String HSPName)
{
System.setSecurityManager( new RMISecurityManager() );
try
{
hsp = (HSP) Naming.lookup ( "//" + HSPName + ":5239/" +
TaskServer2HSP.NAME );
}
catch (Exception e)
{
e.printStackTrace();
}
}
/** Returns a Remote
reference to the HSP.
* @return a Remote
reference to the HSP.
*/
public HSP getHSP()
{
return hsp;
}
/** Returns a Remote
reference to a TaskServer.
* @return a Remote
reference to a TaskServer.
* @param hostInfo The data container of Host information. This information is used
* (well, perhaps in the future) to determine the best TaskServer
* to return.
*/
TaskServer getTaskServer( HostInfo hostInfo )
{
TaskServer s = null;
try
{
s = ((TaskServer2HSP) hsp).getTaskServer( hostInfo );
}
catch (Exception e)
{
e.printStackTrace();
}
return s;
}
}