com.foxsmart.csu.config.global.interfacepkg
Class EncapsulationComponent

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.CiscoRouterConfigComponent
          extended by com.foxsmart.csu.config.global.interfacepkg.EncapsulationComponent
All Implemented Interfaces:
java.io.Serializable

public class EncapsulationComponent
extends CiscoRouterConfigComponent

The EncapsulationComponent class represents an interface's encapsulation information.

See Also:
Serialized Form

Field Summary
static java.lang.String ATM_DXI
           
static java.lang.String AX25
           
static java.lang.String BFE
           
static java.lang.String DCE
           
static java.lang.String DDN
           
static java.lang.String DTE
           
static java.lang.String ENCAPSULATION
           
static java.lang.String FRAME_RELAY
           
static java.lang.String HDLC
           
static java.lang.String IETF
           
static java.lang.String IP
           
static java.lang.String LAPB
           
static java.lang.String MULTI
           
static java.lang.String PPP
           
static java.lang.String PROFILE
           
static java.lang.String SLIP
           
static java.lang.String SMDS
           
static java.lang.String SNAPSHOT
           
static java.lang.String X25
           
 
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
EncapsulationComponent()
          Constructs an encapsulation 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.
protected  boolean deleteOldConfigWhenUpdating()
          Override default method to always return false.
 Commands generateIos()
          Only output the encapsulation statement if the encapsulation options are no HDLC.
protected  Commands generateUpdateIos()
          Generates the IOS commands that will handle the updating of this component.
 EncapsulationOptions getEncapsulationOptions()
          Gets the encapsulation options.
 void setEncapsulationOptions(EncapsulationOptions encapsulationOptions)
          Sets the encapsulation options.
 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, dumpComponents, generateChildrenUpdateConfiglet, generateCompositeIos, generateCompositeIos, generateDeleteIos, generateIos, generateIos, generateIos, generateMultiLineUpdateConfiglet, generateUpdateCompositeIos, 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

ENCAPSULATION

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

ATM_DXI

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

FRAME_RELAY

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

HDLC

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

LAPB

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

PPP

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

SMDS

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

X25

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

SLIP

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

IETF

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

DCE

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

DTE

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

IP

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

MULTI

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

SNAPSHOT

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

PROFILE

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

AX25

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

BFE

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

DDN

public static final java.lang.String DDN
See Also:
Constant Field Values
Constructor Detail

EncapsulationComponent

public EncapsulationComponent()
Constructs an encapsulation object.

Method Detail

getEncapsulationOptions

public EncapsulationOptions getEncapsulationOptions()
Gets the encapsulation options.

Returns:
the encapsulation options.

setEncapsulationOptions

public void setEncapsulationOptions(EncapsulationOptions encapsulationOptions)
Sets the encapsulation options. An encapsulation option must be present to be valid. If no encapsulation is desired, the EncapsulationComponent should be removed from the interface.

Parameters:
encapsulationOptions - the encapsulation options.

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
Only output the encapsulation statement if the encapsulation options are no HDLC. Otherwise, don't output anything since HDLC is the default.

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

generateUpdateIos

protected Commands generateUpdateIos()
                              throws InvalidConfigurationException
Description copied from class: CiscoRouterConfigComponent
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.

Overrides:
generateUpdateIos in class CiscoRouterConfigComponent
Returns:
Command The commands to update this component.
Throws:
InvalidConfigurationException - if this component can't be updated.
See Also:
CiscoRouterConfigComponent

deleteOldConfigWhenUpdating

protected boolean deleteOldConfigWhenUpdating()
Override default method to always return false. By doing this, the encapsulation will simply be updated with the new update command as opposed to the original encapsulation being deleted first. If the encapsulation is deleted first, all sub-interfaces that rely on the encapsulation being set will automatically be deleted by the router which is not desireable. The sub-interfaces might get removed anyway, but with this approach, we have a chance that they might remain.

Overrides:
deleteOldConfigWhenUpdating in class CiscoRouterConfigComponent
Returns:
false always.


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