Author: sanka
Date: Mon Oct  2 02:12:50 2006
New Revision: 451925

URL: http://svn.apache.org/viewvc?view=rev&rev=451925
Log:
Implemented the serialize method in SandesahaPolicyBean.


Modified:
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/SandeshaPolicyBean.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=451925&r1=451924&r2=451925
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 Mon Oct  2 02:12:50 2006
@@ -547,8 +547,15 @@
        }

     

     public interface Assertions {

+        

+        public static final String URI_POLICY_NS = 
"http://schemas.xmlsoap.org/ws/2004/09/policy";;

         public static final String URI_RM_POLICY_NS = 
"http://ws.apache.org/sandesha2/policy";;

         

+        public static final String ATTR_WSRM = "wsrm";

+        public static final String ATTR_WSP = "wsp";

+        

+        public static final String ELEM_POLICY = "Policy";

+        public static final String ELEM_RMASSERTION = "RMAssertion";

         public static final String ELEM_ACK_INTERVAL = 
"AcknowledgementInterval";

         public static final String ELEM_RETRANS_INTERVAL = 
"RetransmissionInterval";

         public static final String ELEM_MAX_RETRANS_COUNT = 
"MaximumRetransmissionCount";

@@ -562,18 +569,20 @@
         public static final String ELEM_INMEMORY_STORAGE_MGR = 
"InMemoryStorageManager";

         public static final String ELEM_PERMANENT_STORAGE_MGR = 
"PermanentStorageManager";

         

-        public static final QName Q_ELEM__RMBEAN = new QName(URI_RM_POLICY_NS, 
"RMBean");

-        public static final QName Q_ELEM_ACK_INTERVAL = new 
QName(URI_RM_POLICY_NS, ELEM_ACK_INTERVAL);

-        public static final QName Q_ELEM_RETRANS_INTERVAL = new 
QName(URI_RM_POLICY_NS, ELEM_RETRANS_INTERVAL);

-        public static final QName Q_ELEM_MAX_RETRANS_COUNT = new 
QName(URI_RM_POLICY_NS, ELEM_MAX_RETRANS_COUNT);

-        public static final QName Q_ELEM_EXP_BACKOFF = new 
QName(URI_RM_POLICY_NS, ELEM_EXP_BACKOFF);

-        public static final QName Q_ELEM_INACTIVITY_TIMEOUT = new 
QName(URI_RM_POLICY_NS, ELEM_INACTIVITY_TIMEOUT);

-        public static final QName Q_ELEM_INACTIVITY_TIMEOUT_MEASURES = new 
QName(URI_RM_POLICY_NS, ELEM_INACTIVITY_TIMEOUT_MEASURES);

-        public static final QName Q_ELEM_INVOKE_INORDER = new 
QName(URI_RM_POLICY_NS, ELEM_INVOKE_INORDER);

-        public static final QName Q_ELEM_MSG_TYPES_TO_DROP = new 
QName(URI_RM_POLICY_NS, ELEM_MSG_TYPES_TO_DROP);

-        public static final QName Q_ELEM_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_STORAGE_MGR);

-        public static final QName Q_ELEM_SEC_MGR = new QName(URI_RM_POLICY_NS, 
ELEM_SEC_MGR);

-        public static final QName Q_ELEM_INMEMORY_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_INMEMORY_STORAGE_MGR);

-        public static final QName Q_ELEM_PERMANENT_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_PERMANENT_STORAGE_MGR);

+        public static final QName Q_ELEM_POLICY = new QName(URI_POLICY_NS, 
ELEM_POLICY, ATTR_WSP);

+        public static final QName Q_ELEM_RMASSERTION = new 
QName(URI_RM_POLICY_NS, ELEM_RMASSERTION, ATTR_WSRM);

+        public static final QName Q_ELEM__RMBEAN = new QName(URI_RM_POLICY_NS, 
"RMBean", ATTR_WSRM);

+        public static final QName Q_ELEM_ACK_INTERVAL = new 
QName(URI_RM_POLICY_NS, ELEM_ACK_INTERVAL, ATTR_WSRM);

+        public static final QName Q_ELEM_RETRANS_INTERVAL = new 
QName(URI_RM_POLICY_NS, ELEM_RETRANS_INTERVAL, ATTR_WSRM);

+        public static final QName Q_ELEM_MAX_RETRANS_COUNT = new 
QName(URI_RM_POLICY_NS, ELEM_MAX_RETRANS_COUNT, ATTR_WSRM);

+        public static final QName Q_ELEM_EXP_BACKOFF = new 
QName(URI_RM_POLICY_NS, ELEM_EXP_BACKOFF, ATTR_WSRM);

+        public static final QName Q_ELEM_INACTIVITY_TIMEOUT = new 
QName(URI_RM_POLICY_NS, ELEM_INACTIVITY_TIMEOUT, ATTR_WSRM);

+        public static final QName Q_ELEM_INACTIVITY_TIMEOUT_MEASURES = new 
QName(URI_RM_POLICY_NS, ELEM_INACTIVITY_TIMEOUT_MEASURES, ATTR_WSRM);

+        public static final QName Q_ELEM_INVOKE_INORDER = new 
QName(URI_RM_POLICY_NS, ELEM_INVOKE_INORDER, ATTR_WSRM);

+        public static final QName Q_ELEM_MSG_TYPES_TO_DROP = new 
QName(URI_RM_POLICY_NS, ELEM_MSG_TYPES_TO_DROP, ATTR_WSRM);

+        public static final QName Q_ELEM_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_STORAGE_MGR, ATTR_WSRM);

+        public static final QName Q_ELEM_SEC_MGR = new QName(URI_RM_POLICY_NS, 
ELEM_SEC_MGR, ATTR_WSRM);

+        public static final QName Q_ELEM_INMEMORY_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_INMEMORY_STORAGE_MGR, ATTR_WSRM);

+        public static final QName Q_ELEM_PERMANENT_STORAGE_MGR =new 
QName(URI_RM_POLICY_NS, ELEM_PERMANENT_STORAGE_MGR, ATTR_WSRM);

     }

 }


Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/SandeshaPolicyBean.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/SandeshaPolicyBean.java?view=diff&rev=451925&r1=451924&r2=451925
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/SandeshaPolicyBean.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/SandeshaPolicyBean.java
 Mon Oct  2 02:12:50 2006
