com.foxsmart.csu.config
Class CiscoRouterConfig

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.CiscoRouterConfigComponent
          extended by com.foxsmart.csu.config.CiscoRouterConfig
All Implemented Interfaces:
CompositeComponent, IndelibleComponent, java.io.Serializable

public class CiscoRouterConfig
extends CiscoRouterConfigComponent
implements CompositeComponent, IndelibleComponent

The CiscoRouterConfig class represents a Cisco Router IOS configuration.

See Also:
Serialized Form

Field Summary
 
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
CiscoRouterConfig()
          Constructs a Cisco Router configuration object.
 
Method Summary
 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 buildFromIos(java.lang.String ios)
          Builds this a Cisco Router Configuration set of classes based on the specified IOS configuration string.
 java.lang.Object clone()
          Creates a cloned router configuration.
 java.lang.String generateHeaderIos()
          Returns the empty string since this is the root for the entire configuration.
 Commands generateIos()
          Returns the IOS configuration commands for this component.
 java.util.List getChildComponentKeys()
          Returns the list of child keys of this composite component.
static java.util.List getChildComponentKeysStatic()
          Gets the child component keys via a static convenience method.
 java.util.List getChildComponentUpdateKeys()
          Returns the list of child keys of this composite component.
static java.util.List getChildComponentUpdateKeysStatic()
          Gets the child component update keys via a static convenience method.
 java.lang.String getOriginalIos()
          Gets the original Cisco IOS configuration read from the router.
 java.util.List getPackages()
          Gets a list of the packages used to instantiate components (e.g.
static java.util.List getPackagesStatic()
          Gets the child component keys via a static convenience method.
static void setChildComponentKeysStatic(java.util.List componentKeys)
          Sets the child component keys for this component via a static convenience method.
static void setChildComponentUpdateKeysStatic(java.util.List componentUpdateKeys)
          Sets the child component update keys for this component via a static convenience method.
static void setPackagesStatic(java.util.List packages)
          Sets the packages for this component via a static convenience method.
 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, generateDeleteIos, generateIos, generateIos, generateIos, generateMultiLineUpdateConfiglet, 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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CiscoRouterConfig

public CiscoRouterConfig()
Constructs a Cisco Router configuration object.

Method Detail

setPackagesStatic

public static void setPackagesStatic(java.util.List packages)
Sets the packages for this component via a static convenience method.

Parameters:
packages - the list of packages

getPackagesStatic

public static java.util.List getPackagesStatic()
Gets the child component keys via a static convenience method.

Returns:
the child component keys.

getPackages

public java.util.List getPackages()
Description copied from interface: CompositeComponent
Gets a list of the packages used to instantiate components (e.g. "com.foxsmart.csu.config"). The packages will be used in the order they are listed.

Specified by:
getPackages in interface CompositeComponent
Returns:
the packages.
See Also:
CompositeComponent.getPackages()

setChildComponentKeysStatic

public static void setChildComponentKeysStatic(java.util.List componentKeys)
Sets the child component keys for this component via a static convenience method.

Parameters:
componentKeys - the child component keys.

getChildComponentKeysStatic

public static java.util.List getChildComponentKeysStatic()
Gets the child component keys via a static convenience method.

Returns:
the child component keys.

getChildComponentKeys

public java.util.List getChildComponentKeys()
Description copied from interface: CompositeComponent
Returns the list of child keys of this composite component. The keys are stored in the order that they should be processed for generating IOS statements. Class objects (e.g. Length.class) should be used for supported components while strings (e.g. "ip") should be used for unsupported components.

Specified by:
getChildComponentKeys in interface CompositeComponent
Returns:
The list of child component keys for generating IOS statements.
See Also:
CompositeComponent.getChildComponentKeys()

setChildComponentUpdateKeysStatic

public static void setChildComponentUpdateKeysStatic(java.util.List componentUpdateKeys)
Sets the child component update keys for this component via a static convenience method.

Parameters:
componentUpdateKeys - the child component keys.

getChildComponentUpdateKeysStatic

public static java.util.List getChildComponentUpdateKeysStatic()
Gets the child component update keys via a static convenience method.

Returns:
the child component update keys.

getChildComponentUpdateKeys

public java.util.List getChildComponentUpdateKeys()
Description copied from interface: CompositeComponent
Returns the list of child keys of this composite component. The keys are stored in the order that they should be processed for updating IOS statements. Class objects (e.g. Length.class) should be used for supported components while strings (e.g. "ip") should be used for unsupported components. In most cases, this list will be the same as getChildComponentKeys with the exception being when the order of updates matters and is different from the order listed in a "show configuration" router command.

Specified by:
getChildComponentUpdateKeys in interface CompositeComponent
Returns:
The list of child component keys for updating IOS statements.
See Also:
CompositeComponent.getChildComponentUpdateKeys()

buildFromIos

public void buildFromIos(java.lang.String ios)
                  throws InvalidConfigurationException
Builds this a Cisco Router Configuration set of classes based on the specified IOS configuration string.

Parameters:
ios - The Cisco IOS configuration string.
Throws:
InvalidConfigurationException - if the IOS configuration can not be parsed for any reason.

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

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

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

getOriginalIos

public java.lang.String getOriginalIos()
Gets the original Cisco IOS configuration read from the router. If the router configuration hasn't been read, null will be returned.

Returns:
The IOS configuration.

generateHeaderIos

public java.lang.String generateHeaderIos()
                                   throws InvalidConfigurationException
Returns the empty string since this is the root for the entire configuration.

Specified by:
generateHeaderIos in interface CompositeComponent
Returns:
The empty string.
Throws:
InvalidConfigurationException - never.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a cloned router configuration. Null is returned if there is a problem cloning the router configuration.

Overrides:
clone in class java.lang.Object
Returns:
The cloned router configuration.
Throws:
java.lang.CloneNotSupportedException - if cloning is not supported.


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