|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectflux.EngineHelper
public abstract class EngineHelper
Helper methods to be used when interacting with the engine and the Flux system as a whole.
Constructor Summary | |
---|---|
EngineHelper()
|
Method Summary | |
---|---|
static boolean |
after(java.util.Date date1,
java.util.Date date2)
Determines if date1 comes after date2. |
static java.util.Date |
applyTimeExpression(java.util.Date relativeTo,
java.lang.String timeExpression,
AllowableBusinessInterval businessInterval,
java.util.TimeZone timeZone)
Applies the given time expression to the specified date. |
static java.util.Date |
applyTimeExpression(java.util.Date relativeTo,
java.lang.String timeExpression,
AllowableBusinessInterval businessInterval,
java.util.TimeZone timeZone,
int count)
Applies the given time expression to the specified date several times. |
static java.util.Date |
applyTimeExpression(java.lang.String timeExpression,
AllowableBusinessInterval businessInterval,
java.util.TimeZone timeZone)
Applies the given time expression to the current date. |
static java.util.Date |
applyTimeExpression(java.lang.String timeExpression,
AllowableBusinessInterval businessInterval,
java.util.TimeZone timeZone,
int count)
Applies the given time expression to the current date several times. |
static boolean |
before(java.util.Date date1,
java.util.Date date2)
Determines if date1 comes before date2. |
static int |
compareTo(java.util.Date date1,
java.util.Date date2)
Compares two dates for ordering. |
static java.lang.Object |
deserialize(byte[] serializedObject)
Deserializes the specified array of bytes to an object. |
static boolean |
equals(java.util.Date date1,
java.util.Date date2)
Compares two dates for equality. |
static boolean |
fallsOn(java.util.Date date,
java.lang.String unit)
Determines if the specified date falls on the specified unit. |
static boolean |
fallsOn(java.util.Date date,
java.lang.String unit,
AllowableBusinessInterval businessInterval,
java.util.TimeZone timeZone)
Determines if the specified date falls on the specified unit. |
static CatalogNode |
getActionCatalog()
Returns a tree of triggers and actions that can be used to construct flow charts. |
static java.util.Properties |
getApplicationProperties()
Loads application-specific properties from the "factories.properties" file, which must be located on the system class path, on the current class loader's class path, or in the directory where the JVM is started, which is specified by the system property "user.dir". |
static java.beans.BeanInfo |
getBeanInfo(Action action)
Returns a BeanInfo object for the specified action, which describes the properties that are defined on a class of triggers or actions. |
static java.beans.BeanInfo |
getBeanInfo(FlowChart flowChart)
Returns a BeanInfo object for the specified flow chart, which describes the properties that are defined on all flow charts. |
static java.util.List<java.lang.String> |
getNameComponents(java.lang.String namespace)
Accepts a string that contains "/" symbols and returns each component of that string separately after removing all "/" symbols. |
static java.util.SortedSet |
getPersistentVariableFields(java.lang.Class persistentVariable)
To aid in working with persistent variables, returns all public fields of the given class, including super classes but not java.lang.Object, that meet certain criteria. |
static java.util.TimeZone |
getTimeZone(java.lang.String timeZone)
Returns a TimeZone object for the specified time zone. |
static BusinessInterval |
makeBusinessInterval(java.lang.String name)
Returns a new BusinessInterval with the given name. |
static BusinessIntervalFactory |
makeBusinessIntervalFactory()
Returns a BusinessIntervalFactory for the creation and manipulation of complex BusinessInterval objects. |
static Cron |
makeCron()
Makes a new Cron object for manipulating Cron-style time expressions. |
static Cron |
makeCron(CronSlice slice)
Makes a new Cron object based on a CronSlice. |
static CronForLoop |
makeCronForLoop(CronSlice startConstraint,
CronSlice endConstraint,
CronSlice incrementConstraint)
Makes a new Cron "for" loop that represents a timing loop. |
static CronForLoop |
makeCronForLoop(CronSlice startConstraint,
CronSlice endConstraint,
CronSlice incrementConstraint,
int count)
Makes a new Cron "for" loop that represents a timing loop. |
static CronForLoop |
makeCronForLoop(CronSlice startConstraint,
CronSlice incrementConstraint,
int count)
Makes a new Cron "for" loop that represents a timing loop. |
static CronOr |
makeCronOr(java.util.Set<CronSlice> cronSlices)
Makes a new Cron "or" that represents a logical "or" of many Cron slices. |
static CronSlice |
makeCronSlice(CronColumn start,
CronColumn end)
Makes a new CronSlice object based on the specified starting and ending Cron columns. |
static java.lang.String |
makeDate(java.util.Date date)
Makes a string date from the date object using the default time zone; the time zone is displayed in the string date. |
static java.util.Date |
makeDate(java.lang.String date)
Makes a date from the given string date; the time zone is included in the string date. |
static java.lang.String |
makeDateInDefaultTimeZone(java.util.Date date)
Makes a string date from the date object using the default time zone; the default time zone is not displayed in the string date. |
static java.util.Date |
makeDateInDefaultTimeZone(java.lang.String date)
Makes a date from the given string date in the default time zone; any time zone in the string date is ignored. |
static FlowChart |
makeFlowChart()
Creates a new flow chart with a name equal to "/". |
static FlowChart |
makeFlowChart(java.lang.String name)
Creates a new flow chart with the given name. |
static java.util.List<FlowChart> |
makeFlowChartsFromCrontab(java.io.InputStream crontabInputStream)
Creates a list of flow charts from a Crontab input stream, which represents a standard Unix Crontab file that contains Unix Cron jobs. |
static java.util.List<FlowChart> |
makeFlowChartsFromXml(java.io.InputStream xmlStream)
Creates a list of flow charts from an XML input stream. |
static java.util.List<FlowChart> |
makeFlowChartsFromXml(java.io.InputStream xmlStream,
boolean verify)
Creates a list of flow charts from an XML input stream. |
static java.lang.Object |
makeJavaBeanFromXml(java.io.InputStream xmlStream)
Creates a JavaBean from an XML input stream, which conforms to the XML DTD file java-bean-5-0.dtd. |
static Relative |
makeRelative()
Makes a new Relative object for manipulating Relative time expressions. |
static TimeExpression |
makeTimeExpression(java.lang.String timeExpression)
Makes either a Cron time expression object or a Relative time expression object, based on the specified time expression string. |
static java.sql.Timestamp |
makeTimestamp(java.lang.String timestamp)
Makes a timestamp from the given string timestamp; the time zone is included in the string timestamp. |
static java.lang.String |
makeTimestamp(java.sql.Timestamp timestamp)
Makes a string timestamp from the timestamp object using the default time zone; the time zone is displayed in the string timestamp. |
static java.sql.Timestamp |
makeTimestampInDefaultTimeZone(java.lang.String timestamp)
Makes a timestamp from the given string timestamp in the default time zone; any time zone in the string timestamp is ignored. |
static java.lang.String |
makeTimestampInDefaultTimeZone(java.sql.Timestamp timestamp)
Makes a string timestamp from the timestamp object using the default time zone; the default time zone is not displayed in the string timestamp. |
static void |
makeXmlFromFlowCharts(java.util.List<FlowChart> flowCharts,
java.io.OutputStream xmlStream,
boolean verify)
Writes one or more flow charts to an XML output stream. |
static void |
makeXmlFromJavaBean(java.lang.Object javaBean,
java.io.OutputStream xmlStream)
Writes a JavaBean to an XML output stream, which conforms to the XML DTD file java-bean-5-0.dtd. |
static java.util.Date |
max(java.util.Date date1,
java.util.Date date2)
Returns the greater date. |
static java.util.Date |
min(java.util.Date date1,
java.util.Date date2)
Returns the lesser date. |
static byte[] |
serialize(java.lang.Object object)
Serializes the specified object to an array of bytes. |
static java.util.Date |
skip(java.util.Date start,
java.util.Date limit,
java.lang.String timeExpression,
AllowableBusinessInterval businessInterval)
Repeatedly applies the time expression to the start date to derive the smallest date that meets or exceeds the limit date. |
static java.util.Date |
skip(java.util.Date start,
java.util.Date limit,
java.lang.String timeExpression,
AllowableBusinessInterval businessInterval,
int count)
Repeatedly applies the time expression to the start date until the repeat count expires or the smallest date that meets or exceeds the limit date is calculated. |
static java.lang.String |
useLastResult()
Generates a conditional expression that the engine will evaluate in a flow to access the previous action's result variable, which must be one of Java's built-in types: Boolean, Byte, Character, Double, Float, Integer, Long, Short, and String. |
static java.lang.String |
useLastResult(java.lang.String field)
Generates a conditional expression that the engine will evaluate in a flow to access the previous action's result variable, which must not be one of Java's built-in types. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EngineHelper()
Method Detail |
---|
public static boolean after(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static java.util.Date applyTimeExpression(java.util.Date relativeTo, java.lang.String timeExpression, AllowableBusinessInterval businessInterval, java.util.TimeZone timeZone) throws EngineException
relativeTo
- The date to which the time expression is applied.timeExpression
- The time expression to apply to the given relative
date.businessInterval
- The optional business interval to use. May be
null.timeZone
- The optional time zone to use. May be null.
EngineException
- If the time expression is invalid.public static java.util.Date applyTimeExpression(java.util.Date relativeTo, java.lang.String timeExpression, AllowableBusinessInterval businessInterval, java.util.TimeZone timeZone, int count) throws EngineException
relativeTo
- The date to which the time expression is applied.timeExpression
- A time expression.businessInterval
- The optional business interval to use. May be
null.timeZone
- The optional time zone to use. May be null.count
- The number of times to apply the time expression.
EngineException
- If the time expression is invalid.public static java.util.Date applyTimeExpression(java.lang.String timeExpression, AllowableBusinessInterval businessInterval, java.util.TimeZone timeZone) throws EngineException
timeExpression
- The time expression to apply to the current date.businessInterval
- The optional business interval to use. May be
null.timeZone
- The optional time zone to use. May be null.
EngineException
- If the time expression is invalid.public static java.util.Date applyTimeExpression(java.lang.String timeExpression, AllowableBusinessInterval businessInterval, java.util.TimeZone timeZone, int count) throws EngineException
timeExpression
- A time expression.businessInterval
- The optional business interval to use. May be
null.timeZone
- The optional time zone to use. May be null.count
- The number of times to apply the time expression.
EngineException
- If the time expression is invalid.public static boolean before(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static int compareTo(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static java.lang.Object deserialize(byte[] serializedObject) throws java.io.IOException, java.lang.ClassNotFoundException
serializedObject
- The object to deserialize.
java.io.IOException
- If a deserialization error occurs.
java.lang.ClassNotFoundException
- If the deserialized class cannot be found.public static boolean equals(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static boolean fallsOn(java.util.Date date, java.lang.String unit)
date
- The date to check.unit
- Day-of-week, month-of-year, holiday, non-holiday, weekday,
weekend day, or business day.
public static boolean fallsOn(java.util.Date date, java.lang.String unit, AllowableBusinessInterval businessInterval, java.util.TimeZone timeZone)
date
- The date to check.unit
- Day-of-week, month-of-year, holiday, non-holiday,
weekday, weekend day, or business day.businessInterval
- Used if the unit requires it.timeZone
- if this date is to be oriented to a time zone other
than the default. May be null.
public static CatalogNode getActionCatalog() throws EngineException
EngineException
- If a system error occurs.FlowChart.makeFactory(java.lang.String)
public static java.util.Properties getApplicationProperties() throws EngineException
EngineException
- If a system error occurs.public static java.beans.BeanInfo getBeanInfo(Action action)
action
- A trigger or action object.
public static java.beans.BeanInfo getBeanInfo(FlowChart flowChart)
flowChart
- A flow chart object.
public static java.util.List<java.lang.String> getNameComponents(java.lang.String namespace)
namespace
- A string to parse into components.
java.lang.IllegalArgumentException
- If namespace is null.public static java.util.SortedSet getPersistentVariableFields(java.lang.Class persistentVariable)
persistentVariable
- A kind of persistent variable.
public static java.util.TimeZone getTimeZone(java.lang.String timeZone)
timeZone
- A time zone such as "America/New_York".
java.lang.IllegalArgumentException
- If the JVM does not recognize the time
zone.public static BusinessInterval makeBusinessInterval(java.lang.String name)
name
- The name of the new BusinessInterval.
public static BusinessIntervalFactory makeBusinessIntervalFactory()
for creating simple BusinessInterval objects.
public static Cron makeCron()
public static Cron makeCron(CronSlice slice)
slice
- A contiguous subset of Cron columns.
public static CronForLoop makeCronForLoop(CronSlice startConstraint, CronSlice endConstraint, CronSlice incrementConstraint)
startConstraint
- The constraint when the timing loop begins.endConstraint
- The constraint when the timing loop finishes.incrementConstraint
- Specifies intermittent timing points between the
start and end constraint.
public static CronForLoop makeCronForLoop(CronSlice startConstraint, CronSlice endConstraint, CronSlice incrementConstraint, int count)
startConstraint
- The constraint when the timing loop begins.endConstraint
- The constraint when the timing loop finishes.incrementConstraint
- Specifies intermittent timing points between the
start and end constraint.count
- The maximum number of times the timing loop will
fire. The constant INFINITY may be used.
CronForLoop.INFINITY
public static CronForLoop makeCronForLoop(CronSlice startConstraint, CronSlice incrementConstraint, int count)
startConstraint
- The constraint when the timing loop begins.incrementConstraint
- Specifies intermittent timing points between the
start and end constraint.count
- The maximum number of times the timing loop will
fire. The constant INFINITY may be used.
CronForLoop.INFINITY
public static CronOr makeCronOr(java.util.Set<CronSlice> cronSlices)
cronSlices
- Each Cron slice forms the logical "or".
java.lang.IllegalArgumentException
- If any of the Cron slices is a Cron "for"
loop. Cron "for" loops may not be used in
a Cron "or".public static CronSlice makeCronSlice(CronColumn start, CronColumn end)
start
- The starting Cron column for the new CronSlice.end
- The ending Cron column for the new CronSlice.
java.lang.IllegalArgumentException
- If the ending Cron column precedes the
starting Cron column.public static java.lang.String makeDate(java.util.Date date)
date
- An instant in time.
SimpleDateFormat
public static java.util.Date makeDate(java.lang.String date)
date
- The date specification.
java.lang.IllegalArgumentException
- If the date specification is illegal.SimpleDateFormat
public static java.lang.String makeDateInDefaultTimeZone(java.util.Date date)
date
- An instant in time.
SimpleDateFormat
public static java.util.Date makeDateInDefaultTimeZone(java.lang.String date)
date
- The date specification.
java.lang.IllegalArgumentException
- If the date specification is illegal.SimpleDateFormat
public static FlowChart makeFlowChart()
public static FlowChart makeFlowChart(java.lang.String name)
name
- The name of the flow chart. The name may be null or empty.
public static java.util.List<FlowChart> makeFlowChartsFromCrontab(java.io.InputStream crontabInputStream) throws EngineException
/bin/sh -c 'The string "'
crontabInputStream
- A Crontab input stream of Unix Cron jobs.
EngineException
- If a system error occurs.public static java.util.List<FlowChart> makeFlowChartsFromXml(java.io.InputStream xmlStream) throws EngineException
xmlStream
- An XML input stream of flow charts.
EngineException
- If the XML stream could not be converted to flow
charts.public static java.util.List<FlowChart> makeFlowChartsFromXml(java.io.InputStream xmlStream, boolean verify) throws EngineException
xmlStream
- An XML input stream of flow charts.verify
- Indicates whether to check if the incoming flow charts are
valid.
EngineException
- If the XML stream could not be converted to flow
charts.public static java.lang.Object makeJavaBeanFromXml(java.io.InputStream xmlStream) throws EngineException
xmlStream
- An XML input stream containing a JavaBean.
EngineException
- If xmlStream could not be converted to a JavaBean.public static Relative makeRelative()
public static TimeExpression makeTimeExpression(java.lang.String timeExpression) throws EngineException
timeExpression
- A time expression in string form.
EngineException
- If the time expression is invalid.public static java.sql.Timestamp makeTimestamp(java.lang.String timestamp)
timestamp
- The timestamp specification.
java.lang.IllegalArgumentException
- If the date specification is illegal.SimpleDateFormat
public static java.lang.String makeTimestamp(java.sql.Timestamp timestamp)
timestamp
- An instant in time.
SimpleDateFormat
public static java.sql.Timestamp makeTimestampInDefaultTimeZone(java.lang.String timestamp)
timestamp
- The timestamp specification.
java.lang.IllegalArgumentException
- If the date specification is illegal.SimpleDateFormat
public static java.lang.String makeTimestampInDefaultTimeZone(java.sql.Timestamp timestamp)
timestamp
- An instant in time.
SimpleDateFormat
public static void makeXmlFromFlowCharts(java.util.List<FlowChart> flowCharts, java.io.OutputStream xmlStream, boolean verify) throws EngineException
flowCharts
- The flow charts to render into
XML.xmlStream
- An XML output stream of flow charts.verify
- Indicates whether to check if the outgoing flow charts
are valid.
EngineException
- If a system error occurs.public static void makeXmlFromJavaBean(java.lang.Object javaBean, java.io.OutputStream xmlStream) throws EngineException
javaBean
- A JavaBean to write to xmlStream.xmlStream
- An XML output stream to receive the JavaBean.
EngineException
- If the JavaBean could not be written to xmlStream.public static java.util.Date max(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static java.util.Date min(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.
public static byte[] serialize(java.lang.Object object) throws java.io.IOException
object
- The object to serialize.
java.io.IOException
- If a serialization error occurs.public static java.util.Date skip(java.util.Date start, java.util.Date limit, java.lang.String timeExpression, AllowableBusinessInterval businessInterval) throws EngineException
start
- The Date to start the calculation from.limit
- When the calculation meets or exceeds this date,
the method returns.timeExpression
- A time expression.businessInterval
- The optional business interval to use. May be
null.
EngineException
- If the time expression is invalid.public static java.util.Date skip(java.util.Date start, java.util.Date limit, java.lang.String timeExpression, AllowableBusinessInterval businessInterval, int count) throws EngineException
start
- The Date to start the calculation from.limit
- If the calculation meets or exceeds this date, the
method returns.timeExpression
- A time expression.businessInterval
- The optional business interval to use. May be
null.count
- The maximum number of times to apply the Time
Expression.
EngineException
- If the time expression is invalid.public static java.lang.String useLastResult()
public static java.lang.String useLastResult(java.lang.String field)
field
- The field name of the result variable to access.
useLastResult()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |