You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Sanka Samaranayake <ss...@gmail.com> on 2005/11/21 07:02:35 UTC

[Axis2] Adding support for WS Policy in Axis2

Dear Axis2 Developers,

I would like to know whether there are any efforts to add support for WS 
Policy in Axis2 framework. The Web Services Policy Framework (WS-Policy) 
provides a general purpose model and corresponding syntax to describe 
and communicate the policies of a Web service.  Ws-commons/policy 
provides a framework which can be used to manipulate WS Policies. 
Following is a brief introduction on ws-commons/policy and I hope that 
it'll be useful in any effort to add WS Policy support in Axis2 framework.


How to use ws-commons/Policy.


Ws-commons/Policy framework provides a convenient way to process 
policies. In this framework a requirement is viewed as an assertion. An 
assertion can be of two types. 

(a) Primitive Assertion - it is a domain specific requirement.
One needs domain-specific knowledge to process a primitive assertion.

(b) Composite Assertion: it contains set of requirements and implicit 
knowledge how those requirements should met.
For instance AndCompositeAssertion requires that all of its terms (set 
of assertions it contains) are met.

XorCompositeAssertion requires that exactly one of it terms should met.


Policy operations:

Three policy operations are defined
(a) normalize();
Creates a new Assertion object which is in its normalized format.

(b) intersect();
Provides a set of alternatives which both parties understand. If any 
policy alternative that contains an assertion which the other party 
doesn't understand is ignored.

(c) merge();
Provides all alternatives which can be derived by two policies. If one 
of these alternatives can be met, then at least one of the policy 
alternatives of both policies are met.


How to read a policy object:

InputStream is = new FileInputStream("/home/ ..... /policy.xml");

PolicyFactory factory = PolicyFactory.getInstance();
PolicyReader reader = factory.getPolicyReader();
Policy policy = reader.readPolicy(is);


How write a policy object:

OutputStream os = new FileOutputStream("/home/..../policy.xml");

PolicyFactory factory = PolicyFactory.getInstance();
PolicyWriter writer = factory.getPolicyWriter();
writer.writePolicy(os);


How to normalize a policy ;

Policy policy = reader.readPolicy(...);
Policy normalized = (Policy) policy.normalize();


How to merge two policies;

Policy policy1 = reader.readPolicy("..../policy1");
Policy policy2 = reader.readPolicy("..../policy2");

Policy merged = (Policy) policy1.merge(policy2);

Best,
Sanka









Re: [Axis2] Adding support for WS Policy in Axis2

Posted by Srinath Perera <he...@gmail.com>.
Big +1 !!!   I am on my toes to see policy working for Axis2

On 11/21/05, Davanum Srinivas <da...@gmail.com> wrote:
> Sanka,
>
> +1 from me. i think we need to get WS-SecurityPolicy working with
> Axis2's security module.
>
> thanks,
> dims
>
> On 11/21/05, Sanka Samaranayake <ss...@gmail.com> wrote:
> > Dear Axis2 Developers,
> >
> > I would like to know whether there are any efforts to add support for WS
> > Policy in Axis2 framework. The Web Services Policy Framework (WS-Policy)
> > provides a general purpose model and corresponding syntax to describe
> > and communicate the policies of a Web service.  Ws-commons/policy
> > provides a framework which can be used to manipulate WS Policies.
> > Following is a brief introduction on ws-commons/policy and I hope that
> > it'll be useful in any effort to add WS Policy support in Axis2 framework.
> >
> >
> > How to use ws-commons/Policy.
> >
> >
> > Ws-commons/Policy framework provides a convenient way to process
> > policies. In this framework a requirement is viewed as an assertion. An
> > assertion can be of two types.
> >
> > (a) Primitive Assertion - it is a domain specific requirement.
> > One needs domain-specific knowledge to process a primitive assertion.
> >
> > (b) Composite Assertion: it contains set of requirements and implicit
> > knowledge how those requirements should met.
> > For instance AndCompositeAssertion requires that all of its terms (set
> > of assertions it contains) are met.
> >
> > XorCompositeAssertion requires that exactly one of it terms should met.
> >
> >
> > Policy operations:
> >
> > Three policy operations are defined
> > (a) normalize();
> > Creates a new Assertion object which is in its normalized format.
> >
> > (b) intersect();
> > Provides a set of alternatives which both parties understand. If any
> > policy alternative that contains an assertion which the other party
> > doesn't understand is ignored.
> >
> > (c) merge();
> > Provides all alternatives which can be derived by two policies. If one
> > of these alternatives can be met, then at least one of the policy
> > alternatives of both policies are met.
> >
> >
> > How to read a policy object:
> >
> > InputStream is = new FileInputStream("/home/ ..... /policy.xml");
> >
> > PolicyFactory factory = PolicyFactory.getInstance();
> > PolicyReader reader = factory.getPolicyReader();
> > Policy policy = reader.readPolicy(is);
> >
> >
> > How write a policy object:
> >
> > OutputStream os = new FileOutputStream("/home/..../policy.xml");
> >
> > PolicyFactory factory = PolicyFactory.getInstance();
> > PolicyWriter writer = factory.getPolicyWriter();
> > writer.writePolicy(os);
> >
> >
> > How to normalize a policy ;
> >
> > Policy policy = reader.readPolicy(...);
> > Policy normalized = (Policy) policy.normalize();
> >
> >
> > How to merge two policies;
> >
> > Policy policy1 = reader.readPolicy("..../policy1");
> > Policy policy2 = reader.readPolicy("..../policy2");
> >
> > Policy merged = (Policy) policy1.merge(policy2);
> >
> > Best,
> > Sanka
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>

Re: [Axis2] Adding support for WS Policy in Axis2

Posted by Davanum Srinivas <da...@gmail.com>.
Sanka,

+1 from me. i think we need to get WS-SecurityPolicy working with
Axis2's security module.

thanks,
dims

On 11/21/05, Sanka Samaranayake <ss...@gmail.com> wrote:
> Dear Axis2 Developers,
>
> I would like to know whether there are any efforts to add support for WS
> Policy in Axis2 framework. The Web Services Policy Framework (WS-Policy)
> provides a general purpose model and corresponding syntax to describe
> and communicate the policies of a Web service.  Ws-commons/policy
> provides a framework which can be used to manipulate WS Policies.
> Following is a brief introduction on ws-commons/policy and I hope that
> it'll be useful in any effort to add WS Policy support in Axis2 framework.
>
>
> How to use ws-commons/Policy.
>
>
> Ws-commons/Policy framework provides a convenient way to process
> policies. In this framework a requirement is viewed as an assertion. An
> assertion can be of two types.
>
> (a) Primitive Assertion - it is a domain specific requirement.
> One needs domain-specific knowledge to process a primitive assertion.
>
> (b) Composite Assertion: it contains set of requirements and implicit
> knowledge how those requirements should met.
> For instance AndCompositeAssertion requires that all of its terms (set
> of assertions it contains) are met.
>
> XorCompositeAssertion requires that exactly one of it terms should met.
>
>
> Policy operations:
>
> Three policy operations are defined
> (a) normalize();
> Creates a new Assertion object which is in its normalized format.
>
> (b) intersect();
> Provides a set of alternatives which both parties understand. If any
> policy alternative that contains an assertion which the other party
> doesn't understand is ignored.
>
> (c) merge();
> Provides all alternatives which can be derived by two policies. If one
> of these alternatives can be met, then at least one of the policy
> alternatives of both policies are met.
>
>
> How to read a policy object:
>
> InputStream is = new FileInputStream("/home/ ..... /policy.xml");
>
> PolicyFactory factory = PolicyFactory.getInstance();
> PolicyReader reader = factory.getPolicyReader();
> Policy policy = reader.readPolicy(is);
>
>
> How write a policy object:
>
> OutputStream os = new FileOutputStream("/home/..../policy.xml");
>
> PolicyFactory factory = PolicyFactory.getInstance();
> PolicyWriter writer = factory.getPolicyWriter();
> writer.writePolicy(os);
>
>
> How to normalize a policy ;
>
> Policy policy = reader.readPolicy(...);
> Policy normalized = (Policy) policy.normalize();
>
>
> How to merge two policies;
>
> Policy policy1 = reader.readPolicy("..../policy1");
> Policy policy2 = reader.readPolicy("..../policy2");
>
> Policy merged = (Policy) policy1.merge(policy2);
>
> Best,
> Sanka
>
>
>
>
>
>
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/