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.Object
Factory 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.eventBinding
package. 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
create
orcreateDefault
methods. 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 T
create(int processHobj, int objectHobj, int instanceId, D2Session session)
Create new instance of EventProxy.T
create(int processHobj, int instanceId, D2Session session)
Create new instance of EventProxy.T
create(int processHobj, D2Session session)
Create new instance of EventProxy.T
create(java.lang.String processName, int instanceId, D2Session session)
Create new instance of EventProxy synchronously.T
create(java.lang.String processName, java.lang.String objectName, int instanceId, D2Session session)
Create new instance of EventProxy.T
create(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.T
createDefault(java.lang.String objectName, D2Session session)
Create new instance of EventProxy synchronously.T
createDefault(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 implementingT
interface.static <T> EventProxyFactory<T>
createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor)
Create instance of EventProxyFactory that would create instances implementingT
interface.
-
-
-
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 implementingT
interface. Use default instance ofUnivalConvertor
ofsession
'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 ofcreate
andcreateDefault
methods, 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
- whentype
is 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 implementingT
interface. 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 ofcreate
andcreateDefault
methods, 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
- whentype
is 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 fromobjectName
parameter 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 resolvingobjectName
java.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 fromobjectName
parameter 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 fromprocessName
parameter 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 resolvingobjectName
java.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 fromprocessName
parameter 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 inprocessHobj
parameter 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 fromprocessName
parameter and InstanceID passed ininstanceId
parameter.- 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 resolvingobjectName
java.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 fromprocessName
parameter and InstanceID passed ininstanceId
parameter.- 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 inprocessHobj
parameter and InstanceID passed ininstanceId
parameter.- 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 fromobjectName
parameter, ProcessHOBJ derived fromprocessName
parameter and InstanceID passed ininstanceId
parameter.- 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 resolvingobjectName
andprocessName
java.util.concurrent.ExecutionException
- thrown when JAPI session throws exception during resolvingobjectName
andprocessName
-
create
public T create(int processHobj, int objectHobj, int instanceId, D2Session session)
Create new instance of EventProxy. Use ObjectHOBJ passed inobjectName
parameter, ProcessHOBJ passed inprocessName
parameter and InstanceID passed ininstanceId
parameter.- Parameters:
processHobj
- HOBJ of D2000 processobjectHobj
- HOBJ of D2000 callable objectinstanceId
- ID of callable object instancesession
- associate session- Returns:
- new instance of EventProxy
-
-