Cisco Systems, Inc.

com.pcube.apps.engage.common
Class GlobalControllersArray

java.lang.Object
  extended by com.pcube.apps.engage.common.GlobalControllersArray
All Implemented Interfaces:
Formattable, java.io.Serializable, java.lang.Cloneable

public class GlobalControllersArray
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, Formattable

The array of bandwidth limiters. Bandwidth limiters in the array can be modified so that the bandwidth accumulated by them will also be accumulated in the total bandwidth limiter.

See Also:
GlobalController, Serialized Form

Field Summary
static int AGGREGATED_GC_LINK_ID
           
static int DEFAULT_GLOBAL_CONTROLLER_INDEX
           
static java.lang.String DEFAULT_GLOBAL_CONTROLLER_NAME
           
static java.lang.String DEFAULT_GLOBAL_CONTROLLER_NAME_IN_VL_MODE
           
static GlobalController DUMMY_GC_IN_VL_MODE
           
static java.lang.String DUMMY_GC_IN_VL_MODE_NAME
           
 
Constructor Summary
GlobalControllersArray(Policy policy, int linkId, int arrayDirection)
          GlobalControllersArray Constructor.
 
Method Summary
 boolean add(GlobalController item)
          Adds a new GlobalController to this list.
 java.lang.Object clone()
          Producing an identical object to this object.
 boolean contains(GlobalController item)
          Checks if a certain GlobalController exists in this list.
 boolean contains(java.lang.String item)
          Checks if an GlobalController with bears the specific name exists in this list.
 void fromStream(java.io.BufferedReader in, Formatter f)
          Method fromStream
 GlobalController getAt(int index)
          Gets the GlobalController this list has in a specific index.
 long getBw(int GlobalControllerIndex)
           
 float getBWPercentage(int GlobalControllerIndex)
          Deprecated.  
 java.lang.String[] getGlobalControllersNames()
           
 int getIndexOfItem(java.lang.String item)
          Gets the index of the GlobalController in this list which has the specific name.
 int getNumberOfGlobalControllerByType(int type)
          in virtual link mode the template GCs is being stored at the beginning and the global at the end If this method is being called not in virtual link mode return the GC array size
 java.lang.String getPackageBwControllerUsingGcAsString(java.lang.String gcName)
          return string of package name and bandwidth controller associate with GC name
 int getSize()
          Gets the size of this list.
 int indexOf(GlobalController controller)
           
 void internalSetGlobalControllerName(int GlobalControllerIndex, java.lang.String newName)
           
 boolean isGlobalControllerUsed(int index)
           
 boolean remove(int index)
          Removes the GlobalController from a specific index in this list.
 boolean remove(java.lang.String item)
          Removes the GlobalController which has specific name from this list.
 void setBW(int gcIdx, long bw)
           
 void setBWPercentage(int gcIdx, float percentage)
          Deprecated.  
 void setBWPercentage(int gcIdx, TimeBasedValue percentage)
           
 void setGlobalControllerName(int globalControllerIndex, java.lang.String newName)
          Sets the name of the GlobalController in the specific index in this list.
 void setLinkId(int id)
           
 void setValueFrom(GlobalControllersArray other)
          Method setValueFrom
 void toStream(java.io.PrintStream out, Formatter f)
          Method toStream
 java.lang.String toString()
           
 void updateDefaultGloablContoller(boolean isVirtualLinkMode)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_GLOBAL_CONTROLLER_INDEX

public static final int DEFAULT_GLOBAL_CONTROLLER_INDEX
See Also:
Constant Field Values

DEFAULT_GLOBAL_CONTROLLER_NAME

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

DEFAULT_GLOBAL_CONTROLLER_NAME_IN_VL_MODE

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

DUMMY_GC_IN_VL_MODE_NAME

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

DUMMY_GC_IN_VL_MODE

public static final GlobalController DUMMY_GC_IN_VL_MODE

AGGREGATED_GC_LINK_ID

public static final int AGGREGATED_GC_LINK_ID
See Also:
Constant Field Values
Constructor Detail

GlobalControllersArray

public GlobalControllersArray(Policy policy,
                              int linkId,
                              int arrayDirection)
GlobalControllersArray Constructor.

Parameters:
policy -
linkId -
arrayDirection -
Method Detail

add

public boolean add(GlobalController item)
            throws DuplicateItemException
Adds a new GlobalController to this list. In virtual link mode, all global virtual link GCs will be placed at the end of the array.

Parameters:
item - the added GlobalController
Returns:
true if added, false otherwise
Throws:
DuplicateItemException - if such an GlobalController already exists in this list

clone

public java.lang.Object clone()
Producing an identical object to this object.

Overrides:
clone in class java.lang.Object
Returns:
a newly allocated object similar to this object.

contains

public boolean contains(GlobalController item)
Checks if a certain GlobalController exists in this list.

Parameters:
item - the queried GlobalController
Returns:
true if exists, false otherwise

contains

public boolean contains(java.lang.String item)
Checks if an GlobalController with bears the specific name exists in this list.

Parameters:
item - the desired GlobalController's name
Returns:
true if exists, false otherwise

