BEA Systems, Inc.

com.bea.rfid.workflow.epcis
Class EventGenerator

java.lang.Object
  extended by com.bea.rfid.workflow.epcis.EventGenerator
Direct Known Subclasses:
AggregationEventGenerator, ObjectEventGenerator

public abstract class EventGenerator
extends Object

Abstract base class for generating EPCIS events for list of com.connecterra.ale.api.ECReportGroupListMember containing tags read. Concrete implementations of this must implement createSpecificEPCISEvent, which is to create the specific EPCIS event for that implementation.

This contains EPCIS event fields that are common across all EPCIS event types. These are:

These values will be used as field values for the EPCIS event that is generated.

This also contains a template event. Non-null fields on the template event will override the properties set on the instance of the class. For example, if the template event contains a read point URI, that value will be used on the generated event. Business transactions and EPCIS event extensions on the template event will be added to the business transactions event extensions on this. The generated event will contain the union of the business transactions and event extensions on this and the template event.

This may be in active or inactive state and input tags are processed only in active state.

This implementation assumes single threaded operation and is not synchronized. If multiple threads access this concurrently, it must be synchronized externally.


Constructor Summary
EventGenerator()
           
 
Method Summary
 void addBusinessTransaction(com.connecterra.epcis.api.BusinessTransaction bizTrans)
          Adds a business transaction entry to list of business transactions to be used on the generated event.
 void addBusinessTransaction(URI bizTransType, URI bizTransID)
          Creates a business transaction for the given type and ID and adds it to the list of business transactions to be used on the generated event.
 void addEventExtension(String namespace, String name, String value)
          Creates an EPCIS event extension for the given namespace, name and values and adds it to the list of event extensions to be used on the generated event.
protected static URI convertToEPC(com.connecterra.ale.api.ECReportGroupListMember tagIn)
          Returns URI form for a com.connecterra.ale.api.ECReportGroupListMember.
protected static List convertToEPCList(List tags)
          Utility method to create a list of URIs that can be used on EPCIS event fields from a given list of com.connecterra.ale.api.ECReportGroupListMember.
 com.connecterra.epcis.api.EPCISDocument createEPCISDocument(List tags)
          Returns EPCISDocument with the generated EPCIS event for the input tags.
abstract  com.connecterra.epcis.impl.AbstractEPCISEvent createSpecificEPCISEvent(List tags)
          Abstract method to create the EPCIS event specific to the concrete implementation.
 URI getBusinessLocation()
          Returns the business location URI value on this.
 URI getBusinessStep()
          Returns the business step URI value on this.
 List getBusinessTransactionList()
          Returns the list of business transations specified on this.
 URI getDisposition()
          Returns the disposition URI value on this.
 List getEventExtensionList()
          Returns the list of EPCIS event extensions specified on this.
 URI getReadPoint()
          Returns the read point URI value on this.
 com.connecterra.epcis.api.EPCISDocument getTemplate()
          Returns EPCISDocument with the template event.
protected  String getTemplateAction()
          Utility method to get action string specified in the template event.
protected  com.connecterra.epcis.api.EPCISBasicEvent getTemplateEvent()
          Returns the template event extracted from the template EPCISDocument.
 boolean isProcessing()
          Returns boolean indicating if the event generator is in active state or not.
protected  void populateAbstractEPCISEvent(com.connecterra.epcis.impl.AbstractEPCISEvent event)
          Populates common EPCIS event fields using the event field properties on this.
 void setBusinessLocation(URI bizLocURI)
          Specifies the business location URI that must be used on generated events if the template event does not contain one.
 void setBusinessStep(URI bizStepURI)
          Specifies the business step URI that must be used on generated events if the template event does not contain one.
 void setBusinessTransactionList(List bizTransactions)
          Specifies business transactions that must be used along with the ones on template event on the generated event.
 void setDisposition(URI disposition)
          Specifies the disposition URI that must be used on generated events if the template event does not contain one.
 void setEventExtensionList(List extensions)
          Specifies EPCIS event extensions that must be used along with the ones on template event, on the generated event.
 void setReadPoint(URI readPointURI)
          Specifies the read point URI that must be used on generated events if the template event does not contain one.
 void setTemplate(com.connecterra.epcis.api.EPCISDocument templateDoc)
          Specifies the template event for this event generator.
 void startProcessing()
          Moves this to the state where it processes tags to generate EPCIS events.
 void stopProcessing()
          Moves this to the state where it does not generate EPCIS events for input tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventGenerator

public EventGenerator()
Method Detail

createSpecificEPCISEvent

public abstract com.connecterra.epcis.impl.AbstractEPCISEvent createSpecificEPCISEvent(List tags)
                                                                                throws com.connecterra.epcis.api.EPCISException
Abstract method to create the EPCIS event specific to the concrete implementation. This method is used by createEPCISDocument to get the EPCIS event, which is further filled out using event field properties on this.

Parameters:
tags - list of com.connecterra.ale.api.ECReportGroupListMember for which EPCIS event must be generated
Returns:
the generated EPCIS event
Throws:
com.connecterra.epcis.api.EPCISException - if an error occurs trying to create the event

startProcessing

public void startProcessing()
Moves this to the state where it processes tags to generate EPCIS events.


stopProcessing

public void stopProcessing()
Moves this to the state where it does not generate EPCIS events for input tags.


isProcessing

public boolean isProcessing()
Returns boolean indicating if the event generator is in active state or not. This generates EPCIS events for input tags only in the active state.

Returns:
true if the event generator is in active state; false otherwise.

createEPCISDocument

public com.connecterra.epcis.api.EPCISDocument createEPCISDocument(List tags)
                                                            throws com.connecterra.epcis.api.EPCISException
Returns EPCISDocument with the generated EPCIS event for the input tags. This uses the abstract method, createSpecificEPCISEvent, to create specific event and populates the common event fields on that.

Parameters:
tags - list of com.connecterra.ale.api.ECReportGroupListMember for which EPCIS event must be generated
Returns:
EPCISDocument with the generated EPCIS event
Throws:
com.connecterra.epcis.api.EPCISException - if an error occurs trying to create the EPCIS event

populateAbstractEPCISEvent

protected void populateAbstractEPCISEvent(com.connecterra.epcis.impl.AbstractEPCISEvent event)
                                   throws com.connecterra.epcis.api.EPCISException
Populates common EPCIS event fields using the event field properties on this.

Parameters:
event - AbstractEPCISEvent whose event fields should be populated using the event field properties
Throws:
com.connecterra.epcis.api.EPCISException - if an error occurs trying to set the event fields

getReadPoint

public URI getReadPoint()
Returns the read point URI value on this. This will be used on the generated events if the template event does not contain a read point URI.

Returns:
the read point URI value on this

setReadPoint

public void setReadPoint(URI readPointURI)
Specifies the read point URI that must be used on generated events if the template event does not contain one.

Parameters:
readPointURI - the read point URI that must be used on generated events if the template event does not contain one

getBusinessLocation

public URI getBusinessLocation()
Returns the business location URI value on this. This will be used on the generated events if the template event does not contain one.

Returns:
the business location URI value on this

setBusinessLocation

public void setBusinessLocation(URI bizLocURI)
Specifies the business location URI that must be used on generated events if the template event does not contain one.

Parameters:
bizLocURI - the business location URI that must be used on generated events if the template event does not contain one

getBusinessStep

public URI getBusinessStep()
Returns the business step URI value on this. This will be used on the generated events if the template event does not contain one.

Returns:
the business step URI value on this

setBusinessStep

public void setBusinessStep(URI bizStepURI)
Specifies the business step URI that must be used on generated events if the template event does not contain one.

Parameters:
bizStepURI - the business step URI that must be used on generated events if the template event does not contain one

getDisposition

public URI getDisposition()
Returns the disposition URI value on this. This will be used on the generated events if the template event does not contain one.

Returns:
the disposition URI value on this

setDisposition

public void setDisposition(URI disposition)
Specifies the disposition URI that must be used on generated events if the template event does not contain one.

Parameters:
disposition - the disposition URI that must be used on generated events if the template event does not contain one

getBusinessTransactionList

