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
-
HORBServer(int)
- Start a new HORB Server for the specified port.
-
HORBServer(int, String, String)
- Start a new HORB Server for the specified port.
-
HORBServer(ServerStatus)
- Starts a new HORB Server with the specified characteristics in
serverStatus.
-
debugging()
- returns debugging flag of the HORB server for the current thread.
-
getClientHostName()
- returns current client's hostname.
-
getClientInetAddress()
- returns current client's IP address.
-
getClientNetAddress()
-
-
getCurrentPort()
- return the current port connecting to the client.
-
getHORBServer()
- returns HORB server for the current thread
-
getHORBServer(int)
- returns HORB server for the port.
-
getIOCIService()
- return the current IOCI object of the current thread.
-
getLocalHostName()
- returns local hostname.
-
getLocalInetAddress()
- returns IP address of the local host.
-
getLocalNetAddress()
- returns network address of the local host in byte array.
-
getObject(String)
- return registered object having the requested objectID.
-
getPriority2()
- returns the current thread's priority.
-
getSkeleton()
- returns skeleton object of the current server thread.
-
getSystemACL()
- return sytem ACL server.
-
getUsername()
- return username of the client.
-
invite(HorbURL, String, HorbURL, IOCI, String, String)
- This is an internal method.
-
main(String[])
- HORB.exe HORB Server entry point.
-
registerObject(String, Object, String)
- Register the instance of className as a HORB object.
-
registerObject(String, Object, String, int)
- Register an instance of className for port.
-
run()
- main loop of HORB Server.
-
setPriority2(int)
- set priority of currently executing thread.
-
startACL(AclStatus[], int)
- start an ACL server for this system.
-
startSystemACLMaster()
- start ACL master server.
-
unRegisterObject(String)
- unregister a server object registered by registerObject().
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.
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:
-
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.
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.
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
invite
public void invite(HorbURL serverURL,
String serverThreadName,
HorbURL clientURL,
IOCI newIOCI,
String username,
String key) throws HORBException, IOException
- This is an internal method.
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
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.
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
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.
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.
getPriority2
public final static int getPriority2()
- returns the current thread's priority.
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.
debugging
public final static boolean debugging()
- returns debugging flag of the HORB server for the current thread.
getSkeleton
public static Skeleton getSkeleton() throws HORBException
- returns skeleton object of the current server thread.
Example:
Skeleton skeleton = HORBServer.getSkeleton();
skeleton.accept(0);
getClientHostName
public final static String getClientHostName() throws HORBException
- returns current client's hostname.
- Returns:
- client's hostname.
getClientInetAddress
public final static InetAddress getClientInetAddress() throws HORBException
- returns current client's IP address.
- Returns:
- InetAddress client's IP address.
getClientNetAddress
public final static byte[] getClientNetAddress() throws HORBException
getLocalHostName
public final static String getLocalHostName() throws HORBException, IOException
- returns local hostname.
- Returns:
- local hostname.
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.
getLocalInetAddress
public final static InetAddress getLocalInetAddress() throws HORBException
- returns IP address of the local host.
- Returns:
- IP address of the local host.
getCurrentPort
public final static int getCurrentPort() throws HORBException
- return the current port connecting to the client.
getUsername
public final static String getUsername() throws HORBException
- return username of the client. null means anonymous access.
getIOCIService
public final static IOCIService getIOCIService() throws HORBException
- return the current IOCI object of the current thread.
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
getSystemACL
public final static ACL getSystemACL()
- return sytem ACL server.
startSystemACLMaster
public final static void startSystemACLMaster() throws HORBException, IOException
- start ACL master server.
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