Class EventProxyFactory<T>
- java.lang.Object
-
- sk.ipesoft.d2000.d2japi.annotations.EventProxyFactory<T>
-
- Type Parameters:
T- annotated interface
public class EventProxyFactory<T> extends java.lang.ObjectFactory class for creating "EventProxy" objects.EventProxy is object that represents "callable" object in D2000 (Event, Schema or JAPI Session). EventProxy implements an user defined interface annotated with annotations from
sk.ipesoft.d2000.d2japi.annotations.eventBindingpackage. Its implementation transforms method calls to RPC and SBA calls.EventProxy instance is associated with one JAPI Session instance - the one passed to one of
createorcreateDefaultmethods. All RPC and SBA calls are send from associated session.RPC and SBA calls made via certain EventProxy instance are all addressed to D2000 callable object identified by:
- ProcessHOBJ
- HOBJ of EventHandler process, HI process, JAPI Session.
- ObjectHOBJ
- HOBJ of Event or Schema. Use 0 in case of JAPI Session.
- InstanceID
- Number of instance, default is 0.
HOBJs of process and object can be obtained from optional attribute of annotation
Event.name(). If provided, the name is resolved to HOBJ of object. When name of D2000 Event is provided, its parent HOBJ is used as HOBJ of process. When name of D2000 Schema is provided only HOBJ of object is usable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tcreate(int processHobj, int objectHobj, int instanceId, D2Session session)Create new instance of EventProxy.Tcreate(int processHobj, int instanceId, D2Session session)Create new instance of EventProxy.Tcreate(int processHobj, D2Session session)Create new instance of EventProxy.Tcreate(java.lang.String processName, int instanceId, D2Session session)Create new instance of EventProxy synchronously.Tcreate(java.lang.String processName, java.lang.String objectName, int instanceId, D2Session session)Create new instance of EventProxy.Tcreate(java.lang.String processName, D2Session session)Create new instance of EventProxy synchronously.FutureEvent<T>createAsync(java.lang.String processName, int instanceId, D2Session session)Create new instance of EventProxy asynchronously.FutureEvent<T>createAsync(java.lang.String processName, D2Session session)Create new instance of EventProxy asynchronously.TcreateDefault(java.lang.String objectName, D2Session session)Create new instance of EventProxy synchronously.TcreateDefault(D2Session session)Create new instance of EventProxy.FutureEvent<T>createDefaultAsync(java.lang.String objectName, D2Session session)Create new instance of EventProxy asynchronously.static <T> EventProxyFactory<T>createFactory(java.lang.Class<T> type, D2Session session)Create instance of EventProxyFactory that would create instances implementingTinterface.static <T> EventProxyFactory<T>createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor)Create instance of EventProxyFactory that would create instances implementingTinterface.
-
-
-
Method Detail
-
createFactory
public static <T> EventProxyFactory<T> createFactory(java.lang.Class<T> type, D2Session session) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Create instance of EventProxyFactory that would create instances implementingTinterface. Use default instance ofUnivalConvertorofsession's connector.- Type Parameters:
T- annotated interface- Parameters:
type- reference to the type of annotated interfacesession- connected JAPI Session object used for resolving D2000 names to HOBJ. It can be different than one passed to any ofcreateandcreateDefaultmethods, but MUST be connected to the same D2000 kernel.- Returns:
- new instance of EventProxyFactory
- Throws:
java.util.concurrent.ExecutionException- encapsulates exception thrown by JAPI Sessionjava.lang.InterruptedException- thrown when interrupted during waiting for result of JAPI Session requestsjava.lang.IllegalArgumentException- whentypeis annotated incorrectly
-
createFactory
public static <T> EventProxyFactory<T> createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Create instance of EventProxyFactory that would create instances implementingTinterface. Use custom instance ofUnivalConvertor.- Type Parameters:
T- annotated interface- Parameters:
type- reference to the type of annotated interfacesession- connected JAPI Session object used for resolving D2000 names to HOBJ. It can be different than one passed to any ofcreateandcreateDefaultmethods, but MUST be connected to the same D2000 kernel.convertor- instance of UnivalConvertor, could be shared by several factories to improve performance- Returns:
- new instance of EventProxyFactory
- Throws:
java.util.concurrent.ExecutionException- encapsulates exception thrown by JAPI Sessionjava.lang.InterruptedException- thrown when interrupted during waiting for result of JAPI Session requestsjava.lang.IllegalArgumentException- whentypeis annotated incorrectly
-
createDefault
public T createDefault(D2Session session)
Create new instance of EventProxy. Use ObjectHOBJ and ProcessHOBJ derived fromEvent.name()and InstanceID set to 0.- Parameters:
session- associate session- Returns:
- new instance of EventProxy
-
createDefault
public T createDefault(java.lang.String objectName, D2Session session) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new instance of EventProxy synchronously. Use ObjectHOBJ and ProcessHOBJ derived fromobjectNameparameter and InstanceID set to 0.- Parameters:
objectName- name of D2000 callable object.session- associate session- Returns:
- new instance of EventProxy
- Throws:
java.lang.InterruptedException- thrown when interrupted during resolvingobjectNamejava.util.concurrent.ExecutionException- thrown when JAPI session throws exception during resolvingobjectName
-
createDefaultAsync
public FutureEvent<T> createDefaultAsync(java.lang.String objectName, D2Session session)
Create new instance of EventProxy asynchronously. Use ObjectHOBJ and ProcessHOBJ derived fromobjectNameparameter and InstanceID set to 0.- Parameters:
objectName- name of D2000 callable object.session- associate session- Returns:
- new instance of EventProxy
-
create
public T create(java.lang.String processName, D2Session session) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new instance of EventProxy synchronously. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ derived fromprocessNameparameter and InstanceID set to 0.- Parameters:
processName- name D2000 processsession- associate session- Returns:
- new instance of EventProxy
- Throws:
java.lang.InterruptedException- thrown when interrupted during resolvingobjectNamejava.util.concurrent.ExecutionException- thrown when JAPI session throws exception during resolvingobjectName
-
createAsync
public FutureEvent<T> createAsync(java.lang.String processName, D2Session session)
Create new instance of EventProxy asynchronously. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ derived fromprocessNameparameter and InstanceID set to 0.- Parameters:
processName- name D2000 processsession- associate session- Returns:
- new instance of EventProxy
-
create
public T create(int processHobj, D2Session session)
Create new instance of EventProxy. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ passed inprocessHobjparameter InstanceID set to 0.- Parameters:
processHobj- HOBJ of D2000 processsession- associate session- Returns:
- new instance of EventProxy
-
create
public T create(java.lang.String processName, int instanceId, D2Session session) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new instance of EventProxy synchronously. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ derived fromprocessNameparameter and InstanceID passed ininstanceIdparameter.- Parameters:
processName- name D2000 processinstanceId- ID of callable object instancesession- associate session- Returns:
- new instance of EventProxy
- Throws:
java.lang.InterruptedException- thrown when interrupted during resolvingobjectNamejava.util.concurrent.ExecutionException- thrown when JAPI session throws exception during resolvingobjectName
-
createAsync
public FutureEvent<T> createAsync(java.lang.String processName, int instanceId, D2Session session)
Create new instance of EventProxy asynchronously. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ derived fromprocessNameparameter and InstanceID passed ininstanceIdparameter.- Parameters:
processName- name D2000 processinstanceId- ID of callable object instancesession- associate session- Returns:
- new instance of EventProxy
-
create
public T create(int processHobj, int instanceId, D2Session session)
Create new instance of EventProxy. Use ObjectHOBJ derived fromEvent.name(), ProcessHOBJ passed inprocessHobjparameter and InstanceID passed ininstanceIdparameter.- Parameters:
processHobj- HOBJ of D2000 processinstanceId- ID of callable object instancesession- associate session- Returns:
- new instance of EventProxy
-
create
public T create(java.lang.String processName, java.lang.String objectName, int instanceId, D2Session session) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new instance of EventProxy. Use ObjectHOBJ derived fromobjectNameparameter, ProcessHOBJ derived fromprocessNameparameter and InstanceID passed ininstanceIdparameter.- Parameters:
processName- name of D2000 processobjectName- name of D2000 callable objectinstanceId- ID of callable object instancesession- associate session- Returns:
- new instance of EventProxy
- Throws:
java.lang.InterruptedException- thrown when interrupted during resolvingobjectNameandprocessNamejava.util.concurrent.ExecutionException- thrown when JAPI session throws exception during resolvingobjectNameandprocessName
-
create
public T create(int processHobj, int objectHobj, int instanceId, D2Session session)
Create new instance of EventProxy. Use ObjectHOBJ passed inobjectNameparameter, ProcessHOBJ passed inprocessNameparameter and InstanceID passed ininstanceIdparameter.- Parameters:
processHobj- HOBJ of D2000 processobjectHobj- HOBJ of D2000 callable objectinstanceId- ID of callable object instancesession- associate session- Returns:
- new instance of EventProxy
-
-