Public Member Functions | |
BasicPolicy () | |
Constructor defaulting initial namespace to everything with no localName. | |
BasicPolicy (String name) | |
Constructor defaulting the initial namespace to "everything". | |
BasicPolicy (String name, ArrayList< ContentName > namespace) | |
Constructor allowing an initial namespace to be set. | |
void | updateFromInputStream (InputStream stream) throws RepositoryException |
Update the policy from a file This assumes that the update is not "from the network". | |
void | update (PolicyXML pxml, boolean fromNet) throws RepositoryException |
Applies policy changes. | |
ArrayList< ContentName > | getNamespace () |
Gets the current namespace covered by this repository. | |
void | setNamespace (ArrayList< ContentName > namespace) |
ContentName | getPolicyName () |
Gets the policy path for this repository. | |
void | setVersion (String version) |
Sets the repository version to be used by this policy interpreter. | |
void | setGlobalPrefix (String globalPrefix) throws MalformedContentNameStringException |
Sets the global prefix for this policy interpreter. | |
ContentName | getGlobalPrefix () |
Gets the global prefix currently in use for this repository. | |
String | getLocalName () |
Gets the local name currently used by this repository. | |
void | setLocalName (String localName) throws MalformedContentNameStringException |
The localName is used to identify an individual repository among several in an organization or other entity. | |
synchronized PolicyXML | getPolicyXML () |
synchronized void | setPolicyXML (PolicyXML pxml) |
Set the associated policyXML. | |
Static Public Member Functions | |
static ContentName | getPolicyName (ContentName globalPrefix) |
Creates the path for a policy file for a repository given it's global prefix and local name. | |
static PolicyXML | createPolicyXML (InputStream stream) throws ContentDecodingException |
Public Attributes | |
String | POLICY_VERSION = "1.5" |
Static Public Attributes | |
static final String | POLICY = "POLICY" |
Protected Attributes | |
String | _repoVersion = null |
PolicyXML | _pxml = null |
TODO policy change requests via the network are currently totally insecure and could easily be exploited to disrupt the proper functioning of a repository.
The policy file is structured as follows:
All elements must be nested within a <policy> element.
The file must contain a <version> element with an id attribute set to a string corresponding to the current version of the repository which is "1.4".
The file must contain a <localname> element which specifies the local name.
The file must contain a <globalname> element which specifies the global name.
The file may contain any number of <namespace> elements specifying namespaces
covered by the repository
For example: <Policy> <PolicyVersion> 1.5 </PolicyVersion> <LocalName> TestRepository </LocalName> <GlobalPrefix> parc.com/csl/ccn/repositories </GlobalPrefix> <Namespace> /testNameSpace </Namespace> <Namespace> /testNameSpace2 </Namespace> </Policy>
org.ccnx.ccn.impl.repo.BasicPolicy.BasicPolicy | ( | String | name | ) |
Constructor defaulting the initial namespace to "everything".
name | local name for this repository |
org.ccnx.ccn.impl.repo.BasicPolicy.BasicPolicy | ( | String | name, | |
ArrayList< ContentName > | namespace | |||
) |
Constructor allowing an initial namespace to be set.
name | local name for this repository | |
namespace | the initial namespace |
void org.ccnx.ccn.impl.repo.BasicPolicy.updateFromInputStream | ( | InputStream | is | ) | throws RepositoryException |
Update the policy from a file This assumes that the update is not "from the network".
is | stream for the file |
Implements org.ccnx.ccn.impl.repo.Policy.
void org.ccnx.ccn.impl.repo.BasicPolicy.update | ( | PolicyXML | pxml, | |
boolean | fromNet | |||
) | throws RepositoryException |
Applies policy changes.
pxml | policy data |
XMLStreamException |
Implements org.ccnx.ccn.impl.repo.Policy.
ArrayList<ContentName> org.ccnx.ccn.impl.repo.BasicPolicy.getNamespace | ( | ) |
Gets the current namespace covered by this repository.
Any name not included within this namespace will not be stored in this repository.
Implements org.ccnx.ccn.impl.repo.Policy.
static ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyName | ( | ContentName | globalPrefix | ) | [static] |
Creates the path for a policy file for a repository given it's global prefix and local name.
globalPrefix | global prefix as a ContentName | |
localName | local name as a / separated String |
ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyName | ( | ) |
Gets the policy path for this repository.
void org.ccnx.ccn.impl.repo.BasicPolicy.setVersion | ( | String | version | ) |
Sets the repository version to be used by this policy interpreter.
After this call any policy file containing a different version will be rejected.
version | The version as a String |
Implements org.ccnx.ccn.impl.repo.Policy.
void org.ccnx.ccn.impl.repo.BasicPolicy.setGlobalPrefix | ( | String | globalPrefix | ) | throws MalformedContentNameStringException |
Sets the global prefix for this policy interpreter.
After this call any policy file containing a different global prefix will be rejected
globalPrefix | the global prefix as a slash separated String |
Implements org.ccnx.ccn.impl.repo.Policy.
ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getGlobalPrefix | ( | ) |
Gets the global prefix currently in use for this repository.
Implements org.ccnx.ccn.impl.repo.Policy.
String org.ccnx.ccn.impl.repo.BasicPolicy.getLocalName | ( | ) |
Gets the local name currently used by this repository.
Implements org.ccnx.ccn.impl.repo.Policy.
void org.ccnx.ccn.impl.repo.BasicPolicy.setLocalName | ( | String | localName | ) | throws MalformedContentNameStringException |
The localName is used to identify an individual repository among several in an organization or other entity.
localName | the name as a string in the form xxx/yyy/zzz |
MalformedContentNameStringException | if the name is formatted incorrectly |
Implements org.ccnx.ccn.impl.repo.Policy.
synchronized PolicyXML org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyXML | ( | ) |
synchronized void org.ccnx.ccn.impl.repo.BasicPolicy.setPolicyXML | ( | PolicyXML | pxml | ) |
Set the associated policyXML.
pxml | the PolicyXML |
Implements org.ccnx.ccn.impl.repo.Policy.