|
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 |
addTimeFrameRule(TimeFrame frame)
Announcing the ability to configure specific regulations for the TimeFrame. |
Object |
clone()
|
void |
fromStream(BufferedReader in,
Formatter f)
Method fromStream |
Rule |
getDefaultRule()
Gets the default time based regulations. |
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. |
String |
getServiceName()
Gets the Service name of the Service the ServiceRule's regulations relate to. |
boolean |
isDefaultServiceRule()
|
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. |
Iterator |
iterateRules()
iterate all rules including the default rule which is returned first. |
Iterator |
iterateTBRules()
|
void |
removeTimeFrameRule(TimeFrame frame)
Eliminating the ability to configure specific regulations for the TimeFrame. |
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(String newServiceName)
Sets the Service name the ServiceRule's Rules are related to . |
void |
toStream(PrintStream out,
Formatter f)
Method toStream |
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
ItemNotFoundExceptionpublic Object clone()
clone in class ArrayElementArrayElement.clone()
public void fromStream(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 getRuleForTimeFrame(TimeFrame frame)
frame - the desired TimeFrame
ItemNotFoundException - if a specific Rule for this TimeFrame was not createdpublic String getServiceName()
public boolean isDefaultServiceRule()
public boolean isTimeFrameRuleDefined(int timeFrameIndex)
timeFrameIndex - the queried TimeFrame's index
public boolean isTimeFrameRuleDefined(TimeFrame frame)
frame - the queried TimeFrame
public void removeTimeFrameRule(TimeFrame frame)
frame - the TimeFrame
ItemNotFoundException - if no configuration ability was given to the TimeFrame in the
first placepublic void setPackageIndex(int index)
index - the new Package indexpublic void setQuotaManagmentMode(int mode)
mode - public void setServiceName(String newServiceName)
newServiceName - the new Service's name
ItemNotFoundException - if no such Service exists in the Policy's ServiceArray
public void toStream(PrintStream out,
Formatter f)
Formattable
toStream in interface FormattableFormattable.toStream(java.io.PrintStream,
com.pcube.apps.engage.common.Formatter)public String toString()
toString in class Objectpublic Iterator iterateTBRules()
public Iterator iterateRules()
|
Cisco Systems, Inc. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||