public List getBusinessTransactionList()
Returns the list of business transations specified on this. The generated event will contain the union of these and the business transactions on the template event.

Returns:
the list of business transations specified on this

setBusinessTransactionList

public void setBusinessTransactionList(List bizTransactions)
Specifies business transactions that must be used along with the ones on template event on the generated event.

Parameters:
bizTransactions - list of business transactions that must be used along with the ones on template event on the generated event

addBusinessTransaction

public void addBusinessTransaction(URI bizTransType,
                                   URI bizTransID)
Creates a business transaction for the given type and ID and adds it to the list of business transactions to be used on the generated event.

Parameters:
bizTransType - the business transaction type URI
bizTransID - the business transaction ID

addBusinessTransaction

public void addBusinessTransaction(com.connecterra.epcis.api.BusinessTransaction bizTrans)
Adds a business transaction entry to list of business transactions to be used on the generated event.

Parameters:
bizTrans - the business transaction to be added to the list to be used on the generated event

getEventExtensionList

public List getEventExtensionList()
Returns the list of EPCIS event extensions specified on this. The generated event will contain the union of these and the extensions on the template event.

Returns:
the list of EPCIS event extensions specified on this

setEventExtensionList

public void setEventExtensionList(List extensions)
Specifies EPCIS event extensions that must be used along with the ones on template event, on the generated event.

Parameters:
extensions - list of event extensions that must be used along with the ones on template event on the generated event

addEventExtension

public void addEventExtension(String namespace,
                              String name,
                              String value)
Creates an EPCIS event extension for the given namespace, name and values and adds it to the list of event extensions to be used on the generated event.

Parameters:
namespace - namespace of the extension
name - name of the extension
value - value for the extension

getTemplate

public com.connecterra.epcis.api.EPCISDocument getTemplate()
Returns EPCISDocument with the template event. Non-null fields on the template event will override the event field properties set on this. For example, if the template event contains a read point URI, that value will be used on the generated event. Business transactions and EPCIS event extensions on the template event will be added to the business transactions event extensions on this.

Returns:
EPCISDocument with the template event. Returns null if there is no template set on this.

setTemplate

public void setTemplate(com.connecterra.epcis.api.EPCISDocument templateDoc)
Specifies the template event for this event generator. Non-null fields on the template event will override the event field properties set on this. For example, if the template event contains a read point URI, that value will be used on the generated event. Business transactions and EPCIS event extensions on the template event will be added to the business transactions event extensions on this.

Parameters:
templateDoc - EPCISDocument with the template event

getTemplateEvent

protected com.connecterra.epcis.api.EPCISBasicEvent getTemplateEvent()
Returns the template event extracted from the template EPCISDocument. This method returns null if there is no template set on this. This is provided as a convenience so that subclasses can get to the template event easily.

Returns:
the template event extracted from the template EPCISDocument. Returns null if there is no template set on this.

getTemplateAction

protected String getTemplateAction()
Utility method to get action string specified in the template event. This is provided so that casting to the appropriate type of EPCISEvent type and then getting action string is isolated in one place. Returns null if there is no template specified or if the template event does not contain action.

Returns:
the action string, if any, specified in the template event. Returns null if no template event is specified.

convertToEPCList

protected static List convertToEPCList(List tags)
Utility method to create a list of URIs that can be used on EPCIS event fields from a given list of com.connecterra.ale.api.ECReportGroupListMember. This uses convertToEPC to get the URI for each ECReportGroupListMember in the list.

Parameters:
tags - list of com.connecterra.ale.api.ECReportGroupListMember
Returns:
list of URIs for the input tags

convertToEPC

protected static URI convertToEPC(com.connecterra.ale.api.ECReportGroupListMember tagIn)
Returns URI form for a com.connecterra.ale.api.ECReportGroupListMember. This is used by the event generation code to get the URI form to use in EPCIS events for input tags. Below is the sequence in which this tries to get the URI form:

Parameters:
tagIn - the input com.connecterra.ale.api.ECReportGroupListMember
Returns:
the URI representation from the input

Documentation is available at
${DOCSWEBROOT}
Copyright 2007 BEA Systems Inc.