com.foxsmart.csu.config.global
Class IpAccessListComponent

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.CiscoRouterConfigComponent
          extended by com.foxsmart.csu.config.global.IpAccessListComponent
All Implemented Interfaces:
MultiLineComponent, java.io.Serializable

public class IpAccessListComponent
extends CiscoRouterConfigComponent
implements MultiLineComponent

The IpAccessListComponent class represents all the named access lists defined on the router.

See Also:
Serialized Form

Field Summary
static java.lang.String ACCESS_LIST
           
static java.lang.String EXTENDED
           
static java.lang.String EXTENDED_TYPE
          Extended Access List Type
static java.lang.String INTERVAL
           
static java.lang.String IP
           
static java.lang.String LOG_UPDATE
           
static java.lang.String LOGGING
           
static java.lang.Integer MAX_LOG_UPDATE_THRESHOLD_HITS
          Maximum log update threshold number of hits
static java.lang.Integer MAX_LOGGING_INTERVAL_MILLIS
          Maximum logging interval
static java.lang.Integer MIN_LOG_UPDATE_THRESHOLD_HITS
          Minimum log update threshold number of hits
static java.lang.Integer MIN_LOGGING_INTERVAL_MILLIS
          Minimum logging interval in milliseconds
static java.lang.String STANDARD
           
static java.lang.String STANDARD_TYPE
          Standard Access List Type
static java.lang.String THRESHOLD
           
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigComponent
commentComponent, componentMap, log, parentComponent
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
NO, tokenIndex
 
Constructor Summary
IpAccessListComponent()
          Constructs an IP access list component object.
 
Method Summary
 void addAccessListEntry(NameAccessListEntry accessListEntry)
          Adds an access list entry.
 java.util.List buildFromIos(java.util.List configLines)
          Parse and populate the specific CiscoRouterComponent object based on the passed in individual lines of the IOS configuration.
 void clearAccessListEntries(java.lang.String accessListName)
          Removes any previously added name access lists etnries for the specified access list name.
 void disableAccessList(java.lang.String name)
          Disables an access list name.
 void enableAccessList(java.lang.String name, java.lang.String type)
          Enables an access list name and specifies its type.
 Commands generateDeleteIos(CiscoRouterConfig updatedCiscoRouterConfig)
          Generates the IOS configuration commands to delete this component.
 Commands generateIos()
          Returns the IOS configuration commands for this component.
