|
Cisco Systems, Inc. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pcube.apps.engage.common.ArrayElement
com.pcube.apps.engage.policy.ServiceRule
public class ServiceRule
A set of time based Rules for a specific Package and Service. ServiceRule
holds a different Rule per each time frame, and a default Rule. By default,
all of the time based Rules nherit all of the default Rule's parameters. To
configure a Rule for a specific time frame, it must be explicitly announced
by using the
addTimeFrameRule function.
Code Sample:
*
// creates a new Package Package myPackage = new Package(myPolicy); * // creates new service rule ServiceRule serviceRule = new ServiceRule(policy); * // adds service to rule try{ serviceRule.setServiceName(serviceName); }catch(ItemNotFoundException e) { // handle exception } * // gets the default rule - it will apply for all the time based rules since no time based // rules are created Rule defaultRule = serviceRule.getDefaultRule(); // set default rule state to be disable defaultRule.setState(Rule.RULE_STATE_DISABLED); * // announce the need for configuring specific behavior for the T1 Rule peak = null; try{ peak = serviceRule.addTimeFrameRule(TimeFrame.T1); }catch(ItemNotFoundException e) { // handle exception } }catch(DuplicateItemException e) { // handle exception } * // set T1 rule state to be enable peak.setState(Rule.RULE_STATE_ENABLED); * // adds service rule to the package's serviceRuleArray try{ myPackage.setServiceRule(serviceRule); }catch(ItemNotFoundException e) { // handle exception }
The code is an example of setting a Rule which will apply for
only T1 timeframe, and a defautl Rule that will apply for the rest of the
time frames, and will be disabled.
| Constructor Summary | |
|---|---|
ServiceRule(com.pcube.apps.engage.policy.Rule.RuleResourceProvider resourceProvider)
ServiceRule Constructor |
|
| Method Summary | |
|---|---|
Rule |
addRuleFrameRule(RuleFrame frame)
|
Rule |
addTimeFrameRule(TimeFrame frame)
Announcing the ability to configure specific regulations for the TimeFrame. |
java.lang.Object |
clone()
|
void |
fromStream(java.io.BufferedReader in,
Formatter f)
Method fromStream |
Rule |
getDefaultRule()
Gets the default time based regulations. |
int |
getPackageIndex()
|
Rule |
getRuleForRuleFrame(int ruleFrameIndex)
|
Rule |
getRuleForRuleFrame(RuleFrame frame)
|
Rule |
getRuleForTimeFrame(int timeFrameIndex)
Gets the set of regulations for the specific TimeFrame by the TimeFrame index |
Rule |
getRuleForTimeFrame(TimeFrame frame)
Gets the set of regulations for the specific TimeFrame. |
java.lang.String |
getServiceName()
Gets the Service name of the Service the ServiceRule's regulations relate to. |
boolean |
getTurState()
|
boolean |
isDefaultServiceRule()
|
boolean |
isRuleFrameRuleDefined(int ruleFrameIndex)
|
boolean |
isRuleFrameRuleDefined(RuleFrame frame)
|
boolean |
isTimeFrameRuleDefined(int timeFrameIndex)
Checks if a certain TimeFrame has specific regulations ,by the TimeFrame index. |
boolean |
isTimeFrameRuleDefined(TimeFrame frame)
Checks if a certain TimeFrame has specific regulations. |
java.util.Iterator |
iterateRFRules()
|
java.util.Iterator |
iterateRules()
iterate all rules including the default rule which is returned first. |
java.util.Iterator |
iterateTBRules()
|
void |
removeRuleFrameRule(RuleFrame frame)
|
void |
removeTimeFrameRule(TimeFrame frame)
Eliminating the ability to configure specific regulations for the TimeFrame. |
void |
setDefaultRuleOverride(boolean isDefaultRuleOverride)
|
void |
setPackageIndex(int index)
Sets the Package index the ServiceRule's Rules are related to . |
void |
setQuotaManagmentMode(int mode)
sets quota managment mode: sets in default anf TB rules. |
void |
setServiceName(java.lang.String newServiceName)
Sets the Service name the ServiceRule's Rules are related to . |
void |
setTurState(boolean isTurEnabled)
|
void |
toStream(java.io.PrintStream out,
Formatter f)
Method toStream |
java.lang.String |
toString()
The ServiceRule's String representation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ServiceRule(com.pcube.apps.engage.policy.Rule.RuleResourceProvider resourceProvider)
policy - the Policy the ServiceRule belongs to| Method Detail |
|---|
public Rule addTimeFrameRule(TimeFrame frame)
throws DuplicateItemException
frame - the desired TimeFrame
DuplicateItemException - if the TimeFrame already has a specific Rule
ItemNotFoundException
public Rule addRuleFrameRule(RuleFrame frame)
throws DuplicateItemException
DuplicateItemExceptionpublic java.lang.Object clone()
clone in class ArrayElementArrayElement.clone()
public void fromStream(java.io.BufferedReader in,
Formatter f)
throws ImportExportException
Formattable
fromStream in interface FormattableImportExportExceptionFormattable.fromStream(java.io.BufferedReader,
com.pcube.apps.engage.common.Formatter)public Rule getDefaultRule()
public Rule getRuleForTimeFrame(int timeFrameIndex)
timeFrameIndex -
public Rule getRuleForRuleFrame(int ruleFrameIndex)
public Rule getRuleForTimeFrame(TimeFrame frame)
frame - the desired TimeFrame
ItemNotFoundException - if a specific Rule for this TimeFrame was not createdpublic Rule getRuleForRuleFrame(RuleFrame frame)
public java.lang.String getServiceName()
public boolean isDefaultServiceRule()
public boolean isTimeFrameRuleDefined(int timeFrameIndex)
timeFrameIndex - the queried TimeFrame's index
public boolean isRuleFrameRuleDefined(int ruleFrameIndex)
public boolean isTimeFrameRuleDefined(TimeFrame frame)
frame - the queried TimeFrame
public boolean isRuleFrameRuleDefined(RuleFrame frame)
public void removeTimeFrameRule(TimeFrame frame)
frame - the TimeFrame
ItemNotFoundException - if no configuration ability was given to the TimeFrame in the
first placepublic void removeRuleFrameRule(RuleFrame frame)
public void setPackageIndex(int index)
index - the new Package indexpublic int getPackageIndex()
public void setQuotaManagmentMode(int mode)
mode - public void setServiceName(java.lang.String newServiceName)
newServiceName - the new Service's name
ItemNotFoundException - if no such Service exists in the Policy's ServiceArray
public void toStream(java.io.PrintStream out,
Formatter f)
Formattable
toStream in interface FormattableFormattable.toStream(java.io.PrintStream,
com.pcube.apps.engage.common.Formatter)public java.lang.String toString()
toString in class java.lang.Objectpublic void setTurState(boolean isTurEnabled)
public boolean getTurState()
public void setDefaultRuleOverride(boolean isDefaultRuleOverride)
public java.util.Iterator iterateTBRules()
public java.util.Iterator iterateRFRules()
public java.util.Iterator iterateRules()
|
Cisco Systems, Inc. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||