Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class Package

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

public class Package
extends UsableArrayElement
implements java.io.Serializable, Formattable

See Also:
Serialized Form

Field Summary
static byte AGGREGATED_PERIOD_DAILY
          The Package's parameter are calculated on an daily basis.
static byte AGGREGATED_PERIOD_HOURLY
          The Package's parameter are calculated on an hourly basis.
static byte AGGREGATED_PERIOD_MONTHLY
          The Package's parameter are calculated on an monthly basis.
static byte AGGREGATED_PERIOD_ONE_SHOT
          Subscriber's quota is renewed by an external system
static byte AGGREGATED_PERIOD_WEEKLY
          The Package's parameter are calculated on an weekly basis.
static int MAX_NUMBER_PERIODIC_NOTIFICATION
           
static int MAX_NUMBER_SERVICE_RULES
           
 PackageCombo packageCombo
           
 
Constructor Summary
Package(Policy policy)
          Package constructor.
 
Method Summary
 boolean areLimitsSetForServiceRules()
          Checks if any of this Package's service rules have set the limits by changing them from the default UNLIMITED values.
 java.lang.Object clone()
          Producing an identical object to this object.
 void configureRules()
           
 java.util.HashMap<java.lang.Integer,java.lang.Integer> countAssignedPeriodicConditionalRedirect()
          return HashMap of periodic condition redirect profiles to number.
 Package duplicatePkg()
           
 void fromStream(java.io.BufferedReader in, Formatter f)
          Reading this object from a BufferedReader
 int getActualCounterIndex()
           
 int getAddOnGroupIndex()
           
 java.lang.String getAddOnGroupName()
           
 int getAddOnPackageIndex()
           
 byte getAggregationPeriod()
          Gets this Package's aggregation period in which the parameters are accounted for.
 com.pcube.apps.engage.policy.antispam.AntiSpamSettingPerPackage getAntiSpamSettingPerPackage()
           
 java.util.Map getBucketToRulesMapping()
          Builds a map of bucket to rule list.
 BWControllerArray getBWControllers()
           
 int getCalendarIndex()
           
 Package[] getChildrenPackages()
           
 int getCounterIndex()
          This method will return the counter Index of the selected package
 java.lang.String getCounterName()
           
 java.lang.String getDescription()
          Gets this Package's description.
 BWController getDownstreamPrimaryBWC()
           
 java.lang.String getName()
          Gets this Package's name
 int getNumericId()
           
 PackageCombo getPackageCombo()
           
 int getPackageComboIndex()
           
 int getPackageIndex()
           
 int getParentPkgIndex()
           
 java.lang.String getParentPkgName()
           
 Policy getPolicy()
           
 BWController getPrimaryBWC(int direction)
           
 QuotaProfileData getProfileData()
           
 QuotaBucketsArray getQuotaBuckets()
           
 int getQuotaManagmentMode()
          Quota Managment mode: either Exteranl or Periodical (per aggregation period)
 ServiceRule getRule(java.lang.String serviceRuleName)
          Gets a ServiceRule which bears a specific name from this Package's ServiceRuleArray .
 java.util.Set getRulesBWCSet()
          Builds the set of BWC that this package's rules use.
 ServiceRule getServiceRule(int serviceRuleIndex)
          Gets the ServiceRule from this Package's ServiceRuleArray in a specific index.
 ServiceRuleArray getServiceRuleList()
          Gets this Package's list of restrictions.
 BWController getUpstreamPrimaryBWC()
           
 int getVasTableIndex()
           
 boolean isAddOnPackage()
           
 boolean isAssignedConditionalRedirectToRule(int notificationIndex)
          return true if the notification index assigned to any rule
 boolean isAttackSignalingRdrEnabled()
           
 boolean isComboPackage()
           
 boolean isContentFilteringEnabled()
           
 boolean isDefaultPackage()
           
 boolean isExclusivePackageCounterEnabled()
           
 boolean isExternalQuotaManagment()
           
 boolean isGlobalRulePackage()
           
 boolean isUnknownSubs()
           
 int numOfAssignedPeriodicConditionalRedirect()
          count number of unique periodic condition redirect profiles assigned to package rules.
 void setAddOnGroupDescription(java.lang.String newDescription)
           
 void setAddOnGroupIndex(int newAddOnGroupIndex)
           
 void setAddOnGroupname(java.lang.String name)
           
 void setAggregationPeriod(byte newAggregationPeriod)
          Sets the the resolution in which the parameters are accounted for.
 void setAttackSignalingRdrEnabled(boolean attackSignalingRdrEnabled)
           
 void setCalendarIndex(int calendarIndex)
           
 void setContentFilteringEnabled(boolean isContentFilteringEnabled)
           
 void setCounterIndex(int counterIndex)
           
 void setDescription(java.lang.String newDescription)
          Sets this Package's description.
 void setName(java.lang.String newName)
          Sets this Package's name
 void setPackageCombo(PackageCombo packageCombo)
           
 void setPackageComboIndex(int packageComboIndex)
           
 void setParentPackageIndex(int newParentPackageIndex)
           
 void setParentPkg(java.lang.String pkgName)
           
 void setProfileData(QuotaProfileData profileData)
          attach quota profile.
 void setQuotaBucketsArray(QuotaBucketsProfile array)
           
 void setQuotaManagmentMode(int mode)
          set quota managment mode: must be either PERIODICAL_QUOTA_MANAGMENT or EXTERNAL_QUOTA_MANAGMENT setting quota managment to external disables the Global Package Rules (== total trafiic rules).
 void setServiceRule(ServiceRule serviceRule)
          Adds a ServiceRule to this Package.
 void setServiceRuleArray(ServiceRuleArray serviceRuleArray)
           
 void setUsed(boolean newUsed)
          Setting this Package as used in the PackageArray
 void setVasTableIndex(int vasTableIndex)
           
 void toStream(java.io.PrintStream out, Formatter f)
          Writing this object to a PrintStream
 java.lang.String toString()
          Get this Package's name.
 