protected  Commands generateMultiLineUpdateConfiglet(CiscoRouterConfigComponent origComponent)
          Generates the IOS commands that will handle the updating of a multi-line component.
 java.util.List getAccessListEntries(java.lang.String accessListName)
          Returns a list of NameAccessListEntry object that have been added so far based on the specified access list name.
 java.lang.String getAccessListType(java.lang.String name)
          Returns the access list type (i.e.
 java.lang.Integer getLoggingInterval()
          Gets the logging interval.
 java.lang.Integer getLogUpdateThreshold()
          Gets the log update threshold.
 boolean isAccessListEnabled(java.lang.String name)
          Returns whether the specified access list name is enabled or not.
 void setLoggingInterval(java.lang.Integer loggingInterval)
          Sets the logging interval in milliseconds.
 void setLogUpdateThreshold(java.lang.Integer logUpdateThreshold)
          Sets the log update threshold number of hits.
 void validate()
          Validates this object to ensure it contains a valid IOS configuration.
 
Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigComponent
addComponent, addComponent, checkComponentType, deleteOldConfigWhenUpdating, dumpComponents, generateChildrenUpdateConfiglet, generateCompositeIos, generateCompositeIos, generateIos, generateIos, generateIos, generateUpdateCompositeIos, generateUpdateIos, generateUpdateIos, getAllComponents, getCiscoRouterConfig, getComment, getComponentClassName, getComponentClassName, getComponentKeys, getComponents, getComponents, getDeferredDelete, getFirstComponent, getFirstComponent, getParentComponent, getTotalComponents, getTotalComponents, getUpdateConfiglet, instantiateComponent, instantiateComponent, isValid, removeAllComponents, removeAllComponents, removeAllComponents, removeComponent, removeComponent, removeComponent, requiresCommentSeparator, setComment, setParentComponent, validateChildren
 
Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
checkExists, checkLineComplete, checkNotEmpty, checkRange, checkTokenCount, checkTokenCount, checkTokenMatch, checkTokenMatch, decrementTokenIndex, generateCommands, getBigDecimalNumberFromString, getDoubleNumberFromString, getEnum, getHexadecimalNumberFromString, getIntegerNumberFromString, getIpAddressFromString, getLine, getLongNumberFromString, getMacAddressFromString, getNextOptionalToken, getNextToken, getToken, getTokenIndex, getTokens, getTotalIndentedLines, getTotalLines, incrementTokenIndex, invalidConfiguration, invalidTokenFound, isEmpty, moreIndentedLines, moreLines, moreTokens, removeLines, resetTokenIndex, setTokenIndex, tokensLeft
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IP

public static final java.lang.String IP
See Also:
Constant Field Values

ACCESS_LIST

public static final java.lang.String ACCESS_LIST
See Also:
Constant Field Values

LOGGING

public static final java.lang.String LOGGING
See Also:
Constant Field Values

LOG_UPDATE

public static final java.lang.String LOG_UPDATE
See Also:
Constant Field Values

INTERVAL

public static final java.lang.String INTERVAL
See Also:
Constant Field Values

THRESHOLD

public static final java.lang.String THRESHOLD
See Also:
Constant Field Values

STANDARD

public static final java.lang.String STANDARD
See Also:
Constant Field Values

EXTENDED

public static final java.lang.String EXTENDED
See Also:
Constant Field Values

STANDARD_TYPE

public static final java.lang.String STANDARD_TYPE
Standard Access List Type

See Also:
Constant Field Values

EXTENDED_TYPE

public static final java.lang.String EXTENDED_TYPE
Extended Access List Type

See Also:
Constant Field Values

MIN_LOGGING_INTERVAL_MILLIS

public static final java.lang.Integer MIN_LOGGING_INTERVAL_MILLIS
Minimum logging interval in milliseconds


MAX_LOGGING_INTERVAL_MILLIS

public static final java.lang.Integer MAX_LOGGING_INTERVAL_MILLIS
Maximum logging interval


MIN_LOG_UPDATE_THRESHOLD_HITS

public static final java.lang.Integer MIN_LOG_UPDATE_THRESHOLD_HITS
Minimum log update threshold number of hits


MAX_LOG_UPDATE_THRESHOLD_HITS

public static final java.lang.Integer MAX_LOG_UPDATE_THRESHOLD_HITS
Maximum log update threshold number of hits

Constructor Detail

IpAccessListComponent

public IpAccessListComponent()
Constructs an IP access list component object.

Method Detail

addAccessListEntry

public void addAccessListEntry(NameAccessListEntry accessListEntry)
                        throws InvalidConfigurationException
Adds an access list entry.

Parameters:
accessListEntry - The name access list entry.
Throws:
InvalidConfigurationException - if the access list doesn't have a name set.

enableAccessList

public void enableAccessList(java.lang.String name,
                             java.lang.String type)
                      throws InvalidConfigurationException
Enables an access list name and specifies its type. If a previous type was specified, the new type will overwrite the previous type. Access lists must be enabled to be active. Otherwise, any access list entries will be ignored.

Parameters:
name - The access list name
type - The access list type. Must be STANDARD_TYPE or EXTENDED_TYPE.
Throws:
InvalidConfigurationException - if the name or type are invalid.

disableAccessList

public void disableAccessList(java.lang.String name)
Disables an access list name. Once an access list is disabled, it will not be active, even if access list entries have been added.

Parameters:
name - The access list name.

isAccessListEnabled

public boolean isAccessListEnabled(java.lang.String name)
Returns whether the specified access list name is enabled or not.

Parameters:
name - The access list name to check.
Returns:
True if the access list name is enabled or false if not.

getAccessListType

public java.lang.String getAccessListType(java.lang.String name)
Returns the access list type (i.e. STANDARD_TYPE or EXTENDED_TYPE). Null will be returned if the access list is not enabled.

Parameters:
name - The access list name.
Returns:
The access list type or null.

getAccessListEntries

public java.util.List getAccessListEntries(java.lang.String accessListName)
Returns a list of NameAccessListEntry object that have been added so far based on the specified access list name.

Parameters:
accessListName - The access list name to get the access list entries from.
Returns:
The list of access list entries.

clearAccessListEntries

public void clearAccessListEntries(java.lang.String accessListName)
Removes any previously added name access lists etnries for the specified access list name.

Parameters:
accessListName - The access list name to remove all access lists entries from.

setLoggingInterval

public void setLoggingInterval(java.lang.Integer loggingInterval)
Sets the logging interval in milliseconds. Valid values are between 0-2147483647.

Parameters:
loggingInterval - The logging interval.

getLoggingInterval

public java.lang.Integer getLoggingInterval()
Gets the logging interval.

Returns:
the logging interval.

setLogUpdateThreshold

public void setLogUpdateThreshold(java.lang.Integer logUpdateThreshold)
Sets the log update threshold number of hits. Valid values are between 0-2147483647.

Parameters:
logUpdateThreshold - The log update threshold.

getLogUpdateThreshold

public java.lang.Integer getLogUpdateThreshold()
Gets the log update threshold.

Returns:
the log update threshold.

validate

public void validate()
              throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
Validates this object to ensure it contains a valid IOS configuration.

Specified by:
validate in class CiscoRouterConfigComponent
Throws:
InvalidConfigurationException - if the configuration is invalid.
See Also:
CiscoRouterConfigComponent

buildFromIos

public java.util.List buildFromIos(java.util.List configLines)
                            throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
Parse and populate the specific CiscoRouterComponent object based on the passed in individual lines of the IOS configuration. The passed in configuration lines should represent the first line in the configuration that applies to the specific component. The component should use all lines needed by its specific part of the configuration and return a List with the remaining lines that are not part of the component's configuration.

Specified by:
buildFromIos in class CiscoRouterConfigComponent
Parameters:
configLines - The list of IOS configuration lines.
Returns:
The rest of the lines that were not parsed by the component.
Throws:
InvalidConfigurationException - if the IOS configuration can not be parsed for any reason.
See Also:
CiscoRouterConfigComponent

generateIos

public Commands generateIos()
                     throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
Returns the IOS configuration commands for this component.

Specified by:
generateIos in class CiscoRouterConfigComponent
Returns:
The IOS configuration string as a list of Command objects. To generate a configlet from the list of Command objects, use Command.getConfiglet().
Throws:
InvalidConfigurationException - if the IOS configuration is invalid and the IOS string can not be generated. The validate() method is used to determine if the configuration is valid.
See Also:
CiscoRouterConfigComponent

generateDeleteIos

public Commands generateDeleteIos(CiscoRouterConfig updatedCiscoRouterConfig)
                           throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
Generates the IOS configuration commands to delete this component. This is the default implementation that generates a "no" statement followed by the generateIos() string for non CompositeComponents or generateHeaderIos() for CompositeComponents. Specific components may choose to override this method if this implementation is incorrect. The "no" keyword is placed where the first character of the command is located. For example, if the IOS command is " length 255", then the returned command will be " no length 255" (and not "no length 255").

Note that this implementation will call the getDeferredDelete method on the component and set the "deferred flag" on the returned Commands with its returned value.

Specified by:
generateDeleteIos in interface MultiLineComponent
Overrides:
generateDeleteIos in class CiscoRouterConfigComponent
Parameters:
updatedCiscoRouterConfig - the updated Cisco router configuration.
Returns:
The generated IOS string to deleted the component.
Throws:
InvalidConfigurationException - if the IOS configuration is invalid and the IOS string can not be generated. The validate() method is used to determine if the configuration is valid.
See Also:
MultiLineComponent

generateMultiLineUpdateConfiglet

protected Commands generateMultiLineUpdateConfiglet(CiscoRouterConfigComponent origComponent)
                                             throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
Generates the IOS commands that will handle the updating of a multi-line component. This implementation will first delete the original configuration by calling generateDeleteIos() and then generate the new configuration by calling generateIos(). The multi-line component should ensure the generateDeleteIos() is implemented properly since the default "no" + generateIos() will most likely not work for a multi-line configuration. Note that if the component is an IndelibleComponent or if the deleteOldConfigWhenUpdating method returns true, only the new IOS configuration will be generated with generateUpdateIos().

Overrides:
generateMultiLineUpdateConfiglet in class CiscoRouterConfigComponent
Parameters:
origComponent - The original component.
Returns:
The IOS statements that can be used to update a router configuration.
Throws:
InvalidConfigurationException - if either this or the passed in configuration are invalid.
See Also:
CiscoRouterConfigComponent


Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.