com.foxsmart.csu.config
Class CiscoRouterConfigComponent

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.CiscoRouterConfigComponent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AaaNewModelComponent, AbsoluteTimeoutComponent, AccessClassComponent, AccessListComponent, ActivationCharacterComponent, AutobaudComponent, AutocommandComponent, AutocommandOptionsComponent, AutohangupComponent, AutoselectComponent, BandwidthComponent, BannerComponent, CiscoRouterConfig, ClassComponent, ClassMapComponent, DatabitsComponent, DataCharacterBitsComponent, DescriptionComponent, DialerCallbackServerComponent, DialerEnableTimeoutComponent, DialerFastIdleComponent, DialerIdleTimeoutComponent, DialerIsdnComponent, DialerOutgoingComponent, DialerVoiceCallComponent, DialerWaitForCarrierTimeComponent, DisconnectCharacterComponent, DispatchCharacterComponent, DispatchMachineComponent, DispatchTimeoutComponent, DomainLookupComponent, EditingComponent, EnableComponent, EncapsulationComponent, EndComponent, EscapeCharacterComponent, ExecBannerComponent, ExecCharacterBitsComponent, ExecComponent, ExecTimeoutComponent, FairQueueComponent, FlowcontrolComponent, FlushAtActivationComponent, FrameRelayAdaptiveShapingComponent, FrameRelayBcComponent, FrameRelayBeComponent, FrameRelayCirComponent, FrameRelayClassComponent, FrameRelayEndToEndKeepaliveComponent, FrameRelayFairQueueComponent, FrameRelayFecnAdaptComponent, FrameRelayFragmentComponent, FrameRelayInterfaceQueueComponent, FrameRelayIpRtpComponent, FrameRelayMincirComponent, FrameRelayTrafficRateComponent, FullHelpComponent, HistoryComponent, HoldCharacterComponent, HostnameComponent, InsecureComponent, InterfaceComponent, InternationalComponent, IpAccessListComponent, IpComponent, IpMtuComponent, IpRouteComponent, LengthComponent, LineComponent, LocationComponent, LockableComponent, LoggingComponent, LoginComponent, LogoutWarningComponent, MapClassAtmComponent, MapClassDialerComponent, MapClassFrameRelayComponent, MatchComponent, MemorySizeComponent, ModemComponent, MonitorComponent, MotdBannerComponent, MultiLineConfigComponent, NotifyComponent, PaddingComponent, ParityComponent, PasswordComponent, PolicyMapComponent, PriorityComponent, PrivateComponent, PrivilegeComponent, PromptComponent, QueueLimitComponent, RandomDetectComponent, RateLimitComponent, RefuseMessageComponent, RotaryComponent, RxspeedComponent, SchedulerComponent, ScriptComponent, ServiceComponent, ServicePolicyComponent, SessionDisconnectWarningComponent, SessionLimitComponent, SessionTimeoutComponent, SpecialCharacterBitsComponent, SpeedComponent, StartCharacterComponent, StateMachineComponent, StopbitsComponent, StopCharacterComponent, TelnetComponent, TerminalTypeComponent, TimeoutComponent, TransportComponent, TxspeedComponent, VacantMessageComponent, VersionComponent, WidthComponent, X25Component

public abstract class CiscoRouterConfigComponent
extends CiscoRouterConfigParser
implements java.io.Serializable

The CiscoRouterConfigComponent class represents a part of an overall Cisco Router IOS configuration. All parts of the router configuration should be made up of classes that extend this class.

See Also:
Serialized Form

Field Summary
protected  CommentComponent commentComponent
           
protected  java.util.Map componentMap
           
protected  org.apache.commons.logging.Log log
           
protected  CiscoRouterConfigComponent parentComponent
           
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
NO, tokenIndex
 
Constructor Summary
CiscoRouterConfigComponent()
          Constructs the component.
 
Method Summary
 void addComponent(CiscoRouterConfigComponent component)
          Adds a component to the list of configuration components based on a configuration key.
protected  void addComponent(java.lang.String key, CiscoRouterConfigComponent component)
          Adds a component to the list of configuration components based on a configuration key.
abstract  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.
 CiscoRouterConfigComponent checkComponentType(CiscoRouterConfigComponent component, java.lang.Class compareClass)
          Checks that the passed in component is the same type as our component.
protected  boolean deleteOldConfigWhenUpdating()
          A flag that determines if delete commands should be issued to first delete the old component before issuing the update commands for the new component.
protected  void dumpComponents()
          Dumps the configuration components.
protected  Commands generateChildrenUpdateConfiglet(CiscoRouterConfigComponent origCompositeComponent)
          Generates the list of commands that will handle the updating of all children of this component.
protected  Commands generateCompositeIos(CiscoRouterConfigComponent component)
          Generates the IOS commands for a composite component.
protected  Commands generateCompositeIos(CiscoRouterConfigComponent configComponent, boolean update)
          Generates the IOS commands for a composite component.
 Commands generateDeleteIos(CiscoRouterConfig updatedCiscoRouterConfig)
          Generates the IOS configuration commands to delete this component.
abstract  Commands generateIos()
          Returns the IOS configuration commands for this component.
protected  Commands generateIos(java.lang.Class key)
          Generates the IOS commands for all components based on the specified key.
protected  Commands generateIos(java.lang.String key)
          Generates the IOS commands for all components based on the specified key.
protected  Commands generateIos(java.lang.String key, boolean update)
          Generates the IOS commands for all components based on the specified key.
protected  Commands generateMultiLineUpdateConfiglet(CiscoRouterConfigComponent origComponent)
          Generates the IOS commands that will handle the updating of a multi-line component.
protected  Commands generateUpdateCompositeIos(CiscoRouterConfigComponent component)
          Generates the update IOS commands for a composite component.
protected  Commands generateUpdateIos()
          Generates the IOS commands that will handle the updating of this component.
protected  Commands generateUpdateIos(java.lang.String key)
          Generates the IOS commands for all components based on the specified key.
 java.util.List getAllComponents()
          Gets all the components for all keys.
static CiscoRouterConfig getCiscoRouterConfig(CiscoRouterConfigComponent component)
          Searches the parent component hierarchy of the passed in component and returns the first CiscoRouterConfig component found (should be the highest level parent).
 CommentComponent getComment()
          Gets the comment associated with this component.
protected  java.lang.String getComponentClassName(java.util.List tokens, int numTokens)
          Gets the component class name for the passed in list of tokens and number of tokens to use.
protected  java.lang.String getComponentClassName(java.lang.String componentKeyword)
          Gets the component class name for the passed in router component keyword.
protected  java.util.List getComponentKeys()
          Gets the component key set for this component.
 java.util.List getComponents(java.lang.Class key)
          Gets all the components for a specified key.
protected  java.util.List getComponents(java.lang.String key)
          Gets all the components for a specified key.
 boolean getDeferredDelete()
          This default implementation returns false which ensures all Commands are processed in their standard order.
 CiscoRouterConfigComponent getFirstComponent(java.lang.Class key)
          Gets a single component for a specified key.
protected  CiscoRouterConfigComponent getFirstComponent(java.lang.String key)
          Gets a single component for a specified key.
 CiscoRouterConfigComponent getParentComponent()
          Gets the parent component of this component.
 int getTotalComponents(java.lang.Class key)
          Gets the number of components for a specified key.
protected  int getTotalComponents(java.lang.String key)
          Gets the number of components for a specified key.
 Commands getUpdateConfiglet(CiscoRouterConfigComponent origComponent)
          Returns the list of IOS commands that can be used to provision the router to update the original configuration (passed in as a parameter) to look like this component.
protected  CiscoRouterConfigComponent instantiateComponent(java.util.List tokens, java.util.List packages)
          Instantiates the passed in List of tokens as a class name trying the passed in packages for its location.
