incubator-imperius-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Bengtson" <e...@jpox.org>
Subject RE: SPI , APIs etc
Date Sat, 19 Jan 2008 11:10:35 GMT
>SPI / API : The interfaces within the external package etc can be 
>classified into SPI or API. Are you referring to documenting which is 
>which and how to use them?

+ Some consistent naming across the methods

>or you are thinking there are more places where we could add APIs/ SPIs ? 
>(or we need to add more methods to the existing interfaces?)

Add and drop methods/interfaces

>XML schema for Expressions: I will give that a shot and will post it and 
>we can iterate over it (or if you have something already please share it)

Go ahead.

>You had also talked about a Factory that would instantiate the SPL engine. 
>I was thinking of a class with a static method which returns a singleton 
>instance of
>PolicyManager did you have anything more in mind?

IMO a singleton is not a good pattern inside a framework and should be handled by users if
they need this pattern.

Here is a rough proposal for API (MBeans should also be in the API, but not specified here):

Interface Policy{
String getName();
Boolean deploy(); //update=true
Boolean deploy(boolean update);
Boolean undeploy();
}

Interface PolicyManager{...}
Interface SPI.DataColletor{...}
Interface SPI.Actuator{...}
Interface SPI.PolicyRuleProvider
{
getDataCollector();
getActuator();
}
Interface SPI.PolicyEvaluator
{
Object evaluate(Map params);
}
Class JavaSPL.PolicyRuleProviderImpl implements PolicyRuleProvider

Class SPLCore.PolicyManagerImpl implements PolicyManager

Class SPLCore.ImperiusFactory
{
static PolicyManager newPolicyManager(Map properties);
}

Example 1 (Factory and Evaluator):
Map m = ...
m.put("org.apache.imperius.spl.PolicyRuleProviderClass", "JavaSPL.PolicyRuleProviderImpl");
m.put(...);
PolicyManager pm = ImperiusFactory.newPolicyManager(m);
PolicyEvaluator eval = pm.newPolicyEvaluator(name);
Map result = eval.evaluate(parameters);

Example 2 (Custom Datastore):
Map m = ...
m.put("org.apache.imperius.spl.PolicyRuleProviderClass", "JavaSPL.PolicyRuleProviderImpl");
m.put("org.apache.imperius.spl.DatastoreClass", "Custom.RDBMSDatastoreImpl");
m.put(...); //other properties e.g. datastore connection properties
PolicyManager pm = ImperiusFactory.newPolicyManager(m);
PolicyEvaluator eval = pm.newPolicyEvaluator(name);
Map result = eval.evaluate(parameters);

Example 3 (Custom Evaluator - Evaluate via RMI):
Map m = ...
m.put("org.apache.imperius.spl.PolicyRuleProviderClass", "JavaSPL.PolicyRuleProviderImpl");
m.put("org.apache.imperius.spl.DatastoreClass", "Custom.RDBMSDatastoreImpl");
m.put("org.apache.imperius.spl.PolicyEvaluatorClass", "Custom.RMIPolicyEvaluatorImpl");
m.put(...); //other properties e.g. datastore connection properties and rmi server
PolicyManager pm = ImperiusFactory.newPolicyManager(m);
PolicyEvaluator eval = pm.newPolicyEvaluator(name);
Map result = eval.evaluate(parameters);

Example 3 (Deploy Policy):
Map m = ...
m.put("org.apache.imperius.spl.PolicyRuleProviderClass", "JavaSPL.PolicyRuleProviderImpl");
m.put("org.apache.imperius.spl.DatastoreClass", "Custom.RDBMSDatastoreImpl");
m.put(...);
PolicyManager pm = ImperiusFactory.newPolicyManager(m);
Policy policy = pm.newPolicy(name);
policy.deploy();

Example 4 (UnDeploy Policy):
Map m = ...
m.put("org.apache.imperius.spl.PolicyRuleProviderClass", "JavaSPL.PolicyRuleProviderImpl");
m.put("org.apache.imperius.spl.DatastoreClass", "Custom.RDBMSDatastoreImpl");
m.put(...);
PolicyManager pm = ImperiusFactory.newPolicyManager(m);
Policy policy = pm.getPolicy(name);
policy.undeploy();




Mime
View raw message