@Retention(value=CLASS)
@Target(value={CONSTRUCTOR,METHOD})
public @interface ShelfLifeCheck
Perform a Shelf Life expiration check.
Performs a Shelf Life check using the expiration parameters. The expiration can be defined by using one of these techniques:
expirationDate
attribute. The warningDate
attribute specifies when warnings about expiration will be emitted. This is optional, and if
omitted then no warnings are given.expirationPeriod
attribute. The start
date is retrieved from a field or method specified with the
startDateSource
attribute. This field of type or method returning a
java.util.Date
. Similarly, the warning date is specified as a number of
days prior to the expiration date with the warningPeriod
attribute.tokenSource
attribute specifies a field of type or method returning a java.io.Reader
that reads the token (as from a file). If the expiration stored in the token is relative then the
start date must also be provided. If this approach is used, values set for expiration/warning
date/period in the annotation are ignored.The Shelf Life check performs one of the following actions:
System.out
(or a dialog). If the application has expired, then a message is
emitted to System.out (or a dialog) and System.exit()
is called with a exit
code of 1. On Android, if injected into an Activity it will finish() that activity, otherwise it will throw an exception.action
attribute. The method is called each time a check is made, and the
result of the check can be determined by interrogating the passed token. The method must accept a token and return void:void someCustomActionMethod(Token token)
A Shelf Life key file is necessary when creating Shelf Life tokens, whether that is at build-time if the token is integrated into the compiled application or at token-creation-time if the token is managed externally. The location of the Shelf Life key file can be specified in the <shelflife> section of the configuration file, or on the Shelf Life Check screen.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
action
The custom action method that will be called on each check.
|
java.lang.String |
expirationDate
The expiration date.
|
java.lang.String |
expirationPeriod
The number of days since the start date that the application expires.
|
java.lang.String |
startDateSource
The source for the start date when using relative expiration period.
|
java.lang.String |
tokenSource
The source for the expiration token when providing a token at run-time.
|
java.lang.String |
warningDate
The warning date.
|
java.lang.String |
warningPeriod
The number of days before expiration that the warning period starts.
|
InjectionPoint |
where
The location in the method where instrumentation will take place.
|
public abstract java.lang.String action
Token
instance.public abstract InjectionPoint where
public abstract java.lang.String expirationDate
MM/DD/YYYY
format. May reference DashO
properties, which will be expanded at the time of instrumentation.public abstract java.lang.String warningDate
MM/DD/YYYY
format. May reference DashO
properties, which will be expanded at the time of instrumentation.public abstract java.lang.String startDateSource
Date
field or a zero-argument method returning Date.public abstract java.lang.String expirationPeriod
public abstract java.lang.String warningPeriod
public abstract java.lang.String tokenSource
Reader
field or a zero-argument method returning the Reader.
The Reader
's close() method will be called
automatically.Copyright © 2018 PreEmptive Solutions, LLC. All Rights Reserved.