protected  CiscoRouterConfigComponent instantiateComponent(java.lang.String className, java.util.List packages)
          Instantiates the passed in class name trying the passed in packages for its location.
 boolean isValid()
          Determines if this component is valid or not.
 void removeAllComponents()
          Removes all components from the list of configuration components for all configuration keys.
 void removeAllComponents(java.lang.Class key)
          Removes all components from the list of configuration components based on a configuration key.
protected  void removeAllComponents(java.lang.String key)
          Removes all components from the list of configuration components based on a configuration key.
 void removeComponent(CiscoRouterConfigComponent component)
          Removes a component from the list of configuration components based on a configuration key.
protected  void removeComponent(java.util.List componentList, CiscoRouterConfigComponent component)
          Removes the component from the component list while also removing the component's parent reference.
protected  void removeComponent(java.lang.String key, CiscoRouterConfigComponent component)
          Removes a component from the list of configuration components based on a configuration key.
 boolean requiresCommentSeparator()
          Determines if a comment separator should be generated between the various instances of this component when generateIos is called and more than one component of this type exists.
 void setComment(CommentComponent comment)
          Sets a comment associated with a CiscoRouterConfigComponent.
protected  void setParentComponent(CiscoRouterConfigComponent parentComponent)
          Sets the parent component for this component.
abstract  void validate()
          Validates this object to ensure it contains a valid IOS configuration.
protected  void validateChildren()
          Validates all the children of this component.
 
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

log

protected org.apache.commons.logging.Log log

commentComponent

protected CommentComponent commentComponent

componentMap

protected java.util.Map componentMap

parentComponent

protected CiscoRouterConfigComponent parentComponent
Constructor Detail

CiscoRouterConfigComponent

public CiscoRouterConfigComponent()
Constructs the component.

Method Detail

buildFromIos

public abstract java.util.List buildFromIos(java.util.List configLines)
                                     throws InvalidConfigurationException
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.

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.

generateIos

public abstract Commands generateIos()
                              throws InvalidConfigurationException
Returns the IOS configuration commands for this component.

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.

validate

public abstract void validate()
                       throws InvalidConfigurationException
Validates this object to ensure it contains a valid IOS configuration.

Throws:
InvalidConfigurationException - if the configuration is invalid.

getComponentKeys

protected java.util.List getComponentKeys()
Gets the component key set for this component.

Returns:
The component key set.

validateChildren

protected void validateChildren()
                         throws InvalidConfigurationException
Validates all the children of this component.

Throws:
InvalidConfigurationException - if any of the children are invalid.

generateIos

protected Commands generateIos(java.lang.Class key)
                        throws InvalidConfigurationException
Generates the IOS commands for all components based on the specified key.

Parameters:
key - The key for the components to generate.
Returns:
The generated IOS commands for the specified key.
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.

generateIos

protected Commands generateIos(java.lang.String key)
                        throws InvalidConfigurationException
Generates the IOS commands for all components based on the specified key.

Parameters:
key - The key for the components to generate.
Returns:
The generated IOS commands for the specified key.
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.

generateUpdateIos

protected Commands generateUpdateIos(java.lang.String key)
                              throws InvalidConfigurationException
Generates the IOS commands for all components based on the specified key.

Parameters:
key - The key for the components to generate.
Returns:
The generated IOS commands for the specified key.
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.

generateIos

protected Commands generateIos(java.lang.String key,
                               boolean update)
                        throws InvalidConfigurationException
Generates the IOS commands for all components based on the specified key.

Parameters:
key - The key for the components to generate.
update - If true, update IOS statements will be issued (e.g. generateUpdateIos). Otherwise, view IOS statements will be generated (e.g. generateIos).
Returns:
The generated IOS commands for the specified key.
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.

generateCompositeIos

protected Commands generateCompositeIos(CiscoRouterConfigComponent component)
                                 throws InvalidConfigurationException
Generates the IOS commands for a composite component. The passed in component should be a composite component.

Parameters:
component - The component to generate the IOS from
Returns:
The IOS commands.
Throws:
InvalidConfigurationException - if the configuration is invalid.

generateUpdateCompositeIos

protected Commands generateUpdateCompositeIos(CiscoRouterConfigComponent component)
                                       throws InvalidConfigurationException
