org.ipdr.ftp
Class CapabilityFile

java.lang.Object
  extended by org.ipdr.ftp.CapabilityFile

public class CapabilityFile
extends java.lang.Object

This class represents a CapabilityFile. This allows operations such as getting SubscriptionGroup details, adding a SubscriptionGroup etc.


Field Summary
protected  java.util.ArrayList subscriptionGroups_
           
protected  SubscriptionGroup subsGroup_
           
protected  java.lang.String version_
           
 
Constructor Summary
CapabilityFile()
           Constructor for CapabilityFile class.
CapabilityFile(java.lang.String capabilityFileURL)
           Constructor for CapabilityFile class.
 
Method Summary
 boolean addGroup(SubscriptionGroup subsGroup)
           This method adds a new SubscriptionGroup to the subscriptionGroups_ ArrayList
protected  void createSubscriptionList(org.w3c.dom.Document document)
          This method extracts SubscriptionGroup details from XML if some conditions are satisfied.
 boolean deleteGroup(java.lang.String groupID)
           This method removes a SubscriptionGroup from the capability file with search based on GroupID
 SubscriptionGroup[] getAllGroups()
           This method returns an array of SubscriptionGroup elements for this Capbility file.
protected  BRRecord getBRRecordElement(org.w3c.dom.Node node)
          This method gets the BRRecord value from an XML node and returns it.
protected  java.lang.String getElementValue(org.w3c.dom.Node childNode)
           This method gets the value from an XML node and returns it.
 SubscriptionGroup getGroup(java.lang.String groupID)
           This method returns an object of SubscriptionGroup element for the group ID passed.
 java.lang.String[] getGroupIDs()
           This method returns an array of all groupIds for this CapabilityFile.
 java.lang.String toXML()
           This method returns an XML string representing the CapabilityFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subscriptionGroups_

protected java.util.ArrayList subscriptionGroups_

subsGroup_

protected SubscriptionGroup subsGroup_

version_

protected java.lang.String version_
Constructor Detail

CapabilityFile

public CapabilityFile()

Constructor for CapabilityFile class.


CapabilityFile

public CapabilityFile(java.lang.String capabilityFileURL)
               throws IPDRFTPException

Constructor for CapabilityFile class. It is in this constructor that the parsing of capability file is done.

Parameters:
capabilityFileURL - String for CapabilityFile URL.

Throws:
IPDRFTPException
Method Detail

createSubscriptionList

protected void createSubscriptionList(org.w3c.dom.Document document)
                               throws IPDRFTPException
This method extracts SubscriptionGroup details from XML if some conditions are satisfied.

Parameters:
document - Document object created after parsing the XML.
Throws:
IPDRFTPException

getElementValue

protected java.lang.String getElementValue(org.w3c.dom.Node childNode)

This method gets the value from an XML node and returns it.

Parameters:
childNode - Node object whose value is required.
Returns:
String The value of the node in the XML.


getBRRecordElement

protected BRRecord getBRRecordElement(org.w3c.dom.Node node)
This method gets the BRRecord value from an XML node and returns it.

Parameters:
node - Node object which contains the BRRecord.
Returns:
BRRecord The BRRecord in the XML.

addGroup

public boolean addGroup(SubscriptionGroup subsGroup)
                 throws IPDRFTPException

This method adds a new SubscriptionGroup to the subscriptionGroups_ ArrayList

Parameters:
subsGroup - Subscription Group to add
Returns:
boolean Return true if VERSION_NUMBER string is successfully written to the Control file else return false.

Throws:
IPDRFTPException

deleteGroup

public boolean deleteGroup(java.lang.String groupID)
                    throws IPDRFTPException

This method removes a SubscriptionGroup from the capability file with search based on GroupID

Parameters:
groupID - String indicating the groupID for the SubscriptionGroup which is to be removed.
Returns:
boolean indicating the success/failure of the operation

Throws:
IPDRFTPException

getAllGroups

public SubscriptionGroup[] getAllGroups()

This method returns an array of SubscriptionGroup elements for this Capbility file.

Returns:
SubscriptionGroup[] An array of all SubscriptionGroup objects


getGroup

public SubscriptionGroup getGroup(java.lang.String groupID)
                           throws IPDRFTPException

This method returns an object of SubscriptionGroup element for the group ID passed.

Parameters:
groupID - String containing groupID of the SubscriptionGroup
Returns:
SubscriptionGroups An object of SubscriptionGroup class with groupID as groupID

Throws:
IPDRFTPException

getGroupIDs

public java.lang.String[] getGroupIDs()
                               throws IPDRFTPException

This method returns an array of all groupIds for this CapabilityFile.

Returns:
String[] A string array containing all the groupIDs

Throws:
IPDRFTPException

toXML

public java.lang.String toXML()
                       throws IPDRFTPException

This method returns an XML string representing the CapabilityFile.

Returns:
String A string containing capability XML

Throws:
IPDRFTPException