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/06/12 18:08:26 UTC
svn commit: r413696 - in
/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events:
./ impl/
Author: danj
Date: Mon Jun 12 09:08:25 2006
New Revision: 413696
URL: http://svn.apache.org/viewvc?rev=413696&view=rev
Log:
Initial check-in of IBM-donated code for Muse 2.0 - with
support for Axis2 (re-try after failure due to problem
with email to muse-commits).
Currently, the modules that are not implementations of the
WS-* specs - core, utils, WS-A/SOAP, etc. - have working
Maven 2.0 build files. Right now they simply compile and
write to the user's local $module/build directory. I have
not determined how to get Maven to skip this intermediary
copy and just put the jars in the user's local repository.
I currently use a script to build each module's POM file,
but as I learn more about Maven I will hopefully find a way
to aggregate POM files into one larger project. If not, I
will provide a simple Ant script.
I'm not sure where the design doc should go, and don't
want to mess with the web site yet, so please look at the
design-doc.zip that was uploaded to JIRA along with the
other IBM contributions until I determine the proper place.
Added:
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Component.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ComponentAddress.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ManagementEvent.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Situation.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefConstants.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefFactory.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java
webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleWefFactory.java
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Component.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Component.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Component.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Component.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface Component extends XmlSerializable, ExtendedElements
+{
+ ComponentAddress getAddress();
+
+ QName getName();
+
+ URI getResourceID();
+
+ void setAddress(ComponentAddress address);
+
+ void setName(QName name);
+
+ void setResourceID(URI resourceID);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ComponentAddress.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ComponentAddress.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ComponentAddress.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ComponentAddress.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,32 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface ComponentAddress extends XmlSerializable, ExtendedElements
+{
+ //
+ // no additional type info - this is an xsd:any
+ //
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ExtendedElements.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,60 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+/**
+ *
+ * This is a utility interface for WEF components that can be extended
+ * with arbitrary elements (their schema definitions include an xsd:any).
+ * The elements added using this interface's methods will be serialized
+ * under the root element of the concrete class' XML representation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface ExtendedElements
+{
+ void addExtendedElement(QName elementName, Object elementValue);
+
+ 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.
+ *
+ */
+ Collection getExtendedElements(QName elementName);
+
+ /**
+ *
+ * @return All Elements added using the addExtendedElement() method(s).
+ *
+ */
+ Collection getExtendedElements();
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ManagementEvent.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ManagementEvent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/ManagementEvent.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,69 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import java.net.URI;
+import java.util.Date;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * ManagementEvent defines the even type of the WSDM Event Format (WEF).
+ * It is composed of accessor methods for its fields and serialization
+ * methods for convertion to and from XML. Event objects should be
+ * created with a {@WefFactory WefFactory}.
+ * <br><br>
+ * <code>
+ * WefFactory factory = new SimpleWefFactory();<br>
+ * ManagementEvent event = factory.createEvent();<br>
+ * event.setSequenceNumber(1234);
+ * <br>// etc.<br>
+ * <br>
+ * </code>
+ * The factory will also have methods for instantiating the event from XML.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface ManagementEvent extends XmlSerializable, ExtendedElements
+{
+ URI getEventID();
+
+ Component getReporter();
+
+ Date getReportTime();
+
+ long getSequenceNumber();
+
+ Situation getSituation();
+
+ Component getSource();
+
+ void setEventID(URI eventID);
+
+ void setReporter(Component reporter);
+
+ void setReportTime(Date reportTime);
+
+ void setSequenceNumber(long sequenceNumber);
+
+ void setSituation(Situation situation);
+
+ void setSource(Component source);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Situation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Situation.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Situation.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/Situation.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,98 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * Situation defines the constants and fields for the WSDM Event
+ * Format's (WEF) situation data type. This type is embedded in
+ * a {@linkplain ManagementEvent ManagementEvent} when reporting
+ * events to subscribers. It is composed of accessor methods for
+ * its fields and serialization methods to convertion to and from XML.
+ * The constants define the valid values for the fields as defined
+ * by WSDM.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface Situation extends XmlSerializable
+{
+ String SUCCESSFUL = "Successful";
+
+ String UNSUCCESSFUL = "Unsuccessful";
+
+ 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;
+
+ short HIGHEST_PRIORITY = 100;
+
+ QName[] getCategoryType();
+
+ String getMessage();
+
+ short getPriority();
+
+ short getSeverity();
+
+ Date getSituationTime();
+
+ SubstitutableMessage getSubstitutableMessage();
+
+ String getSuccessDisposition();
+
+ void setCategoryType(QName categoryType);
+
+ void setCategoryType(QName[] categoryType);
+
+ void setMessage(String message);
+
+ void setPriority(short priority);
+
+ void setSeverity(short severity);
+
+ void setSituationTime(Date situationTime);
+
+ void setSubstitutableMessage(SubstitutableMessage message);
+
+ void setSuccessDisposition(String disposition);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,40 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface SubstitutableMessage extends XmlSerializable
+{
+ String getMessageId();
+
+ String getMessageIdType();
+
+ String[] getValues();
+
+ void setMessageId(String id);
+
+ void setMessageIdType(String idType);
+
+ void setValues(String[] values);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefConstants.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefConstants.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,133 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * This class defines the names and static values defined for the WSDM
+ * Event Format, version 1.1.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+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 MGMT_EVENT_QNAME =
+ new QName(MUWS_P1_URI, "ManagementEvent", MUWS_P1_PREFIX);
+
+ public static final String REPORT_TIME = "ReportTime";
+
+ public static final String SEQUENCE_NUMBER = "sequenceNumber";
+
+ 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 COMP_ADDRESS_QNAME =
+ new QName(MUWS_P1_URI, "ComponentAddress", MUWS_P1_PREFIX);
+
+ public static final QName SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "Situation", MUWS_P2_PREFIX);
+
+ public static final QName SITUATION_CATEGORY_QNAME =
+ new QName(MUWS_P2_URI, "SituationCategory", MUWS_P2_PREFIX);
+
+ public static final QName SUCCESS_DISPOSITION_QNAME =
+ new QName(MUWS_P2_URI, "SuccessDisposition", MUWS_P2_PREFIX);
+
+ public static final String SUCCESSFUL = "Successful";
+ public static final String UNSUCCESSFUL = "Unsuccessful";
+
+ public static final QName SITUATION_TIME_QNAME =
+ new QName(MUWS_P2_URI, "SituationTime", MUWS_P2_PREFIX);
+
+ public static final QName SEVERITY_QNAME =
+ new QName(MUWS_P2_URI, "Severity", MUWS_P2_PREFIX);
+
+ public static final QName PRIORITY_QNAME =
+ new QName(MUWS_P2_URI, "Priority", MUWS_P2_PREFIX);
+
+ public static final QName MESSAGE_QNAME =
+ new QName(MUWS_P2_URI, "Message", MUWS_P2_PREFIX);
+
+ public static final QName SUBSTITUTABLE_MSG_QNAME =
+ new QName(MUWS_P2_URI, "SubstitutableMsg", MUWS_P2_PREFIX);
+
+ public static final String MSG_ID = "MsgId";
+
+ public static final String MSG_ID_TYPE = "MsgIdType";
+
+ public static final QName VALUE_QNAME =
+ new QName(MUWS_P2_URI, "Value", MUWS_P2_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 CONFIGURE_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "ConfigureSituation", MUWS_P2_PREFIX);
+
+ public static final QName START_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "StartSituation", MUWS_P2_PREFIX);
+
+ 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 REPORT_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "ReportSituation", MUWS_P2_PREFIX);
+
+ public static final QName CONNECT_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "ConnectSituation", MUWS_P2_PREFIX);
+
+ public static final QName DEPENDENCY_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "DependencySituation", MUWS_P2_PREFIX);
+
+ public static final QName OTHER_SITUATION_QNAME =
+ new QName(MUWS_P2_URI, "OtherSituation", MUWS_P2_PREFIX);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefFactory.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/WefFactory.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,57 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+/**
+ *
+ * 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.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface WefFactory
+{
+ Component createComponent();
+
+ Component createComponent(Element componentXML);
+
+ ComponentAddress createComponentAddress();
+
+ ComponentAddress createComponentAddress(Element addressXML);
+
+ ComponentAddress createComponentAddress(XmlSerializable addressData);
+
+ ManagementEvent createEvent();
+
+ ManagementEvent createEvent(Element eventXML);
+
+ SubstitutableMessage createSubstitutableMessage();
+
+ SubstitutableMessage createSubstitutableMessage(Element messageXML);
+
+ Situation createSituation();
+
+ Situation createSituation(Element situationXML);
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,129 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+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;
+import org.apache.muse.ws.dm.muws.events.WefConstants;
+import org.apache.muse.ws.dm.muws.events.WefFactory;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleComponent
+ extends AbstractExtendedElements implements Component
+{
+ private ComponentAddress _address = null;
+
+ private QName _name = null;
+
+ private URI _resourceID = null;
+
+ public SimpleComponent()
+ {
+ //
+ // no default action - allow people to create "blank"
+ // components and validate in toXML()
+ //
+ }
+
+ public SimpleComponent(Element xml, WefFactory factory)
+ {
+ _name = XmlUtils.getElementQName(xml);
+
+ Element addressXML = XmlUtils.getElement(xml, WefConstants.COMP_ADDRESS_QNAME);
+ _address = factory.createComponentAddress(addressXML);
+ }
+
+ public ComponentAddress getAddress()
+ {
+ return _address;
+ }
+
+ public QName getName()
+ {
+ return _name;
+ }
+
+ public URI getResourceID()
+ {
+ return _resourceID;
+ }
+
+ public void setAddress(ComponentAddress address)
+ {
+ _address = address;
+ }
+
+ public void setName(QName name)
+ {
+ _name = name;
+ }
+
+ public void setResourceID(URI resourceID)
+ {
+ _resourceID = resourceID;
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+ QName name = getName();
+
+ if (name == null)
+ throw new RuntimeException("Invalid component type: no root name.");
+
+ Element componentXML = XmlUtils.createElement(factory, name);
+
+ ComponentAddress address = getAddress();
+
+ if (address != null)
+ {
+ Element addressXML = address.toXML(factory);
+ componentXML.appendChild(addressXML);
+ }
+
+ URI resourceID = getResourceID();
+
+ if (resourceID != null)
+ XmlUtils.setElement(componentXML, WefConstants.RESOURCE_ID_QNAME, resourceID);
+
+ appendExtendedElements(componentXML);
+
+ return componentXML;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,66 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.dm.muws.events.ComponentAddress;
+import org.apache.muse.ws.dm.muws.events.WefConstants;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleComponentAddress
+ extends AbstractExtendedElements implements ComponentAddress
+{
+ private Element _contents = null;
+
+ public SimpleComponentAddress()
+ {
+ this(null);
+ }
+
+ public SimpleComponentAddress(Element contents)
+ {
+ _contents = contents;
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+ Element addressXML = XmlUtils.createElement(factory, WefConstants.COMP_ADDRESS_QNAME);
+
+ if (_contents != null)
+ {
+ Element copy = (Element)factory.importNode(_contents, true);
+ addressXML.appendChild(copy);
+ }
+
+ appendExtendedElements(addressXML);
+
+ return addressXML;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,253 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import java.net.URI;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.uuid.RandomUuidFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.util.xml.XsdUtils;
+import org.apache.muse.ws.dm.muws.events.Component;
+import org.apache.muse.ws.dm.muws.events.ManagementEvent;
+import org.apache.muse.ws.dm.muws.events.Situation;
+import org.apache.muse.ws.dm.muws.events.WefFactory;
+import org.apache.muse.ws.dm.muws.events.WefConstants;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleManagementEvent
+ extends AbstractExtendedElements implements ManagementEvent
+{
+ private URI _eventID = RandomUuidFactory.getInstance().createUUID();
+
+ private Component _reporter = null;
+
+ private Date _reportTime = new Date();
+
+ private long _sequenceNumber = -1;
+
+ private Component _source = null;
+
+ private Situation _situation = null;
+
+ public SimpleManagementEvent()
+ {
+ //
+ // no action - allow people to construct WEFs starting with
+ // a blank event. toXML() will validate before serializing
+ //
+ }
+
+ public SimpleManagementEvent(Element xml, WefFactory factory)
+ {
+ //
+ // NOTE: we can call public get/set methods in the constructor
+ // because these methods are final
+ //
+
+ String sequenceString = xml.getAttributeNS(WefConstants.MUWS_P2_URI, WefConstants.SEQUENCE_NUMBER);
+
+ if (sequenceString != null && sequenceString.length() > 0)
+ _sequenceNumber = Long.parseLong(sequenceString);
+
+ String timeString = xml.getAttribute(WefConstants.REPORT_TIME);
+
+ try
+ {
+ if (timeString != null && timeString.length() > 0)
+ setReportTime(XsdUtils.getLocalTime(timeString));
+ }
+
+ catch (ParseException error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+
+ //
+ // keep track of all elements in the MUWS namespaces - the
+ // ones leftover are the "extended elements"
+ //
+ Set alreadySeen = new HashSet();
+
+ Element idXML = XmlUtils.getElement(xml, WefConstants.EVENT_ID_QNAME);
+
+ if (idXML != null)
+ {
+ setEventID(URI.create(XmlUtils.extractText(idXML)));
+ alreadySeen.add(idXML);
+ }
+
+ Element reporterXML = XmlUtils.getElement(xml, WefConstants.REPORTER_COMP_QNAME);
+ Component reporter = factory.createComponent(reporterXML);
+ setReporter(reporter);
+ alreadySeen.add(reporterXML);
+
+ Element sourceXML = XmlUtils.getElement(xml, WefConstants.SOURCE_COMP_QNAME);
+ Component source = factory.createComponent(sourceXML);
+ setSource(source);
+ alreadySeen.add(sourceXML);
+
+ Element situationXML = XmlUtils.getElement(xml, WefConstants.SITUATION_QNAME);
+
+ if (situationXML != null)
+ {
+ Situation situation = factory.createSituation(situationXML);
+ setSituation(situation);
+ alreadySeen.add(situationXML);
+ }
+
+ Element[] children = XmlUtils.getAllElements(xml);
+
+ for (int n = 0; n < children.length; ++n)
+ if (!alreadySeen.contains(children[n]))
+ addExtendedElement(children[n]);
+ }
+
+ public final URI getEventID()
+ {
+ return _eventID;
+ }
+
+ public final Component getReporter()
+ {
+ return _reporter;
+ }
+
+ public final Date getReportTime()
+ {
+ return _reportTime;
+ }
+
+ public final long getSequenceNumber()
+ {
+ return _sequenceNumber;
+ }
+
+ public final Situation getSituation()
+ {
+ return _situation;
+ }
+
+ public final Component getSource()
+ {
+ return _source;
+ }
+
+ public final void setEventID(URI eventID)
+ {
+ _eventID = eventID;
+ }
+
+ public final void setReporter(Component reporter)
+ {
+ _reporter = reporter;
+ }
+
+ public final void setReportTime(Date reportTime)
+ {
+ _reportTime = reportTime;
+ }
+
+ public final void setSequenceNumber(long sequenceNumber)
+ {
+ _sequenceNumber = sequenceNumber;
+ }
+
+ public final void setSituation(Situation situation)
+ {
+ _situation = situation;
+ }
+
+ public final void setSource(Component source)
+ {
+ _source = source;
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+ Element wef = XmlUtils.createElement(doc, WefConstants.MGMT_EVENT_QNAME);
+
+ long sequence = getSequenceNumber();
+
+ if (sequence >= 0)
+ {
+ String name = WefConstants.MUWS_P2_PREFIX + ':' + WefConstants.SEQUENCE_NUMBER;
+ wef.setAttributeNS(WefConstants.MUWS_P2_URI, name, Long.toString(sequence));
+ }
+
+ Date time = getReportTime();
+
+ if (time != null)
+ wef.setAttribute(WefConstants.REPORT_TIME, XsdUtils.getLocalTimeString(time));
+
+ URI eventID = getEventID();
+
+ if (eventID == null)
+ throw new RuntimeException("Invalid WEF: no EventID");
+
+ XmlUtils.setElement(wef, WefConstants.EVENT_ID_QNAME, eventID);
+
+ Component source = getSource();
+
+ if (source == null)
+ throw new RuntimeException("Invalid WEF: no source component.");
+
+ Element sourceXML = source.toXML(doc);
+ wef.appendChild(sourceXML);
+
+ Component reporter = getReporter();
+
+ if (reporter!= null)
+ {
+ Element reporterXML = reporter.toXML(doc);
+ wef.appendChild(reporterXML);
+ }
+
+ Situation situation = getSituation();
+
+ if (situation != null)
+ {
+ Element situationXML = situation.toXML(doc);
+ wef.appendChild(situationXML);
+ }
+
+ appendExtendedElements(wef);
+
+ return wef;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,265 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+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;
+import org.apache.muse.ws.dm.muws.events.WefConstants;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleSituation implements Situation
+{
+ private QName[] _categoryType = null;
+
+ private String _message = null;
+
+ private SubstitutableMessage _subMessage = null;
+
+ private String _successDisposition = null;
+
+ private Date _situationTime = new Date();
+
+ private short _priority = -1;
+
+ private short _severity = -1;
+
+ public SimpleSituation()
+ {
+ //
+ // no action - allow users to create situations from scratch
+ //
+ }
+
+ public SimpleSituation(Element xml)
+ {
+ //
+ // NOTE: we can use public get/set methods in the constructor
+ // because they are final
+ //
+ setMessage(XmlUtils.getElementText(xml, WefConstants.MESSAGE_QNAME));
+
+ String disposition = XmlUtils.getElementText(xml, WefConstants.SUCCESS_DISPOSITION_QNAME);
+
+ if (disposition != null)
+ setSuccessDisposition(disposition);
+
+ Element priorityXML = XmlUtils.getElement(xml, WefConstants.PRIORITY_QNAME);
+
+ if (priorityXML != null)
+ _priority = XmlUtils.getShort(priorityXML).shortValue();
+
+ Element severityXML = XmlUtils.getElement(xml, WefConstants.SEVERITY_QNAME);
+
+ if (severityXML != null)
+ _severity = XmlUtils.getShort(severityXML).shortValue();
+
+ Element timeXML = XmlUtils.getElement(xml, WefConstants.SITUATION_TIME_QNAME);
+
+ try
+ {
+ if (timeXML != null)
+ _situationTime = XmlUtils.getDate(timeXML);
+ }
+
+ catch (ParseException error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+
+ Element categoryXML = XmlUtils.getElement(xml, WefConstants.SITUATION_CATEGORY_QNAME);
+ Element categoryTypeXML = XmlUtils.getFirstElement(categoryXML);
+
+ List hierarchy = new LinkedList();
+
+ while (categoryTypeXML != null)
+ {
+ QName categoryName = XmlUtils.getElementQName(categoryTypeXML);
+ hierarchy.add(categoryName);
+ categoryTypeXML = XmlUtils.getElement(categoryTypeXML, WefConstants.SITUATION_CATEGORY_QNAME);
+ }
+
+ _categoryType = new QName[hierarchy.size()];
+ _categoryType = (QName[])hierarchy.toArray(_categoryType);
+ }
+
+ public final short getPriority()
+ {
+ return _priority;
+ }
+
+ public final short getSeverity()
+ {
+ return _severity;
+ }
+
+ public final Date getSituationTime()
+ {
+ return _situationTime;
+ }
+
+ public final SubstitutableMessage getSubstitutableMessage()
+ {
+ return _subMessage;
+ }
+
+ public final String getSuccessDisposition()
+ {
+ return _successDisposition;
+ }
+
+ public final void setPriority(short priority)
+ {
+ if (priority < LOWEST_PRIORITY || priority > HIGHEST_PRIORITY)
+ throw new IllegalArgumentException("Priority out of bounds: " + priority);
+
+ _priority = priority;
+ }
+
+ public final void setSeverity(short severity)
+ {
+ if (severity < UNKNOWN_SEVERITY || severity > FATAL_SEVERITY)
+ throw new IllegalArgumentException("Severity out of bounds: " + severity);
+
+ _severity = severity;
+ }
+
+ public final void setSituationTime(Date situationTime)
+ {
+ _situationTime = situationTime;
+ }
+
+ public final void setSubstitutableMessage(SubstitutableMessage message)
+ {
+ _subMessage = message;
+ }
+
+ public final void setSuccessDisposition(String disposition)
+ {
+ if (!UNSUCCESSFUL.equals(disposition) && !SUCCESSFUL.equals(disposition))
+ throw new IllegalArgumentException("Invalid disposition: " + 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()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+ Element situation = XmlUtils.createElement(factory, WefConstants.SITUATION_QNAME);
+
+ QName[] type = getCategoryType();
+
+ if (type == null || type.length == 0)
+ throw new RuntimeException("Invalid Situation: no category type");
+
+ Element categoryType = XmlUtils.createElement(factory, WefConstants.SITUATION_CATEGORY_QNAME);
+ situation.appendChild(categoryType);
+
+ Element parent = categoryType;
+
+ for (int n = 0; n < type.length; ++n)
+ {
+ Element nextPart = XmlUtils.createElement(factory, type[n]);
+ parent.appendChild(nextPart);
+ parent = nextPart;
+ }
+
+ String disposition = getSuccessDisposition();
+
+ if (disposition != null)
+ XmlUtils.setElement(situation, WefConstants.SUCCESS_DISPOSITION_QNAME, disposition);
+
+ Date time = getSituationTime();
+
+ if (time != null)
+ XmlUtils.setElement(situation, WefConstants.SITUATION_TIME_QNAME, time);
+
+ short priority = getPriority();
+
+ if (priority >= 0)
+ XmlUtils.setElement(situation, WefConstants.PRIORITY_QNAME, new Short(priority));
+
+ short severity = getSeverity();
+
+ if (severity >= 0)
+ XmlUtils.setElement(situation, WefConstants.SEVERITY_QNAME, new Short(severity));
+
+ String message = getMessage();
+
+ if (message != null)
+ XmlUtils.setElement(situation, WefConstants.MESSAGE_QNAME, message);
+
+ SubstitutableMessage subMessage = getSubstitutableMessage();
+
+ if (subMessage != null)
+ XmlUtils.setElement(situation, WefConstants.SUBSTITUTABLE_MSG_QNAME, subMessage);
+
+ return situation;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,111 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.dm.muws.events.SubstitutableMessage;
+import org.apache.muse.ws.dm.muws.events.WefConstants;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleSubstitutableMessage implements SubstitutableMessage
+{
+ private static final String[] _EMPTY_VALUES = new String[0];
+
+ private String _msgId = null;
+
+ private String _msgIdType = null;
+
+ private String[] _values = _EMPTY_VALUES;
+
+ public SimpleSubstitutableMessage()
+ {
+ //
+ // no action - allow users to create situations from scratch
+ //
+ }
+
+ public SimpleSubstitutableMessage(Element messageXML)
+ {
+ _msgId = messageXML.getAttribute(WefConstants.MSG_ID);
+ _msgIdType = messageXML.getAttribute(WefConstants.MSG_ID_TYPE);
+ _values = XmlUtils.getElementsText(messageXML, WefConstants.VALUE_QNAME);
+ }
+
+ public String getMessageId()
+ {
+ return _msgId;
+ }
+
+ public String getMessageIdType()
+ {
+ return _msgIdType;
+ }
+
+ public String[] getValues()
+ {
+ return _values;
+ }
+
+ public void setMessageId(String id)
+ {
+ _msgId = id;
+ }
+
+ public void setMessageIdType(String idType)
+ {
+ _msgIdType = idType;
+ }
+
+ public void setValues(String[] values)
+ {
+ if (values == null)
+ values = _EMPTY_VALUES;
+
+ _values = values;
+ }
+
+ public Element toXML()
+ {
+ return null;
+ }
+
+ public Element toXML(Document doc)
+ {
+ Element root = XmlUtils.createElement(doc, WefConstants.SUBSTITUTABLE_MSG_QNAME);
+
+ root.setAttribute(WefConstants.MSG_ID, getMessageId());
+ root.setAttribute(WefConstants.MSG_ID_TYPE, getMessageIdType());
+
+ String[] values = getValues();
+
+ for (int n = 0; n < values.length; ++n)
+ {
+ Element next = XmlUtils.createElement(doc, WefConstants.VALUE_QNAME, values[n]);
+ root.appendChild(next);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleWefFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleWefFactory.java?rev=413696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleWefFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src/org/apache/muse/ws/dm/muws/events/impl/SimpleWefFactory.java Mon Jun 12 09:08:25 2006
@@ -0,0 +1,94 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.events.impl;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.dm.muws.events.Component;
+import org.apache.muse.ws.dm.muws.events.ComponentAddress;
+import org.apache.muse.ws.dm.muws.events.ManagementEvent;
+import org.apache.muse.ws.dm.muws.events.Situation;
+import org.apache.muse.ws.dm.muws.events.SubstitutableMessage;
+import org.apache.muse.ws.dm.muws.events.WefFactory;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * SimpleWefFactory is the default implementation of the WefFactory component.
+ * The objects it creates are all instantiated from classes defined in this
+ * same package (org.apache.muse.ws.dm.muws.events.impl).
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleWefFactory implements WefFactory
+{
+ public Component createComponent()
+ {
+ return new SimpleComponent();
+ }
+
+ public Component createComponent(Element componentXML)
+ {
+ return new SimpleComponent(componentXML, this);
+ }
+
+ public ComponentAddress createComponentAddress()
+ {
+ return new SimpleComponentAddress();
+ }
+
+ public ComponentAddress createComponentAddress(Element addressXML)
+ {
+ return new SimpleComponentAddress(addressXML);
+ }
+
+ public ComponentAddress createComponentAddress(XmlSerializable addressData)
+ {
+ return new SimpleComponentAddress(addressData.toXML());
+ }
+
+ public ManagementEvent createEvent()
+ {
+ return new SimpleManagementEvent();
+ }
+
+ public ManagementEvent createEvent(Element eventXML)
+ {
+ return new SimpleManagementEvent(eventXML, this);
+ }
+
+ public Situation createSituation()
+ {
+ return new SimpleSituation();
+ }
+
+ public Situation createSituation(Element situationXML)
+ {
+ return new SimpleSituation(situationXML);
+ }
+
+ public SubstitutableMessage createSubstitutableMessage()
+ {
+ return new SimpleSubstitutableMessage();
+ }
+
+ public SubstitutableMessage createSubstitutableMessage(Element messageXML)
+ {
+ return new SimpleSubstitutableMessage(messageXML);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org