Generates the update IOS commands for a composite component. The passed in component should be a composite component.

Parameters:
component - The component to generate the IOS from
Returns:
The IOS commands.
Throws:
InvalidConfigurationException - if the configuration is invalid.

generateCompositeIos

protected Commands generateCompositeIos(CiscoRouterConfigComponent configComponent,
                                        boolean update)
                                 throws InvalidConfigurationException
Generates the IOS commands for a composite component. The passed in component should be a composite component. This method handles both view and update commands based on the "update" parameter setting.

Parameters:
configComponent - The component to generate the IOS from
update - If true, update IOS statements will be issued (e.g. generateUpdateIos). If false, view IOS statements will be issued (e.g. generateIos).
Returns:
The IOS commands.
Throws:
InvalidConfigurationException - if the configuration is invalid.

getDeferredDelete

public boolean getDeferredDelete()
This default implementation returns false which ensures all Commands are processed in their standard order. If a particular Component needs it's deletes to be deferred until the end, they should override this implementation to return true.

Returns:
false.

generateDeleteIos

public Commands generateDeleteIos(CiscoRouterConfig updatedCiscoRouterConfig)
                           throws InvalidConfigurationException
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.

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.

requiresCommentSeparator

public boolean requiresCommentSeparator()
Determines if a comment separator should be generated between the various instances of this component when generateIos is called and more than one component of this type exists. This only applies to MultiInstanceComponents. MultiInstanceComponent's should override this method if they want to return false. This implementation (i.e. the default implementation) always returns "true".

Returns:
True always.

setComment

public void setComment(CommentComponent comment)
Sets a comment associated with a CiscoRouterConfigComponent. This would typically be the comment directly before the component in the IOS configuration. Null should be passed to remove any comment associated with this component.

Parameters:
comment - The comment to associate with this component.

getComment

public CommentComponent getComment()
Gets the comment associated with this component. Null is returned if no comment is associated with this component.

Returns:
The comment associated with this component.

isValid

public boolean isValid()
Determines if this component is valid or not. This method uses the validate() method to determine if a component is valid or not.

Returns:
True if the component is valid or false if not.

addComponent

public void addComponent(CiscoRouterConfigComponent component)
                  throws InvalidConfigurationException
Adds a component to the list of configuration components based on a configuration key. If the component is a MultiInstanceComponent, it may be added more than once. Otherwise, an exception will be thrown if the component has already been added.

Parameters:
component - The component to add
Throws:
InvalidConfigurationException - if a non-MultiInterfaceComponent has already been added.

addComponent

protected void addComponent(java.lang.String key,
                            CiscoRouterConfigComponent component)
                     throws InvalidConfigurationException
Adds a component to the list of configuration components based on a configuration key. If the component is a MultiInstanceComponent, it may be added more than once. Otherwise, an exception will be thrown if the component has already been added.

Parameters:
key - The key for which component list to add to
component - The component to add
Throws:
InvalidConfigurationException - if a non-MultiInterfaceComponent has already been added.

removeAllComponents

public void removeAllComponents(java.lang.Class key)
Removes all components from the list of configuration components based on a configuration key. If the component or the list based on the key are not present, no components are removed.

Parameters:
key - The key for which component list to delete from

removeAllComponents

protected void removeAllComponents(java.lang.String key)
Removes all components from the list of configuration components based on a configuration key. If the component or the list based on the key are not present, no components are removed.

Parameters:
key - The key for which component list to delete from

removeAllComponents

public void removeAllComponents()
Removes all components from the list of configuration components for all configuration keys.


removeComponent

public void removeComponent(CiscoRouterConfigComponent component)
Removes a component from the list of configuration components based on a configuration key. If the component or the list based on the key are not present, no component is removed.

Parameters:
component - The component to remove

removeComponent

protected void removeComponent(java.lang.String key,
                               CiscoRouterConfigComponent component)
Removes a component from the list of configuration components based on a configuration key. If the component or the list based on the key are not present, no component is removed.

Parameters:
key - The key for which component list to delete from
component - The component to remove