@@ -35,173 +35,271 @@
 

 public class SandeshaPolicyBean implements Assertion {

 

-       // String storageManagerClass = null;

-       boolean inOrder = true;

+    // String storageManagerClass = null;

+    boolean inOrder = true;

 

-       ArrayList msgTypesToDrop = null;

+    ArrayList msgTypesToDrop = null;

 

-       private String inMemoryStorageManagerClass = null;

+    private String inMemoryStorageManagerClass = null;

 

-       private String permanentStorageManagerClass = null;

+    private String permanentStorageManagerClass = null;

 

-       private String securityManagerClass = null;

-

-       private long inactiveTimeoutValue;

-

-       private String inactivityTimeoutMeasure;

-

-       private long inactivityTimeoutInterval = -1;

-

-       private long acknowledgementInterval;

-

-       private long retransmissionInterval;

-

-       private boolean exponentialBackoff;

-

-       private int maximumRetransmissionCount;

-

-       public void setInactiveTimeoutInterval(long value, String measure) {

-               long timeOut = -1;

-

-               if (measure == null) {

-                       this.inactivityTimeoutInterval = value;

-               } else if ("seconds".equals(measure)) {

-                       timeOut = value * 1000;

-               } else if ("minutes".equals(measure)) {

-                       timeOut = value * 60 * 1000;

-               } else if ("hours".equals(measure)) {

-                       timeOut = value * 60 * 60 * 1000;

-               } else if ("days".equals(measure)) {

-                       timeOut = value * 24 * 60 * 60 * 1000;

-               }

-

-               this.inactivityTimeoutInterval = timeOut;

-

-       }

-

-       public void setAcknowledgementInterval(long acknowledgementInterval) {

-               this.acknowledgementInterval = acknowledgementInterval;

-       }

-

-       public String getInMemoryStorageManagerClass() {

-               return inMemoryStorageManagerClass;

-       }

-

-       public void setInMemoryStorageManagerClass(

-                       String inMemoryStorageManagerClass) {

-               this.inMemoryStorageManagerClass = inMemoryStorageManagerClass;

-       }

-

-       public String getPermanentStorageManagerClass() {

-               return permanentStorageManagerClass;

-       }

-

-       public void setPermanentStorageManagerClass(

-                       String permanentStorageManagerClass) {

-               this.permanentStorageManagerClass = 
permanentStorageManagerClass;

-       }

-

-       public boolean isInOrder() {

-               return inOrder;

-       }

-

-       public void setInOrder(boolean inOrder) {

-               this.inOrder = inOrder;

-       }

-

-       public ArrayList getMsgTypesToDrop() {

-               return msgTypesToDrop;

-       }

-

-       public void setMsgTypesToDrop(ArrayList msgTypesToDrop) {

-               this.msgTypesToDrop = msgTypesToDrop;

-       }

-

-       public void addMsgTypeToDrop(Integer typeNo) {

-

-               if (typeNo != null) {

-                       if (msgTypesToDrop == null)

-                               msgTypesToDrop = new ArrayList();

-

-                       msgTypesToDrop.add(typeNo);

-               }

-       }

-

-       public int getMaximumRetransmissionCount() {

-               return maximumRetransmissionCount;

-       }

-

-       public void setMaximumRetransmissionCount(int 
maximumRetransmissionCount) {

-               this.maximumRetransmissionCount = maximumRetransmissionCount;

-       }

-

-       public String getSecurityManagerClass() {

-               return securityManagerClass;

-       }

-

-       public void setSecurityManagerClass(String className) {

-               this.securityManagerClass = className;

-       }

-

-       public QName getName() {

-               return Sandesha2Constants.Assertions.Q_ELEM__RMBEAN;

-       }

-

-       public boolean isOptional() {

-               return false;

-       }

-

-       public PolicyComponent normalize() {

-               throw new UnsupportedOperationException("TODO");

-       }

-

-       public void serialize(XMLStreamWriter writer) throws XMLStreamException 
{

-               throw new UnsupportedOperationException("TODO");

-       }

-

-       public boolean equal(PolicyComponent policyComponent) {

-               throw new UnsupportedOperationException("TODO");

-       }

-

-       public short getType() {

-               return Constants.TYPE_ASSERTION;

-       }

-

-       public boolean isExponentialBackoff() {

-               return exponentialBackoff;

-       }

-

-       public void setExponentialBackoff(boolean exponentialBackoff) {

-               this.exponentialBackoff = exponentialBackoff;

-       }

-

-       public long getRetransmissionInterval() {

-               return retransmissionInterval;

-       }

-

-       public void setRetransmissionInterval(long retransmissionInterval) {

-               this.retransmissionInterval = retransmissionInterval;

-       }

-

-       public long getAcknowledgementInterval() {

-               return acknowledgementInterval;

-       }

-

-       public long getInactivityTimeoutInterval() {

-               if (inactivityTimeoutInterval<0)

-                       setInactiveTimeoutInterval(inactiveTimeoutValue, 
inactivityTimeoutMeasure);

-               

-               return inactivityTimeoutInterval;

-       }

-

-       public void setInactiveTimeoutValue(long inactiveTimeoutValue) {

-               this.inactiveTimeoutValue = inactiveTimeoutValue;

-       }

-

-       public void setInactivityTimeoutMeasure(String 
inactivityTimeoutMeasure) {

-               this.inactivityTimeoutMeasure = inactivityTimeoutMeasure;

-       }

-       

-       

+    private String securityManagerClass = null;

+

+    private long inactiveTimeoutValue;

+

+    private String inactivityTimeoutMeasure;

+

+    private long inactivityTimeoutInterval = -1;

+

+    private long acknowledgementInterval;

+

+    private long retransmissionInterval;

+

+    private boolean exponentialBackoff;

+

+    private int maximumRetransmissionCount;

+

+    public void setInactiveTimeoutInterval(long value, String measure) {

+        long timeOut = -1;

+

+        if (measure == null) {

+            this.inactivityTimeoutInterval = value;

+        } else if ("seconds".equals(measure)) {

+            timeOut = value * 1000;

+        } else if ("minutes".equals(measure)) {

+            timeOut = value * 60 * 1000;

+        } else if ("hours".equals(measure)) {

+            timeOut = value * 60 * 60 * 1000;

+        } else if ("days".equals(measure)) {

+            timeOut = value * 24 * 60 * 60 * 1000;

+        }

+

+        this.inactivityTimeoutInterval = timeOut;

+

+    }

+

+    public void setAcknowledgementInterval(long acknowledgementInterval) {

+        this.acknowledgementInterval = acknowledgementInterval;

+    }

+

+    public String getInMemoryStorageManagerClass() {

+        return inMemoryStorageManagerClass;

+    }

+

+    public void setInMemoryStorageManagerClass(

+            String inMemoryStorageManagerClass) {

+        this.inMemoryStorageManagerClass = inMemoryStorageManagerClass;

+    }

+

+    public String getPermanentStorageManagerClass() {

+        return permanentStorageManagerClass;

+    }

+

+    public void setPermanentStorageManagerClass(

+            String permanentStorageManagerClass) {

+        this.permanentStorageManagerClass = permanentStorageManagerClass;

+    }

+

+    public boolean isInOrder() {

+        return inOrder;

+    }

+

+    public void setInOrder(boolean inOrder) {

+        this.inOrder = inOrder;

+    }

+

+    public ArrayList getMsgTypesToDrop() {

+        return msgTypesToDrop;

+    }

+

+    public void setMsgTypesToDrop(ArrayList msgTypesToDrop) {

+        this.msgTypesToDrop = msgTypesToDrop;

+    }

+

+    public void addMsgTypeToDrop(Integer typeNo) {

+

+        if (typeNo != null) {

+            if (msgTypesToDrop == null)

+                msgTypesToDrop = new ArrayList();

+

+            msgTypesToDrop.add(typeNo);

+        }

+    }

+

+    public int getMaximumRetransmissionCount() {

+        return maximumRetransmissionCount;

+    }

+

+    public void setMaximumRetransmissionCount(int maximumRetransmissionCount) {

+        this.maximumRetransmissionCount = maximumRetransmissionCount;

+    }

+

+    public String getSecurityManagerClass() {

+        return securityManagerClass;

+    }

+

+    public void setSecurityManagerClass(String className) {

+        this.securityManagerClass = className;

+    }

+

+    public QName getName() {

+        return Sandesha2Constants.Assertions.Q_ELEM__RMBEAN;

+    }

+

+    public boolean isOptional() {

+        return false;

+    }

+

+    public PolicyComponent normalize() {

+        throw new UnsupportedOperationException("TODO");

+    }

+

+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {

+        String localName = Sandesha2Constants.Assertions.Q_ELEM_RMASSERTION

+                .getLocalPart();

+        String namespaceURI = Sandesha2Constants.Assertions.Q_ELEM_RMASSERTION

+                .getNamespaceURI();

+

+        String prefix = writer.getPrefix(namespaceURI);

+        if (prefix == null) {

+            prefix = Sandesha2Constants.Assertions.Q_ELEM_RMASSERTION

+                    .getPrefix();

+            writer.setPrefix(prefix, namespaceURI);

+        }

+

+        // <wsrm:RMAssertion>

+        writer.writeStartElement(prefix, localName, namespaceURI);

+        // xmlns:wsrm=".."

+        writer.writeNamespace(prefix, namespaceURI);

+

+        String policyLocalName = Sandesha2Constants.Assertions.Q_ELEM_POLICY

+                .getLocalPart();

+        String policyNamespaceURI = Sandesha2Constants.Assertions.Q_ELEM_POLICY

+                .getNamespaceURI();

+        String wspPrefix = writer.getPrefix(policyNamespaceURI);

+

+        if (wspPrefix == null) {

+            wspPrefix = 
Sandesha2Constants.Assertions.Q_ELEM_POLICY.getPrefix();

+            writer.writeNamespace(wspPrefix, policyNamespaceURI);

+        }

+

+        // <wsp:Policy>

+        writer

+                .writeStartElement(wspPrefix, policyLocalName,

+                        policyNamespaceURI);

+

+        // <wsrm:AcknowledgementInterval />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_ACK_INTERVAL.getLocalPart(), namespaceURI);

+        writer.writeCharacters(Long.toString(getAcknowledgementInterval()));

+        writer.writeEndElement();

+        

+        // <wsrm:RetransmissionInterval />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_RETRANS_INTERVAL.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(Long.toString(getRetransmissionInterval()));

+        writer.writeEndElement();

+

+        // <wsrm:MaximumRetransmissionCount />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_MAX_RETRANS_COUNT.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(Long.toString(getMaximumRetransmissionCount()));

+        writer.writeEndElement();

+        

+        // <wsrm:ExponentialBackoff />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_EXP_BACKOFF.getLocalPart(), namespaceURI);

+        writer.writeCharacters(Boolean.toString(isExponentialBackoff()));

+        writer.writeEndElement();

+        

+        // <wsrm:InactivityTimeout />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_INACTIVITY_TIMEOUT.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(Long.toString(getInactivityTimeoutInterval()));

+        writer.writeEndElement();

+        

+        // <wsrm:InactivityTimeoutMeasure />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_INACTIVITY_TIMEOUT_MEASURES.getLocalPart(),
 namespaceURI);

+        writer.writeCharacters(inactivityTimeoutMeasure);

+        writer.writeEndElement();

+        

+        // <wsrm:InvokeInOrder />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_INVOKE_INORDER.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(Boolean.toString(isInOrder()));

+        writer.writeEndElement();

+        

+        // <wsrm:MessageTypesToDrop />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_MSG_TYPES_TO_DROP.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters("none"); // FIXME

+        writer.writeEndElement();

+        

+        // <wsrm:StorageManagers>

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_STORAGE_MGR.getLocalPart(), namespaceURI);

+        

+        // <wsrm:InMemoryStorageManager />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_INMEMORY_STORAGE_MGR.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(getInMemoryStorageManagerClass());

+        writer.writeEndElement();

+        

+        // <wsrm:PermanentStorageManager />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_PERMANENT_STORAGE_MGR.getLocalPart(), 
namespaceURI);

+        writer.writeCharacters(getPermanentStorageManagerClass());

+        writer.writeEndElement();        

+        

+        // </wsrm:StorageManager>

+        writer.writeEndElement();

+        

+        // <wsrm:SecurityManager />

+        writer.writeStartElement(prefix, 
Sandesha2Constants.Assertions.Q_ELEM_SEC_MGR.getLocalPart(), namespaceURI);

+        writer.writeCharacters(getSecurityManagerClass());

+        writer.writeEndElement();

+        

+        // </wsp:Policy>

+        writer.writeEndElement();

+

+        // </wsrm:RMAssertion>

+        writer.writeEndElement();

+

+    }

+

+    public boolean equal(PolicyComponent policyComponent) {

+        throw new UnsupportedOperationException("TODO");

+    }

+

+    public short getType() {

+        return Constants.TYPE_ASSERTION;

+    }

+

+    public boolean isExponentialBackoff() {

+        return exponentialBackoff;

+    }

+

+    public void setExponentialBackoff(boolean exponentialBackoff) {

+        this.exponentialBackoff = exponentialBackoff;

+    }

+

+    public long getRetransmissionInterval() {

+        return retransmissionInterval;

+    }

+

+    public void setRetransmissionInterval(long retransmissionInterval) {

+        this.retransmissionInterval = retransmissionInterval;

+    }

+

+    public long getAcknowledgementInterval() {

+        return acknowledgementInterval;

+    }

+

+    public long getInactivityTimeoutInterval() {

+        if (inactivityTimeoutInterval < 0)

+            setInactiveTimeoutInterval(inactiveTimeoutValue,

+                    inactivityTimeoutMeasure);

+

+        return inactivityTimeoutInterval;

+    }

+

+    public void setInactiveTimeoutValue(long inactiveTimeoutValue) {

+        this.inactiveTimeoutValue = inactiveTimeoutValue;

+    }

+

+    public void setInactivityTimeoutMeasure(String inactivityTimeoutMeasure) {

+        this.inactivityTimeoutMeasure = inactivityTimeoutMeasure;

+    }

 

 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to