Methods inherited from class com.pcube.apps.engage.common.UsableArrayElement
fromStream, isUsed, toStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AGGREGATED_PERIOD_DAILY

public static final byte AGGREGATED_PERIOD_DAILY
The Package's parameter are calculated on an daily basis.

See Also:
Constant Field Values

AGGREGATED_PERIOD_HOURLY

public static final byte AGGREGATED_PERIOD_HOURLY
The Package's parameter are calculated on an hourly basis.

See Also:
Constant Field Values

AGGREGATED_PERIOD_MONTHLY

public static final byte AGGREGATED_PERIOD_MONTHLY
The Package's parameter are calculated on an monthly basis.

See Also:
Constant Field Values

AGGREGATED_PERIOD_ONE_SHOT

public static final byte AGGREGATED_PERIOD_ONE_SHOT
Subscriber's quota is renewed by an external system

See Also:
Constant Field Values

AGGREGATED_PERIOD_WEEKLY

public static final byte AGGREGATED_PERIOD_WEEKLY
The Package's parameter are calculated on an weekly basis.

See Also:
Constant Field Values

MAX_NUMBER_SERVICE_RULES

public static final int MAX_NUMBER_SERVICE_RULES

MAX_NUMBER_PERIODIC_NOTIFICATION

public static final int MAX_NUMBER_PERIODIC_NOTIFICATION
See Also:
Constant Field Values

packageCombo

public PackageCombo packageCombo
Constructor Detail

Package

public Package(Policy policy)
Package constructor.

Parameters:
policy - the Policy to whom this Package belongs.
Method Detail

areLimitsSetForServiceRules

public boolean areLimitsSetForServiceRules()
Checks if any of this Package's service rules have set the limits by changing them from the default UNLIMITED values. The limits are volume limit, session limit and BW limit. FIXME: check quota buckets limits?

Returns:
true if these values have been set, false otherwise

clone

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

Specified by:
clone in class ArrayElement
Returns:
a newly alocated object similar to this object.
See Also:
Object.clone()

duplicatePkg

public Package duplicatePkg()
Returns:

fromStream

public void fromStream(java.io.BufferedReader in,
                       Formatter f)
                throws ImportExportException
Reading this object from a BufferedReader

Specified by:
fromStream in interface Formattable
Overrides:
fromStream in class UsableArrayElement
Parameters:
in - - the BufferedReader
f - - the formatter used to read this object from the BufferedReader
Throws:
ImportExportException

getActualCounterIndex

public int getActualCounterIndex()
Returns:

getAggregationPeriod

public byte getAggregationPeriod()
Gets this Package's aggregation period in which the parameters are accounted for.

Returns:
this Pacakge's resolution
See Also:
AGGREGATED_PERIOD_HOURLY, AGGREGATED_PERIOD_DAILY

getBWControllers

public BWControllerArray getBWControllers()