removeComponent

protected void removeComponent(java.util.List componentList,
                               CiscoRouterConfigComponent component)
Removes the component from the component list while also removing the component's parent reference.

Parameters:
componentList - the component list to remove the component from.
component - the component to remove.

getComponents

public java.util.List getComponents(java.lang.Class key)
Gets all the components for a specified key. If no components are associated with the key, an empty list is returned.

Parameters:
key - The key for the components.
Returns:
The list of components.

getComponents

protected java.util.List getComponents(java.lang.String key)
Gets all the components for a specified key. If no components are associated with the key, an empty list is returned.

Parameters:
key - The key for the components.
Returns:
The list of components.

getAllComponents

public java.util.List getAllComponents()
Gets all the components for all keys. If no components exist, an empty list is returned.

Returns:
The list of all components.

getTotalComponents

public int getTotalComponents(java.lang.Class key)
Gets the number of components for a specified key.

Parameters:
key - The key for the components.
Returns:
The number of components.

getTotalComponents

protected int getTotalComponents(java.lang.String key)
Gets the number of components for a specified key.

Parameters:
key - The key for the components.
Returns:
The number of components.

getFirstComponent

public CiscoRouterConfigComponent getFirstComponent(java.lang.Class key)
Gets a single component for a specified key. If no components are associated with the key, null is returned.

Parameters:
key - The key for the components.
Returns:
The component.

getFirstComponent

protected CiscoRouterConfigComponent getFirstComponent(java.lang.String key)
Gets a single component for a specified key. If no components are associated with the key, null is returned.

Parameters:
key - The key for the components.
Returns:
The component.

instantiateComponent

protected CiscoRouterConfigComponent instantiateComponent(java.lang.String className,
                                                          java.util.List packages)
                                                   throws InvalidConfigurationException
Instantiates the passed in class name trying the passed in packages for its location. If the class couldn't be instantiated, then null is returned.

Parameters:
className - The class name to try to instantiate
packages - The list of packages to try, in the order specified.
Returns:
The instantiated component or null.
Throws:
InvalidConfigurationException - if we were unable to find the root CiscoRouterConfig object.

instantiateComponent

protected CiscoRouterConfigComponent instantiateComponent(java.util.List tokens,
                                                          java.util.List packages)
                                                   throws InvalidConfigurationException
Instantiates the passed in List of tokens as a class name trying the passed in packages for its location. If the class couldn't be instantiated, then null is returned. Note that the global list of packages will be attempted before the passed in list of packages to provide a way for custom built components to be instantiated outside the standard Cisco Smart Update package hierarchy.

Parameters:
tokens - The list of tokens for this IOS line (e.g. exec-timeout, ...)
packages - The list of packages to try, in the order specified.
Returns:
The instantiated component or null.
Throws:
InvalidConfigurationException - if we were unable to find the root CiscoRouterConfig object.

getComponentClassName

protected java.lang.String getComponentClassName(java.util.List tokens,
                                                 int numTokens)
Gets the component class name for the passed in list of tokens and number of tokens to use.

Parameters:
tokens - The list of tokens
numTokens - The number of tokens to use
Returns:
The component class name (e.g. ExecTimeout)

getComponentClassName

protected java.lang.String getComponentClassName(java.lang.String componentKeyword)
Gets the component class name for the passed in router component keyword. The component class name is determined by capitalizing the first character, removing all "-" characters and capitalizing the character before them.

Parameters:
componentKeyword - The keyword for the component (e.g. exec-timeout).
Returns:
The component class name (e.g. ExecTimeout)

getParentComponent

public CiscoRouterConfigComponent getParentComponent()
Gets the parent component of this component. The component could be null if it doesn't have a parent.

Returns:
the parent component.

setParentComponent

protected void setParentComponent(CiscoRouterConfigComponent parentComponent)
Sets the parent component for this component. The parent is automatically set when this component is added.

Parameters:
parentComponent - the parent component.

getUpdateConfiglet

public Commands getUpdateConfiglet(CiscoRouterConfigComponent origComponent)
                            throws InvalidConfigurationException
