|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.server.AccessRuleFile
Collection of access rules that are read from a separate file.
An AccessRuleFile
instance is constructed using a
descriptor and a file watch interval. The descriptor is a character string
that is parsed to determine which file should be parsed and monitored for
changes. Such a descriptor must match the following pattern:
file filename
where filename is the name of the file to parse and watch.
The file watch interval is specified in seconds. At the specified interval, the file will be checked for modifications. If there are any modifications, then the file is reloaded and the access rules are re-applied.
If the file watch interval is set to 0
, then the watching
is disabled, and no automatic reloading will be performed.
Constructor Summary | |
AccessRuleFile(String descriptor,
int interval)
Constructs a new AccessRuleFile based on a descriptor and
a file watch interval. |
Method Summary | |
void |
dispose()
Disposes this access rule. |
Boolean |
isAllowed(String ip,
String functionName)
Determines if the specified IP address is allowed to access the specified function, returning a Boolean object or
null . |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AccessRuleFile(String descriptor, int interval) throws IllegalArgumentException, ParseException
AccessRuleFile
based on a descriptor and
a file watch interval.
If the specified interval is 0
, then no watching will be
performed.
descriptor
- the access rule file descriptor, the character string to parse,
cannot be null
.interval
- the interval to check the ACL file for modifications, in seconds,
must be >= 0.
ParseException
- If the token is incorrectly formatted.
IllegalArgumentException
- if descriptor == null || interval < 0
.Method Detail |
public Boolean isAllowed(String ip, String functionName) throws IllegalArgumentException, ParseException
Boolean
object or
null
.
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
null
is returned.
isAllowed
in interface AccessRuleContainer
ip
- the IP address, cannot be null
.functionName
- the name of the function, cannot be null
.
Boolean.TRUE
if the specified IP address is allowed to access
the specified function, Boolean.FALSE
if it is disallowed
access or null
if there is no match.
IllegalArgumentException
- if ip == null || functionName == null
.
ParseException
- if the specified IP address is malformed.public void dispose() throws IllegalStateException
Once disposed, the isAllowed(java.lang.String, java.lang.String)
method should no longer be
called.
dispose
in interface AccessRuleContainer
IllegalStateException
- if dispose()
has been called previously
(since XINS 1.3.0).public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |