Class horb.orb.HORBServer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class horb.orb.HORBServer

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----horb.orb.HORBServer

public class HORBServer
extends Thread
implements Cloneable
HORB Server. Port server and system management.

A thread of HORB Server serves a port to accept requests for object creation and thread creation. Multiple ports can be served with multiple HORB servers. If port number is designated to -1, a HORB Server starts without port server. You can use such HORB server for invitation.

When you alter this class, be careful for multithreading with other HORBServer threads.

See Also:
HORB, IOCIService, IOCI

Constructor Index

 o HORBServer(int)
Start a new HORB Server for the specified port.
 o HORBServer(int, String, String)
Start a new HORB Server for the specified port.
 o HORBServer(ServerStatus)
Starts a new HORB Server with the specified characteristics in serverStatus.

Method Index

 o debugging()
returns debugging flag of the HORB server for the current thread.
 o getClientHostName()
returns current client's hostname.
 o getClientInetAddress()
returns current client's IP address.
 o getClientNetAddress()
 o getCurrentPort()
return the current port connecting to the client.
 o getHORBServer()
returns HORB server for the current thread
 o getHORBServer(int)
returns HORB server for the port.
 o getIOCIService()
return the current IOCI object of the current thread.
 o getLocalHostName()
returns local hostname.
 o getLocalInetAddress()
returns IP address of the local host.
 o getLocalNetAddress()
returns network address of the local host in byte array.
 o getObject(String)
return registered object having the requested objectID.
 o getPriority2()
returns the current thread's priority.
 o getSkeleton()
returns skeleton object of the current server thread.
 o getSystemACL()
return sytem ACL server.
 o getUsername()
return username of the client.
 o invite(HorbURL, String, HorbURL, IOCI, String, String)
This is an internal method.
 o main(String[])
HORB.exe HORB Server entry point.
 o registerObject(String, Object, String)
Register the instance of className as a HORB object.
 o registerObject(String, Object, String, int)
Register an instance of className for port.
 o run()
main loop of HORB Server.
 o setPriority2(int)
set priority of currently executing thread.
 o startACL(AclStatus[], int)
start an ACL server for this system.
 o startSystemACLMaster()
start ACL master server.
 o unRegisterObject(String)
unregister a server object registered by registerObject().

Constructors

 o HORBServer
  public HORBServer(int port) throws HORBException
Start a new HORB Server for the specified port. This HORB server accepts connect request from clients and serves them. This is a short form of HORBServer(int, String, String);
Parameters:
port - port number to serve for. If 0, port number is got from HORBClient.getPort() to set as default. This means service port is same as outgoing port number. If -1, a HORB Server is created without a port server. Such HORB Server is intended to be used in applets.
 o HORBServer
  public HORBServer(int port,
                    String name,
                    String IOCIClassName) throws HORBException
Start a new HORB Server for the specified port. This HORB server accepts connect request from clients and serves them.
Parameters:
port - port number to serve for. If 0, port number is got from HORBClient.getPort() to set as default. This means service port is same as outgoing port number. If -1, a HORB Server is created without a port server. Such HORB Server is intended to be used in applets.
name - name of this server. The thread name also uses this. If null, a default name is used. The default name is "HORBServer(portNo)".
IOCIClassName - classname of an implementation of IOCI. Default IOCI is used if null.
See Also:
 o HORBServer
  public HORBServer(ServerStatus serverStatus) throws HORBException
Starts a new HORB Server with the specified characteristics in serverStatus. Although this interface is intended to be internal use, you can use this if you need. Fill in name, IOCIClassName, port, hostnameLookup, logging, versionCheck and logFile of serverStatus before calling this entry point.
Parameters:
serverStatus - server control structure.

Methods

 o main
  public static void main(String argv[]) throws ClassNotFoundException, HORBException, InstantiationException, IllegalAccessException, IOException
HORB.exe HORB Server entry point. This main() instantiates the HORB object. The HORB object instantiates the HORBServer object if server feature is requested. This scheme keeps the HORB class small.
 o run
  public final void run()
main loop of HORB Server. This is an internal method.

accept connection and start ThreadServer.

Overrides:
run in class Thread
 o invite
  public void invite(HorbURL serverURL,
                     String serverThreadName,
                     HorbURL clientURL,
                     IOCI newIOCI,
                     String username,
                     String key) throws HORBException, IOException
This is an internal method.
 o registerObject
  public static HorbURL registerObject(String className,
                                       Object object,
                                       String objectID) throws HORBException
Register the instance of className as a HORB object. The objectID is the name of the instance. The object can be accessed from any port.

You must have a skeleton class of the className, for example horb.package1.Foo_Skeleton.class.

 Example:
   horb.package1.Foo foo = new horb.packate1.Foo("hello");
   HorbURL url = HORBServer.registerObject("horb.package1.Foo", foo, "foo1");
   The object can be accessed from outside via url.