Returns the list of IOS commands that can be used to provision the router to update the original configuration (passed in as a parameter) to look like this component. If the passed in component is null, then this component will be added as a new component.

If this component is a CompositeComponent and also an IndelibleComponent, all the children are processed individually by calling generateHeaderIos() first to enter the CompositeComponent's configuration mode followed by generateChildrenUpdateConfiglet(origComponent) to process the children.

If this component is a CompositeComponent and can be deleted, the whole original component is first deleted using generateDeleteIos() and then the new component is added using generateUpdateIos().

If this component is a MultiLineComponent, generateMultiLineUpdateConfiglet(origComponent) is called to perform the processing.

If this component is an IndelibleComponent or if deleteOldConfigWhenUpdating() returns false, then only update commands are issued using generateUpdateIos(). Otherwise, delete commands are first issued using generateDeleteIos() before the update commands are issued.

Note that it the Commmands that are returned by this method may contain individual Command objects that have the deferred flag set. It is up to the caller of this method to place those deferred Commands at the end of any updates that are done to the router.

Parameters:
origComponent - The original component.
Returns:
The IOS commands that can be used to update a router configuration.
Throws:
InvalidConfigurationException - if either this or the passed in configuration are invalid.

generateUpdateIos

protected Commands generateUpdateIos()
                              throws InvalidConfigurationException
Generates the IOS commands that will handle the updating of this component. This implementation will simply delegate to generateIos. Specific components that have a different set of IOS commands to update the component than the IOS statements to view the component should override this method.

Returns:
Command The commands to update this component.
Throws:
InvalidConfigurationException - if this component can't be updated.

generateMultiLineUpdateConfiglet

protected Commands generateMultiLineUpdateConfiglet(CiscoRouterConfigComponent origComponent)
                                             throws InvalidConfigurationException
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().

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.

generateChildrenUpdateConfiglet

protected Commands generateChildrenUpdateConfiglet(CiscoRouterConfigComponent origCompositeComponent)
                                            throws InvalidConfigurationException
Generates the list of commands that will handle the updating of all children of this component. By default, the children will be processed in an undetermined order. However, if a particular CompositeComponent desires a certain order of processing, they should implement the getChildComponentUpdateKeys() method to specify the desired order.

Parameters:
origCompositeComponent - The original composite component. This parameter can not be null.
Returns:
The IOS commands that can be used to update a router configuration.
Throws:
InvalidConfigurationException - if either this or the passed in configuration are invalid.

getCiscoRouterConfig

public static CiscoRouterConfig getCiscoRouterConfig(CiscoRouterConfigComponent component)
                                              throws InvalidConfigurationException
Searches the parent component hierarchy of the passed in component and returns the first CiscoRouterConfig component found (should be the highest level parent).

Parameters:
component - The component whose parents will be searched.
Returns:
The parent CiscoRouterConfig.
Throws:
InvalidConfigurationException - if no CiscoRouterConfig parent could be found.

deleteOldConfigWhenUpdating

protected boolean deleteOldConfigWhenUpdating()
A flag that determines if delete commands should be issued to first delete the old component before issuing the update commands for the new component. The default behavior of this method is true (i.e. delete commands will be issued first). Specific components should override this method to change the default behavior if they wish for only update statements to be issued (e.g. EncapsulationComponent).

Note that this method only applies to components that can be deleted. IndelibleComponents won't have delete commands issued when updating - even if this method returns true.

Returns:
true always.

checkComponentType

public CiscoRouterConfigComponent checkComponentType(CiscoRouterConfigComponent component,
                                                     java.lang.Class compareClass)
                                              throws InvalidConfigurationException
Checks that the passed in component is the same type as our component. An exception will be thrown if the component types are different. If the components are the same, the passed in component will be returned.

Parameters:
component - the component to compare with.
compareClass - the class the component needs to match.
Returns:
The passed in component.
Throws:
InvalidConfigurationException - if the components are not the same.

dumpComponents

protected void dumpComponents()
Dumps the configuration components.



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