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 2007/03/24 14:24:36 UTC
svn commit: r522026 [6/10] - in /webservices/muse/trunk/modules:
osgi-bundles/muse-complete/src/org/apache/muse/complete/
osgi-bundles/muse-util-all/src/org/apache/muse/util/osgi/
osgi-bundles/muse-wsa-soap/src/org/apache/muse/ws/addressing/osgi/ osgi-...
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleMetadataSection.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleMetadataSection.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleMetadataSection.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleMetadataSection.java Sat Mar 24 06:24:32 2007
@@ -1,101 +1,104 @@
-/*=============================================================================*
- * 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.resource.transfer.create.impl;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.create.InvalidMetadataFault;
-import org.apache.muse.ws.resource.transfer.create.MetadataSection;
-import org.apache.muse.ws.resource.transfer.create.WSRTMetadata;
-
-/**
- * This object represents a metadata section in WS-RT create requests. WSRT
- * metadata sections have a collection of WSRTMetadata objects.
- *
- * @author Mohammad Fakhar
- * @see org.apache.muse.ws.resource.transfer.create.WSRTMetadata
- * @see org.apache.muse.ws.resource.transfer.create.impl.SimpleLifetimeMetadata
- * @see org.apache.muse.ws.resource.transfer.create.impl.SimpleMetadataFactory
- * @see org.apache.muse.ws.resource.transfer.create.DialectMetadata
- *
- */
-
-public class SimpleMetadataSection implements MetadataSection
-{
- //
- // Used to lookup all exception messages
- //
- private Messages _MESSAGES = MessagesFactory.get(SimpleLifetimeMetadata.class);
-
- private WSRTMetadata[] _wsrtMetadata = null;
-
- public SimpleMetadataSection()
- {
- //
- // no initialization tasks required
- //
- }
-
- public SimpleMetadataSection(Element xml) throws InvalidMetadataFault
- {
- String dialect = xml.getAttribute(WsrtConstants.DIALECT_ATTR_NAME);
-
- if (!dialect.equals(WsrtConstants.WSRT_NAMESPACE_URI))
- throw new InvalidMetadataFault(_MESSAGES.get("OnlyWSRTMDSupp"));
-
- Element[] wsrtMetadataXML = XmlUtils.getElements(xml, WsrtConstants.WSRT_METADATA_QNAME);
-
- _wsrtMetadata = new WSRTMetadata[wsrtMetadataXML.length];
-
- for (int i = 0; i < wsrtMetadataXML.length; i++)
- _wsrtMetadata[i] = new SimpleWSRTMetadata(wsrtMetadataXML[i]);
- }
-
- public WSRTMetadata[] getWsrtMetadata()
- {
- return _wsrtMetadata;
- }
-
- public void setWsrtMetadata(WSRTMetadata[] wsrtMetadata)
- {
- _wsrtMetadata = wsrtMetadata;
- }
-
- public Element toXML()
- {
- return toXML(XmlUtils.EMPTY_DOC);
- }
-
- public Element toXML(Document factory)
- {
-
- Element mdSection = XmlUtils.createElement(factory, WsrtConstants.METADATA_SECTION_QNAME);
- mdSection.setAttribute(WsrtConstants.DIALECT_ATTR_NAME, WsrtConstants.WSRT_NAMESPACE_URI);
-
- for (int i = 0; i < _wsrtMetadata.length; i++)
- mdSection.appendChild(_wsrtMetadata[i].toXML(factory));
-
- return mdSection;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.create.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.create.InvalidMetadataFault;
+import org.apache.muse.ws.resource.transfer.create.MetadataSection;
+import org.apache.muse.ws.resource.transfer.create.WSRTMetadata;
+
+/**
+ * This object represents a metadata section in WS-RT create requests. WSRT
+ * metadata sections have a collection of WSRTMetadata objects.
+ *
+ * @author Mohammad Fakhar
+ * @see org.apache.muse.ws.resource.transfer.create.WSRTMetadata
+ * @see org.apache.muse.ws.resource.transfer.create.impl.SimpleLifetimeMetadata
+ * @see org.apache.muse.ws.resource.transfer.create.impl.SimpleMetadataFactory
+ * @see org.apache.muse.ws.resource.transfer.create.DialectMetadata
+ *
+ */
+
+public class SimpleMetadataSection implements MetadataSection
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private Messages _MESSAGES = MessagesFactory.get(SimpleLifetimeMetadata.class);
+
+ private WSRTMetadata[] _wsrtMetadata = null;
+
+ public SimpleMetadataSection()
+ {
+ //
+ // no initialization tasks required
+ //
+ }
+
+ public SimpleMetadataSection(Element xml) throws InvalidMetadataFault
+ {
+ String dialect = xml.getAttribute(WsrtConstants.DIALECT_ATTR_NAME);
+
+ if (!dialect.equals(WsrtConstants.WSRT_NAMESPACE_URI))
+ throw new InvalidMetadataFault(_MESSAGES.get("OnlyWSRTMDSupp"));
+
+ Element[] wsrtMetadataXML = XmlUtils.getElements(xml, WsrtConstants.WSRT_METADATA_QNAME);
+
+ _wsrtMetadata = new WSRTMetadata[wsrtMetadataXML.length];
+
+ for (int i = 0; i < wsrtMetadataXML.length; i++)
+ _wsrtMetadata[i] = new SimpleWSRTMetadata(wsrtMetadataXML[i]);
+ }
+
+ public WSRTMetadata[] getWsrtMetadata()
+ {
+ return _wsrtMetadata;
+ }
+
+ public void setWsrtMetadata(WSRTMetadata[] wsrtMetadata)
+ {
+ _wsrtMetadata = wsrtMetadata;
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+
+ Element mdSection = XmlUtils.createElement(factory, WsrtConstants.METADATA_SECTION_QNAME);
+ mdSection.setAttribute(WsrtConstants.DIALECT_ATTR_NAME, WsrtConstants.WSRT_NAMESPACE_URI);
+
+ for (int i = 0; i < _wsrtMetadata.length; i++)
+ mdSection.appendChild(_wsrtMetadata[i].toXML(factory));
+
+ return mdSection;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleWSRTMetadata.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleWSRTMetadata.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleWSRTMetadata.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/create/impl/SimpleWSRTMetadata.java Sat Mar 24 06:24:32 2007
@@ -1,106 +1,109 @@
-/*=============================================================================*
- * 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.resource.transfer.create.impl;
-
-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.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.create.DialectMetadata;
-import org.apache.muse.ws.resource.transfer.create.LifetimeMetadata;
-import org.apache.muse.ws.resource.transfer.create.WSRTMetadata;
-
-/**
- * This is Muse's default implementation of WSRTMetadata. It holds the lifetime
- * and dialect metadata objects
- *
- * @author Mohammad Fakhar
- */
-
-public class SimpleWSRTMetadata implements WSRTMetadata
-{
-
- private LifetimeMetadata _ltMetadata;
-
- private DialectMetadata[] _dialectMD;
-
- public SimpleWSRTMetadata()
- {
- //
- // no initialization tasks required
- //
- }
-
- public SimpleWSRTMetadata(Element xml)
- {
- Element[] metadataXML = XmlUtils.getAllElements(xml);
-
- for (int i = 0; i < metadataXML.length; i++)
- {
- Element md = metadataXML[i];
- QName mdQname = new QName(md.getNamespaceURI(), md.getLocalName(), md.getPrefix());
-
- if (mdQname.equals(WsrtConstants.WSRT_LIFETIME_QNAME))
- setLifeTimeMetadata(new SimpleLifetimeMetadata(md));
- }
-
- }
-
- public LifetimeMetadata getLifeTimeMetadata()
- {
- return _ltMetadata;
- }
-
- public void setLifeTimeMetadata(LifetimeMetadata ltMetadata)
- {
- _ltMetadata = ltMetadata;
- }
-
- public DialectMetadata[] getDialectMetadata()
- {
- return _dialectMD;
- }
-
- public void setDialectMetadata(DialectMetadata[] metadata)
- {
- _dialectMD = metadata;
- }
-
- public Element toXML()
- {
- return toXML(XmlUtils.EMPTY_DOC);
- }
-
- public Element toXML(Document factory)
- {
- Element wsrtMDXML = XmlUtils.createElement(factory, WsrtConstants.WSRT_METADATA_QNAME);
-
- if (_ltMetadata != null)
- {
- wsrtMDXML.appendChild(_ltMetadata.toXML(factory));
- }
-
- // FIXME: eventually need to append wsrt dialect metdata here too
-
- return wsrtMDXML;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.create.impl;
+
+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.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.create.DialectMetadata;
+import org.apache.muse.ws.resource.transfer.create.LifetimeMetadata;
+import org.apache.muse.ws.resource.transfer.create.WSRTMetadata;
+
+/**
+ * This is Muse's default implementation of WSRTMetadata. It holds the lifetime
+ * and dialect metadata objects
+ *
+ * @author Mohammad Fakhar
+ */
+
+public class SimpleWSRTMetadata implements WSRTMetadata
+{
+
+ private LifetimeMetadata _ltMetadata;
+
+ private DialectMetadata[] _dialectMD;
+
+ public SimpleWSRTMetadata()
+ {
+ //
+ // no initialization tasks required
+ //
+ }
+
+ public SimpleWSRTMetadata(Element xml)
+ {
+ Element[] metadataXML = XmlUtils.getAllElements(xml);
+
+ for (int i = 0; i < metadataXML.length; i++)
+ {
+ Element md = metadataXML[i];
+ QName mdQname = new QName(md.getNamespaceURI(), md.getLocalName(), md.getPrefix());
+
+ if (mdQname.equals(WsrtConstants.WSRT_LIFETIME_QNAME))
+ setLifeTimeMetadata(new SimpleLifetimeMetadata(md));
+ }
+
+ }
+
+ public LifetimeMetadata getLifeTimeMetadata()
+ {
+ return _ltMetadata;
+ }
+
+ public void setLifeTimeMetadata(LifetimeMetadata ltMetadata)
+ {
+ _ltMetadata = ltMetadata;
+ }
+
+ public DialectMetadata[] getDialectMetadata()
+ {
+ return _dialectMD;
+ }
+
+ public void setDialectMetadata(DialectMetadata[] metadata)
+ {
+ _dialectMD = metadata;
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+ Element wsrtMDXML = XmlUtils.createElement(factory, WsrtConstants.WSRT_METADATA_QNAME);
+
+ if (_ltMetadata != null)
+ {
+ wsrtMDXML.appendChild(_ltMetadata.toXML(factory));
+ }
+
+ // FIXME: eventually need to append wsrt dialect metdata here too
+
+ return wsrtMDXML;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/delete/impl/SimpleDeleteCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/delete/impl/SimpleDeleteCapability.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/delete/impl/SimpleDeleteCapability.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/delete/impl/SimpleDeleteCapability.java Sat Mar 24 06:24:32 2007
@@ -1,59 +1,62 @@
-/*=============================================================================*
- * 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.resource.transfer.delete.impl;
-
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
-import org.apache.muse.ws.resource.lifetime.WsrlConstants;
-import org.apache.muse.ws.resource.lifetime.impl.SimpleImmediateTermination;
-import org.apache.muse.ws.resource.transfer.delete.DeleteCapability;
-
-/**
- * This is Muse's default WS-RT delete capability implementation. It delegates
- * to the WS-RF ImmediateTerminationCapability to delete resources.
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class SimpleDeleteCapability extends AbstractWsResourceCapability implements DeleteCapability
-{
- protected SimpleImmediateTermination terminationCap = null;
-
- public void delete() throws BaseFault
- {
- // delegate delete to ws-rf capability
- terminationCap.destroy();
- }
-
- public void initialize() throws SoapFault
- {
- super.initialize();
-
- // ensure ws-rf termination capability is on resource
- terminationCap = (SimpleImmediateTermination)getWsResource().getCapability(WsrlConstants.IMMEDIATE_TERMINATION_URI);
-
- if (terminationCap == null)
- {
- terminationCap = new SimpleImmediateTermination();
- terminationCap.initialize();
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.delete.impl;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+import org.apache.muse.ws.resource.lifetime.WsrlConstants;
+import org.apache.muse.ws.resource.lifetime.impl.SimpleImmediateTermination;
+import org.apache.muse.ws.resource.transfer.delete.DeleteCapability;
+
+/**
+ * This is Muse's default WS-RT delete capability implementation. It delegates
+ * to the WS-RF ImmediateTerminationCapability to delete resources.
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class SimpleDeleteCapability extends AbstractWsResourceCapability implements DeleteCapability
+{
+ protected SimpleImmediateTermination terminationCap = null;
+
+ public void delete() throws BaseFault
+ {
+ // delegate delete to ws-rf capability
+ terminationCap.destroy();
+ }
+
+ public void initialize() throws SoapFault
+ {
+ super.initialize();
+
+ // ensure ws-rf termination capability is on resource
+ terminationCap = (SimpleImmediateTermination)getWsResource().getCapability(WsrlConstants.IMMEDIATE_TERMINATION_URI);
+
+ if (terminationCap == null)
+ {
+ terminationCap = new SimpleImmediateTermination();
+ terminationCap.initialize();
+ }
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/InvalidExpressionFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/InvalidExpressionFault.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/InvalidExpressionFault.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/InvalidExpressionFault.java Sat Mar 24 06:24:32 2007
@@ -1,67 +1,70 @@
-/*=============================================================================*
- * 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.resource.transfer.faults;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-
-/**
- * Thrown by WS-RT capabilities when an invalid expression is encountered in an
- * operation
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class InvalidExpressionFault extends SenderFault
-{
- private static final QName INVALID_SYNTAX = new QName(WsrtConstants.WSRT_NAMESPACE_URI,
- "InvalidExpressionSyntax", WsrtConstants.WSX_PREFIX);
-
- private static final QName INVALID_VALUE = new QName(WsrtConstants.WSRT_NAMESPACE_URI,
- "InvalidExpressionValue", WsrtConstants.WSX_PREFIX);
-
- public InvalidExpressionFault(Element xml)
- {
- super(xml);
- }
-
- public InvalidExpressionFault(Throwable cause, boolean isInvalidSyntax)
- {
- super(WsrtConstants.INVALID_EXPRESSION, cause);
-
- Document factory = XmlUtils.EMPTY_DOC;
- Node detailText = factory.createTextNode(cause.getMessage());
- Element detail = null;
-
- if (isInvalidSyntax)
- detail = XmlUtils.createElement(INVALID_SYNTAX);
- else
- detail = XmlUtils.createElement(INVALID_VALUE);
-
- detail.appendChild(detailText);
- super.setDetail(detail);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.faults;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+
+/**
+ * Thrown by WS-RT capabilities when an invalid expression is encountered in an
+ * operation
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class InvalidExpressionFault extends SenderFault
+{
+ private static final QName INVALID_SYNTAX = new QName(WsrtConstants.WSRT_NAMESPACE_URI,
+ "InvalidExpressionSyntax", WsrtConstants.WSX_PREFIX);
+
+ private static final QName INVALID_VALUE = new QName(WsrtConstants.WSRT_NAMESPACE_URI,
+ "InvalidExpressionValue", WsrtConstants.WSX_PREFIX);
+
+ public InvalidExpressionFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public InvalidExpressionFault(Throwable cause, boolean isInvalidSyntax)
+ {
+ super(WsrtConstants.INVALID_EXPRESSION, cause);
+
+ Document factory = XmlUtils.EMPTY_DOC;
+ Node detailText = factory.createTextNode(cause.getMessage());
+ Element detail = null;
+
+ if (isInvalidSyntax)
+ detail = XmlUtils.createElement(INVALID_SYNTAX);
+ else
+ detail = XmlUtils.createElement(INVALID_VALUE);
+
+ detail.appendChild(detailText);
+ super.setDetail(detail);
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/SenderFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/SenderFault.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/SenderFault.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/SenderFault.java Sat Mar 24 06:24:32 2007
@@ -1,61 +1,64 @@
-/*=============================================================================*
- * 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.resource.transfer.faults;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.addressing.soap.SoapConstants;
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-
-/**
- * Base fault class from which sender side WS-RT faults inherit
- *
- * @author Mohammad Fakhar
- *
- */
-
-public abstract class SenderFault extends BaseFault
-{
-
- public SenderFault(Element xml)
- {
- super(xml);
- setCode(SoapConstants.SENDER_QNAME);
- }
-
- public SenderFault(QName qname, String message)
- {
- super(qname, message);
- setCode(SoapConstants.SENDER_QNAME);
- }
-
- public SenderFault(QName qname, String message, Throwable cause)
- {
- super(qname, message, cause);
- setCode(SoapConstants.SENDER_QNAME);
- }
-
- public SenderFault(QName qname, Throwable cause)
- {
- super(qname, cause);
- setCode(SoapConstants.SENDER_QNAME);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.faults;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.soap.SoapConstants;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ * Base fault class from which sender side WS-RT faults inherit
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public abstract class SenderFault extends BaseFault
+{
+
+ public SenderFault(Element xml)
+ {
+ super(xml);
+ setCode(SoapConstants.SENDER_QNAME);
+ }
+
+ public SenderFault(QName qname, String message)
+ {
+ super(qname, message);
+ setCode(SoapConstants.SENDER_QNAME);
+ }
+
+ public SenderFault(QName qname, String message, Throwable cause)
+ {
+ super(qname, message, cause);
+ setCode(SoapConstants.SENDER_QNAME);
+ }
+
+ public SenderFault(QName qname, Throwable cause)
+ {
+ super(qname, cause);
+ setCode(SoapConstants.SENDER_QNAME);
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/UnsupportedDialectFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/UnsupportedDialectFault.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/UnsupportedDialectFault.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/faults/UnsupportedDialectFault.java Sat Mar 24 06:24:32 2007
@@ -1,55 +1,58 @@
-/*=============================================================================*
- * 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.resource.transfer.faults;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-
-/**
- * Thrown by WS-RT capabilities when they encounter a dialect that is not
- * supported by resource
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class UnsupportedDialectFault extends SenderFault
-{
-
- public UnsupportedDialectFault(Element xml)
- {
- super(xml);
- }
-
- public UnsupportedDialectFault(String message)
- {
- super(WsrtConstants.UNSUPPORTED_DIALECT, message);
- }
-
- public UnsupportedDialectFault(String message, Throwable cause)
- {
- super(WsrtConstants.UNSUPPORTED_DIALECT, message, cause);
- }
-
- public UnsupportedDialectFault(Throwable cause)
- {
- super(WsrtConstants.UNSUPPORTED_DIALECT, cause);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+
+/**
+ * Thrown by WS-RT capabilities when they encounter a dialect that is not
+ * supported by resource
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class UnsupportedDialectFault extends SenderFault
+{
+
+ public UnsupportedDialectFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public UnsupportedDialectFault(String message)
+ {
+ super(WsrtConstants.UNSUPPORTED_DIALECT, message);
+ }
+
+ public UnsupportedDialectFault(String message, Throwable cause)
+ {
+ super(WsrtConstants.UNSUPPORTED_DIALECT, message, cause);
+ }
+
+ public UnsupportedDialectFault(Throwable cause)
+ {
+ super(WsrtConstants.UNSUPPORTED_DIALECT, cause);
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetHandler.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetHandler.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetHandler.java Sat Mar 24 06:24:32 2007
@@ -1,133 +1,136 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.muse.core.routing.AbstractMessageHandler;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XPathUtils;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
-import org.apache.muse.ws.resource.properties.WsrpConstants;
-import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.faults.UnsupportedDialectFault;
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-import org.w3c.dom.Element;
-
-/**
- * parses WS-RT Get request to create WS-RT Expressions and ensures that dialect
- * used in Get request is supported by resource
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class GetHandler extends AbstractMessageHandler
-{
- //
- // Used to lookup all exception messages
- //
- private Messages _MESSAGES = MessagesFactory.get(GetHandler.class);
-
- private ResourcePropertyCollection _rpColl = null;
-
- public GetHandler(ResourcePropertyCollection rpColl)
- {
- super(WsrtConstants.GET_URI, WsrtConstants.GET_QNAME);
-
- _rpColl = rpColl;
- }
-
- public Object[] fromXML(Element xml) throws SoapFault
- {
- if (xml == null)
- // WS-Transfer get request, which specify empty bodies
- return new Object[] { null, null };
-
- if (!isGetRequest(xml))
- throw new RuntimeException(_MESSAGES.get("InvalidGetRequest", new Object[] {XmlUtils.toString(xml)}));
-
- String dialect = xml.getAttribute(WsrtConstants.DIALECT_ATTR_NAME);
-
- // wsrt get delegation layer delegates get operations to wsrp layer
- // entirely, therefore
- // dialect has to be supported by wsrf resource that we are delegating
- // to
- if (!isSupportedDialect(dialect))
- throw new UnsupportedDialectFault(_MESSAGES.get("DialectNotSupported", new Object[] {dialect}));
-
- GetRequest request = new GetRequest(xml, dialect);
- return new Object[] { request.getDialect(), request.getExpressions() };
- }
-
- public Element toXML(Object result)
- {
- GetResponse get = new GetResponse((GetResult)result);
- return get.toXML();
- }
-
- private boolean isGetRequest(Element xml)
- {
- QName qname = new QName(xml.getNamespaceURI(), xml.getLocalName(), xml.getPrefix());
- return qname.equals(WsrtConstants.GET_QNAME);
- }
-
- public boolean isSupportedDialect(String dialect) throws BaseFault
- {
- // wsrf resources by default have to support xpath and qname dialect,
- // if this is a different dialect, then look at rp document for dialect
- // declarations.
- if (dialect.equals(WsrtConstants.QNAME_DIALECT)
- || dialect.equals(XPathUtils.NAMESPACE_URI)
- || dialect.equals(WsrtConstants.XPATH_LEVEL1_DIALECT))
- return true;
-
- Element[] supportedDialects = null;
- boolean isSupported = false;
-
- try
- {
- supportedDialects = _rpColl.getResourceProperty(WsrpConstants.QUERY_DIALECT_QNAME);
- }
- catch (InvalidResourcePropertyQNameFault e)
- {
- // if no dialect declarations exist in rp doc, the resource doesn't
- // support anything
- // besides xpath and qname dialect
- return false;
- }
-
- for (int i = 0; i < supportedDialects.length; i++)
- {
- Element dialectXML = supportedDialects[i];
- String supportedDialect = XmlUtils.extractText(dialectXML);
- if (supportedDialect.equals(dialect))
- {
- isSupported = true;
- break;
- }
- }
- return isSupported;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.core.routing.AbstractMessageHandler;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XPathUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.faults.UnsupportedDialectFault;
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+import org.w3c.dom.Element;
+
+/**
+ * parses WS-RT Get request to create WS-RT Expressions and ensures that dialect
+ * used in Get request is supported by resource
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class GetHandler extends AbstractMessageHandler
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private Messages _MESSAGES = MessagesFactory.get(GetHandler.class);
+
+ private ResourcePropertyCollection _rpColl = null;
+
+ public GetHandler(ResourcePropertyCollection rpColl)
+ {
+ super(WsrtConstants.GET_URI, WsrtConstants.GET_QNAME);
+
+ _rpColl = rpColl;
+ }
+
+ public Object[] fromXML(Element xml) throws SoapFault
+ {
+ if (xml == null)
+ // WS-Transfer get request, which specify empty bodies
+ return new Object[] { null, null };
+
+ if (!isGetRequest(xml))
+ throw new RuntimeException(_MESSAGES.get("InvalidGetRequest", new Object[] {XmlUtils.toString(xml)}));
+
+ String dialect = xml.getAttribute(WsrtConstants.DIALECT_ATTR_NAME);
+
+ // wsrt get delegation layer delegates get operations to wsrp layer
+ // entirely, therefore
+ // dialect has to be supported by wsrf resource that we are delegating
+ // to
+ if (!isSupportedDialect(dialect))
+ throw new UnsupportedDialectFault(_MESSAGES.get("DialectNotSupported", new Object[] {dialect}));
+
+ GetRequest request = new GetRequest(xml, dialect);
+ return new Object[] { request.getDialect(), request.getExpressions() };
+ }
+
+ public Element toXML(Object result)
+ {
+ GetResponse get = new GetResponse((GetResult)result);
+ return get.toXML();
+ }
+
+ private boolean isGetRequest(Element xml)
+ {
+ QName qname = new QName(xml.getNamespaceURI(), xml.getLocalName(), xml.getPrefix());
+ return qname.equals(WsrtConstants.GET_QNAME);
+ }
+
+ public boolean isSupportedDialect(String dialect) throws BaseFault
+ {
+ // wsrf resources by default have to support xpath and qname dialect,
+ // if this is a different dialect, then look at rp document for dialect
+ // declarations.
+ if (dialect.equals(WsrtConstants.QNAME_DIALECT)
+ || dialect.equals(XPathUtils.NAMESPACE_URI)
+ || dialect.equals(WsrtConstants.XPATH_LEVEL1_DIALECT))
+ return true;
+
+ Element[] supportedDialects = null;
+ boolean isSupported = false;
+
+ try
+ {
+ supportedDialects = _rpColl.getResourceProperty(WsrpConstants.QUERY_DIALECT_QNAME);
+ }
+ catch (InvalidResourcePropertyQNameFault e)
+ {
+ // if no dialect declarations exist in rp doc, the resource doesn't
+ // support anything
+ // besides xpath and qname dialect
+ return false;
+ }
+
+ for (int i = 0; i < supportedDialects.length; i++)
+ {
+ Element dialectXML = supportedDialects[i];
+ String supportedDialect = XmlUtils.extractText(dialectXML);
+ if (supportedDialect.equals(dialect))
+ {
+ isSupported = true;
+ break;
+ }
+ }
+ return isSupported;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetRequest.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetRequest.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetRequest.java Sat Mar 24 06:24:32 2007
@@ -1,70 +1,73 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.resource.transfer.Expression;
-import org.apache.muse.ws.resource.transfer.ExpressionFactory;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.impl.SimpleExpressionFactory;
-
-/**
- * Given a WS-RT request and a dialect, creates WS-RT expressions
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class GetRequest
-{
-
- private String _dialect = null;
-
- private Expression[] _expressions = null;
-
- public GetRequest(Element request, String dialect)
- {
- _dialect = dialect;
-
- Element[] expressionsXML = XmlUtils.getElements(request, WsrtConstants.EXPRESSION_QNAME);
- _expressions = new Expression[expressionsXML.length];
-
- // TODO: make expression factory pluggable
- ExpressionFactory exprFactory = new SimpleExpressionFactory();
-
- for (int i = 0; i < expressionsXML.length; i++)
- {
- Expression expr = exprFactory.createExpression(expressionsXML[i], dialect);
- _expressions[i] = expr;
- }
-
- }
-
- public Expression[] getExpressions()
- {
- return _expressions;
- }
-
- public String getDialect()
- {
- return _dialect;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.transfer.Expression;
+import org.apache.muse.ws.resource.transfer.ExpressionFactory;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.impl.SimpleExpressionFactory;
+
+/**
+ * Given a WS-RT request and a dialect, creates WS-RT expressions
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class GetRequest
+{
+
+ private String _dialect = null;
+
+ private Expression[] _expressions = null;
+
+ public GetRequest(Element request, String dialect)
+ {
+ _dialect = dialect;
+
+ Element[] expressionsXML = XmlUtils.getElements(request, WsrtConstants.EXPRESSION_QNAME);
+ _expressions = new Expression[expressionsXML.length];
+
+ // TODO: make expression factory pluggable
+ ExpressionFactory exprFactory = new SimpleExpressionFactory();
+
+ for (int i = 0; i < expressionsXML.length; i++)
+ {
+ Expression expr = exprFactory.createExpression(expressionsXML[i], dialect);
+ _expressions[i] = expr;
+ }
+
+ }
+
+ public Expression[] getExpressions()
+ {
+ return _expressions;
+ }
+
+ public String getDialect()
+ {
+ return _dialect;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetResponse.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetResponse.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/GetResponse.java Sat Mar 24 06:24:32 2007
@@ -1,131 +1,134 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.muse.util.xml.XmlSerializable;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.resource.transfer.AttributeNode;
-import org.apache.muse.ws.resource.transfer.TextNode;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-import org.apache.muse.ws.resource.transfer.impl.SimpleAttributeNode;
-import org.apache.muse.ws.resource.transfer.impl.SimpleTextNode;
-
-public class GetResponse implements XmlSerializable
-{
-
- private GetResult _results;
-
- public GetResponse(GetResult results)
- {
- _results = results;
- }
-
- public GetResult getResults()
- {
- return _results;
- }
-
- public Element toXML()
- {
- return toXML(XmlUtils.EMPTY_DOC);
- }
-
- public Element toXML(Document doc)
- {
-
- if (_results instanceof WstGetResult)
- {
- WstGetResult wstResult = (WstGetResult)_results;
- return wstResult.getRpDoc();
- }
- QName qname = WsrtConstants.GET_RESPONSE_QNAME;
- Element getResponse = XmlUtils.createElement(doc, qname);
-
- if (_results instanceof QNameDialectGetResult)
- {
- QNameDialectGetResult qNameResult = (QNameDialectGetResult)_results;
- Element[] qNames = qNameResult.getResult();
-
- for (int n = 0; n < qNames.length; ++n)
- {
- Element wsrtResult = XmlUtils.createElement(doc, WsrtConstants.RESULT_QNAME);
- Element prop = qNames[n];
-
- Node propNode = doc.importNode(prop, true);
- wsrtResult.appendChild(propNode);
- getResponse.appendChild(wsrtResult);
- }
- }
- else if (_results instanceof NonQNameDialectGetResult)
- {
- NonQNameDialectGetResult nonQNameResult = (NonQNameDialectGetResult)_results;
-
- // non prop dialect results are an array of node arrays
- Node[][] resultNodes = nonQNameResult.getResults();
-
- for (int i = 0; i < resultNodes.length; i++)
- {
- Node[] nodes = resultNodes[i];
-
- Element wsrtResult = XmlUtils.createElement(doc, WsrtConstants.RESULT_QNAME);
-
- for (int j = 0; j < nodes.length; j++)
- {
- Node importedNode = doc.importNode(nodes[j], true);
-
- // if node is a text node create a wsrt text object
- if (importedNode.getNodeType() == Node.TEXT_NODE)
- {
- TextNode textNode = new SimpleTextNode(importedNode.getNodeValue());
- Element textNodeXML = textNode.toXML(doc);
- wsrtResult.appendChild(textNodeXML);
- }
-
- // if node is an attribute node create a wsrt attribute
- // object
- else if (importedNode.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- String attrname = importedNode.getNodeName();
- String attrvalue = importedNode.getNodeValue();
-
- AttributeNode attribute = new SimpleAttributeNode(attrname, attrvalue);
- Element attrXML = attribute.toXML(doc);
- wsrtResult.appendChild(attrXML);
- }
-
- // just append node as a direct child of wsrt result.
- else
- {
- wsrtResult.appendChild(importedNode);
- }
- }
- getResponse.appendChild(wsrtResult);
- }
- }
-
- return getResponse;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.transfer.AttributeNode;
+import org.apache.muse.ws.resource.transfer.TextNode;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+import org.apache.muse.ws.resource.transfer.impl.SimpleAttributeNode;
+import org.apache.muse.ws.resource.transfer.impl.SimpleTextNode;
+
+public class GetResponse implements XmlSerializable
+{
+
+ private GetResult _results;
+
+ public GetResponse(GetResult results)
+ {
+ _results = results;
+ }
+
+ public GetResult getResults()
+ {
+ return _results;
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+
+ if (_results instanceof WstGetResult)
+ {
+ WstGetResult wstResult = (WstGetResult)_results;
+ return wstResult.getRpDoc();
+ }
+ QName qname = WsrtConstants.GET_RESPONSE_QNAME;
+ Element getResponse = XmlUtils.createElement(doc, qname);
+
+ if (_results instanceof QNameDialectGetResult)
+ {
+ QNameDialectGetResult qNameResult = (QNameDialectGetResult)_results;
+ Element[] qNames = qNameResult.getResult();
+
+ for (int n = 0; n < qNames.length; ++n)
+ {
+ Element wsrtResult = XmlUtils.createElement(doc, WsrtConstants.RESULT_QNAME);
+ Element prop = qNames[n];
+
+ Node propNode = doc.importNode(prop, true);
+ wsrtResult.appendChild(propNode);
+ getResponse.appendChild(wsrtResult);
+ }
+ }
+ else if (_results instanceof NonQNameDialectGetResult)
+ {
+ NonQNameDialectGetResult nonQNameResult = (NonQNameDialectGetResult)_results;
+
+ // non prop dialect results are an array of node arrays
+ Node[][] resultNodes = nonQNameResult.getResults();
+
+ for (int i = 0; i < resultNodes.length; i++)
+ {
+ Node[] nodes = resultNodes[i];
+
+ Element wsrtResult = XmlUtils.createElement(doc, WsrtConstants.RESULT_QNAME);
+
+ for (int j = 0; j < nodes.length; j++)
+ {
+ Node importedNode = doc.importNode(nodes[j], true);
+
+ // if node is a text node create a wsrt text object
+ if (importedNode.getNodeType() == Node.TEXT_NODE)
+ {
+ TextNode textNode = new SimpleTextNode(importedNode.getNodeValue());
+ Element textNodeXML = textNode.toXML(doc);
+ wsrtResult.appendChild(textNodeXML);
+ }
+
+ // if node is an attribute node create a wsrt attribute
+ // object
+ else if (importedNode.getNodeType() == Node.ATTRIBUTE_NODE)
+ {
+ String attrname = importedNode.getNodeName();
+ String attrvalue = importedNode.getNodeValue();
+
+ AttributeNode attribute = new SimpleAttributeNode(attrname, attrvalue);
+ Element attrXML = attribute.toXML(doc);
+ wsrtResult.appendChild(attrXML);
+ }
+
+ // just append node as a direct child of wsrt result.
+ else
+ {
+ wsrtResult.appendChild(importedNode);
+ }
+ }
+ getResponse.appendChild(wsrtResult);
+ }
+ }
+
+ return getResponse;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/NonQNameDialectGetResult.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/NonQNameDialectGetResult.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/NonQNameDialectGetResult.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/NonQNameDialectGetResult.java Sat Mar 24 06:24:32 2007
@@ -1,50 +1,53 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import org.w3c.dom.Node;
-
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-
-/**
- * When the dialect used in WS-RT Get operation is not the QName dialect, the
- * results for each WS-RT expression is best modeled as a Node array. Therefore
- * the collective results of all WS-RT expressions in a WS-RT get operation is
- * an array of Node arrays
- */
-
-public class NonQNameDialectGetResult implements GetResult
-{
- private Node[][] _results;
-
- public NonQNameDialectGetResult(Node[][] results)
- {
- _results = results;
- }
-
- public Node[][] getResults()
- {
- return _results;
- }
-
- public void setResults(Node[][] results)
- {
- _results = results;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import org.w3c.dom.Node;
+
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+
+/**
+ * When the dialect used in WS-RT Get operation is not the QName dialect, the
+ * results for each WS-RT expression is best modeled as a Node array. Therefore
+ * the collective results of all WS-RT expressions in a WS-RT get operation is
+ * an array of Node arrays
+ */
+
+public class NonQNameDialectGetResult implements GetResult
+{
+ private Node[][] _results;
+
+ public NonQNameDialectGetResult(Node[][] results)
+ {
+ _results = results;
+ }
+
+ public Node[][] getResults()
+ {
+ return _results;
+ }
+
+ public void setResults(Node[][] results)
+ {
+ _results = results;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/QNameDialectGetResult.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/QNameDialectGetResult.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/QNameDialectGetResult.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/QNameDialectGetResult.java Sat Mar 24 06:24:32 2007
@@ -1,52 +1,55 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-
-/**
- * When the QName ialect is used in WS-RT Get operation, the result of each
- * WS-RT expression has to be an element. Therefore collective results of WS-RT
- * Expressions in a get request are an array of Elements
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class QNameDialectGetResult implements GetResult
-{
- private Element[] _result;
-
- public QNameDialectGetResult(Element[] result)
- {
- _result = result;
- }
-
- public Element[] getResult()
- {
- return _result;
- }
-
- public void setResult(Element[] result)
- {
- _result = result;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+
+/**
+ * When the QName ialect is used in WS-RT Get operation, the result of each
+ * WS-RT expression has to be an element. Therefore collective results of WS-RT
+ * Expressions in a get request are an array of Elements
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class QNameDialectGetResult implements GetResult
+{
+ private Element[] _result;
+
+ public QNameDialectGetResult(Element[] result)
+ {
+ _result = result;
+ }
+
+ public Element[] getResult()
+ {
+ return _result;
+ }
+
+ public void setResult(Element[] result)
+ {
+ _result = result;
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/SimpleGetCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/SimpleGetCapability.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/SimpleGetCapability.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/SimpleGetCapability.java Sat Mar 24 06:24:32 2007
@@ -1,198 +1,201 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-import java.lang.reflect.Method;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.muse.core.routing.MessageHandler;
-import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
-import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
-import org.apache.muse.ws.resource.properties.WsrpConstants;
-import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
-import org.apache.muse.ws.resource.properties.query.faults.InvalidQueryExpressionFault;
-import org.apache.muse.ws.resource.properties.query.faults.QueryEvaluationErrorFault;
-import org.apache.muse.ws.resource.properties.query.impl.SimpleQueryCapability;
-import org.apache.muse.ws.resource.transfer.Expression;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
-import org.apache.muse.ws.resource.transfer.get.GetFault;
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-import org.apache.muse.ws.resource.transfer.get.GetCapability;
-import org.apache.muse.ws.resource.transfer.impl.QNameExpression;
-
-/**
- * This is Muse's default implementation of the WS-RT Get capability. It
- * delegates to WS-RF Set and Query capabilities to serve WS-RT/WS-T Get
- * requests WS-RT requests with QName dialects map to wsrf Get capability and
- * WS-RT requests with non-QName dialects map to wsrf Query capability.
- *
- * @author Mohammad Fakhar
- *
- */
-
-public class SimpleGetCapability extends AbstractWsResourceCapability implements GetCapability
-{
-
- protected org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability wsrfGetCap = null;
-
- protected SimpleQueryCapability wsrfQueryCap = null;
-
- protected MessageHandler createGetHandler()
- {
- // the handler needs the wsrf prop collection to check if dialects in
- // request
- // are supported by resource
- ResourcePropertyCollection rpColl = getWsResource().getPropertyCollection();
-
- // the handler parses the WS-RT request to create WS-RT expressions.
- MessageHandler handler = new GetHandler(rpColl);
-
- Method method = ReflectUtils.getFirstMethod(getClass(), "get");
- handler.setMethod(method);
-
- return handler;
- }
-
- public GetResult get(String dialect, Expression[] expressions) throws InvalidExpressionFault, GetFault, BaseFault
- {
- GetResult results = null;
-
- if (dialect == null) // its a ws-transfer Get
- {
- Element rpDoc = wsrfGetCap.getResourcePropertyDocument();
- return new WstGetResult(rpDoc);
- }
- if (dialect.equals(WsrtConstants.QNAME_DIALECT))
- results = getQNameDialectResults(expressions);
- else
- results = getNonQNameDialectResults(dialect, expressions);
-
- return results;
- }
-
- protected QNameDialectGetResult getQNameDialectResults(Expression[] expressions) throws InvalidExpressionFault, GetFault
- {
- // the top level property qnames to query
- QName[] expressionQNames = new QName[expressions.length];
-
- for (int i = 0; i < expressions.length; i++)
- {
- // get handler ensures that prop expressions were created if dialect
- // was QName dialect
- QNameExpression qnameExpr = (QNameExpression)expressions[i];
- expressionQNames[i] = qnameExpr.getQname();
- }
-
- try
- {
- // delegate property queries to wsrf get capability
- Element[] props = wsrfGetCap.getMultipleResourceProperties(expressionQNames);
-
- return new QNameDialectGetResult(props);
- }
- catch (InvalidResourcePropertyQNameFault e)
- {
- // prop doesn't exist
- throw new InvalidExpressionFault(e, false);
- }
- catch (Exception e)
- {
- // was a valid get request, but something went wrong
- throw new GetFault(e);
- }
- }
-
- protected NonQNameDialectGetResult getNonQNameDialectResults(String dialect, Expression[] expressions) throws InvalidExpressionFault, GetFault
- {
- // the results of a non-QName dialect query is an array of node
- // arrays
- Node[][] results = new Node[expressions.length][];
-
- for (int i = 0; i < expressions.length; i++)
- {
- try
- {
- // delegate non-QName dialect queries to wsrf query
- // capability.
- // The wsrf query capability takes in queries as strings so we
- // use the toString method
- // of expression to retrieve a String representation of it
- results[i] = wsrfQueryCap.queryResourceProperties(expressions[i].toString(), dialect);
- }
- catch (InvalidQueryExpressionFault e)
- {
- // wrong syntax
- throw new InvalidExpressionFault(e, true);
- }
- catch (QueryEvaluationErrorFault e)
- {
- // bad expression value
- throw new InvalidExpressionFault(e, false);
- }
- catch (Exception e)
- {
- // was a valid get request, but something went wrong
- throw new GetFault(e);
- }
- }
-
- return new NonQNameDialectGetResult(results);
-
- }
-
- public void initialize() throws SoapFault
- {
- super.initialize();
-
- // ensure the get/query wsrf capabilities are on resource
-
- wsrfGetCap = (org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability)getWsResource().getCapability(WsrpConstants.GET_CAPABILITY);
-
- if (wsrfGetCap == null)
- {
- wsrfGetCap = new org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability();
- wsrfGetCap.initialize();
- }
-
- wsrfQueryCap = (SimpleQueryCapability)getWsResource().getCapability(WsrpConstants.QUERY_CAPABILITY);
-
- if (wsrfQueryCap == null)
- {
- wsrfQueryCap = new SimpleQueryCapability();
- wsrfQueryCap.initialize();
- }
-
- setMessageHandler(createGetHandler());
- }
-
- public void shutdown() throws SoapFault
- {
- super.shutdown();
- wsrfGetCap.shutdown();
- wsrfQueryCap.shutdown();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.core.routing.MessageHandler;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+import org.apache.muse.ws.resource.properties.query.faults.InvalidQueryExpressionFault;
+import org.apache.muse.ws.resource.properties.query.faults.QueryEvaluationErrorFault;
+import org.apache.muse.ws.resource.properties.query.impl.SimpleQueryCapability;
+import org.apache.muse.ws.resource.transfer.Expression;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
+import org.apache.muse.ws.resource.transfer.get.GetFault;
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+import org.apache.muse.ws.resource.transfer.get.GetCapability;
+import org.apache.muse.ws.resource.transfer.impl.QNameExpression;
+
+/**
+ * This is Muse's default implementation of the WS-RT Get capability. It
+ * delegates to WS-RF Set and Query capabilities to serve WS-RT/WS-T Get
+ * requests WS-RT requests with QName dialects map to wsrf Get capability and
+ * WS-RT requests with non-QName dialects map to wsrf Query capability.
+ *
+ * @author Mohammad Fakhar
+ *
+ */
+
+public class SimpleGetCapability extends AbstractWsResourceCapability implements GetCapability
+{
+
+ protected org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability wsrfGetCap = null;
+
+ protected SimpleQueryCapability wsrfQueryCap = null;
+
+ protected MessageHandler createGetHandler()
+ {
+ // the handler needs the wsrf prop collection to check if dialects in
+ // request
+ // are supported by resource
+ ResourcePropertyCollection rpColl = getWsResource().getPropertyCollection();
+
+ // the handler parses the WS-RT request to create WS-RT expressions.
+ MessageHandler handler = new GetHandler(rpColl);
+
+ Method method = ReflectUtils.getFirstMethod(getClass(), "get");
+ handler.setMethod(method);
+
+ return handler;
+ }
+
+ public GetResult get(String dialect, Expression[] expressions) throws InvalidExpressionFault, GetFault, BaseFault
+ {
+ GetResult results = null;
+
+ if (dialect == null) // its a ws-transfer Get
+ {
+ Element rpDoc = wsrfGetCap.getResourcePropertyDocument();
+ return new WstGetResult(rpDoc);
+ }
+ if (dialect.equals(WsrtConstants.QNAME_DIALECT))
+ results = getQNameDialectResults(expressions);
+ else
+ results = getNonQNameDialectResults(dialect, expressions);
+
+ return results;
+ }
+
+ protected QNameDialectGetResult getQNameDialectResults(Expression[] expressions) throws InvalidExpressionFault, GetFault
+ {
+ // the top level property qnames to query
+ QName[] expressionQNames = new QName[expressions.length];
+
+ for (int i = 0; i < expressions.length; i++)
+ {
+ // get handler ensures that prop expressions were created if dialect
+ // was QName dialect
+ QNameExpression qnameExpr = (QNameExpression)expressions[i];
+ expressionQNames[i] = qnameExpr.getQname();
+ }
+
+ try
+ {
+ // delegate property queries to wsrf get capability
+ Element[] props = wsrfGetCap.getMultipleResourceProperties(expressionQNames);
+
+ return new QNameDialectGetResult(props);
+ }
+ catch (InvalidResourcePropertyQNameFault e)
+ {
+ // prop doesn't exist
+ throw new InvalidExpressionFault(e, false);
+ }
+ catch (Exception e)
+ {
+ // was a valid get request, but something went wrong
+ throw new GetFault(e);
+ }
+ }
+
+ protected NonQNameDialectGetResult getNonQNameDialectResults(String dialect, Expression[] expressions) throws InvalidExpressionFault, GetFault
+ {
+ // the results of a non-QName dialect query is an array of node
+ // arrays
+ Node[][] results = new Node[expressions.length][];
+
+ for (int i = 0; i < expressions.length; i++)
+ {
+ try
+ {
+ // delegate non-QName dialect queries to wsrf query
+ // capability.
+ // The wsrf query capability takes in queries as strings so we
+ // use the toString method
+ // of expression to retrieve a String representation of it
+ results[i] = wsrfQueryCap.queryResourceProperties(expressions[i].toString(), dialect);
+ }
+ catch (InvalidQueryExpressionFault e)
+ {
+ // wrong syntax
+ throw new InvalidExpressionFault(e, true);
+ }
+ catch (QueryEvaluationErrorFault e)
+ {
+ // bad expression value
+ throw new InvalidExpressionFault(e, false);
+ }
+ catch (Exception e)
+ {
+ // was a valid get request, but something went wrong
+ throw new GetFault(e);
+ }
+ }
+
+ return new NonQNameDialectGetResult(results);
+
+ }
+
+ public void initialize() throws SoapFault
+ {
+ super.initialize();
+
+ // ensure the get/query wsrf capabilities are on resource
+
+ wsrfGetCap = (org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability)getWsResource().getCapability(WsrpConstants.GET_CAPABILITY);
+
+ if (wsrfGetCap == null)
+ {
+ wsrfGetCap = new org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability();
+ wsrfGetCap.initialize();
+ }
+
+ wsrfQueryCap = (SimpleQueryCapability)getWsResource().getCapability(WsrpConstants.QUERY_CAPABILITY);
+
+ if (wsrfQueryCap == null)
+ {
+ wsrfQueryCap = new SimpleQueryCapability();
+ wsrfQueryCap.initialize();
+ }
+
+ setMessageHandler(createGetHandler());
+ }
+
+ public void shutdown() throws SoapFault
+ {
+ super.shutdown();
+ wsrfGetCap.shutdown();
+ wsrfQueryCap.shutdown();
+ }
+
+}
Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/WstGetResult.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/WstGetResult.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/WstGetResult.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/get/impl/WstGetResult.java Sat Mar 24 06:24:32 2007
@@ -1,50 +1,53 @@
-/*=============================================================================*
- * 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.resource.transfer.get.impl;
-
-/**
- * Result of a WS-Transfer Get is the resource property document, which is an
- * Element
- *
- * @author Mohammad Fakhar
- */
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.resource.transfer.get.GetResult;
-
-public class WstGetResult implements GetResult
-{
- private Element _rpDoc;
-
- public WstGetResult(Element doc)
- {
- _rpDoc = doc;
- }
-
- public Element getRpDoc()
- {
- return _rpDoc;
- }
-
- public void setRpDoc(Element rpDoc)
- {
- _rpDoc = rpDoc;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.resource.transfer.get.impl;
+
+/**
+ * Result of a WS-Transfer Get is the resource property document, which is an
+ * Element
+ *
+ * @author Mohammad Fakhar
+ */
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.transfer.get.GetResult;
+
+public class WstGetResult implements GetResult
+{
+ private Element _rpDoc;
+
+ public WstGetResult(Element doc)
+ {
+ _rpDoc = doc;
+ }
+
+ public Element getRpDoc()
+ {
+ return _rpDoc;
+ }
+
+ public void setRpDoc(Element rpDoc)
+ {
+ _rpDoc = rpDoc;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org