org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator Class Reference

Implements the base Name Enumerator. More...

Inheritance diagram for org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator:

org.ccnx.ccn.CCNInterestHandler org.ccnx.ccn.CCNContentHandler

List of all members.

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.


Detailed Description

Implements the base Name Enumerator.

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

See also:
CCNInterestHandler

CCNContentHandler

BasicNameEnumeratorListener

NameEnumerationResponse


Constructor & Destructor Documentation

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.

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

Parameters:
handle CCNHandle for sending and receiving collection objects during enumeration.
c BasicNameEnumeratorListener callback to receive enumeration responses.


Member Function Documentation

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.

Parameters:
prefix ContentName to enumerate
Exceptions:
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.

Parameters:
prefix ContentName to cancel enumeration
Returns:
boolean Returns if the prefix is successfully canceled.

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.

Parameters:
c ContentObject containing the ContentNames under a registered prefix
interest The interest matching or triggering a name enumeration response
Returns:
Interest Returns a new Interest to further enumerate or null to cancel the interest that matched these objects. This implementation returns null since new interests are created and expressed as the returned CollectionObjects are processed.
See also:
CollectionObject

CCNInterestHandler

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.

Parameters:
interest Interest object matching the namespace filter.
Returns:
boolean

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.

Parameters:
name ContentName to check for in registered names for responses
Returns:
boolean Returns true if the name is registered and false if not

void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.registerNameSpace ( ContentName  name  )  throws IOException

Method to register a namespace for filtering incoming Interests.

Parameters:
name ContentName to register for filtering incoming Interests
Exceptions:
IOException 
See also:
CCNInterestHandler

void org.ccnx.ccn.profiles.nameenum.CCNNameEnumerator.registerNameForResponses ( ContentName  name  ) 

Method to register a name to include in incoming name enumeration requests.

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

Parameters:
n ContentName identifying a NEResponse
Returns:
NEResponse Returns the NEResponse matching the name.

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.

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

Parameters:
n ContentName for the NERequest to be found.
Returns:
NERequest NERequest instance with the supplied ContentName. Returns null if no NERequest exists.

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.

Parameters:
prefixToCancel 


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:04 2012 for Content-Centric Networking in Java by  doxygen 1.5.6