You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/08/23 23:35:36 UTC

svn commit: r434194 - in /webservices/muse/trunk/modules: muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/

Author: danj
Date: Wed Aug 23 14:35:35 2006
New Revision: 434194

URL: http://svn.apache.org/viewvc?rev=434194&view=rev
Log:
Updated JavaDoc and messages file for WEF API and implementation.

Added:
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/Messages.properties
Modified:
    webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java
    webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/Situation.java
    webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefConstants.java
    webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefFactory.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/AbstractExtendedElements.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java Wed Aug 23 14:35:35 2006
@@ -35,21 +35,26 @@
 
 public interface ExtendedElements
 {
-    void addExtendedElement(QName elementName, Object elementValue);
-
+    /**
+     * 
+     * @param xml
+     *        The custom XML that will be added to end of the WEF component.
+     *
+     */
     void addExtendedElement(Element xml);
     
     /**
-     * 
+     *
      * @param elementName
-     *        The QName of the desired Element(s)
-     *        
-     * @return The set of extended Elements (which were provided using 
-     *         the addExtendedElement() methods) whose names are equal 
-     *         to the one given.
+     *        The name of the XML element that will be added to the end of 
+     *        the WEF component.
+     *  
+     * @param elementValue
+     *        The value that will be serialized to XML and added to the end 
+     *        of the WEF component. 
      *
      */
-    Collection getExtendedElements(QName elementName);
+    void addExtendedElement(QName elementName, Object elementValue);
     
     /**
      * 
@@ -57,4 +62,16 @@
      *
      */
     Collection getExtendedElements();
+    
+    /**
+     * 
+     * @param elementName
+     *        The QName of the desired Element(s)
+     *        
+     * @return The set of extended Elements (which were provided using 
+     *         the addExtendedElement() methods) whose names are equal 
+     *         to the one given.
+     *
+     */
+    Collection getExtendedElements(QName elementName);
 }

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/Situation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/Situation.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/Situation.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/Situation.java Wed Aug 23 14:35:35 2006
@@ -38,33 +38,23 @@
 
 public interface Situation extends XmlSerializable
 {
-    String SUCCESSFUL = "Successful";
-
-    String UNSUCCESSFUL = "Unsuccessful";
+    short LOWEST_PRIORITY = 0;
+    short LOW_PRIORITY = 10;
+    short MEDIUM_PRIORITY = 50;
+    short HIGH_PRIORITY = 70;
+    short HIGHEST_PRIORITY = 100;
 
     short UNKNOWN_SEVERITY = 0;
-
     short INFO_SEVERITY = 1;
-
     short WARNING_SEVERITY = 2;
-
     short MINOR_SEVERITY = 3;
-
     short MAJOR_SEVERITY = 4;
-
     short CRITICAL_SEVERITY = 5;
-
     short FATAL_SEVERITY = 6;
 
-    short LOWEST_PRIORITY = 0;
-
-    short LOW_PRIORITY = 10;
-
-    short MEDIUM_PRIORITY = 50;
-
-    short HIGH_PRIORITY = 70;
+    String SUCCESSFUL = "Successful";
 
-    short HIGHEST_PRIORITY = 100;
+    String UNSUCCESSFUL = "Unsuccessful";
     
     QName[] getCategoryType();
 

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefConstants.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefConstants.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefConstants.java Wed Aug 23 14:35:35 2006
@@ -28,81 +28,90 @@
  */
 
 public class WefConstants
-{
+{    
     public static final String MUWS_P1_PREFIX = "muws1";
-
+    
     public static final String MUWS_P1_URI = 
         "http://docs.oasis-open.org/wsdm/muws1-2.xsd";
-
+    
     public static final String MUWS_P2_PREFIX = "muws2";
     
     public static final String MUWS_P2_URI = 
         "http://docs.oasis-open.org/wsdm/muws2-2.xsd";
     
-    public static final QName RESOURCE_ID_QNAME = 
-        new QName(MUWS_P1_URI, "ResourceId", MUWS_P1_PREFIX);
+    public static final QName AVAILABILITY_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "AvailabilitySituation", MUWS_P2_PREFIX);
+
+    public static final QName CAPABILITY_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "CapabilitySituation", MUWS_P2_PREFIX);
+
+    public static final QName COMP_ADDRESS_QNAME = 
+        new QName(MUWS_P1_URI, "ComponentAddress", MUWS_P1_PREFIX);
     
-    public static final QName MGMT_EVENT_QNAME = 
-        new QName(MUWS_P1_URI, "ManagementEvent", MUWS_P1_PREFIX);
+    public static final QName CONFIGURE_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "ConfigureSituation", MUWS_P2_PREFIX);
     
-    public static final String REPORT_TIME = "ReportTime";
+    public static final QName CONNECT_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "ConnectSituation", MUWS_P2_PREFIX);
     
-    public static final String SEQUENCE_NUMBER = "sequenceNumber";
+    public static final QName CREATE_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "CreateSituation", MUWS_P2_PREFIX);
+    
+    public static final QName DEPENDENCY_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "DependencySituation", MUWS_P2_PREFIX);
+    
+    public static final QName DESTROY_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "DestroySituation", MUWS_P2_PREFIX);
     
     public static final QName EVENT_ID_QNAME = 
         new QName(MUWS_P1_URI, "EventId", MUWS_P1_PREFIX);
     
-    public static final QName SOURCE_COMP_QNAME = 
-        new QName(MUWS_P1_URI, "SourceComponent", MUWS_P1_PREFIX);
-    
-    public static final QName REPORTER_COMP_QNAME = 
-        new QName(MUWS_P1_URI, "ReporterComponent", MUWS_P1_PREFIX);
+    public static final QName MESSAGE_QNAME = 
+        new QName(MUWS_P2_URI, "Message", MUWS_P2_PREFIX);
     
-    public static final QName COMP_ADDRESS_QNAME = 
-        new QName(MUWS_P1_URI, "ComponentAddress", MUWS_P1_PREFIX);
+    public static final QName MGMT_EVENT_QNAME = 
+        new QName(MUWS_P1_URI, "ManagementEvent", MUWS_P1_PREFIX);
     
-    public static final QName SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "Situation", MUWS_P2_PREFIX);
+    public static final String MSG_ID = "MsgId";
     
-    public static final QName SITUATION_CATEGORY_QNAME = 
-        new QName(MUWS_P2_URI, "SituationCategory", MUWS_P2_PREFIX);
+    public static final String MSG_ID_TYPE = "MsgIdType";
     
-    public static final QName SUCCESS_DISPOSITION_QNAME = 
-        new QName(MUWS_P2_URI, "SuccessDisposition", MUWS_P2_PREFIX);
+    public static final QName OTHER_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "OtherSituation", MUWS_P2_PREFIX);
     
-    public static final String SUCCESSFUL = "Successful";
-    public static final String UNSUCCESSFUL = "Unsuccessful";
+    public static final QName PRIORITY_QNAME = 
+        new QName(MUWS_P2_URI, "Priority", MUWS_P2_PREFIX);
     
-    public static final QName SITUATION_TIME_QNAME = 
-        new QName(MUWS_P2_URI, "SituationTime", MUWS_P2_PREFIX);
+    public static final QName REPORT_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "ReportSituation", MUWS_P2_PREFIX);
     
-    public static final QName SEVERITY_QNAME = 
-        new QName(MUWS_P2_URI, "Severity", MUWS_P2_PREFIX);
+    public static final String REPORT_TIME = "ReportTime";
     
-    public static final QName PRIORITY_QNAME = 
-        new QName(MUWS_P2_URI, "Priority", MUWS_P2_PREFIX);
+    public static final QName REPORTER_COMP_QNAME = 
+        new QName(MUWS_P1_URI, "ReporterComponent", MUWS_P1_PREFIX);
     
-    public static final QName MESSAGE_QNAME = 
-        new QName(MUWS_P2_URI, "Message", MUWS_P2_PREFIX);
+    public static final QName REQUEST_SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "RequestSituation", MUWS_P2_PREFIX);
     
-    public static final QName SUBSTITUTABLE_MSG_QNAME = 
-        new QName(MUWS_P2_URI, "SubstitutableMsg", MUWS_P2_PREFIX);
+    public static final QName RESOURCE_ID_QNAME = 
+        new QName(MUWS_P1_URI, "ResourceId", MUWS_P1_PREFIX);
     
-    public static final String MSG_ID = "MsgId";
+    public static final String SEQUENCE_NUMBER = "sequenceNumber";
     
