|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.manageable.Manageable org.xins.server.API
Base class for API implementation classes.
Nested Class Summary |
Nested classes inherited from class org.xins.common.manageable.Manageable |
Manageable.State |
Field Summary |
Fields inherited from class org.xins.common.manageable.Manageable |
BOOTSTRAPPED, BOOTSTRAPPING, DEINITIALIZING, INITIALIZING, UNUSABLE, USABLE |
Fields inherited from interface org.xins.server.DefaultResultCodes |
_DISABLED_FUNCTION, _INTERNAL_ERROR, _INVALID_REQUEST, _INVALID_RESPONSE |
Constructor Summary | |
protected |
API(String name)
Constructs a new API object. |
Method Summary | |
protected void |
add(Manageable m)
Adds the specified manageable object. |
boolean |
allow(String ip,
String functionName)
Determines if the specified IP address is allowed to access the specified function, returning a boolean value. |
protected void |
bootstrapImpl(PropertyReader buildSettings)
Bootstraps this API (wrapper method). |
protected void |
bootstrapImpl2(PropertyReader buildSettings)
Bootstraps this API (implementation method). |
protected void |
deinitImpl()
Performs shutdown of this XINS API. |
APISpec |
getAPISpecification()
Get the specification of the API. |
PropertyReader |
getBootstrapProperties()
Gets the bootstrap properties specified for the API. |
List |
getFunctionList()
Gets the list of the functions of this API. |
String |
getName()
Gets the name of this API. |
RuntimeProperties |
getProperties()
Gets the runtime properties specified in the implementation. |
long |
getStartupTimestamp()
Gets the timestamp that indicates when this API instance
was created. |
TimeZone |
getTimeZone()
Returns the applicable time zone. |
protected void |
initImpl(PropertyReader runtimeSettings)
Initializes this API. |
protected void |
reinitializeImpl()
Triggers re-initialization of this API. |
Methods inherited from class org.xins.common.manageable.Manageable |
assertUsable, bootstrap, deinit, getState, init, isBootstrapped, isUsable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected API(String name) throws IllegalArgumentException
API
object.
name
- the name of the API, cannot be null
nor can it be an
empty string.
IllegalArgumentException
- if name == null
|| name.length()
< 1
.Method Detail |
public final String getName()
null
and never an empty
string.public final List getFunctionList()
List
of Function
objects, never null
.public PropertyReader getBootstrapProperties()
null
.public RuntimeProperties getProperties()
null
.public final long getStartupTimestamp()
API
instance
was created.
public final TimeZone getTimeZone()
null
.protected final void bootstrapImpl(PropertyReader buildSettings) throws IllegalStateException, MissingRequiredPropertyException, InvalidPropertyValueException, BootstrapException
bootstrapImpl2(PropertyReader)
.
bootstrapImpl
in class Manageable
buildSettings
- the build-time configuration properties, not null
.
IllegalStateException
- if this API is currently not bootstraping.
MissingRequiredPropertyException
- if a required property is not given.
InvalidPropertyValueException
- if a property has an invalid value.
BootstrapException
- if the bootstrap fails.protected void bootstrapImpl2(PropertyReader buildSettings) throws MissingRequiredPropertyException, InvalidPropertyValueException, BootstrapException
API
is empty.
Custom subclasses can perform any necessary bootstrapping in this
class.
Note that bootstrapping and initialization are different. Bootstrap
includes only the one-time configuration of the API based on the
build-time settings, while the initialization
The add(Manageable)
may be called from this method,
and from this method only.
buildSettings
- the build-time properties, guaranteed not to be null
.
MissingRequiredPropertyException
- if a required property is not given.
InvalidPropertyValueException
- if a property has an invalid value.
BootstrapException
- if the bootstrap fails.protected final void reinitializeImpl()
protected final void initImpl(PropertyReader runtimeSettings) throws MissingRequiredPropertyException, InvalidPropertyValueException, InitializationException, IllegalStateException
initImpl
in class Manageable
runtimeSettings
- the runtime configuration settings, cannot be null
.
MissingRequiredPropertyException
- if a required property is missing.
InvalidPropertyValueException
- if a property has an invalid value.
InitializationException
- if the initialization failed for some other reason.
IllegalStateException
- if this API is currently not initializing.protected final void add(Manageable m) throws IllegalStateException, IllegalArgumentException
m
- the manageable object to add, not null
.
IllegalStateException
- if this API is currently not bootstrapping.
IllegalArgumentException
- if instance == null
.protected final void deinitImpl()
deinitImpl
in class Manageable
public final APISpec getAPISpecification() throws InvalidSpecificationException
APISpec
specification object, never null
.
InvalidSpecificationException
- if the specification cannot be found or is invalid.public boolean allow(String ip, String functionName) throws IllegalArgumentException
boolean
value.
This method finds the first matching rule and then returns the
allow property of that rule (see
AccessRule.isAllowRule()
). If there is no matching rule, then
false
is returned.
ip
- the IP address, cannot be null
.functionName
- the name of the function, cannot be null
.
true
if the request is allowed, false
if
the request is denied.
IllegalArgumentException
- if ip == null || functionName == null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |