You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2005/02/15 21:43:18 UTC
svn commit: r153952 [3/4] - in incubator/apollo/trunk/src:
java/org/apache/ws/resource/faults/ java/org/apache/ws/resource/faults/axis/
java/org/apache/ws/resource/faults/axis/v1_2_draft01/
java/org/apache/ws/resource/faults/axis/v1_2_draft03/
java/org/apache/ws/resource/faults/v1_2_draft03/
java/org/apache/ws/resource/handler/
java/org/apache/ws/resource/handler/axis/ java/org/apache/ws/resource/impl/
java/org/apache/ws/resource/lifetime/faults/
java/org/apache/ws/resource/lifetime/v1_2_draft04/
java/org/apache/ws/resource/lifetime/v1_2_draft04/porttype/
java/org/apache/ws/resource/lifetime/v1_2_draft04/porttype/impl/
java/org/apache/ws/resource/properties/
java/org/apache/ws/resource/properties/faults/
java/org/apache/ws/resource/properties/impl/
java/org/apache/ws/resource/properties/query/impl/
java/org/apache/ws/resource/properties/query/xpath/impl/
java/org/apache/ws/resource/properties/v1_2_draft05/
java/org/apache/ws/resource/properties/v1_2_draft05/porttype/
java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/
java/org/apache/ws/resource/servicegroup/v1_2_draft03/
java/org/apache/ws/resource/tool/ java/org/apache/ws/resource/tool/porttype/
java/org/apache/ws/resource/tool/porttype/v1_2_draft01/
java/org/apache/ws/resource/tool/porttype/v1_2_draft05/
java/org/apache/ws/resource/tool/velocity/ site/content/xdocs/
templates/1_2_draft01/ templates/1_2_draft05/
test/org/apache/ws/resource/properties/ webapp/WEB-INF/
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/DeleteResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/DeleteResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/DeleteResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/DeleteResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,174 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.DeleteResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.faults.InvalidSetResourcePropertiesRequestContentFaultException;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.resource.properties.faults.SetResourcePropertyRequestFailedFaultException;
+import org.apache.ws.resource.properties.faults.UnableToModifyResourcePropertyFaultException;
+
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.DeleteResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.DeleteResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.DeleteType;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+
+/**
+ * @author Sal Campana
+ */
+public class DeleteResourcePropertiesPortTypeImpl extends AbstractResourcePropertiesPortType implements DeleteResourcePropertiesPortType
+{
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+ /**
+ * Creates a new {@link AbstractResourcePropertiesPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public DeleteResourcePropertiesPortTypeImpl(ResourceContext resourceContext)
+ {
+ super(resourceContext);
+ }
+
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ * @return DOCUMENT_ME
+ */
+ public DeleteResourcePropertiesResponseDocument deleteResourceProperties(DeleteResourcePropertiesDocument requestDoc)
+ {
+
+ DeleteResourcePropertiesResponseDocument responseDocument = createResponseDocument();
+ DeleteResourcePropertiesDocument.DeleteResourceProperties requestElem = requestDoc.getDeleteResourceProperties();
+ deleteResourceProperty(requestElem.getDelete());
+
+ return responseDocument;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param deleteElem DOCUMENT_ME
+ */
+ protected void deleteResourceProperty( DeleteType deleteElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.DEL_RP_REQ,
+ deleteElem.toString() ) );
+ }
+ QName nameOfPropToBeDeleted = deleteElem.getResourceProperty();
+ if ( nameOfPropToBeDeleted == null )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( namespaces, MSG.getMessage( Keys.DEL_MISSING_RP_ATTRIB ) );
+ }
+ ResourceProperty prop = getProperties().get( nameOfPropToBeDeleted );
+ if ( prop == null )
+ {
+ if ( getProperties().getMetaData().isOpenContent() )
+ {
+ return;
+ } else
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, nameOfPropToBeDeleted );
+ }
+ }
+ throwFaultIfPropertyIsReadOnly( prop );
+ throwFaultIfDeletionViolatesSchema( prop );
+ try
+ {
+ deletePropertyCallback( prop );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException( namespaces, re.toString() );
+ }
+ Object[] oldValue = getValue( prop );
+ prop.clear();
+ Object[] newValue = null;
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+ private Object[] getValue( ResourceProperty prop )
+ {
+ Object[] value = new Object[prop.size()];
+ Iterator propElemIter = prop.iterator();
+ int i = 0;
+ while ( propElemIter.hasNext() )
+ {
+ value[i++] = propElemIter.next();
+ }
+ return value;
+ }
+ private void throwFaultIfPropertyIsReadOnly( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().isReadOnly() )
+ {
+ throw new UnableToModifyResourcePropertyFaultException(namespaces, prop.getMetaData().getName() );
+ }
+ }
+ private void deletePropertyCallback( ResourceProperty prop )
+ {
+ QName nameOfPropToBeDeleted = prop.getMetaData().getName();
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.deleteProperty( nameOfPropToBeDeleted );
+ }
+ }
+
+ private void throwFaultIfDeletionViolatesSchema( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().getMinOccurs() != 0 )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, MSG.getMessage( Keys.ERROR_PROPERTY_DELETE_VIOLATES_SCHEMA,
+ prop.getMetaData().getName() ) );
+ }
+ }
+ /**
+ * Returns SetResourcePropertyCallback or null
+ *
+ * @param prop
+ *
+ * @return SetResourcePropertyCallback or null
+ */
+ private SetResourcePropertyCallback getSetResourcePropertyCallback( ResourceProperty prop )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = null;
+ ResourcePropertyCallback callBack = prop.getCallBack();
+ if ( callBack instanceof SetResourcePropertyCallback )
+ {
+ setResourcePropertyCallback = (SetResourcePropertyCallback) callBack;
+ }
+
+ return setResourcePropertyCallback;
+ }
+ private void firePropChangeEvent( ResourceProperty prop, Object[] oldValue, Object[] newValue )
+ {
+ prop.getChangeListener().propertyChanged( new XmlBeansResourcePropertyValueChangeEvent( oldValue, newValue ) );
+ }
+ private DeleteResourcePropertiesResponseDocument createResponseDocument()
+ {
+ DeleteResourcePropertiesResponseDocument responseDoc =
+ DeleteResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewDeleteResourcePropertiesResponse();
+ return responseDoc;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetMultipleResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetMultipleResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetMultipleResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetMultipleResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,84 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.GetMultipleResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetMultipleResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetMultipleResourcePropertiesDocument;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author Sal Campana
+ */
+public class GetMultipleResourcePropertiesPortTypeImpl extends AbstractResourcePropertiesPortType implements GetMultipleResourcePropertiesPortType
+{
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+ /**
+ * Creates a new {@link AbstractResourcePropertiesPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public GetMultipleResourcePropertiesPortTypeImpl(ResourceContext resourceContext)
+ {
+ super(resourceContext);
+ }
+
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ * @return DOCUMENT_ME
+ */
+ public GetMultipleResourcePropertiesResponseDocument getMultipleResourceProperties(GetMultipleResourcePropertiesDocument requestDoc)
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_MULTI_RP_REQ,
+ requestDoc.toString() ) );
+ }
+
+ GetMultipleResourcePropertiesResponseDocument responseDoc = createResponseDocument();
+ QName[] propNames =
+ requestDoc.getGetMultipleResourceProperties().getResourcePropertyArray();
+
+ for ( int i = 0; i < propNames.length; i++ )
+ {
+ ResourceProperty prop = getProperties().get( propNames[i] );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, propNames[i] );
+ }
+ refreshProperty( prop );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, propNames[i] );
+ }
+
+ addPropertyToResponse( prop,
+ responseDoc.getGetMultipleResourcePropertiesResponse() );
+ }
+
+ return responseDoc;
+ }
+
+ private GetMultipleResourcePropertiesResponseDocument createResponseDocument()
+ {
+ GetMultipleResourcePropertiesResponseDocument responseDoc =
+ GetMultipleResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewGetMultipleResourcePropertiesResponse();
+ return responseDoc;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyDocumentPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyDocumentPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyDocumentPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyDocumentPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,60 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.GetResourcePropertyDocumentPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetResourcePropertyDocumentResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetResourcePropertyDocumentDocument1;
+
+
+/**
+ * @author Sal Campana
+ */
+public class GetResourcePropertyDocumentPortTypeImpl extends AbstractResourcePropertiesPortType implements GetResourcePropertyDocumentPortType
+{
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+ /**
+ * Creates a new {@link AbstractResourcePropertiesPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public GetResourcePropertyDocumentPortTypeImpl(ResourceContext resourceContext)
+ {
+ super(resourceContext);
+ }
+
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ * @return DOCUMENT_ME
+ */
+ public GetResourcePropertyDocumentResponseDocument getResourcePropertyDocument(GetResourcePropertyDocumentDocument1.GetResourcePropertyDocument requestDoc)
+ {
+ GetResourcePropertyDocumentResponseDocument responseDocument = createResponseDocument();
+ GetResourcePropertyDocumentResponseDocument.GetResourcePropertyDocumentResponse responseDoc = responseDocument.getGetResourcePropertyDocumentResponse();
+ XmlBeansResourcePropertySet properties = (XmlBeansResourcePropertySet) getProperties();
+
+ XmlBeanUtils.addChildElement(responseDoc, properties.toXmlObject());
+ return responseDocument;
+ }
+
+ private GetResourcePropertyDocumentResponseDocument createResponseDocument()
+ {
+ GetResourcePropertyDocumentResponseDocument responseDoc =
+ GetResourcePropertyDocumentResponseDocument.Factory.newInstance();
+ responseDoc.addNewGetResourcePropertyDocumentResponse();
+ return responseDoc;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/GetResourcePropertyPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,105 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.GetResourcePropertyPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetResourcePropertyResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.GetResourcePropertyDocument;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * An operation provider for wsrp:GetResourceProperty.
+ *
+ * @author Ian P. Springer
+ */
+public class GetResourcePropertyPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements GetResourcePropertyPortType
+{
+
+ private static final Log LOG = LogFactory.getLog( GetResourcePropertyPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+
+ /**
+ * Creates a new {@link GetResourcePropertyPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public GetResourcePropertyPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * Implementation of the wsrp:GetResourceProperty operation.
+ *
+ * @param requestDoc the requestDoc XMLBean
+ *
+ * @return the response XMLBean
+ *
+ * @throws InvalidResourcePropertyQNameFaultException
+ *
+ * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
+ *
+ */
+ public GetResourcePropertyResponseDocument getResourceProperty( GetResourcePropertyDocument requestDoc )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_RP_REQ, requestDoc.toString() ) );
+ }
+ GetResourcePropertyResponseDocument responseDoc = createResponseDocument();
+ QName propName = requestDoc.getGetResourceProperty();
+ ResourceProperty prop = getProperties().get( propName );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, propName );
+ }
+ refreshProperty( prop );
+ Iterator propElemIter = prop.iterator();
+ while ( propElemIter.hasNext() )
+ {
+ XmlObject propElem = (XmlObject) propElemIter.next();
+ XmlBeanUtils.addChildElement( responseDoc.getGetResourcePropertyResponse(),
+ propElem );
+ }
+ return responseDoc;
+ }
+
+ private GetResourcePropertyResponseDocument createResponseDocument()
+ {
+ GetResourcePropertyResponseDocument responseDoc =
+ GetResourcePropertyResponseDocument.Factory.newInstance();
+ responseDoc.addNewGetResourcePropertyResponse();
+ return responseDoc;
+ }
+}
\ No newline at end of file
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/InsertResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/InsertResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/InsertResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/InsertResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,207 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.InsertResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AnyResourcePropertyMetaData;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.MetaDataViolationException;
+import org.apache.ws.resource.properties.ResourcePropertyMetaData;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.InsertResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.InsertResourcePropertiesDocument;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+
+/**
+ * @author Sal Campana
+ */
+public class InsertResourcePropertiesPortTypeImpl extends AbstractResourcePropertiesPortType implements InsertResourcePropertiesPortType
+{
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+ /**
+ * Creates a new {@link AbstractResourcePropertiesPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public InsertResourcePropertiesPortTypeImpl(ResourceContext resourceContext)
+ {
+ super(resourceContext);
+ }
+
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param insertElem DOCUMENT_ME
+ */
+ protected void insertResourceProperty( InsertType insertElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.INSERT_RP_REQ,
+ insertElem.toString() ) );
+ }
+
+ XmlObject[] propElemsToBeInserted = XmlBeanUtils.getChildElements( insertElem );
+ if ( propElemsToBeInserted.length == 0 )
+ {
+ return; // nothing to do
+ }
+ throwFaultIfElementNamesHeterogenous( propElemsToBeInserted );
+
+ QName propName = XmlBeanUtils.getName( propElemsToBeInserted[0] );
+ ResourceProperty prop = getProperty( propName );
+
+ if(prop == null)
+ {
+ prop = createAnyProperty(propName);
+ getProperties().add(prop);
+ }
+
+ if(!prop.getMetaData().isAny())
+ {
+ //todo probably need to check this for xsd:any to check for possible violations
+ //refreshProperty( prop );
+ throwFaultIfInsertionViolatesSchema( prop, propElemsToBeInserted );
+ }
+
+ throwFaultIfPropertyIsReadOnly( prop );
+
+ try
+ {
+ insertPropertyCallback( prop, propElemsToBeInserted );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException( re.toString() );
+ }
+
+ Object[] oldValue = getValue( prop );
+ for ( int i = 0; i < propElemsToBeInserted.length; i++ )
+ {
+ try
+ {
+ prop.add( propElemsToBeInserted[i] );
+ }
+ catch ( MetaDataViolationException mdve )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( mdve );
+ }
+ }
+ Object[] newValue = getValue( prop );
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+
+ private void throwFaultIfInsertionViolatesSchema( ResourceProperty prop, XmlObject[] propElemsToBeInserted )
+ {
+ //todo probably need to check this for xsd:any to check for possible violations
+ if ( prop.getMetaData().getMaxOccurs() != -1 &&( prop.size() + propElemsToBeInserted.length ) > prop.getMetaData().getMaxOccurs() )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( MSG.getMessage( Keys.ERROR_PROPERTY_INSERT_VIOLATES_SCHEMA,
+ ( ( propElemsToBeInserted.length > 1 )
+ ? "s" : "" ),
+ prop.getMetaData().getName() ) );
+ }
+ }
+ private void throwFaultIfPropertyIsReadOnly( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().isReadOnly() )
+ {
+ throw new UnableToModifyResourcePropertyFaultException( prop.getMetaData().getName() );
+ }
+ }
+ private Object[] getValue( ResourceProperty prop )
+ {
+ Object[] value = new Object[prop.size()];
+ Iterator propElemIter = prop.iterator();
+ int i = 0;
+ while ( propElemIter.hasNext() )
+ {
+ value[i++] = propElemIter.next();
+ }
+ return value;
+ }
+ private void firePropChangeEvent( ResourceProperty prop, Object[] oldValue, Object[] newValue )
+ {
+ prop.getChangeListener().propertyChanged( new XmlBeansResourcePropertyValueChangeEvent( oldValue, newValue ) );
+ }
+
+ private void insertPropertyCallback( ResourceProperty prop,
+ XmlObject[] propElemsToBeInserted )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.insertProperty( propElemsToBeInserted );
+ }
+ }
+ private ResourceProperty createAnyProperty(QName propName)
+ {
+ ResourcePropertyMetaData propMetaData = new AnyResourcePropertyMetaData( propName );
+ return propMetaData.create( getProperties() );
+ }
+ private ResourceProperty getProperty( QName propName )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_RP_WITH_NAME,
+ propName.toString() ) );
+ ResourceProperty prop = getProperties().get( propName );
+ if ( prop == null )
+ {
+ if ( !getProperties().getMetaData().isOpenContent() )
+ {
+ throw new InvalidResourcePropertyQNameFaultException( propName );
+ }
+ }
+ return prop;
+ }
+ private void throwFaultIfElementNamesHeterogenous( XmlObject[] propElems )
+ {
+ QName firstPropElemName = XmlBeanUtils.getName( propElems[0] );
+ for ( int i = 1; i < propElems.length; i++ )
+ {
+ QName propElemName = XmlBeanUtils.getName( propElems[i] );
+ if ( !firstPropElemName.equals( propElemName ) )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( MSG.getMessage( Keys.ERROR_PROPERTY_INSERT_VIOLATES_SCHEMA,
+ ( ( propElems.length > 1 )
+ ? "s" : "" ),
+ firstPropElemName ) );
+ }
+ }
+ }
+
+ private InsertResourcePropertiesResponseDocument createResponseDocument()
+ {
+ InsertResourcePropertiesResponseDocument responseDoc =
+ InsertResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewInsertResourcePropertiesResponse();
+ return responseDoc;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ * @return DOCUMENT_ME
+ */
+ public InsertResourcePropertiesResponseDocument insertResourceProperties(InsertResourcePropertiesDocument requestDoc)
+ {
+ return null;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/NamespaceVersionHolderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/NamespaceVersionHolderImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/NamespaceVersionHolderImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/NamespaceVersionHolderImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,41 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.v1_2_draft05.ResourcePropertiesConstants;
+import org.apache.ws.resource.lifetime.v1_2_draft04.ResourceLifetime1_2Constants;
+import org.apache.ws.resource.faults.v1_2_draft03.Faults1_2Constants;
+import org.apache.ws.resource.servicegroup.v1_2_draft03.ServiceGroup1_2Constants;
+import org.apache.axis.message.addressing.Constants;
+
+
+/**
+ * @author Sal Campana
+ */
+public class NamespaceVersionHolderImpl implements NamespaceVersionHolder
+{
+
+ public String getPropertiesXsdNamespace()
+ {
+ return ResourcePropertiesConstants.NSURI_WSRP_SCHEMA;
+ }
+
+ public String getLifetimeXsdNamespace()
+ {
+ return ResourceLifetime1_2Constants.NSURI_WSRL_SCHEMA;
+ }
+
+ public String getBaseFaultsXsdNamespace()
+ {
+ return Faults1_2Constants.NSURI_BASEFAULTS_SCHEMA;
+ }
+
+ public String getAddressingNamespace()
+ {
+ return Constants.NS_URI_ADDRESSING_08;
+ }
+
+ public String getServiceGroupsXsdNamespace()
+ {
+ return ServiceGroup1_2Constants.NSURI_WSSG_SCHEMA;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/QueryResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/QueryResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/QueryResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/QueryResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,174 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.query.QueryEngine;
+import org.apache.ws.resource.properties.query.UnknownQueryExpressionDialectException;
+import org.apache.ws.resource.properties.query.QueryEvaluationErrorException;
+import org.apache.ws.resource.properties.query.InvalidQueryExpressionException;
+
+import org.apache.ws.resource.properties.query.impl.QueryEngineImpl;
+import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
+
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.QueryResourcePropertiesPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.faults.UnknownQueryExpressionDialectFaultException;
+import org.apache.ws.resource.properties.faults.QueryEvaluationErrorFaultException;
+import org.apache.ws.resource.properties.faults.InvalidQueryExpressionFaultException;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryExpressionType;
+
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import java.lang.reflect.Array;
+
+/**
+ * LOG-DONE An operation provider for wsrp:QueryResourceProperties.
+ *
+ * @author Ian P. Springer
+ */
+public class QueryResourcePropertiesPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements QueryResourcePropertiesPortType
+{
+
+ private static final Log LOG = LogFactory.getLog( QueryResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+
+ /**
+ * DOCUMENT_ME
+ */
+ private static final QueryEngine QUERY_ENGINE = new QueryEngineImpl();
+
+ /**
+ * Creates a new {@link QueryResourcePropertiesPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public QueryResourcePropertiesPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * Implementation of the wsrp:QueryResourceProperties operation.
+ *
+ * @param requestDoc the requestDoc XMLBean
+ *
+ * @return the response XMLBean
+ *
+ * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
+ *
+ * @throws UnknownQueryExpressionDialectFaultException
+ * if query dialect is unsupported.
+ * @throws QueryEvaluationErrorFaultException
+ * if query evaluation fails.
+ * @throws InvalidQueryExpressionFaultException
+ * if query expression is invalid.
+ */
+ public QueryResourcePropertiesResponseDocument queryResourceProperties( QueryResourcePropertiesDocument requestDoc )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.QUERY_RP_REQ,
+ requestDoc.toString() ) );
+ }
+
+ QueryResourcePropertiesResponseDocument responseDoc = createResponseDocument();
+ QueryExpressionType queryExprElem =
+ requestDoc.getQueryResourceProperties().getQueryExpression();
+ SOAPEnvelope envelope;
+ try
+ {
+ envelope = getResourceContext().getSOAPMessage().getSOAPPart().getEnvelope();
+ }
+ catch ( SOAPException soape )
+ {
+ throw new JAXRPCException( MSG.getMessage( Keys.FAILED_TO_EXTRACT_SOAP_ENV, soape ) );
+ }
+
+ XmlBeansQueryExpression queryExpr = new XmlBeansQueryExpression( queryExprElem );
+
+ refreshAllProperties();
+ Object result = null;
+ try
+ {
+ result = QUERY_ENGINE.executeQuery( queryExpr,
+ getProperties(),
+ envelope );
+ }
+ catch ( UnknownQueryExpressionDialectException uqede )
+ {
+ throw new UnknownQueryExpressionDialectFaultException( namespaces, uqede.getDialect() );
+ }
+ catch ( QueryEvaluationErrorException qeee )
+ {
+ throw new QueryEvaluationErrorFaultException(namespaces, qeee.getMessage() );
+ }
+ catch ( InvalidQueryExpressionException iqee )
+ {
+ throw new InvalidQueryExpressionFaultException(namespaces, queryExpr );
+ }
+
+ QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse responseElem =
+ responseDoc.getQueryResourcePropertiesResponse();
+ if ( result.getClass().isArray() )
+ {
+ for ( int i = 0; i < Array.getLength( result ); i++ )
+ {
+ Object resultItem = Array.get( result, i );
+ XmlObject resultXBean = null;
+ try
+ {
+ resultXBean = XmlBeanUtils.toXmlObject( resultItem );
+ }
+ catch ( Exception e )
+ {
+ throw new JAXRPCException( e );
+ }
+
+ XmlBeanUtils.addChildElement( responseElem, resultXBean );
+ }
+ }
+ else
+ {
+ XmlBeanUtils.setValue( responseElem,
+ result.toString() );
+ }
+
+ return responseDoc;
+ }
+
+ private QueryResourcePropertiesResponseDocument createResponseDocument()
+ {
+ QueryResourcePropertiesResponseDocument responseDoc =
+ QueryResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewQueryResourcePropertiesResponse();
+ return responseDoc;
+ }
+}
\ No newline at end of file
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/SetResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/SetResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/SetResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/SetResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,433 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.MetaDataViolationException;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourcePropertyMetaData;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.faults.InvalidSetResourcePropertiesRequestContentFaultException;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.resource.properties.faults.SetResourcePropertyRequestFailedFaultException;
+import org.apache.ws.resource.properties.faults.UnableToModifyResourcePropertyFaultException;
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.SetResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AnyResourcePropertyMetaData;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.SetResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.SetResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.InsertType;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.DeleteType;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.UpdateType;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * LOG-DONE An operation provider for wsrp:SetResourceProperties.
+ *
+ * @author Ian P. Springer
+ */
+public class SetResourcePropertiesPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements SetResourcePropertiesPortType
+{
+
+ private static final Log LOG = LogFactory.getLog( SetResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+
+ /**
+ * Creates a new {@link SetResourcePropertiesPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SetResourcePropertiesPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * Implementation of the wsrp:SetResourceProperties operation.
+ *
+ * @param requestDoc the requestDoc XMLBean
+ *
+ * @return the response XMLBean
+ *
+ * @throws InvalidResourcePropertyQNameFaultException
+ *
+ * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
+ *
+ */
+ public SetResourcePropertiesResponseDocument setResourceProperties( SetResourcePropertiesDocument requestDoc )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.SET_RP_REQ,
+ requestDoc.toString() ) );
+ }
+
+ SetResourcePropertiesResponseDocument responseDoc = createResponseDocument();
+ SetResourcePropertiesDocument.SetResourceProperties requestElem = requestDoc.getSetResourceProperties();
+
+ InsertType[] insertElems = requestElem.getInsertArray();
+ for ( int i = 0; i < insertElems.length; i++ )
+ {
+ insertResourceProperty( insertElems[i] );
+ }
+
+ DeleteType[] deleteElems = requestElem.getDeleteArray();
+ for ( int i = 0; i < deleteElems.length; i++ )
+ {
+ deleteResourceProperty( deleteElems[i] );
+ }
+
+ UpdateType[] updateElems = requestElem.getUpdateArray();
+ for ( int i = 0; i < updateElems.length; i++ )
+ {
+ updateResourceProperty( updateElems[i] );
+ }
+
+ return responseDoc;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param deleteElem DOCUMENT_ME
+ */
+ protected void deleteResourceProperty( DeleteType deleteElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.DEL_RP_REQ,
+ deleteElem.toString() ) );
+ }
+ QName nameOfPropToBeDeleted = deleteElem.getResourceProperty();
+ if ( nameOfPropToBeDeleted == null )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, MSG.getMessage( Keys.DEL_MISSING_RP_ATTRIB ) );
+ }
+ ResourceProperty prop = getProperties().get( nameOfPropToBeDeleted );
+ if ( prop == null )
+ {
+ if ( getProperties().getMetaData().isOpenContent() )
+ {
+ return;
+ } else
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, nameOfPropToBeDeleted );
+ }
+ }
+ throwFaultIfPropertyIsReadOnly( prop );
+ throwFaultIfDeletionViolatesSchema( prop );
+ try
+ {
+ deletePropertyCallback( prop );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException( namespaces,re.toString() );
+ }
+ Object[] oldValue = getValue( prop );
+ prop.clear();
+ Object[] newValue = null;
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param insertElem DOCUMENT_ME
+ */
+ protected void insertResourceProperty( InsertType insertElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.INSERT_RP_REQ,
+ insertElem.toString() ) );
+ }
+
+ XmlObject[] propElemsToBeInserted = XmlBeanUtils.getChildElements( insertElem );
+ if ( propElemsToBeInserted.length == 0 )
+ {
+ return; // nothing to do
+ }
+ throwFaultIfElementNamesHeterogenous( propElemsToBeInserted );
+
+ QName propName = XmlBeanUtils.getName( propElemsToBeInserted[0] );
+ ResourceProperty prop = getProperty( propName );
+
+ if(prop == null)
+ {
+ prop = createAnyProperty(propName);
+ getProperties().add(prop);
+ }
+
+ if(!prop.getMetaData().isAny())
+ {
+ //todo probably need to check this for xsd:any to check for possible violations
+ //refreshProperty( prop );
+ throwFaultIfInsertionViolatesSchema( prop, propElemsToBeInserted );
+ }
+
+ throwFaultIfPropertyIsReadOnly( prop );
+
+ try
+ {
+ insertPropertyCallback( prop, propElemsToBeInserted );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException(namespaces, re.toString() );
+ }
+
+ Object[] oldValue = getValue( prop );
+ for ( int i = 0; i < propElemsToBeInserted.length; i++ )
+ {
+ try
+ {
+ prop.add( propElemsToBeInserted[i] );
+ }
+ catch ( MetaDataViolationException mdve )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, mdve );
+ }
+ }
+ Object[] newValue = getValue( prop );
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+
+ private void firePropChangeEvent( ResourceProperty prop, Object[] oldValue, Object[] newValue )
+ {
+ prop.getChangeListener().propertyChanged( new XmlBeansResourcePropertyValueChangeEvent( oldValue, newValue ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param updateElem DOCUMENT_ME
+ */
+ protected void updateResourceProperty( UpdateType updateElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.UPDATE_RP_REQ,
+ updateElem.toString() ) );
+ }
+
+ XmlObject[] newPropElems = XmlBeanUtils.getChildElements( updateElem );
+ if ( newPropElems.length == 0 )
+ {
+ return; // nothing to do
+ }
+
+ QName propName = XmlBeanUtils.getName( newPropElems[0] );
+ ResourceProperty prop = getProperty( propName );
+
+ throwFaultIfPropertyIsReadOnly( prop );
+ throwFaultIfElementNamesHeterogenous( newPropElems );
+ throwFaultIfUpdateViolatesSchema( prop, newPropElems );
+
+ try
+ {
+ updatePropertyCallback( prop, newPropElems );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException(namespaces, re.toString() );
+ }
+
+ Object[] oldValue = getValue( prop );
+ // TODO: we might need to clone the oldValue elems, since we might be destroying them when we call clear() below
+ try
+ {
+ prop.clear();
+ for ( int i = 0; i < newPropElems.length; i++ )
+ {
+ prop.add( newPropElems[i] );
+ }
+ }
+ catch ( MetaDataViolationException mdve )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, mdve );
+ }
+ Object[] newValue = getValue( prop );
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+
+ private ResourceProperty createAnyProperty(QName propName)
+ {
+ ResourcePropertyMetaData propMetaData = new AnyResourcePropertyMetaData( propName );
+ return propMetaData.create( getProperties() );
+ }
+
+ private Object[] getValue( ResourceProperty prop )
+ {
+ Object[] value = new Object[prop.size()];
+ Iterator propElemIter = prop.iterator();
+ int i = 0;
+ while ( propElemIter.hasNext() )
+ {
+ value[i++] = propElemIter.next();
+ }
+ return value;
+ }
+
+ private ResourceProperty getProperty( QName propName )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_RP_WITH_NAME,
+ propName.toString() ) );
+ ResourceProperty prop = getProperties().get( propName );
+ if ( prop == null )
+ {
+ if ( !getProperties().getMetaData().isOpenContent() )
+ {
+ throw new InvalidResourcePropertyQNameFaultException(namespaces, propName );
+ }
+ }
+ return prop;
+ }
+
+ private void throwFaultIfElementNamesHeterogenous( XmlObject[] propElems )
+ {
+ QName firstPropElemName = XmlBeanUtils.getName( propElems[0] );
+ for ( int i = 1; i < propElems.length; i++ )
+ {
+ QName propElemName = XmlBeanUtils.getName( propElems[i] );
+ if ( !firstPropElemName.equals( propElemName ) )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, MSG.getMessage( Keys.ERROR_PROPERTY_INSERT_VIOLATES_SCHEMA,
+ ( ( propElems.length > 1 )
+ ? "s" : "" ),
+ firstPropElemName ) );
+ }
+ }
+ }
+
+ private void throwFaultIfDeletionViolatesSchema( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().getMinOccurs() != 0 )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( namespaces,MSG.getMessage( Keys.ERROR_PROPERTY_DELETE_VIOLATES_SCHEMA,
+ prop.getMetaData().getName() ) );
+ }
+ }
+
+ private void throwFaultIfInsertionViolatesSchema( ResourceProperty prop, XmlObject[] propElemsToBeInserted )
+ {
+ //todo probably need to check this for xsd:any to check for possible violations
+ if ( prop.getMetaData().getMaxOccurs() != -1 &&( prop.size() + propElemsToBeInserted.length ) > prop.getMetaData().getMaxOccurs() )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, MSG.getMessage( Keys.ERROR_PROPERTY_INSERT_VIOLATES_SCHEMA,
+ ( ( propElemsToBeInserted.length > 1 )
+ ? "s" : "" ),
+ prop.getMetaData().getName() ) );
+ }
+ }
+
+ private void throwFaultIfUpdateViolatesSchema( ResourceProperty prop, XmlObject[] newPropElems )
+ {
+ if ( prop.getMetaData().getMaxOccurs() != -1 && newPropElems.length > prop.getMetaData().getMaxOccurs() )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException(namespaces, MSG.getMessage( Keys.ERROR_PROPERTY_UPDATE_VIOLATES_SCHEMA,
+ prop.getMetaData().getName() ) );
+ }
+ }
+
+ /**
+ * Returns SetResourcePropertyCallback or null
+ *
+ * @param prop
+ *
+ * @return SetResourcePropertyCallback or null
+ */
+ private SetResourcePropertyCallback getSetResourcePropertyCallback( ResourceProperty prop )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = null;
+ ResourcePropertyCallback callBack = prop.getCallBack();
+ if ( callBack instanceof SetResourcePropertyCallback )
+ {
+ setResourcePropertyCallback = (SetResourcePropertyCallback) callBack;
+ }
+
+ return setResourcePropertyCallback;
+ }
+
+ private SetResourcePropertiesResponseDocument createResponseDocument()
+ {
+ SetResourcePropertiesResponseDocument responseDoc =
+ SetResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewSetResourcePropertiesResponse();
+ return responseDoc;
+ }
+
+ private void deletePropertyCallback( ResourceProperty prop )
+ {
+ QName nameOfPropToBeDeleted = prop.getMetaData().getName();
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.deleteProperty( nameOfPropToBeDeleted );
+ }
+ }
+
+ private void insertPropertyCallback( ResourceProperty prop,
+ XmlObject[] propElemsToBeInserted )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.insertProperty( propElemsToBeInserted );
+ }
+ }
+
+ private void throwFaultIfPropertyIsReadOnly( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().isReadOnly() )
+ {
+ throw new UnableToModifyResourcePropertyFaultException( namespaces,prop.getMetaData().getName() );
+ }
+ }
+
+ private void updatePropertyCallback( ResourceProperty prop,
+ XmlObject[] newPropElems )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.updateProperty( newPropElems );
+ }
+ }
+}
\ No newline at end of file
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/UpdateResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/UpdateResourcePropertiesPortTypeImpl.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/UpdateResourcePropertiesPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/UpdateResourcePropertiesPortTypeImpl.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,171 @@
+package org.apache.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.resource.properties.v1_2_draft05.porttype.UpdateResourcePropertiesPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.MetaDataViolationException;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.UpdateResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.UpdateResourcePropertiesDocument;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+
+/**
+ * @author Sal Campana
+ */
+public class UpdateResourcePropertiesPortTypeImpl extends AbstractResourcePropertiesPortType implements UpdateResourcePropertiesPortType
+{
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesPortTypeImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NamespaceVersionHolder namespaces = new NamespaceVersionHolderImpl() ;
+ /**
+ * Creates a new {@link AbstractResourcePropertiesPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public UpdateResourcePropertiesPortTypeImpl(ResourceContext resourceContext)
+ {
+ super(resourceContext);
+ }
+
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ * @return DOCUMENT_ME
+ */
+ public UpdateResourcePropertiesResponseDocument updateResourceProperties(UpdateResourcePropertiesDocument requestDoc)
+ {
+ return null;
+ }
+ /**
+ * DOCUMENT_ME
+ *
+ * @param updateElem DOCUMENT_ME
+ */
+ protected void updateResourceProperty( UpdateType updateElem )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.UPDATE_RP_REQ,
+ updateElem.toString() ) );
+ }
+
+ XmlObject[] newPropElems = XmlBeanUtils.getChildElements( updateElem );
+ if ( newPropElems.length == 0 )
+ {
+ return; // nothing to do
+ }
+
+ QName propName = XmlBeanUtils.getName( newPropElems[0] );
+ ResourceProperty prop = getProperty( propName );
+
+ throwFaultIfPropertyIsReadOnly( prop );
+ throwFaultIfElementNamesHeterogenous( newPropElems );
+ throwFaultIfUpdateViolatesSchema( prop, newPropElems );
+
+ try
+ {
+ updatePropertyCallback( prop, newPropElems );
+ }
+ catch ( RuntimeException re )
+ {
+ throw new SetResourcePropertyRequestFailedFaultException( re.toString() );
+ }
+
+ Object[] oldValue = getValue( prop );
+ // TODO: we might need to clone the oldValue elems, since we might be destroying them when we call clear() below
+ try
+ {
+ prop.clear();
+ for ( int i = 0; i < newPropElems.length; i++ )
+ {
+ prop.add( newPropElems[i] );
+ }
+ }
+ catch ( MetaDataViolationException mdve )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( mdve );
+ }
+ Object[] newValue = getValue( prop );
+ if ( prop.getChangeListener() != null )
+ {
+ firePropChangeEvent( prop, oldValue, newValue );
+ }
+ }
+
+ private void updatePropertyCallback( ResourceProperty prop,
+ XmlObject[] newPropElems )
+ {
+ SetResourcePropertyCallback setResourcePropertyCallback = getSetResourcePropertyCallback( prop );
+ if ( setResourcePropertyCallback != null )
+ {
+ setResourcePropertyCallback.updateProperty( newPropElems );
+ }
+ }
+ private void firePropChangeEvent( ResourceProperty prop, Object[] oldValue, Object[] newValue )
+ {
+ prop.getChangeListener().propertyChanged( new XmlBeansResourcePropertyValueChangeEvent( oldValue, newValue ) );
+ }
+ private void throwFaultIfElementNamesHeterogenous( XmlObject[] propElems )
+ {
+ QName firstPropElemName = XmlBeanUtils.getName( propElems[0] );
+ for ( int i = 1; i < propElems.length; i++ )
+ {
+ QName propElemName = XmlBeanUtils.getName( propElems[i] );
+ if ( !firstPropElemName.equals( propElemName ) )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( MSG.getMessage( Keys.ERROR_PROPERTY_INSERT_VIOLATES_SCHEMA,
+ ( ( propElems.length > 1 )
+ ? "s" : "" ),
+ firstPropElemName ) );
+ }
+ }
+ }
+ private void throwFaultIfPropertyIsReadOnly( ResourceProperty prop )
+ {
+ if ( prop.getMetaData().isReadOnly() )
+ {
+ throw new UnableToModifyResourcePropertyFaultException( prop.getMetaData().getName() );
+ }
+ }
+ private void throwFaultIfUpdateViolatesSchema( ResourceProperty prop, XmlObject[] newPropElems )
+ {
+ if ( prop.getMetaData().getMaxOccurs() != -1 && newPropElems.length > prop.getMetaData().getMaxOccurs() )
+ {
+ throw new InvalidSetResourcePropertiesRequestContentFaultException( MSG.getMessage( Keys.ERROR_PROPERTY_UPDATE_VIOLATES_SCHEMA,
+ prop.getMetaData().getName() ) );
+ }
+ }
+
+ private Object[] getValue( ResourceProperty prop )
+ {
+ Object[] value = new Object[prop.size()];
+ Iterator propElemIter = prop.iterator();
+ int i = 0;
+ while ( propElemIter.hasNext() )
+ {
+ value[i++] = propElemIter.next();
+ }
+ return value;
+ }
+ private UpdateResourcePropertiesResponseDocument createResponseDocument()
+ {
+ UpdateResourcePropertiesResponseDocument responseDoc =
+ UpdateResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewUpdateResourcePropertiesResponse();
+ return responseDoc;
+ }
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/XmlBeansResourcePropertyValueChangeEvent.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/XmlBeansResourcePropertyValueChangeEvent.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/XmlBeansResourcePropertyValueChangeEvent.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v1_2_draft05/porttype/impl/XmlBeansResourcePropertyValueChangeEvent.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004 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.ws.resource.properties.v1_2_draft05.porttype.impl;
+
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.resource.properties.ResourcePropertyValueChangeEvent;
+import org.apache.ws.resource.properties.impl.AbstractXmlBeansResourcePropertyValueChangeEvent;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.ResourcePropertyValueChangeNotificationDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.ResourcePropertyValueChangeNotificationType;
+
+/**
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public class XmlBeansResourcePropertyValueChangeEvent extends AbstractXmlBeansResourcePropertyValueChangeEvent implements ResourcePropertyValueChangeEvent, XmlObjectWrapper
+{
+ public XmlBeansResourcePropertyValueChangeEvent(Object[] oldValue, Object[] newValue)
+ {
+ super(oldValue, newValue);
+ }
+
+ protected XmlObject buildPropValueChangeNotifDocXmlBean( Object[] oldValue, Object[] newValue )
+ {
+ ResourcePropertyValueChangeNotificationDocument propValueChangeNotifDocXBean = ResourcePropertyValueChangeNotificationDocument.Factory.newInstance();
+ ResourcePropertyValueChangeNotificationType propValueChangeNotifXBean = propValueChangeNotifDocXBean.addNewResourcePropertyValueChangeNotification();
+ ResourcePropertyValueChangeNotificationType.OldValue oldValueXBean = propValueChangeNotifXBean.addNewOldValue();
+ if ( oldValue != null )
+ {
+ for ( int i = 0; i < oldValue.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( oldValueXBean, (XmlObject) oldValue[i] );
+ }
+ }
+ else
+ {
+ oldValueXBean.setNil();
+ }
+ ResourcePropertyValueChangeNotificationType.NewValue newValueXBean = propValueChangeNotifXBean.addNewNewValue();
+ if ( newValue != null )
+ {
+ for ( int i = 0; i < oldValue.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( newValueXBean, (XmlObject) newValue[i] );
+ }
+ }
+ else
+ {
+ newValueXBean.setNil();
+ }
+ return propValueChangeNotifDocXBean;
+ }
+
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/servicegroup/v1_2_draft03/ServiceGroup1_2Constants.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/servicegroup/v1_2_draft03/ServiceGroup1_2Constants.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/servicegroup/v1_2_draft03/ServiceGroup1_2Constants.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/servicegroup/v1_2_draft03/ServiceGroup1_2Constants.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.servicegroup.v1_2_draft03;
+
+/**
+ * @author Ian P. Springer
+ */
+public interface ServiceGroup1_2Constants
+{
+
+ /**
+ * Namespace URI for WS-ServiceGroup 1.2 schema.
+ */
+ String NSURI_WSSG_SCHEMA = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ServiceGroup-1.2-draft-03.xsd";
+
+ /**
+ * Namespace prefix for WS-ServiceGroup 1.2 schema.
+ */
+ String NSPREFIX_WSSG_SCHEMA = "wssg";
+
+ /**
+ * Namespace URI for WS-ServiceGroup 1.2 WSDL.
+ */
+ String NSURI_WSSG_WSDL = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ServiceGroup-1.2-draft-03.wsdl";
+
+ /**
+ * Namespace prefix for WS-ServiceGroup 1.2 WSDL.
+ */
+ String NSPREFIX_WSSG_WSDL = "wssgw";
+
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java?view=diff&r1=153951&r2=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java Tue Feb 15 12:38:57 2005
@@ -23,28 +23,21 @@
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
-import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.app.Velocity;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.ws.resource.ResourceDefinition;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.impl.ResourceDefinitionImpl;
-import org.apache.ws.resource.tool.porttype.GetMultipleResourcePropertiesPortType2JavaInfo;
-import org.apache.ws.resource.tool.porttype.GetResourcePropertyPortType2JavaInfo;
-import org.apache.ws.resource.tool.porttype.ImmediateResourceTerminationPortType2JavaInfo;
-import org.apache.ws.resource.tool.porttype.QueryResourcePropertiesPortType2JavaInfo;
-import org.apache.ws.resource.tool.porttype.ScheduledResourceTerminationPortType2JavaInfo;
-import org.apache.ws.resource.tool.porttype.SetResourcePropertiesPortType2JavaInfo;
import org.apache.ws.resource.tool.velocity.ConstQNames;
import org.apache.ws.resource.tool.velocity.ImplementsListBuilder;
import org.apache.ws.resource.tool.velocity.ServiceProperties;
import org.apache.ws.util.XmlBeanNameUtils;
-import org.apache.ws.util.velocity.CommonsLogLogSystem;
import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.velocity.CommonsLogLogSystem;
+import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.impl.common.XmlErrorPrinter;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.apache.xmlbeans.XmlObject;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
import javax.wsdl.Definition;
import javax.wsdl.Service;
@@ -54,6 +47,9 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -61,9 +57,6 @@
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import java.net.URLClassLoader;
-import java.net.URL;
-import java.net.MalformedURLException;
/**
* Generates Java Web service types and skeletons from a WSRF WSDL.
@@ -134,7 +127,7 @@
}
try
{
- cpClassLoader.loadClass( GetResourcePropertyDocument.class.getName() );
+ cpClassLoader.loadClass( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument.class.getName() );
}
catch ( ClassNotFoundException cnfe )
{
@@ -460,12 +453,26 @@
private void initPortTypeInfoMap()
{
- addPortType2JavaInfo( new GetResourcePropertyPortType2JavaInfo() );
- addPortType2JavaInfo( new GetMultipleResourcePropertiesPortType2JavaInfo() );
- addPortType2JavaInfo( new SetResourcePropertiesPortType2JavaInfo() );
- addPortType2JavaInfo( new QueryResourcePropertiesPortType2JavaInfo() );
- addPortType2JavaInfo( new ImmediateResourceTerminationPortType2JavaInfo() );
- addPortType2JavaInfo( new ScheduledResourceTerminationPortType2JavaInfo() );
+ //draft 01
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.GetResourcePropertyPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.GetMultipleResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.SetResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.QueryResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.ImmediateResourceTerminationPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft01.ScheduledResourceTerminationPortType2JavaInfo() );
+
+ //draft 05
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.GetResourcePropertyPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.GetMultipleResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.SetResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.QueryResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.ImmediateResourceTerminationPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.ScheduledResourceTerminationPortType2JavaInfo() );
+
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.InsertResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.UpdateResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.DeleteResourcePropertiesPortType2JavaInfo() );
+ addPortType2JavaInfo( new org.apache.ws.resource.tool.porttype.v1_2_draft05.GetResourcePropertyDocumentPortType2JavaInfo() );
}
private void initVelocity()
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetMultipleResourcePropertiesPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetMultipleResourcePropertiesPortType2JavaInfo.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetMultipleResourcePropertiesPortType2JavaInfo.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetMultipleResourcePropertiesPortType2JavaInfo.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,46 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.tool.porttype.v1_2_draft01;
+
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.GetMultipleResourcePropertiesPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+
+import javax.xml.namespace.QName;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class GetMultipleResourcePropertiesPortType2JavaInfo extends PortType2JavaInfo
+{
+
+ public QName getName()
+ {
+ return GetMultipleResourcePropertiesPortType.NAME;
+ }
+
+ public String getServiceInterfaceName()
+ {
+ return GetMultipleResourcePropertiesPortType.class.getName();
+ }
+
+ public String getServiceTemplateFileName()
+ {
+ return "templates/1_2_draft01/GetMultiple.txt";
+ }
+
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetResourcePropertyPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetResourcePropertyPortType2JavaInfo.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetResourcePropertyPortType2JavaInfo.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/GetResourcePropertyPortType2JavaInfo.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,57 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.tool.porttype.v1_2_draft01;
+
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.GetResourcePropertyPortType;
+import org.apache.ws.resource.PropertiesResource;
+
+import javax.xml.namespace.QName;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class GetResourcePropertyPortType2JavaInfo extends PortType2JavaInfo
+{
+
+ public QName getName()
+ {
+ return GetResourcePropertyPortType.NAME;
+ }
+
+ public String getResourceInterfaceName()
+ {
+ return PropertiesResource.class.getName();
+ }
+
+ public String getServiceInterfaceName()
+ {
+ return GetResourcePropertyPortType.class.getName();
+ }
+
+ public String getResourceTemplateFileName()
+ {
+ return "templates/PropertiesResource.txt";
+ }
+
+ public String getServiceTemplateFileName()
+ {
+ return "templates/1_2_draft01/GetResource.txt";
+ }
+
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/ImmediateResourceTerminationPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/ImmediateResourceTerminationPortType2JavaInfo.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/ImmediateResourceTerminationPortType2JavaInfo.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/ImmediateResourceTerminationPortType2JavaInfo.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,49 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.tool.porttype.v1_2_draft01;
+
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.v1_2_draft01.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.lifetime.v1_2_draft01.porttype.ImmediateResourceTerminationPortType;
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.GetResourcePropertyPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+
+import javax.xml.namespace.QName;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class ImmediateResourceTerminationPortType2JavaInfo extends PortType2JavaInfo
+{
+
+ public QName getName()
+ {
+ return ImmediateResourceTerminationPortType.NAME;
+ }
+
+ public String getServiceInterfaceName()
+ {
+ return ImmediateResourceTerminationPortType.class.getName();
+ }
+
+ public String getServiceTemplateFileName()
+ {
+ return "templates/1_2_draft01/ImmediateResourceTermination.txt";
+ }
+
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/QueryResourcePropertiesPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/QueryResourcePropertiesPortType2JavaInfo.java?view=auto&rev=153952
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/QueryResourcePropertiesPortType2JavaInfo.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/porttype/v1_2_draft01/QueryResourcePropertiesPortType2JavaInfo.java Tue Feb 15 12:38:57 2005
@@ -0,0 +1,46 @@
+/*=============================================================================*
+ * Copyright 2004 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.ws.resource.tool.porttype.v1_2_draft01;
+
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.QueryResourcePropertiesPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+
+import javax.xml.namespace.QName;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class QueryResourcePropertiesPortType2JavaInfo extends PortType2JavaInfo
+{
+
+ public QName getName()
+ {
+ return QueryResourcePropertiesPortType.NAME;
+ }
+
+ public String getServiceInterfaceName()
+ {
+ return QueryResourcePropertiesPortType.class.getName();
+ }
+
+ public String getServiceTemplateFileName()
+ {
+ return "templates/1_2_draft01/Query.txt";
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org