-    public static final String MSG_ID_TYPE = "MsgIdType";
+    public static final QName SEVERITY_QNAME = 
+        new QName(MUWS_P2_URI, "Severity", MUWS_P2_PREFIX);
     
-    public static final QName VALUE_QNAME = 
-        new QName(MUWS_P2_URI, "Value", MUWS_P2_PREFIX);
+    public static final QName SITUATION_CATEGORY_QNAME = 
+        new QName(MUWS_P2_URI, "SituationCategory", MUWS_P2_PREFIX);
     
-    public static final QName AVAILABILITY_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "AvailabilitySituation", MUWS_P2_PREFIX);
+    public static final QName SITUATION_QNAME = 
+        new QName(MUWS_P2_URI, "Situation", MUWS_P2_PREFIX);
     
-    public static final QName CAPABILITY_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "CapabilitySituation", MUWS_P2_PREFIX);
+    public static final QName SITUATION_TIME_QNAME = 
+        new QName(MUWS_P2_URI, "SituationTime", MUWS_P2_PREFIX);
     
-    public static final QName CONFIGURE_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "ConfigureSituation", MUWS_P2_PREFIX);
+    public static final QName SOURCE_COMP_QNAME = 
+        new QName(MUWS_P1_URI, "SourceComponent", MUWS_P1_PREFIX);
     
     public static final QName START_SITUATION_QNAME = 
         new QName(MUWS_P2_URI, "StartSituation", MUWS_P2_PREFIX);
@@ -110,24 +119,16 @@
     public static final QName STOP_SITUATION_QNAME = 
         new QName(MUWS_P2_URI, "StopSituation", MUWS_P2_PREFIX);
     
-    public static final QName CREATE_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "CreateSituation", MUWS_P2_PREFIX);
-    
-    public static final QName DESTROY_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "DestroySituation", MUWS_P2_PREFIX);
-    
-    public static final QName REQUEST_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "RequestSituation", MUWS_P2_PREFIX);
+    public static final QName SUBSTITUTABLE_MSG_QNAME = 
+        new QName(MUWS_P2_URI, "SubstitutableMsg", MUWS_P2_PREFIX);
     
-    public static final QName REPORT_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "ReportSituation", MUWS_P2_PREFIX);
+    public static final QName SUCCESS_DISPOSITION_QNAME = 
+        new QName(MUWS_P2_URI, "SuccessDisposition", MUWS_P2_PREFIX);
     
-    public static final QName CONNECT_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "ConnectSituation", MUWS_P2_PREFIX);
+    public static final String SUCCESSFUL = "Successful";
     
-    public static final QName DEPENDENCY_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "DependencySituation", MUWS_P2_PREFIX);
+    public static final String UNSUCCESSFUL = "Unsuccessful";
     
