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/16 00:20:09 UTC
svn commit: r414696 [4/7] - in /webservices/muse/trunk/modules:
muse-wsdm-muws-adv/ muse-wsdm-muws-adv/src-api/
muse-wsdm-muws-adv/src-api/org/ muse-wsdm-muws-adv/src-api/org/apache/
muse-wsdm-muws-adv/src-api/org/apache/muse/ muse-wsdm-muws-adv/src-ap...
Added: webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Component.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Component.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Component.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Component.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/ComponentAddress.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ComponentAddress.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ComponentAddress.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ComponentAddress.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/ExtendedElements.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ExtendedElements.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ExtendedElements.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ExtendedElements.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/ManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ManagementEvent.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ManagementEvent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/ManagementEvent.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/Situation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Situation.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Situation.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/Situation.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/SubstitutableMessage.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/WefConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefConstants.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefConstants.java Thu Jun 15 15:19:57 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-api/org/apache/muse/ws/dm/muws/events/WefFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefFactory.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-api/org/apache/muse/ws/dm/muws/events/WefFactory.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/AbstractExtendedElements.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/AbstractExtendedElements.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/AbstractExtendedElements.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/AbstractExtendedElements.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,86 @@
+/*=============================================================================*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+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.ExtendedElements;
+
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AbstractExtendedElements implements ExtendedElements
+{
+ private Collection _extendedElements = new ArrayList();
+
+ public final void addExtendedElement(Element xml)
+ {
+ _extendedElements.add(xml);
+ }
+
+ public final void addExtendedElement(QName elementName, Object elementValue)
+ {
+ addExtendedElement(XmlUtils.createElement(elementName, elementValue));
+ }
+
+ public final Collection getExtendedElements()
+ {
+ return _extendedElements;
+ }
+
+ public final Collection getExtendedElements(QName elementName)
+ {
+ Collection results = new ArrayList();
+
+ Iterator i = getExtendedElements().iterator();
+
+ while (i.hasNext())
+ {
+ Element next = (Element)i.next();
+ QName nextName = XmlUtils.getElementQName(next);
+
+ if (nextName.equals(elementName))
+ results.add(next);
+ }
+
+ 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/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponent.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponent.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/SimpleComponentAddress.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponentAddress.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponentAddress.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleComponentAddress.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/SimpleManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleManagementEvent.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleManagementEvent.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleManagementEvent.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/SimpleSituation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSituation.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSituation.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSituation.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleSubstitutableMessage.java Thu Jun 15 15:19:57 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-impl/org/apache/ws/dm/muws/events/impl/SimpleWefFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleWefFactory.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleWefFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-wef/src-impl/org/apache/ws/dm/muws/events/impl/SimpleWefFactory.java Thu Jun 15 15:19:57 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);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsn/pom-api.xml
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/pom-api.xml?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/pom-api.xml (added)
+++ webservices/muse/trunk/modules/muse-wsn/pom-api.xml Thu Jun 15 15:19:57 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsn-api</artifactId>
+ <packaging>jar</packaging>
+ <version>1.9.0-SNAPSHOT</version>
+ <name>Apache Muse - WS-Notification 1.3 API</name>
+ <url>http://ws.apache.org/muse</url>
+ <dependencies>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-core</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-util-qname</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsa-soap</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsrf-api</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src-api</sourceDirectory>
+ <outputDirectory>build/classes-api</outputDirectory>
+ <directory>build/jars</directory>
+ </build>
+</project>
Added: webservices/muse/trunk/modules/muse-wsn/pom-impl.xml
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/pom-impl.xml?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/pom-impl.xml (added)
+++ webservices/muse/trunk/modules/muse-wsn/pom-impl.xml Thu Jun 15 15:19:57 2006
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsn-impl</artifactId>
+ <packaging>jar</packaging>
+ <version>1.9.0-SNAPSHOT</version>
+ <name>Apache Muse - WS-Notification 1.3 Default Implementation</name>
+ <url>http://ws.apache.org/muse</url>
+ <dependencies>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-core</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-util</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-util-qname</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-util-xml</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsa-soap</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsrf-api</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsrf-impl</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-wsn-api</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src-impl</sourceDirectory>
+ <outputDirectory>build/classes-impl</outputDirectory>
+ <directory>build/jars</directory>
+ </build>
+</project>
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Filter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Filter.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Filter.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Filter.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,24 @@
+/*=============================================================================*
+ * 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.notification;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface Filter extends XmlSerializable
+{
+ boolean accepts(NotificationMessage message);
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationConsumer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationConsumer.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationConsumer.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationConsumer.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ * 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.notification;
+
+import java.util.Collection;
+
+import org.apache.muse.core.Capability;
+
+/**
+ *
+ * NotificationConsumer is an internal implementation of the WS-Notification
+ * NotificationConsumer port type; it is based on WS-N 1.2 draft 03.
+ * <br><br>
+ * This interface adds a observer-style listener API to the port type so that
+ * consumers can respond to incoming messages without having to write the
+ * message filtering code themselves. Messages can currently be filtered by
+ * SimpleTopic. When Muse upgrades to WS-N 1.3 draft 01, it will provide a way
+ * to filter by pattern (XPath) and producer (EPR) as well.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface NotificationConsumer extends Capability
+{
+ void addMessageListener(NotificationMessageListener listener);
+
+ Collection getMessageListeners();
+
+ void notify(NotificationMessage[] messages);
+
+ void removeMessageListener(NotificationMessageListener listener);
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessage.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessage.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessage.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,83 @@
+/*=============================================================================*
+ * 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.notification;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.serializer.Serializer;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.notification.topics.WstConstants;
+
+public interface NotificationMessage extends XmlSerializable
+{
+ void addMessageContent(Element content);
+
+ /**
+ *
+ * This method allows you to add message content that has not yet been
+ * serialized into XML. The content object must be of a type that has
+ * a Muse Serializer registered for it; these types include all of
+ * the base/built-in types plus those that had serializers registered
+ * for them in touchpoint.xml.
+ *
+ * @param content
+ * @param qname
+ *
+ * @throws SoapFault
+ *
+ * @see Serializer
+ *
+ */
+ void addMessageContent(QName qname, Object content)
+ throws SoapFault;
+
+ Element getMessageContent(QName qname);
+
+ Object getMessageContent(QName qname, Class type)
+ throws SoapFault;
+
+ Collection getMessageContentNames();
+
+ EndpointReference getProducerReference();
+
+ EndpointReference getSubscriptionReference();
+
+ QName getTopic();
+
+ /**
+ *
+ * @return The concrete expression dialect
+ *
+ * @see WstConstants#CONCRETE_TOPIC_URI
+ *
+ */
+ String getTopicDialect();
+
+ void setProducerReference(EndpointReference producer);
+
+ void setSubscriptionReference(EndpointReference subscription);
+
+ void setTopic(QName topicPath);
+
+ void setTopicDialect(String dialect);
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessageListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessageListener.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessageListener.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationMessageListener.java Thu Jun 15 15:19:57 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.notification;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * NotificationMessageListener is an event listener that allows a notification consumer
+ * to filter incoming messages by topic. If a resource implements
+ * {@linkplain org.apache.muse.ws.notification.NotificationConsumer WS-N NotificationConsumer},
+ * it can register TopicConsumers that will execute code whenever a new
+ * message is received for a topic.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see org.apache.muse.ws.notification.NotificationConsumer#addMessageListener(NotificationMessageListener)
+ *
+ */
+
+public interface NotificationMessageListener
+{
+ boolean accepts(NotificationMessage message);
+
+ /**
+ *
+ * This method is invoked ('fired') by the WS-N implementation whenever
+ * a message is received that has a topic matching the listener's.
+ *
+ * @param message
+ * An incoming message whose topic matches the consumer's.
+ *
+ * @throws SoapFault
+ * <ul>
+ * <li>If the message's topic doesn't match the consumer's.</li>
+ * <li>If the data in the message was incomplete or could not
+ * be processed.</li>
+ * </ul>
+ *
+ */
+ void process(NotificationMessage message)
+ throws SoapFault;
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationProducer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationProducer.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationProducer.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/NotificationProducer.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,160 @@
+/*=============================================================================*
+ * 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.notification;
+
+import java.net.URI;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.notification.faults.*;
+import org.apache.muse.ws.notification.topics.Topic;
+import org.apache.muse.ws.notification.topics.TopicNamespace;
+import org.apache.muse.ws.notification.topics.TopicSet;
+import org.apache.muse.ws.notification.topics.WstConstants;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ *
+ * NotificationProducer is an internal implementation of the WS-Notification
+ * NotificationProducer port type; it is based on WS-N 1.2 draft 03. This
+ * interface <b>will</b> change when Muse is upgraded to WS-N 1.3, which
+ * simplifies the subscription interface significantly.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface NotificationProducer extends WsResourceCapability
+{
+ QName[] PROPERTIES = new QName[]{
+ WsnConstants.FIXED_SET_QNAME,
+ WsnConstants.TOPIC_DIALECT_QNAME,
+ WsnConstants.TOPIC_EXPRESSION_QNAME,
+ WstConstants.TOPIC_SET_QNAME
+ };
+
+ Topic addTopic(QName topicName)
+ throws BaseFault;
+
+ TopicNamespace addTopicNamespace(String namespace)
+ throws BaseFault;
+
+ boolean getFixedTopicSet()
+ throws BaseFault;
+
+ Topic getTopic(QName topicName);
+
+ QName[] getTopicExpression()
+ throws BaseFault;
+
+ URI[] getTopicExpressionDialect()
+ throws BaseFault;
+
+ TopicNamespace getTopicNamespace(String namespace);
+
+ TopicSet getTopicSet();
+
+ boolean hasTopic(QName topicName);
+
+ /**
+ *
+ * Retrieves the last message published for a given topic.
+ * <br><br>
+ * The term 'current' is only helpful if you think of the published
+ * messages being stored in a stack, with the last one on top. This
+ * is the 'current message'. In reality, implementations are not likely
+ * to store an in-memory copy of every message that is published, but
+ * it is a useful mental model for a poorly-named operation.
+ *
+ * @param topicPath
+ * The name of the SimpleTopic whose last message you wish to retrieve.
+ *
+ * @return The last message that was published on the given topic.
+ *
+ */
+ NotificationMessage getCurrentMessage(QName topicPath)
+ throws TopicExpressionDialectUnknownFault,
+ InvalidTopicExpressionFault,
+ TopicNotSupportedFault,
+ MultipleTopicsSpecifiedFault,
+ NoCurrentMessageOnTopicFault;
+
+ void publish(NotificationMessage message)
+ throws SoapFault;
+
+ /**
+ *
+ * Registers a consumer resource to receive events that are published
+ * to a certain topic (along with other filtering rules). Registration
+ * results in the creation of a Subscription resource, which exposes
+ * the WS-N SubscriptionManager port type and can be managed as a regular
+ * WS-RF resource. Once subscription is complete, the event consumer
+ * will receive notifications on the topic until the subscription is
+ * terminated (via WS-RL) or the producer shuts down.
+ *
+ * @param consumer
+ * The EPR of the resource that will receive the notifications
+ * from the producing resource. This does <b>not</b> have to
+ * be the same component that is making the subscribe() request.
+ * An orchestrating service may be subscribing for the consumer.
+ *
+ * @param filter
+ * Optional filter that allows for messages to be published if
+ * they meet a certain criteria. Filter types include topic names,
+ * message patterns (XPath), and current state (WSRP doc).
+ *
+ * @param policy
+ * Optional filter that allows for more complex analysis that
+ * precondition or selector queries. The implementation must
+ * provide one or more policy languages/dialects that clients
+ * can use to express how and when a message that is published
+ * to a topic should be sent. If this parameter is null, no
+ * policy is applied.
+ *
+ * @param terminationTime
+ * Optional setting for the Subscription resource that is created
+ * to represent the consumer's subscription. Because Subscriptions
+ * are WS-resources, they may be terminated with scheduled
+ * termination (WS-RL SetTerminationTime). If this parameter is
+ * null, no termination time is set.
+ *
+ * @return The new Subscription resource.
+ *
+ * @see org.apache.muse.ws.notification.remote.SubscriptionClient
+ *
+ */
+ WsResource subscribe(EndpointReference consumer,
+ Filter filter,
+ Date terminationTime,
+ Policy policy)
+ throws InvalidFilterFault,
+ TopicExpressionDialectUnknownFault,
+ InvalidTopicExpressionFault,
+ TopicNotSupportedFault,
+ InvalidProducerPropertiesExpressionFault,
+ InvalidMessageContentExpressionFault,
+ UnacceptableInitialTerminationTimeFault,
+ UnrecognizedPolicyRequestFault,
+ UnsupportedPolicyRequestFault,
+ NotifyMessageNotSupportedFault,
+ SubscribeCreationFailedFault;
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Policy.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Policy.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Policy.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/Policy.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,26 @@
+/*=============================================================================*
+ * 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.notification;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface Policy extends XmlSerializable
+{
+ //
+ // no additional interfaces - this is a "raw" data type
+ //
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPoint.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPoint.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPoint.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPoint.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,35 @@
+/*=============================================================================*
+ * 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.notification;
+
+import org.apache.muse.ws.notification.faults.UnableToGetMessagesFault;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+public interface PullPoint extends WsResourceCapability, NotificationMessageListener
+{
+ PullPointDataStore getDataStore();
+
+ Filter getFilter();
+
+ NotificationMessage[] getMessages(int maxNumber)
+ throws UnableToGetMessagesFault;
+
+ WsResource getSubscription();
+
+ void setSubscription(WsResource sub);
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointCreation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointCreation.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointCreation.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointCreation.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,27 @@
+/*=============================================================================*
+ * 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.notification;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.notification.faults.UnableToCreatePullPointFault;
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+public interface PullPointCreation extends WsResourceCapability
+{
+ EndpointReference createPullPoint()
+ throws UnableToCreatePullPointFault;
+}
Added: webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointDataStore.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointDataStore.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointDataStore.java (added)
+++ webservices/muse/trunk/modules/muse-wsn/src-api/org/apache/muse/ws/notification/PullPointDataStore.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,31 @@
+/*=============================================================================*
+ * 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.notification;
+
+import org.apache.muse.core.Initialization;
+import org.apache.muse.core.Shutdown;
+import org.apache.muse.ws.notification.faults.UnableToGetMessagesFault;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public interface PullPointDataStore extends Initialization, Shutdown
+{
+ void addMessage(NotificationMessage message)
+ throws BaseFault;
+
+ NotificationMessage[] getMessages(int maxNumber)
+ throws UnableToGetMessagesFault;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org