org.ccnx.ccn.impl.repo.BasicPolicy Class Reference

A reference implementation of Policy using an XML based policy file. More...

List of all members.

Public Member Functions

 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< ContentNamegetNamespace ()
 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.
PolicyXML getPolicyXML ()

Static Public Member Functions

static ContentName getPolicyName (ContentName globalPrefix, String localName)
 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

Detailed Description

A reference implementation of Policy using an XML based policy file.

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>
 

Constructor & Destructor Documentation

org.ccnx.ccn.impl.repo.BasicPolicy.BasicPolicy ( String  name  ) 

Constructor defaulting the initial namespace to "everything".

Parameters:
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.

Parameters:
name local name for this repository
namespace the initial namespace

Member Function Documentation

ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getGlobalPrefix (  ) 

Gets the global prefix currently in use for this repository.

Returns:
the global prefix as a ContentName

Implements org.ccnx.ccn.impl.repo.Policy.

String org.ccnx.ccn.impl.repo.BasicPolicy.getLocalName (  ) 

Gets the local name currently used by this repository.

Returns:
the local name as a slash separated String

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.

Returns:
array of ContentNames specifying the namespace

Implements org.ccnx.ccn.impl.repo.Policy.

ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyName (  ) 

Gets the policy path for this repository.

Returns:
the policy path as a ContentName
static ContentName org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyName ( ContentName  globalPrefix,
String  localName 
) [static]

Creates the path for a policy file for a repository given it's global prefix and local name.

Parameters:
globalPrefix global prefix as a ContentName
localName local name as a / separated String
Returns:
the name as a ContentName
PolicyXML org.ccnx.ccn.impl.repo.BasicPolicy.getPolicyXML (  ) 
Returns:
- get the associated policyXML

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

Parameters:
globalPrefix the global prefix as a slash separated String

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.

Parameters:
localName the name as a string in the form xxx/yyy/zzz
Exceptions:
MalformedContentNameStringException if the name is formatted incorrectly

Implements org.ccnx.ccn.impl.repo.Policy.

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.

Parameters:
version The version as a String

Implements org.ccnx.ccn.impl.repo.Policy.

void org.ccnx.ccn.impl.repo.BasicPolicy.update ( PolicyXML  pxml,
boolean  fromNet 
) throws RepositoryException

Applies policy changes.

Parameters:
pxml policy data
Returns:
Exceptions:
XMLStreamException 

Implements org.ccnx.ccn.impl.repo.Policy.

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".

Parameters:
is stream for the file

Implements org.ccnx.ccn.impl.repo.Policy.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:39 2011 for Content-Centric Networking in Java by  doxygen 1.6.3