Parameters:
className - class name to instantiate prepended package name
object - an instance of the object to be registered.
objectID - the name of the instance
Returns:
HorbURL URL of this object.
Throws: HORBException
Illegal objectID, or skeleton class not found
 o registerObject
  public static HorbURL registerObject(String className,
                                       Object object,
                                       String objectID,
                                       int port) throws HORBException
Register an instance of className for port. The objectID is the name of the instance.

You must have a skeleton class of the className, for example horb.package1.Foo_Skeleton.class.

 Example:
   horb.package1.Foo foo = new horb.packate1.Foo("hello");
   HorbURL url = HORBServer.registerObject("horb.package1.Foo", foo, "foo1", 8899);
   The object can be accessed from outside via url.
Parameters:
className - class name to instantiate prepended package name.
object - an instance of the object to be registered.
objectID - the name of the instance.
port - port number. if not 0, the object is accesible only from the port. If 0, the object is accessible from any port.
Returns:
HorbURL URL of this object.
Throws: HORBException
Illegal objectID, or skeleton class not found, or HORB server is not running for the port.
 o unRegisterObject
  public static void unRegisterObject(String objectID) throws NoObjectException
unregister a server object registered by registerObject(). This does not kill the object. Just unregister from tables.
Parameters:
objectID - object ID of the object to be unregistered.
Throws: NoObjectException
no such object found
 o getHORBServer
  public static HORBServer getHORBServer() throws HORBException
returns HORB server for the current thread
Throws: HORBException
if the current thread is not a HORB thread or server's already dead.
 o getHORBServer
  public static HORBServer getHORBServer(int port) throws HORBException
returns HORB server for the port.
Parameters:
port - server port
Throws: HORBException
if the current thread is not a HORB thread or server's already dead.
 o getPriority2
  public final static int getPriority2()
returns the current thread's priority.
 o setPriority2
  public final void setPriority2(int pri) throws IllegalArgumentException
set priority of currently executing thread.
Parameters:
newPriority - new priority
Throws: IllegalArgumentException
If the priority is not within the range of MIN_PRIORITY and MAX_PRIORITY.
 o debugging
  public final static boolean debugging()
returns debugging flag of the HORB server for the current thread.
 o getSkeleton
  public static Skeleton getSkeleton() throws HORBException
returns skeleton object of the current server thread.
Example:
  Skeleton skeleton = HORBServer.getSkeleton();
  skeleton.accept(0);
 o getClientHostName
  public final static String getClientHostName() throws HORBException
returns current client's hostname.
Returns:
client's hostname.
 o getClientInetAddress
  public final static InetAddress getClientInetAddress() throws HORBException
returns current client's IP address.
Returns:
InetAddress client's IP address.
 o getClientNetAddress
  public final static byte[] getClientNetAddress() throws HORBException
 o getLocalHostName
  public final static String getLocalHostName() throws HORBException, IOException
returns local hostname.
Returns:
local hostname.
 o getLocalNetAddress
  public final static byte[] getLocalNetAddress() throws HORBException, IOException
returns network address of the local host in byte array.
Returns:
network address of the local host.
 o getLocalInetAddress
  public final static InetAddress getLocalInetAddress() throws HORBException
returns IP address of the local host.
Returns:
IP address of the local host.
 o getCurrentPort
  public final static int getCurrentPort() throws HORBException
return the current port connecting to the client.
 o getUsername
  public final static String getUsername() throws HORBException
return username of the client. null means anonymous access.
 o getIOCIService
  public final static IOCIService getIOCIService() throws HORBException
return the current IOCI object of the current thread.
 o startACL
  public final static void startACL(AclStatus acls[],
                                    int aclRefreshInterval) throws HORBException, IOException
start an ACL server for this system. This method works only once. Making an instance of HORBServer calls this method internally. If your program runs not from the HORB command and create HORB Server(s) and you need ACL, call this method before creating the HORB Servers. If you don't call this interface, HORB server starts a "pass through" ACL server. If you want access control, fill in the source field of at least one AclStatus and pass them to this method. Call HORBServer.startSystemACLMaster() if you want to make this ACL a master ACL.
	AclStatus acl = new AclStatus();
	acl.source = "client.acl";
	AclStatus[] acls = new AclStatus[1];
	acls[0] = acl;
	HORBServer.startACL(acls, 0);
	HORBServer hs = new HORBServer(8886, null, null);
	// HORBServer.startSystemACLMaster(); // if you want
Parameters:
acls - array of ACL statuses. The source fields are mandatory.
aclRefreshInterval - ACL refresh interval in seconds. If 0, no refresh occurs.
Throws: HORBException
Exception occured while loading the ACL files.
Throws: IOException
I/O Exception occured while loading the ACL files.
See Also:
startACLMaster
 o getSystemACL
  public final static ACL getSystemACL()
return sytem ACL server.
 o startSystemACLMaster
  public final static void startSystemACLMaster() throws HORBException, IOException
start ACL master server.
 o getObject
  public final static Object getObject(String objectID) throws HORBException
return registered object having the requested objectID.
Parameters:
objectID - objectID of the object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index