-    public static final QName OTHER_SITUATION_QNAME = 
-        new QName(MUWS_P2_URI, "OtherSituation", MUWS_P2_PREFIX);
+    public static final QName VALUE_QNAME = 
+        new QName(MUWS_P2_URI, "Value", MUWS_P2_PREFIX);
 }

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefFactory.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefFactory.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-api/src/org/apache/muse/ws/dm/muws/events/WefFactory.java Wed Aug 23 14:35:35 2006
@@ -23,9 +23,11 @@
 /**
  *
  * WefFactory defines methods needed to instantiate "blank" WEF events and 
- * their sub-components, as well as events and sub-components that come 
- * from XML fragments. The factory component allows for event creation without 
- * reference to specific WEF implementation classes.
+ * their sub-components, as well as events and sub-components that exist as 
+ * from XML fragments. The methods that create objects from XML require that 
+ * the XML fragments be schema-compliant and correspond to the given WEF 
+ * schema element (i.e., createSubstitutableMessage() takes 
+ * <em>muws2:SubstitutableMessage</em>).
  *
  * @author Dan Jemiolo (danj)
  *

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/AbstractExtendedElements.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/AbstractExtendedElements.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/AbstractExtendedElements.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/AbstractExtendedElements.java Wed Aug 23 14:35:35 2006
@@ -48,6 +48,19 @@
         addExtendedElement(XmlUtils.createElement(elementName, elementValue));
     }
 
+    protected void appendExtendedElements(Element xml)
+    {
+        Document doc = xml.getOwnerDocument();
+        Iterator i = getExtendedElements().iterator();
+
+        while (i.hasNext())
+        {
+            Element next = (Element)i.next();
+            next = (Element)doc.importNode(next, true);
+            xml.appendChild(next);
+        }
+    }
+    
     public final Collection getExtendedElements()
     {
         return _extendedElements;
@@ -69,18 +82,5 @@
         }
         
         return results;
-    }
-    
-    protected void appendExtendedElements(Element xml)
-    {
-        Document doc = xml.getOwnerDocument();
-        Iterator i = getExtendedElements().iterator();
-
-        while (i.hasNext())
-        {
-            Element next = (Element)i.next();
-            next = (Element)doc.importNode(next, true);
-            xml.appendChild(next);
-        }
     }
 }

Added: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/Messages.properties?rev=434194&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/Messages.properties Wed Aug 23 14:35:35 2006
@@ -0,0 +1,7 @@
+NoComponentName=The WEF component has no name - what is the name of the XML element that represents the component?
+NoEventID=The WEF event has no EventId field. The EventId field is required by the WEF schema.
+NoSourceComponent=The WEF event has no source component. The source component field is required by the WEF schema.
+NoCategoryType=The WEF situtation has no category type. The category type field is required by the WEF schema.
+PriorityOutOfBounds=The situation priority value is XXX, which is out-of-bounds. The lowest possible value is XXX, the highest is XXX.
+SeverityOutOfBounds=The situation priority value is XXX, which is out-of-bounds. Use the Situation.*_SEVERITY fields to set a proper severity value for the situation.
+InvalidDisposition=The situation disposition value is XXX, which is not valid - the only possible values are 'Unsuccessful' and 'Successful'.

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java Wed Aug 23 14:35:35 2006
@@ -21,6 +21,8 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.ws.dm.muws.events.Component;
 import org.apache.muse.ws.dm.muws.events.ComponentAddress;
@@ -36,6 +38,11 @@
 public class SimpleComponent 
     extends AbstractExtendedElements implements Component
 {
+    //
+    // used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = MessagesFactory.get(SimpleComponent.class);
+    
     private ComponentAddress _address = null;
     
     private QName _name = null;
@@ -103,7 +110,7 @@
         QName name = getName();
         
         if (name == null)
-            throw new RuntimeException("Invalid component type: no root name.");
+            throw new RuntimeException(_MESSAGES.get("NoComponentName"));
         
         Element componentXML = XmlUtils.createElement(factory, name);
         

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java Wed Aug 23 14:35:35 2006
@@ -24,6 +24,8 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.uuid.RandomUuidFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.util.xml.XsdUtils;
@@ -42,6 +44,11 @@
 public class SimpleManagementEvent 
     extends AbstractExtendedElements implements ManagementEvent
 {
+    //
+    // used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = MessagesFactory.get(SimpleManagementEvent.class);
+    
     private String _eventID = RandomUuidFactory.getInstance().createUUID();
     
     private Component _reporter = null;
@@ -50,10 +57,10 @@
     
     private long _sequenceNumber = -1;
 
-    private Component _source = null;
-
     private Situation _situation = null;
 
+    private Component _source = null;
+
     public SimpleManagementEvent()
     {
         //
@@ -217,14 +224,14 @@
         String eventID = getEventID();
 
         if (eventID == null)
-            throw new RuntimeException("Invalid WEF: no EventID");
+            throw new RuntimeException(_MESSAGES.get("NoEventID"));
 
         XmlUtils.setElement(wef, WefConstants.EVENT_ID_QNAME, eventID);
         
         Component source = getSource();
 
         if (source == null)
-            throw new RuntimeException("Invalid WEF: no source component.");
+            throw new RuntimeException(_MESSAGES.get("NoSourceComponent"));
 
         Element sourceXML = source.toXML(doc);
         wef.appendChild(sourceXML);

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java?rev=434194&r1=434193&r2=434194&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java Wed Aug 23 14:35:35 2006
@@ -26,6 +26,8 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.ws.dm.muws.events.Situation;
 import org.apache.muse.ws.dm.muws.events.SubstitutableMessage;
@@ -39,19 +41,24 @@
 
 public class SimpleSituation implements Situation
 {
+    //
+    // used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = MessagesFactory.get(SimpleSituation.class);
+    
     private QName[] _categoryType = null;
 
     private String _message = null;
     
-    private SubstitutableMessage _subMessage = null;
+    private short _priority = -1;
 
-    private String _successDisposition = null;
+    private short _severity = -1;
 
     private Date _situationTime = new Date();
 
-    private short _priority = -1;
+    private SubstitutableMessage _subMessage = null;
 
-    private short _severity = -1;
+    private String _successDisposition = null;
     
     public SimpleSituation()
     {
@@ -112,11 +119,21 @@
         _categoryType = (QName[])hierarchy.toArray(_categoryType);
     }
 
+    public final QName[] getCategoryType()
+    {
+        return _categoryType;
+    }
+
+    public final String getMessage()
+    {
+        return _message;
+    }
+
     public final short getPriority()
     {
         return _priority;
     }
-
+    
     public final short getSeverity()
     {
         return _severity;
@@ -126,7 +143,7 @@
     {
         return _situationTime;
     }
-    
+
     public final SubstitutableMessage getSubstitutableMessage()
     {
         return _subMessage;
@@ -137,10 +154,31 @@
         return _successDisposition;
     }
 
+    public final void setCategoryType(QName categoryType)
+    {
+        setCategoryType(new QName[]{ categoryType });
+    }
+    
+    public final void setCategoryType(QName[] categoryType)
+    {
+        if (categoryType == null || categoryType.length == 0)
+            throw new IllegalArgumentException(_MESSAGES.get("NoCategoryType"));
+        
+        _categoryType = categoryType;
+    }
+
+    public final void setMessage(String message)
+    {
+        _message = message;
+    }
+
     public final void setPriority(short priority)
     {
         if (priority < LOWEST_PRIORITY || priority > HIGHEST_PRIORITY)
-            throw new IllegalArgumentException("Priority out of bounds: " + priority);
+        {
+            Object[] filler = { new Short(priority), new Short(LOWEST_PRIORITY), new Short(HIGHEST_PRIORITY) };
+            throw new IllegalArgumentException(_MESSAGES.get("PriorityOutOfBounds", filler));
+        }
         
         _priority = priority;
     }
@@ -148,7 +186,10 @@
     public final void setSeverity(short severity)
     {
         if (severity < UNKNOWN_SEVERITY || severity > FATAL_SEVERITY)
-            throw new IllegalArgumentException("Severity out of bounds: " + severity);
+        {
+            Object[] filler = { new Short(severity), new Short(UNKNOWN_SEVERITY), new Short(FATAL_SEVERITY) };
+            throw new IllegalArgumentException(_MESSAGES.get("SeverityOutOfBounds", filler));
+        }
         
         _severity = severity;
     }
@@ -166,38 +207,10 @@
     public final void setSuccessDisposition(String disposition)
     {
         if (!UNSUCCESSFUL.equals(disposition) && !SUCCESSFUL.equals(disposition))
-            throw new IllegalArgumentException("Invalid disposition: " + disposition);
+            throw new IllegalArgumentException(_MESSAGES.get("InvalidDisposition", new Object[]{ disposition }));
         
         _successDisposition = disposition;
     }
-
-    public final String getMessage()
-    {
-        return _message;
-    }
-
-    public final void setMessage(String message)
-    {
-        _message = message;
-    }
-
-    public final QName[] getCategoryType()
-    {
-        return _categoryType;
-    }
-    
-    public final void setCategoryType(QName categoryType)
-    {
-        setCategoryType(new QName[]{ categoryType });
-    }
-
-    public final void setCategoryType(QName[] categoryType)
-    {
-        if (categoryType == null || categoryType.length == 0)
-            throw new RuntimeException("Invalid Situation: no category type");
-        
-        _categoryType = categoryType;
-    }
     
     public String toString()
     {
@@ -216,7 +229,7 @@
         QName[] type = getCategoryType();
 
         if (type == null || type.length == 0)
-            throw new RuntimeException("Invalid Situation: no category type");
+            throw new IllegalArgumentException(_MESSAGES.get("NoCategoryType"));
         
         Element categoryType = XmlUtils.createElement(factory, WefConstants.SITUATION_CATEGORY_QNAME);
         situation.appendChild(categoryType);



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