fromStream

public void fromStream(java.io.BufferedReader in,
                       Formatter f)
                throws ImportExportException
Description copied from interface: Formattable
Method fromStream

Specified by:
fromStream in interface Formattable
Throws:
ImportExportException
See Also:
Formattable.fromStream(java.io.BufferedReader, com.pcube.apps.engage.common.Formatter)

getAt

public GlobalController getAt(int index)
                       throws ItemNotFoundException
Gets the GlobalController this list has in a specific index.

Parameters:
index - the index of the desired GlobalController
Returns:
the GlobalController
Throws:
ItemNotFoundException - if no GlobalController exists in the desired index

getBWPercentage

public float getBWPercentage(int GlobalControllerIndex)
                      throws ItemNotFoundException
Deprecated. 

Gets the percentage value of the GlobalController in a certain index in this list.

Parameters:
GlobalControllerIndex - the GlobalController's index in this list
Returns:
the percentage
Throws:
ItemNotFoundException - if no such GlobalController exists in the desired index

getBw

public long getBw(int GlobalControllerIndex)
           throws ItemNotFoundException
Throws:
ItemNotFoundException

getIndexOfItem

public int getIndexOfItem(java.lang.String item)
Gets the index of the GlobalController in this list which has the specific name.

Parameters:
item - the desired GlobalController's name
Returns:
the GlobalController's index if exists, -1 otherwise

getSize

public int getSize()
Gets the size of this list.

Returns:
this list's size

indexOf

public int indexOf(GlobalController controller)
Parameters:
controller -
Returns:

internalSetGlobalControllerName

public void internalSetGlobalControllerName(int GlobalControllerIndex,
                                            java.lang.String newName)
                                     throws DuplicateItemException,
                                            ItemNotFoundException
Parameters:
GlobalControllerIndex -
newName -
Throws:
DuplicateItemException
ItemNotFoundException

isGlobalControllerUsed

public boolean isGlobalControllerUsed(int index)
                               throws ItemNotFoundException
Parameters:
index -
Returns:
@throws ItemNotFoundException
Throws:
ItemNotFoundException

getPackageBwControllerUsingGcAsString

public java.lang.String getPackageBwControllerUsingGcAsString(java.lang.String gcName)
                                                       throws ItemNotFoundException
return string of package name and bandwidth controller associate with GC name

Parameters:
gcName -
Returns:
Throws:
ItemNotFoundException

remove

public boolean remove(int index)
               throws ItemNotFoundException
Removes the GlobalController from a specific index in this list.

Parameters:
index - the removed GlobalController's index in this list
Returns:
true if removal succeeded, false otherwise
Throws:
ItemNotFoundException - if this list has no GlobalController with the desired values

remove

public boolean remove(java.lang.String item)
               throws ItemNotFoundException
Removes the GlobalController which has specific name from this list.

Parameters:
item - the removed GlobalController's name
Returns:
true if removal succeeded, false otherwise
Throws:
ItemNotFoundException - if this list has no GlobalController with the desired values

setBWPercentage

public void setBWPercentage(int gcIdx,
                            float percentage)
                     throws ItemNotFoundException
Deprecated. 

Sets the percentage value of the GlobalController in a certain index in this list.

Parameters:
gcIdx - the GlobalController's index in this list
percentage - the new percentage value
Throws:
ItemNotFoundException - if no such GlobalController exists in the desired index

setBW

public void setBW(int gcIdx,
                  long bw)
           throws ItemNotFoundException
Throws:
ItemNotFoundException

setGlobalControllerName

public void setGlobalControllerName(int globalControllerIndex,
                                    java.lang.String newName)
                             throws DuplicateItemException,
                                    ItemNotFoundException
Sets the name of the GlobalController in the specific index in this list.

Parameters:
globalControllerIndex - the index of the GlobalController who is to be renamed
newName - the GlobalController's new name
Throws:
DuplicateItemException
ItemNotFoundException

setValueFrom

public void setValueFrom(GlobalControllersArray other)
Method setValueFrom

Parameters:
other -

toStream

public void toStream(java.io.PrintStream out,
                     Formatter f)
Description copied from interface: Formattable
Method toStream

Specified by:
toStream in interface Formattable
See Also:
Formattable.toStream(java.io.PrintStream, com.pcube.apps.engage.common.Formatter)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

setBWPercentage

public void setBWPercentage(int gcIdx,
                            TimeBasedValue percentage)
                     throws ItemNotFoundException
Throws:
ItemNotFoundException

getGlobalControllersNames

public java.lang.String[] getGlobalControllersNames()

setLinkId

public void setLinkId(int id)

updateDefaultGloablContoller

public void updateDefaultGloablContoller(boolean isVirtualLinkMode)

getNumberOfGlobalControllerByType

public int getNumberOfGlobalControllerByType(int type)
                                      throws ItemNotFoundException
in virtual link mode the template GCs is being stored at the beginning and the global at the end If this method is being called not in virtual link mode return the GC array size

Parameters:
vlGcArray -
Returns:
Throws:
ItemNotFoundException

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.