|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttw.net.ocs.OCSInterfaceProxyFactory
public class OCSInterfaceProxyFactory
Generates interface proxies through which server-side subjects may be called.
Method Summary | |
---|---|
static java.lang.Object |
generateProxyFor(java.lang.Class[] interfaces,
java.lang.Class subjectClass,
java.lang.String subjectID)
Creates an object which implements one or more interfaces and functions as a proxy of a server-side subject. |
static java.lang.Object |
generateProxyFor(java.lang.Class[] interfaces,
java.lang.Class subjectClass,
java.lang.String subjectID,
OCSClient ocsClient,
boolean checkMethodMatch)
Creates an object which implements one or more interfaces and functions as a proxy of a server-side subject. |
static java.lang.Object |
generateProxyFor(java.lang.Class interfce,
java.lang.Class subjectClass,
java.lang.String subjectID)
Creates an object which implements an interface and functions as a proxy of a server-side subject. |
static java.lang.Object |
generateProxyFor(java.lang.Class interfce,
java.lang.Class subjectClass,
java.lang.String subjectID,
OCSClient ocsClient,
boolean checkMethodMatch)
Creates an object which implements an interface and allows to call a server-side subject. |
static void |
init(OCSClient ocsClient)
Optionally initializes the factory by setting an OCSClient to use in the absence of an explicit specification. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void init(OCSClient ocsClient)
Optionally initializes the factory by setting an OCSClient to use in the absence of an explicit specification. If not set and no OCSClient is specified with the proxy creation, the OCSClient standard instance will be used.
ocsClient
- the OCSClient to use if none is specified in a proxy creation callpublic static java.lang.Object generateProxyFor(java.lang.Class[] interfaces, java.lang.Class subjectClass, java.lang.String subjectID, OCSClient ocsClient, boolean checkMethodMatch) throws OCSException
Creates an object which implements one or more interfaces and functions as a proxy of a server-side subject. The object can be cast to each of the interfaces in order to call the methods declared by an interface. A method call is executed by delegating it to a server-side subject of the specified class. By specifying its ID, the interface proxy can be made to call a particular subject. If no ID is given, the proxy will attach to an arbitrary instance of the subject class. Note that a subject class need not officially implement an interface in order to qualify as a legal addressee of an interface proxy! It suffices that it provides the methods declared in the interface. The subject needs not even provide every method of the interface: As long as a missing method never gets called, no havoc will result. Optionally, the subject class can be checked to make sure it implements every method declared in the interfaces: if this check fails, an OCSException is thrown. Omitting this check is legal; however, calling an interface method which is missing in the subject will result in an OCSRuntimeException being thrown. Note that, other than class proxies, interface proxies cannot create subjects, but only call subjects already available on the server. Subjects to be addressed by interface proxies must therefore be provided by other means. Communication to the server side is mediated by an OCSClient. If none is specified, a possible instance installed in the factory is used, otherwise the standard OCSClient instance. Note that in addition to the interface/s specified as the first argument, the created interface proxy also implements the methods declared in interface OCSInterfaceProxy and its parent interface OCSProxy.
interfaces
- the interfaces that the proxy should implementsubjectClass
- class of the server-side subjectsubjectID
- ID of the subject (may be null)ocsClient
- the OCSClient to use for communication with the servercheckMethodMatch
- ensure that the subject class implements every method declared in the interfaces?
OCSException
- if the subject class is required to implement all the interface's methods and does not
OCSRuntimeException
- in case of an error on the server sideOCSInterfaceProxy
,
OCSProxy
,
OCSServer.addSubject(java.lang.Object, java.lang.Class, java.lang.String, boolean, boolean)
public static java.lang.Object generateProxyFor(java.lang.Class[] interfaces, java.lang.Class subjectClass, java.lang.String subjectID) throws OCSException
Creates an object which implements one or more interfaces and functions as a proxy of a server-side subject. For communication with the server, a possible OCSClient instance installed in the factory is used, otherwise the standard instance accessible in class OCSClient. The subject class gets checked whether it implements every method declared in the interfaces. If it does not, an OCSException is thrown. (See another overload of this method for a more detailed description.)
interfaces
- the interfaces that the proxy shall implementsubjectClass
- class of the server-side subjectsubjectID
- ID of the subject
OCSException
- if the subject class is required to match the interface methods and does not
OCSRuntimeException
- in case of an error on the server sidegenerateProxyFor(java.lang.Class[],java.lang.Class,java.lang.String,tw.net.ocs.OCSClient,boolean)
,
OCSInterfaceProxy
,
OCSProxy
public static java.lang.Object generateProxyFor(java.lang.Class interfce, java.lang.Class subjectClass, java.lang.String subjectID, OCSClient ocsClient, boolean checkMethodMatch) throws OCSException
Creates an object which implements an interface and allows to call a server-side subject. The object can be cast to the interfaces in order to call the methods declared by it. A method call is executed by delegating it to a server-side subject of the specified class. By specifying its ID, the interface proxy can be made to call a particular subject. If no ID is given, the proxy will call an arbitrary instance of the subject class. Note that the subject class need not officially implement the interface in order to qualify as a legal addressee of an interface proxy! It suffices that it provide the methods declared in the interface. The subject need not even provide every method of the interface: as long as a missing method never gets called, no havoc will result. Optionally, the subject class can be checked to make sure it implements every method declared in the interface: if this check fails, an OCSException is thrown. Omitting this check is legal; however, calling an interface method which is missing in the subject will result in an OCSRuntimeException being thrown. Note that, other than class proxies, interface proxies cannot create subjects, but only call subjects already available on the server. Subjects to be addressed by interface proxies must therefore be provided by other means. Communication to the server side is mediated by an OCSClient. If none is specified, a possible instance installed in the factory is used, otherwise the standard OCSClient instance. Note that in addition to the interface specified as the first argument, the created interface proxy also implements the methods declared in interface OCSInterfaceProxy and its parent interface OCSProxy.
interfce
- the interface that the proxy shall implementsubjectClass
- class of the server side subjectsubjectID
- ID of the subjectocsClient
- the OCSClient to use for communication with the servercheckMethodMatch
- ensure that the subject class implements the methods declared in the interface?
OCSException
- if the subject class is required to match the interface methods and does not
OCSRuntimeException
- in case of an error on the server sidegenerateProxyFor(java.lang.Class[],java.lang.Class,java.lang.String,tw.net.ocs.OCSClient,boolean)
,
OCSInterfaceProxy
,
OCSProxy
,
OCSServer.addSubject(java.lang.Object, java.lang.Class, java.lang.String, boolean, boolean)
public static java.lang.Object generateProxyFor(java.lang.Class interfce, java.lang.Class subjectClass, java.lang.String subjectID) throws OCSException
Creates an object which implements an interface and functions as a proxy of a server-side subject. For communication with the server, a possible OCSClient instance installed in the factory is used, otherwise the standard instance accessible in class OCSClient. The subject class gets checked whether it implements every method declared in the interface. If it does not, an OCSException is thrown. (See another overload of this method for a more detailed description.)
interfce
- the interface that the proxy shall implementsubjectClass
- class of the server side subjectsubjectID
- ID of the subject
OCSException
- if the subject class is required to match the interface methods and does not
OCSRuntimeException
- in case of an error on the server sidegenerateProxyFor(java.lang.Class,java.lang.Class,java.lang.String,tw.net.ocs.OCSClient,boolean)
,
OCSInterfaceProxy
,
OCSProxy
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |