Author: sanka
Date: Wed Mar 22 22:19:06 2006
New Revision: 388062

URL: http://svn.apache.org/viewcvs?rev=388062&view=rev
Log:
adding the url for the user's guide v1.0

Added:
    webservices/commons/modules/policy/xdocs/1_0/
    webservices/commons/modules/policy/xdocs/1_0/userguide.xml
Removed:
    webservices/commons/modules/policy/xdocs/userguide.xml
Modified:
    webservices/commons/modules/policy/RELEASE-NOTE.txt
    webservices/commons/modules/policy/xdocs/navigation.xml

Modified: webservices/commons/modules/policy/RELEASE-NOTE.txt
URL: 
http://svn.apache.org/viewcvs/webservices/commons/modules/policy/RELEASE-NOTE.txt?rev=388062&r1=388061&r2=388062&view=diff
==============================================================================
--- webservices/commons/modules/policy/RELEASE-NOTE.txt (original)
+++ webservices/commons/modules/policy/RELEASE-NOTE.txt Wed Mar 22 22:19:06 2006
@@ -6,3 +6,9 @@
 Fully compliant with the WS Policy Specification (September 2004)
 Passes WS Policy Interop Round1 TestSuite
 
+User's guide:
+
+please visit http://ws.apache.org/commons/policy/1_0/userguide.html
+
+
+

Added: webservices/commons/modules/policy/xdocs/1_0/userguide.xml
URL: 
http://svn.apache.org/viewcvs/webservices/commons/modules/policy/xdocs/1_0/userguide.xml?rev=388062&view=auto
==============================================================================
--- webservices/commons/modules/policy/xdocs/1_0/userguide.xml (added)
+++ webservices/commons/modules/policy/xdocs/1_0/userguide.xml Wed Mar 22 
22:19:06 2006
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<document>
+       <properties>
+               <title>WS Policy User's Guide</title>
+       </properties>
+       
+       <head>
+               <meta http-equiv="content-type" content="text/html; 
charset=iso-8859-1" />
+               <meta name="generator" content="amaya 9.2.1, see 
http://www.w3.org/Amaya/"/>
+       </head>
+       
+       <body>
+               <section>
+                       
+                       <h1>Apache Web Services Policy User's Guide:</h1>
+                       <h4>Version 1.0</h4>
+                       
+                       <p>This document will instruct you how to use WS-Policy 
model, taking you
+step by step through the process using a simple sample.</p>
+                       
+                       <p>Send your feedback to: <a
+                                               
href="mailto:[email protected]";>[email protected]</a> (Prefix
+the subject with [Policy])</p>
+                       <p>To subscribe to developer mailing list see <a 
href="http://ws.apache.org/commons/policy/mail-lists.html"; 
target="_blank">here</a>
+                       </p>
+                       
+                       <h2>Content</h2>
+                       <ol>
+                               <li>
+                                       <a href="#create">Create a policy 
object</a>
+                                       <ul>
+                                               <li>
+                                                       <a 
href="#policydoc">Create a policy object by reading a policy document</a>
+                                                       <ul>
+                                                               <li>
+                                                                       <a 
href="#policyreader">How to create a PolicyReader</a>
+                                                               </li>
+                                                               <li>
+                                                                       <a 
href="#feedpolicydoc">Feed the policy document to PolicyReader as an
+            inputStream</a>
+                                                               </li>
+                                                       </ul>
+                                               </li>
+                                               <li>
+                                                       <a 
href="#program">Create a policy object programmatically.</a>
+                                               </li>
+                                       </ul>
+                               </li>
+                               <li>
+                                       <a href="#write">Write a policy 
object</a>
+                               </li>
+                               <li>
+                                       <a href="#normalize">Normalization</a>
+                               </li>
+                               <li>
+                                       <a href="#merge">Merge policy 
objects</a>
+                               </li>
+                               <li>
+                                       <a href="#intersect">Intersect policy 
objects</a>
+                               </li>
+                       </ol>
+                       <a name="create"></a>
+                       <h2>Create a policy object</h2>
+                       
+                       <p>You can create a policy obejct using one of the 
following two methods</p>
+                       <ol>
+                               <li>
+                                       <a href="#policydoc">Create a policy 
object by redaing a policy document</a>
+                               </li>
+                               <li>
+                                       <a href="#program">Create a policy 
object programmatically</a>
+                               </li>
+                       </ol>
+                       <a name="policydoc"></a>
+                       <h3>Create a policy object by reading a policy 
document</h3>
+                       
+                       <p>The following steps need to be taken to create a 
policy object from a
+policy document</p>
+                       <ol>
+                               <li>
+                                       <a href="#policyreader">Create a 
PolicyReader</a> - This is the class that creates a policy object
+    using an InputStream.</li>
+                               <li>
+                                       <a href="#feedpolicydoc">Feed the 
policy document to PolicyReader as an InputStream</a>-This will
+    return a policy object</li>
+                       </ol>
+                       <a name="policyreader"></a>
+                       <h4>1. How to create a PolicyReader</h4>
+                       
+                       <p>PolicyReader is the class that creates a policy 
object using an
+InputStream.</p>
+                       <source>
+                               <pre>PolicyReader reader =
+PolicyFactory.getPolicyReader(PolicyFactory.OM_POLICY_READER);
+
+// or
+
+PolicyReader reader =
+PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);</pre>
+                       </source>
+                       <a name="feedpolicydoc"></a>
+                       <h4>2. Feed the policy document to PolicyReader as an 
InputStream.</h4>
+                       
+                       <p>This step will return a policy object.</p>
+                       <source>
+                               <pre>String pathToPolicyFile = " /home/ 
../Policy1.xml";
+
+FileInputStream fis = new FileInputStream(pathToPolicyFile);
+
+Policy policy = reader.readPolicy(fis);</pre>
+                       </source>
+                       <a name="program"></a>
+                       <h3>Create a policy object programmatically.</h3>
+                       <a name="policy"></a>
+                       <p>Lets consider the sample policy below.</p>
+                       <source>
+                               <pre>&lt;wsp:Policy&gt;
+   &lt;wsp:ExactlyOne&gt; // Corresponds to XorCompositeAssertion
+   &lt;wsp:All&gt; // Corresponds to AndCompositeAssertion
+     &lt;ns1:TestAssertion&gt;
+     TestAssertion1
+     &lt;/ns:TestAssertion&gt;
+   &lt;/wsp:All&gt;
+   &lt;/wsp:ExactlyOne&gt;
+&lt;/wsp:Policy&gt;</pre>
+                       </source>
+                       <p>Now lets create programmatically the policy object 
which represents the
+above policy</p>
+                       <source>
+                               <pre>Policy p = new Policy(); // will give you 
the following element
+
+&lt;wsp:Policy&gt; &lt;/wsp:Policy&gt;
+
+XorCompositeAssertion x1 = new XorCompositeAssertion();
+p.addTerm(x1); //will give you XorCompositeAssertion as seen below
+
+&lt;wsp:Policy&gt;
+&lt;wsp:ExactlyOne&gt;....&lt;/wsp:ExactlyOne&gt;
+&lt;/wsp:Policy&gt;
+
+AndCompositeAssertion a1 = new AndCompositeAssertion();
+x1.addTerm(a1);// will give you AndCompositeAssertion as seen below
+
+&lt;wsp:Policy&gt;
+&lt;wsp:ExactlyOne&gt;
+&lt;wsp:All&gt;...&lt;/wsp:All&gt;
+&lt;/wsp:ExactlyOne&gt;
+&lt;/wsp:Policy&gt;
+
+QName name = new QName("Test", "http://tests.org/tests";, "ns1");
+PrimitiveAssertion prim1 = new PrimitiveAssertion(name);
+prim1.setStrValue("MyTestAssertion");
+a1.addTerm(prim1); //will give you the <a href="#policy">complete policy</a>
+                               </pre>
+                       </source>
+                       <a name="write"></a>
+                       <h2>Write a policy object</h2>
+                       <p>The following code will achieve this task</p>
+                       <source>
+                               <pre>String pathToOutFile = "/home/... 
/Policy2.xml";
+
+FileOutputStream fos = new FileOutputStream(pathToOutFile);
+
+PolicyWriter writer =
+PolicyFactory.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
+
+writer.writePolicy(policy, fos );</pre>
+                       </source>
+                       <a name="normalize"></a>
+                       <h2>Normalization</h2>
+                       <p>The following code will achieve policy 
normalization</p>
+                       <source>
+                               <pre>Policy policy1 = reader.readPolicy(...);
+
+Policy normalized = (Policy) policy1.normalize();</pre>
+                       </source>
+                       <a name="merge"></a>
+                       <h2>Merge policy objects</h2>
+                       <p>The following code will merge two policy objects</p>
+                       <source>
+                               <pre>Policy policy1 = reader.readPolicy(...);
+
+Policy policy2 = reader.readPolicy(...);
+
+Policy merged = (Policy) policy1.merge(policy2);</pre>
+                       </source>
+                       <a name="intersect"></a>
+                       <h2>Intersect policy objects</h2>
+                       <p>The following code will intersect two policy 
objects</p>
+                       <source>
+                               <pre>Policy policy1 = reader.readPolicy(..)
+
+Policy policy2 = reader.readPolicy(..)
+
+Policy intersected = (Policy) policy1.intersect(policy2);</pre>
+                       </source>
+               </section>
+       
+       </body>
+
+</document>

Modified: webservices/commons/modules/policy/xdocs/navigation.xml
URL: 
http://svn.apache.org/viewcvs/webservices/commons/modules/policy/xdocs/navigation.xml?rev=388062&r1=388061&r2=388062&view=diff
==============================================================================
--- webservices/commons/modules/policy/xdocs/navigation.xml (original)
+++ webservices/commons/modules/policy/xdocs/navigation.xml Wed Mar 22 22:19:06 
2006
@@ -8,7 +8,9 @@
                                <item name="Source Code" 
href="http://svn.apache.org/repos/asf/webservices/commons/modules/policy"/>
                        </item>
                        <item name="Documentation">
-                               <item name="User's Guide" 
href="/userguide.html"/>
+                               <item name="User's Guide">
+                                       <item name="Version 1.0" 
href="/1_0/userguide.html"/>
+                               </item>
                                <item name="Javadocs" 
href="/apidocs/index.html"/>
                        </item>
                        <item name="Project Information">


Reply via email to