You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Fernando Antonio Aires Lins <fa...@ufrpe.br> on 2006/08/11 15:43:19 UTC

[Neethi] Accessing assertions at runtime

Hi, 

        when we read a policy, is there any way to find information about the
assertions (example, name of the assertions, if it is primitive or composed...)?
Anyone tried it? 
  
                     Thanks, 
  
                               Fernando Aires 





---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


Re: [Neethi] Accessing assertions at runtime

Posted by Sanka Samaranayke <ss...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Hi Fernando,

sorry for the late reply ..

Fernando Antonio Aires Lins wrote:
> Hello Sanka,
>
> thanks for the answer. I find this in the documentation, but my
> doubt is a little more complex... Supose that you have a Policy
> (described in WS-Policy format), and you wrote it in a .xm file.
> Using the reader, I can read your policy:
>
> Policy policy = reader.readPolicy(fis);
>
> But I have no idea how can I have access for your assertions, and
> informations about the assertions (example: name of the
> assertions).


In this Neethi framework (Old version which has the
org.apache.ws.policy.* package
hierarchy) we have the following policy elements to Neethi objects
mapping.

wsp:Policy             -> Policy
wsp:ExactlyOne   -> ExactlyOne
wsp:All                 -> All
any other assertions -> Primitive Assertions


Therefore if you feed the following policy to a policy reader it will
return Policy object that will have one All object as its child term.
You can access it using policy.getTerms() method that returns
a List of all its child terms.

e.g.
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
    <wsp:All>
        <wsp:Policy />
    </wsp:All>
</wsp:Policy>

Again that All object will have an empty policy object as its child term.
And you have to use all.getTerms() to access that empty policy object
that
returns a List of all the child terms of that All object.

Likewise you can access any primitive assertions using above method.
Once you get to a primitive assertion you can use

primitiveAssertion.getName() to access its QName
primitiveAssertion.getAttributes() to access its attributes .. etc.


Further you must be aware that a policy could have multiple alternatives
with different sets of primitive assertions. If you want to access
those sets of
primitive assertions correspond to different alternatives you can use
policy.iterator() method.
It will return an iterator which points to set of List of primitive
assertions.


e.g.

Iterator iterator = policy.iterator()

for ( ;iterator.hasNext(); ) {
    // List of assertions of a particular alternative
    List assertions = (List) iterator.next();
 
    // first primitive assertion of the that alternative
    PrimitiveAssertion primitiveAssertion = (PrimitiveAssertion) ;
}


Hope this will help,
Sanka

Like you
> said, we have the constructor PrimitiveAssertion, and we can create
>  new assertions. But I just want to know what assertions your
> policy have... I have to create new assertions for this? If it yes,
> how can I associate them with the policy?
>
> Thanks for any help,
>
> Fernando Aires
>
>
>
>
>
> Citando Sanka Samaranayke <ss...@gmail.com>:
>
> Fernando Antonio Aires Lins wrote:
>>>> Hi,
>>>>
>>>> when we read a policy, is there any way to find information
>>>> about the assertions (example, name of the assertions,
>
> PrimitiveAsertion pa; .. pa.getName() will return the QName of that
>  primitive assertion.
>
>>>> if it is primitive or composed...)?
> No .. but any domain specific policy process will know whether a
> primitive assertion which it understands is a primitive assertion
> or not based on its QName since it already has that knowledge.
>
> --Sanka
>>>> Anyone tried it?
>>>>
>>>> Thanks,
>>>>
>>>> Fernando Aires
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
> ---------------------------------------------------------------------
>
>
>>>> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
>>>>  For additional commands, e-mail:
>>>> commons-dev-help@ws.apache.org
>>>>
>>>>
>
> -- Sanka Samaranayake WSO2 Inc. T:+94-77-3506382 F:+94-11-2424304
>
> http://sankas.blogspot.com/ http://www.wso2.net/
>>>
>>>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org For
> additional commands, e-mail: commons-dev-help@ws.apache.org
>>>
>
>> ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: commons-dev-help@ws.apache.org
>
>
>
>
> -- Sanka Samaranayake WSO2 Inc. T:+94-77-3506382 F:+94-11-2424304
>
> http://sankas.blogspot.com/ http://www.wso2.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFE7D0U/Hd0ETKdgNIRAtfaAJ40tdofC+V5OrOebYfL0Pk4br1otQCfbBAA
SeCXeBP1EKJ4IZLan8RoFBY=
=HL5q
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


Re: [Neethi] Accessing assertions at runtime

Posted by Fernando Antonio Aires Lins <fa...@ufrpe.br>.
Hello Sanka,

    thanks for the answer.
    I find this in the documentation, but my doubt is a little more complex...
    Supose that you have a Policy (described in WS-Policy format), and you wrote
it in a .xm file. Using the reader, I can read your policy:
     
    Policy policy = reader.readPolicy(fis);

    But I have no idea how can I have access for your assertions, and
informations about the assertions (example: name of the assertions). Like you
said, we have the constructor PrimitiveAssertion, and we can create new
assertions. But I just want to know what assertions your policy have... I have
to create new assertions for this? If it yes, how can I associate them with the
policy?

                     Thanks for any help,

                              Fernando Aires

    



Citando Sanka Samaranayke <ss...@gmail.com>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Fernando Antonio Aires Lins wrote:
> > Hi,
> >
> > when we read a policy, is there any way to find information about
> > the assertions (example, name of the assertions,
> 
> 
> PrimitiveAsertion pa;
> ..
> pa.getName() will return the QName of that primitive assertion.
> 
> > if it is primitive or composed...)?
> No .. but any domain specific policy process will know whether a
> primitive assertion which it understands is a primitive assertion or
> not based on its QName since it already has that knowledge.
> 
> - --Sanka
> > Anyone tried it?
> >
> > Thanks,
> >
> > Fernando Aires
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org For
> > additional commands, e-mail: commons-dev-help@ws.apache.org
> >
> >
> 
> 
> - --
> Sanka Samaranayake
> WSO2 Inc.
> T:+94-77-3506382 F:+94-11-2424304
> 
> http://sankas.blogspot.com/
> http://www.wso2.net/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.1 (GNU/Linux)
> 
> iD8DBQFE342a/Hd0ETKdgNIRAqdQAJwJJaGF3glPhEl5o+4MO1aEpF2uYQCffb/9
> Uh3qsZITYHeV8SdZJlHVc0Q=
> =QPJP
> -----END PGP SIGNATURE-----
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: commons-dev-help@ws.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


Re: [Neethi] Accessing assertions at runtime

Posted by Sanka Samaranayke <ss...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fernando Antonio Aires Lins wrote:
> Hi,
>
> when we read a policy, is there any way to find information about
> the assertions (example, name of the assertions,


PrimitiveAsertion pa;
..
pa.getName() will return the QName of that primitive assertion.

> if it is primitive or composed...)?
No .. but any domain specific policy process will know whether a
primitive assertion which it understands is a primitive assertion or
not based on its QName since it already has that knowledge.

- --Sanka
> Anyone tried it?
>
> Thanks,
>
> Fernando Aires
>
>
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org For
> additional commands, e-mail: commons-dev-help@ws.apache.org
>
>


- --
Sanka Samaranayake
WSO2 Inc.
T:+94-77-3506382 F:+94-11-2424304

http://sankas.blogspot.com/
http://www.wso2.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFE342a/Hd0ETKdgNIRAqdQAJwJJaGF3glPhEl5o+4MO1aEpF2uYQCffb/9
Uh3qsZITYHeV8SdZJlHVc0Q=
=QPJP
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org