getCalendarIndex

public int getCalendarIndex()

getChildrenPackages

public Package[] getChildrenPackages()
Returns:

getCounterName

public java.lang.String getCounterName()
Returns:

getDescription

public java.lang.String getDescription()
Gets this Package's description.

Returns:
this Package's description

getDownstreamPrimaryBWC

public BWController getDownstreamPrimaryBWC()

getName

public java.lang.String getName()
Gets this Package's name

Returns:
this Package's name

setAddOnGroupname

public void setAddOnGroupname(java.lang.String name)

getAddOnGroupName

public java.lang.String getAddOnGroupName()

getAddOnPackageIndex

public int getAddOnPackageIndex()

getNumericId

public int getNumericId()
Returns:

getPackageIndex

public int getPackageIndex()

getParentPkgIndex

public int getParentPkgIndex()
Returns:

getParentPkgName

public java.lang.String getParentPkgName()
Returns:

getPolicy

public Policy getPolicy()

getPrimaryBWC

public BWController getPrimaryBWC(int direction)

getQuotaBuckets

public QuotaBucketsArray getQuotaBuckets()
Returns:
Returns the quotaBuckets.

getAntiSpamSettingPerPackage

public com.pcube.apps.engage.policy.antispam.AntiSpamSettingPerPackage getAntiSpamSettingPerPackage()

getQuotaManagmentMode

public int getQuotaManagmentMode()
Quota Managment mode: either Exteranl or Periodical (per aggregation period)

Returns:
PERIODICAL_QUOTA_MANAGMENT or EXTERNAL_QUOTA_MANAGMENT

getRule

public ServiceRule getRule(java.lang.String serviceRuleName)
                    throws ItemNotFoundException
Gets a ServiceRule which bears a specific name from this Package's ServiceRuleArray .

Parameters:
serviceRuleName - the desired ServiceRule's name
Returns:
the ServiceRule
Throws:
ItemNotFoundException - if no such ServiceRule exists in this Package's ServiceRuleArray

getRulesBWCSet

public java.util.Set getRulesBWCSet()
Builds the set of BWC that this package's rules use. Notice that this set is constructed each time this method is called so use it wisely.

Returns:
a set of all BWC instances that the package's rules reference.

getServiceRule

public ServiceRule getServiceRule(int serviceRuleIndex)
Gets the ServiceRule from this Package's ServiceRuleArray in a specific index.

Parameters:
serviceRuleIndex - the index of the desired ServiceRule
Returns:
the ServiceRule
Throws:
ItemNotFoundException - if there is no ServiceRule in the desired index (IndexOutOfBound)

getServiceRuleList

public ServiceRuleArray getServiceRuleList()
Gets this Package's list of restrictions.

Returns:
this Package's ServiceRuleArray

getUpstreamPrimaryBWC

public BWController getUpstreamPrimaryBWC()

getVasTableIndex

public int getVasTableIndex()

isDefaultPackage

public boolean isDefaultPackage()
Returns:

isExclusivePackageCounterEnabled

public boolean isExclusivePackageCounterEnabled()
Returns:

isExternalQuotaManagment

public boolean isExternalQuotaManagment()
Returns:
true if quota managment is set to external

isUnknownSubs

public boolean isUnknownSubs()
Returns:

isGlobalRulePackage

public boolean isGlobalRulePackage()

setAggregationPeriod

public void setAggregationPeriod(byte newAggregationPeriod)
Sets the the resolution in which the parameters are accounted for. For example, if a Rule's BW limit is 30 Kbps and the resolution is AGGREGATED_PERIOD_HOURLY , breach will occur only if within the hourly activity the limit will be exceeded.

Parameters:
newAggregationPeriod - the new resolution
See Also:
AGGREGATED_PERIOD_HOURLY, AGGREGATED_PERIOD_DAILY

setCalendarIndex

public void setCalendarIndex(int calendarIndex)

setCounterIndex

public void setCounterIndex(int counterIndex)
Parameters:
counterIndex -

getCounterIndex

public int getCounterIndex()
This method will return the counter Index of the selected package

Returns:

setDescription

public void setDescription(java.lang.String newDescription)
Sets this Package's description.

Parameters:
newDescription - this Package's new description

setAddOnGroupDescription

public void setAddOnGroupDescription(java.lang.String newDescription)

setName

public void setName(java.lang.String newName)
             throws DuplicateItemException
Sets this Package's name

Parameters:
newName - the new Package name
Throws:
DuplicateItemException

