|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.policy.io.xml.PermisXmlReader
public class PermisXmlReader
Policy reader implementation for Permis XML policies.
Constructor Summary | |
---|---|
PermisXmlReader(Reader reader,
PartBeanFactory partFactory)
Creates a new policy reader that uses the specified reader but has not problem reporter. |
|
PermisXmlReader(Reader reader,
PartBeanFactory partFactory,
ProblemReporter problemReporter)
Creates a new policy reader that uses the specified reader. |
Method Summary | |
---|---|
protected URI |
createUri(String string,
String element,
String attribute)
Creates an URI for the specified input string. |
protected String |
encode(String ldapDn)
Encodes an LDAP DN to a valid URI name. |
protected String |
expectAttribute(String attribute)
Returns the value of the attribute of the current element. |
protected String |
getLocation()
Returns the current reader location in format "line:column". |
protected boolean |
isElement(int type,
String name)
Returns true if the cursor points to the element of type and name. |
protected void |
next(int type)
Moves the cursor of parser to the next position of the given XMLStreamConstants
type . |
protected void |
nextElement()
Moves the cursor of parser to the next element, it may be a starting or ending element. |
protected void |
nextElement(int findType,
String findName)
Moves the cursor of parser to the next element of type findType and element
name findName . |
protected boolean |
nextElement(int findType,
String findName,
int stopType,
String stopName)
Moves the cursor of parser to the next element of type findType and element
name findName but the cursor will stop on stopType and
stopName . |
protected String |
optionalAttribute(String attribute)
Returns the value of the optional attribute, null if attribute does not exist. |
protected Map<String,Action> |
readActionPolicy(Map<String,Class<?>> map)
Reads an action policy and fill map with parameter name and type. |
protected Predicate |
readCondition()
Reads a if statement condition and returns it as a Predicate . |
protected List<List<URI>> |
readDomainURIs(String domainSpecElementType)
Reads all the URI s of a domain definition. |
protected ObligationCollection |
readObligationList(Map<String,Obligation> obligations)
Reads a list of obligations. |
protected Map<String,Obligation> |
readObligationPolicy()
Reads an obligation policy. |
Policy |
readPolicy()
Parses the stream and build the policy. |
protected Map<String,Domain> |
readResourceDomainPolicy()
Reads a resource domain policy. |
protected RoleAssignmentRuleCollection |
readRoleAssignmentPolicy(Map<String,DomainBean> subjectDomains,
Map<String,RoleHierarchyBean> hierachies,
Map<String,Authority> soas)
Reads a role assignment policy. |
protected Map<String,RoleHierarchyBean> |
readRoleHierarchyPolicy()
Reads a role hierarchy policy. |
protected Collection<Role> |
readRoleList(Map<String,RoleHierarchyBean> hierarchies)
Reads a role list element. |
protected Map<String,Authority> |
readSoaPolicy()
Reads a soa policy. |
protected Map<String,DomainBean> |
readSubjectDomainPolicy()
Reads a subject domain policy. |
protected TargetAccessRuleCollection |
readTargetAccessPolicy(Map<String,Domain> domains,
Map<String,RoleHierarchyBean> hierarchies,
Map<String,Action> actions,
Map<String,Target> targets,
Map<String,Obligation> obligations)
Reads a target access policy. |
protected Map<String,Target> |
readTargetPolicy(Map<String,Domain> domains,
Map<String,Action> actions)
Reads a target policy. |
protected TimePeriodConstraint |
readValidity(org.joda.time.DateTimeZone defaultZone)
Reads the validity of a role assignment rule. |
protected void |
reportProblem(ProblemType type,
Object... parameters)
Reports a problem of the specified type with the given parameters. |
protected void |
setParameterMap(Map<String,Class<?>> parameterMap)
Defines the relation (actionname, parametername, type). |
protected void |
setZone(org.joda.time.DateTimeZone zone)
Sets the time zone of this policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermisXmlReader(Reader reader, PartBeanFactory partFactory) throws PolicyException
Readers created by this constructor will throw a PolicyException
if a problem
is encountered that could have been reported to a ProblemReporter
.
reader
- the reader to read the policy from.partFactory
- the PartBeanFactory
to use for creating policy parts.PermisXmlReader(Reader, PartBeanFactory, ProblemReporter)
PolicyException
- if the XML reader cannot be created.public PermisXmlReader(Reader reader, PartBeanFactory partFactory, ProblemReporter problemReporter) throws PolicyException
Readers created with a null
ProblemReporter
will throw a
PolicyException
if a non-fatal problem is encountered that could have been
reported to a ProblemReporter
.
reader
- the reader to read the policy from.partFactory
- the PartBeanFactory
to use for creating policy parts.problemReporter
- reporter for serialization problems, may be null
.
PolicyException
- if the XML reader cannot be created.Method Detail |
---|
protected String getLocation()
protected void reportProblem(ProblemType type, Object... parameters) throws PolicyException
The current reader location is passed as the first parameter.
type
- the problem type to report.parameters
- the parameters to pass on.
PolicyException
- if there is no problem reporter available.protected void setZone(org.joda.time.DateTimeZone zone)
zone
- a DateTimeZone
.protected void setParameterMap(Map<String,Class<?>> parameterMap)
parameterMap
- the parameters.protected void nextElement() throws PolicyException
PolicyException
- if next element could not be found.protected boolean isElement(int type, String name) throws PolicyException
PolicyException
- if next element could not be found.protected void next(int type) throws PolicyException
XMLStreamConstants
type
.
type
- type of the next position.
PolicyException
- if next position could not be found.protected void nextElement(int findType, String findName) throws PolicyException
findType
and element
name findName
.
findType
- type of the next element.findName
- name of the next element.
PolicyException
- if next element with name could not be found.protected boolean nextElement(int findType, String findName, int stopType, String stopName) throws PolicyException
findType
and element
name findName
but the cursor will stop on stopType
and
stopName
.
findType
- type of the next element to find.findName
- name of the next element to find.stopType
- type of the next element to stop.stopName
- name of the next element to stop.
PolicyException
- if no next element could not be found.protected String expectAttribute(String attribute) throws PolicyException
attribute
- name of the attribute.
PolicyException
- if no such attribute exists.protected String optionalAttribute(String attribute)
null
if attribute does not exist.
attribute
- name of the attribute.
null
otherwise.protected String encode(String ldapDn) throws UnsupportedEncodingException
ldapDn
- the LDAP DN to encode.
UnsupportedEncodingException
- if encoding fails.protected URI createUri(String string, String element, String attribute) throws URISyntaxException, PolicyException
If the URI cannot be created the string is first converted to a valid URI name and then converted. This conversion will issue a warning.
string
- the string to be converted.element
- the element for which to create the URI.attribute
- the attribute that holds the URI.
URISyntaxException
- if the conversion fails and an URI cannot be created.
PolicyException
- if a conversion takes place and there is no problem reporter.public Policy readPolicy() throws PolicyException
readPolicy
in interface PolicyReader
PolicyException
- signals a problem in reading the policy.protected Map<String,DomainBean> readSubjectDomainPolicy() throws PolicyException
PolicyException
- signals a problem in reading the policy.protected Map<String,Domain> readResourceDomainPolicy() throws PolicyException
PolicyException
- signals a problem in reading the policy.protected List<List<URI>> readDomainURIs(String domainSpecElementType) throws PolicyException
URI
s of a domain definition.
List
of URI
List
s.
PolicyException
- signals a problem in reading the policy.protected Map<String,RoleHierarchyBean> readRoleHierarchyPolicy() throws PolicyException
PolicyException
- signals a problem in reading the policy.protected Map<String,Authority> readSoaPolicy() throws PolicyException
PolicyException
- signals a problem in reading the policy.protected RoleAssignmentRuleCollection readRoleAssignmentPolicy(Map<String,DomainBean> subjectDomains, Map<String,RoleHierarchyBean> hierachies, Map<String,Authority> soas) throws PolicyException
subjectDomains
- existing subject domains.hierachies
- existing role hierarchies.soas
- existing soas.
PolicyException
- signals a problem in reading the policy.protected Map<String,Target> readTargetPolicy(Map<String,Domain> domains, Map<String,Action> actions) throws PolicyException
domains
- read Domains.actions
- read Actions.
PolicyException
- signals a problem in reading the policy.protected Map<String,Action> readActionPolicy(Map<String,Class<?>> map) throws PolicyException
map
- a mapping of parameter name and type.
PolicyException
- signals a problem in reading the policy.protected TargetAccessRuleCollection readTargetAccessPolicy(Map<String,Domain> domains, Map<String,RoleHierarchyBean> hierarchies, Map<String,Action> actions, Map<String,Target> targets, Map<String,Obligation> obligations) throws PolicyException
domains
- existing target domains.hierarchies
- existing role hierarchies.actions
- existing actions.targets
- existing targets.
PolicyException
- signals a problem in reading the policy.protected Map<String,Obligation> readObligationPolicy() throws PolicyException
PolicyException
- signals a problem in reading the policy.protected ObligationCollection readObligationList(Map<String,Obligation> obligations) throws PolicyException
obligations
- existing obligations.
ObligationCollection
.
PolicyException
protected TimePeriodConstraint readValidity(org.joda.time.DateTimeZone defaultZone) throws PolicyException
TimePeriodConstraint
.
PolicyException
- signals a problem in reading the policy.protected Collection<Role> readRoleList(Map<String,RoleHierarchyBean> hierarchies) throws PolicyException
hierarchies
- the existing role hierarchies.
PolicyException
- signals a problem in reading the policy.protected Predicate readCondition() throws PolicyException
Predicate
.
Predicate
.
PolicyException
- signals a problem in reading the policy.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG