Public Member Functions | |
CCNNameEnumerator (ContentName prefix, CCNHandle handle, BasicNameEnumeratorListener c) throws IOException | |
CCNNameEnumerator constructor. | |
CCNNameEnumerator (CCNHandle handle, BasicNameEnumeratorListener c) | |
CCNNameEnumerator constructor. | |
CCNHandle | handle () |
void | registerPrefix (ContentName prefix) throws IOException |
Method to register a prefix for name enumeration. | |
boolean | cancelPrefix (ContentName prefix) |
Method to cancel active enumerations. | |
Interest | handleContent (ContentObject c, Interest interest) |
Callback for name enumeration responses. | |
boolean | handleInterest (Interest interest) |
Method for receiving Interests matching the namespace for answering name enumeration requests. | |
boolean | containsRegisteredName (ContentName name) |
Method to check if a name is already registered to be included in name enumeration responses for incoming Interests. | |
void | registerNameSpace (ContentName name) throws IOException |
Method to register a namespace for filtering incoming Interests. | |
void | registerNameForResponses (ContentName name) |
Method to register a name to include in incoming name enumeration requests. | |
void | cancelEnumerationsWithPrefix (ContentName prefixToCancel) |
Method to cancel more than one prefix at a time. | |
Protected Member Functions | |
NEResponse | getHandledResponse (ContentName n) |
Method to get the NEResponse object for a registered name. | |
void | updateHandledResponses (ContentName n) |
Method to set the dirty flag for NEResponse objects that are updated as new names are registered for responses. | |
NERequest | getCurrentRequest (ContentName n) |
Method to get the corresponding NERequest for a ContentName. | |
Protected Attributes | |
CCNHandle | _handle = null |
BasicNameEnumeratorListener | callback |
ArrayList< ContentName > | _registeredNames = new ArrayList<ContentName>() |
NEHandler | _neHandler |
ArrayList< NEResponse > | _handledResponses = new ArrayList<NEResponse>() |
ArrayList< NERequest > | _currentRequests = new ArrayList<NERequest>() |
Classes | |
class | NEHandler |
Class to handle responses via a separate thread. More... | |
class | NERequest |
A supporting class for CCNNameEnumerator. | |
class | NEResponse |
A supporting class for CCNNameEnumerator. |
Applications register name prefixes. Each prefix is explored until canceled by the application. This version supports enumeration with multiple responders (repositories and applications).
An application can have multiple enumerations active at the same time. For each prefix, the name enumerator will generate an Interest. Responses to the Interest will be in the form of Collections (by a NameEnumeratorResponder and repository implementations). Returned Collections will be parsed for the enumerated names and sent back to the application using the callback with the applicable prefix and an array of names in that namespace. The application is expected to handle duplicate names from multiple responses and should be able to handle names that are returned, but may not be available at this time (for example, /a.com/b/c.txt might have been enumerated but a.com content may not be available).
org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.CCNNameEnumerator | ( | ContentName | prefix, | |
CCNHandle | handle, | |||
BasicNameEnumeratorListener | c | |||
) | throws IOException |
CCNNameEnumerator constructor.
Creates a CCNNameEnumerator, sets the CCNHandle, registers the callback and registers a prefix for enumeration.
prefix | ContentName to enumerate names under | |
handle | CCNHandle for sending and receiving collection objects during enumeration. | |
c | BasicNameEnumeratorListener callback to receive enumeration responses. |
org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.CCNNameEnumerator | ( | CCNHandle | handle, | |
BasicNameEnumeratorListener | c | |||
) |
CCNNameEnumerator constructor.
Creates a CCNNameEnumerator, sets the CCNHandle, and registers the callback.
handle | CCNHandle for sending and receiving collection objects during enumeration. | |
c | BasicNameEnumeratorListener callback to receive enumeration responses. |
void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.registerPrefix | ( | ContentName | prefix | ) | throws IOException |
Method to register a prefix for name enumeration.
A NERequest and initial interest is created for new prefixes. Prefixes that are already registered return and do not impact the already active registration.
prefix | ContentName to enumerate |
IOException |
boolean org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.cancelPrefix | ( | ContentName | prefix | ) |
Method to cancel active enumerations.
The active interests are retrieved from the corresponding NERequest object for the prefix. Each interest is canceled and the NERequest object is removed from the list of active enumerations.
prefix | ContentName to cancel enumeration |
Interest org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.handleContent | ( | ContentObject | c, | |
Interest | interest | |||
) |
Callback for name enumeration responses.
The results contain CollectionObjects containing the names under a prefix. The collection objects are matched to registered prefixes and returned to the calling applications using their registered callback handlers. Each response can create a new Interest that is used to further enumerate the namespace. The implementation explicitly handles multiple name enumeration responders. The method may now create multiple interests to further enumerate the prefix. Please note that the current implementation will need to be updated if responseIDs are more than one component long.
c | ContentObject containing the ContentNames under a registered prefix | |
interest | The interest matching or triggering a name enumeration response |
Implements org.ccnx.ccn.CCNContentHandler.
boolean org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.handleInterest | ( | Interest | interest | ) |
Method for receiving Interests matching the namespace for answering name enumeration requests.
Incoming Interests are verified to have the name enumeration marker. The NEResponse matching the interest is found (if it already exists) and if new names have been registered under the prefix or if no matching NEResponse object is found, a name enumeration response is created.
interest | Interest object matching the namespace filter. |
Implements org.ccnx.ccn.CCNInterestHandler.
boolean org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.containsRegisteredName | ( | ContentName | name | ) |
Method to check if a name is already registered to be included in name enumeration responses for incoming Interests.
name | ContentName to check for in registered names for responses |
void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.registerNameSpace | ( | ContentName | name | ) | throws IOException |
Method to register a namespace for filtering incoming Interests.
name | ContentName to register for filtering incoming Interests |
IOException |
void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.registerNameForResponses | ( | ContentName | name | ) |
Method to register a name to include in incoming name enumeration requests.
name | ContentName to register for name enumeration responses |
NEResponse org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.getHandledResponse | ( | ContentName | n | ) | [protected] |
Method to get the NEResponse object for a registered name.
Returns null if no matching NEResponse is found.
n | ContentName identifying a NEResponse |
void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.updateHandledResponses | ( | ContentName | n | ) | [protected] |
Method to set the dirty flag for NEResponse objects that are updated as new names are registered for responses.
n | New ContentName to be included in name enumeration responses |
NERequest org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.getCurrentRequest | ( | ContentName | n | ) | [protected] |
Method to get the corresponding NERequest for a ContentName.
Returns null if no NERequest is found.
n | ContentName for the NERequest to be found. |
void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.cancelEnumerationsWithPrefix | ( | ContentName | prefixToCancel | ) |
Method to cancel more than one prefix at a time.
This method will cancel all active Interests matching the prefix supplied. The matching NERequest objects are removed from the set of active registered prefixes and the corresponding Interests are canceled.
prefixToCancel |