setParentPackageIndex

public void setParentPackageIndex(int newParentPackageIndex)
                           throws ItemNotFoundException
Throws:
ItemNotFoundException

setAddOnGroupIndex

public void setAddOnGroupIndex(int newAddOnGroupIndex)
                        throws ItemNotFoundException
Throws:
ItemNotFoundException

getAddOnGroupIndex

public int getAddOnGroupIndex()

isAddOnPackage

public boolean isAddOnPackage()

setPackageComboIndex

public void setPackageComboIndex(int packageComboIndex)

getPackageComboIndex

public int getPackageComboIndex()

isComboPackage

public boolean isComboPackage()

setPackageCombo

public void setPackageCombo(PackageCombo packageCombo)

getPackageCombo

public PackageCombo getPackageCombo()

setParentPkg

public void setParentPkg(java.lang.String pkgName)
                  throws ItemNotFoundException
Parameters:
selectedItem -
Throws:
ItemNotFoundException

setQuotaManagmentMode

public void setQuotaManagmentMode(int mode)
                           throws java.lang.IllegalArgumentException
set quota managment mode: must be either PERIODICAL_QUOTA_MANAGMENT or EXTERNAL_QUOTA_MANAGMENT setting quota managment to external disables the Global Package Rules (== total trafiic rules).

Parameters:
mode -
Throws:
java.lang.IllegalArgumentException - - thrown if mode is not one of the two allowed modes.

setServiceRule

public void setServiceRule(ServiceRule serviceRule)
                    throws DuplicateItemException,
                           ItemNotFoundException
Adds a ServiceRule to this Package.

Parameters:
serviceRule - the new ServiceRule
Throws:
DuplicateItemException - if there is already a ServiceRule with duplicate items in this Package's ServiceRuleArray
ItemNotFoundException

setServiceRuleArray

public void setServiceRuleArray(ServiceRuleArray serviceRuleArray)

setUsed

public void setUsed(boolean newUsed)
Setting this Package as used in the PackageArray

Overrides:
setUsed in class UsableArrayElement
Parameters:
newUsed -

setVasTableIndex

public void setVasTableIndex(int vasTableIndex)

toStream

public void toStream(java.io.PrintStream out,
                     Formatter f)
Writing this object to a PrintStream

Specified by:
toStream in interface Formattable
Overrides:
toStream in class UsableArrayElement
Parameters:
out - - the PrintStream
f - - the formatter used to write this object

toString

public java.lang.String toString()
Get this Package's name.

Overrides:
toString in class java.lang.Object
Returns:
this Package's name

getBucketToRulesMapping

public java.util.Map getBucketToRulesMapping()
Builds a map of bucket to rule list. The list of rules consists of the rules that consume volume and sessions from a bucket (a key in the map).

Returns:

isAttackSignalingRdrEnabled

public boolean isAttackSignalingRdrEnabled()

setAttackSignalingRdrEnabled

public void setAttackSignalingRdrEnabled(boolean attackSignalingRdrEnabled)

isContentFilteringEnabled

public boolean isContentFilteringEnabled()
Returns:
Returns the isContentFilteringEnabled.

setContentFilteringEnabled

public void setContentFilteringEnabled(boolean isContentFilteringEnabled)
Parameters:
isContentFilteringEnabled - The isContentFilteringEnabled to set.

isAssignedConditionalRedirectToRule

public boolean isAssignedConditionalRedirectToRule(int notificationIndex)
return true if the notification index assigned to any rule

Parameters:
notificationIndex -
Returns:

numOfAssignedPeriodicConditionalRedirect

public int numOfAssignedPeriodicConditionalRedirect()
count number of unique periodic condition redirect profiles assigned to package rules.

Returns:

countAssignedPeriodicConditionalRedirect

public java.util.HashMap<java.lang.Integer,java.lang.Integer> countAssignedPeriodicConditionalRedirect()
return HashMap of periodic condition redirect profiles to number. This number value holds the times this redirect was assigned to the package rules.

Returns:

getProfileData

public QuotaProfileData getProfileData()
Returns:
the attached quota profile (maybe null).

setProfileData

public void setProfileData(QuotaProfileData profileData)
attach quota profile.

Parameters:
profileData -

configureRules

public void configureRules()

setQuotaBucketsArray

public void setQuotaBucketsArray(QuotaBucketsProfile array)
                          throws QuotaDataException
Throws:
QuotaDataException

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.