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 ip...@apache.org on 2004/12/13 23:31:01 UTC

svn commit: r111752 - in incubator/apollo/trunk: examples/filesystem/src/example/filesystem examples/filesystem/src/example/filesystem/callback src/java/org/apache/ws/resource/i18n src/java/org/apache/ws/resource/properties/faults src/java/org/apache/ws/resource/properties/impl src/java/org/apache/ws/util src/test/org/apache/ws/resource/properties src/test/org/apache/ws/resource/properties/porttype/impl

Author: ips
Date: Mon Dec 13 14:31:01 2004
New Revision: 111752

URL: http://svn.apache.org/viewcvs?view=rev&rev=111752
Log:
various

Added:
   incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanNameUtils.java
Modified:
   incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java
   incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java
   incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
   incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java
   incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java
   incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java
   incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java

Modified: incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java?view=diff&rev=111752&p1=incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java&r1=111751&p2=incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java	(original)
+++ incubator/apollo/trunk/examples/filesystem/src/example/filesystem/FileSystemHome.java	Mon Dec 13 14:31:01 2004
@@ -17,6 +17,11 @@
 
 import example.filesystem.backend.FileSystem;
 import example.filesystem.backend.UnixFileSystem;
+import example.filesystem.callback.BackupFrequencyCallback;
+import example.filesystem.callback.CommentCallback;
+import example.filesystem.callback.FsckPassNumberCallback;
+import example.filesystem.callback.OptionsCallback;
+import example.filesystem.callback.MountPointCallback;
 import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.ResourceContextException;
@@ -42,107 +47,118 @@
 
 /**
  * Home for FileSystem WS-Resources.
- *
+ * <p/>
  * NOTE: This class is generated and is NOT meant to be modified.
  *
  * @author Sal Campana, Ian P. Springer
  */
 public class FileSystemHome
-   extends AbstractResourceHome
-   implements ResourceFactory,
-              Serializable
+        extends AbstractResourceHome
+        implements ResourceFactory,
+        Serializable
 {
-   private FileSystem m_fileSystem = new UnixFileSystem();
+    private FileSystem m_fileSystem = new UnixFileSystem();
 
-   /**
-    * DOCUMENT_ME
-    *
-    * @param resourceContext DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    *
-    * @throws ResourceException        DOCUMENT_ME
-    * @throws ResourceContextException DOCUMENT_ME
-    * @throws ResourceUnknownException DOCUMENT_ME
-    */
-   public Resource getInstance( ResourceContext resourceContext )
-   throws ResourceException, 
-          ResourceContextException, 
-          ResourceUnknownException
-   {
-      ResourceKey key      = resourceContext.getResourceKey(  );
-      Resource    resource = null;
-      try
-      {
-         resource = find( key );
-      }
-      catch ( ResourceException re )
-      {
-         Object id = key.getValue(  );
-         if ( id.equals( "1234" ) || id.equals( "5678" ) )
-         {
-            try
+    /**
+     * DOCUMENT_ME
+     *
+     * @param resourceContext DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     *
+     * @throws ResourceException        DOCUMENT_ME
+     * @throws ResourceContextException DOCUMENT_ME
+     * @throws ResourceUnknownException DOCUMENT_ME
+     */
+    public Resource getInstance( ResourceContext resourceContext )
+            throws ResourceException,
+            ResourceContextException,
+            ResourceUnknownException
+    {
+        ResourceKey key = resourceContext.getResourceKey();
+        Resource resource = null;
+        try
+        {
+            resource = find( key );
+        }
+        catch ( ResourceException re )
+        {
+            Object id = key.getValue();
+            if ( id.equals( "1234" ) || id.equals( "5678" ) )
             {
-                FileSystemPropertiesDocument propDoc = FileSystemPropertiesDocument.Factory.newInstance();
-                ResourcePropertySet propSet = new XmlBeansResourcePropertySet( propDoc );
-                initProperties(propSet);
-                resource = createInstance( key, propSet );
+                try
+                {
+                    FileSystemPropertiesDocument propDoc = FileSystemPropertiesDocument.Factory.newInstance();
+                    ResourcePropertySet propSet = new XmlBeansResourcePropertySet( propDoc );
+                    initProperties( propSet );
+                    resource = createInstance( key, propSet );
+                }
+                catch ( Exception e )
+                {
+                    throw new ResourceException( e );
+                }
+                add( key, resource );
             }
-            catch ( Exception e )
+            else
             {
-               throw new ResourceException( e );
+                throw new ResourceUnknownException( id,
+                        resourceContext.getServiceName() );
             }
-            add( key, resource );
-         }
-         else
-         {
-            throw new ResourceUnknownException( id,
-                                                resourceContext.getServiceName(  ) );
-         }
-      }
-      return resource;
-   }
+        }
+        return resource;
+    }
 
     /**
      * Method to initialize the ResourceProperies with the values from the backend.
      *
      * @param propSet
      */
-    private void initProperties(ResourcePropertySet propSet)
+    private void initProperties( ResourcePropertySet propSet )
     {
-        ResourceProperty resourceProperty = propSet.get(FileSystemPropertyQNames.BACKUP_FREQUENCY);
-        BackupFrequencyDocument o = BackupFrequencyDocument.Factory.newInstance();
-        o.setBackupFrequency(m_fileSystem.getBackupFrequency());
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.COMMENT);
-        CommentDocument comment = CommentDocument.Factory.newInstance();
-        comment.setComment(m_fileSystem.getComment());
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.DEVICE_SPECIAL_FILE);
-        DeviceSpecialFileDocument deviceDoc = DeviceSpecialFileDocument.Factory.newInstance();
-        deviceDoc.setDeviceSpecialFile(m_fileSystem.getDeviceSpecialFile());
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.FSCK_PASS_NUMBER);
-        FsckPassNumberDocument fsck = FsckPassNumberDocument.Factory.newInstance();
-        fsck.setFsckPassNumber(m_fileSystem.getFsckPassNumber());
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.MOUNT_POINT_DIR);
-        MountPointDirectoryDocument mountPt = MountPointDirectoryDocument.Factory.newInstance();
-        mountPt.setMountPointDirectory(m_fileSystem.getMountPoint());
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.OPTIONS);
-        OptionsDocument optionsDoc = OptionsDocument.Factory.newInstance();
-        org.apache.ws.resource.example.filesystem.OptionsDocument.Options options = optionsDoc.addNewOptions();
+        ResourceProperty prop = propSet.get( FileSystemPropertyQNames.DEVICE_SPECIAL_FILE );
+        DeviceSpecialFileDocument deviceDocXBean = DeviceSpecialFileDocument.Factory.newInstance();
+        deviceDocXBean.setDeviceSpecialFile( m_fileSystem.getDeviceSpecialFile() );
+        prop.add( deviceDocXBean );
+
+        prop = propSet.get( FileSystemPropertyQNames.TYPE );
+        TypeDocument typeDocXBean = TypeDocument.Factory.newInstance();
+        typeDocXBean.setType( m_fileSystem.getType() );
+        prop.add( typeDocXBean );
+
+        BackupFrequencyDocument backupDocXBean = BackupFrequencyDocument.Factory.newInstance();
+        backupDocXBean.setBackupFrequency( m_fileSystem.getBackupFrequency() );
+        prop = propSet.get( FileSystemPropertyQNames.BACKUP_FREQUENCY );
+        prop.add( backupDocXBean );
+        prop.setCallback( new BackupFrequencyCallback( m_fileSystem ) );
+
+        CommentDocument commentDocXBean = CommentDocument.Factory.newInstance();
+        commentDocXBean.setComment( m_fileSystem.getComment() );
+        prop = propSet.get( FileSystemPropertyQNames.COMMENT );
+        prop.add( commentDocXBean );
+        prop.setCallback( new CommentCallback( m_fileSystem ) );
+
+        FsckPassNumberDocument fsckDocXBean = FsckPassNumberDocument.Factory.newInstance();
+        fsckDocXBean.setFsckPassNumber( m_fileSystem.getFsckPassNumber() );
+        prop = propSet.get( FileSystemPropertyQNames.FSCK_PASS_NUMBER );
+        prop.add( fsckDocXBean );
+        prop.setCallback( new FsckPassNumberCallback( m_fileSystem ) );
+
+        MountPointDirectoryDocument mountPointDocXBean = MountPointDirectoryDocument.Factory.newInstance();
+        mountPointDocXBean.setMountPointDirectory( m_fileSystem.getMountPoint() );
+        prop = propSet.get( FileSystemPropertyQNames.MOUNT_POINT_DIR );
+        prop.add( mountPointDocXBean );
+        prop.setCallback( new MountPointCallback( m_fileSystem ) );
+
+        OptionsDocument optionsDocXBean = OptionsDocument.Factory.newInstance();
+        org.apache.ws.resource.example.filesystem.OptionsDocument.Options options = optionsDocXBean.addNewOptions();
         List backendOptions = m_fileSystem.getOptions();
-        for (int i = 0; i < backendOptions.size(); i++)
+        for ( int i = 0; i < backendOptions.size(); i++ )
         {
-            options.addOption((String) backendOptions.get(i));
+            options.addOption( (String) backendOptions.get( i ) );
         }
-
-
-        resourceProperty = propSet.get(FileSystemPropertyQNames.TYPE);
-        TypeDocument type = TypeDocument.Factory.newInstance();
-        type.setType(m_fileSystem.getType());
+        prop = propSet.get( FileSystemPropertyQNames.OPTIONS );
+        prop.add( optionsDocXBean );
+        prop.setCallback( new OptionsCallback( m_fileSystem ) );
 
     }
 

Modified: incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java?view=diff&rev=111752&p1=incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java&r1=111751&p2=incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java	(original)
+++ incubator/apollo/trunk/examples/filesystem/src/example/filesystem/callback/CommentCallback.java	Mon Dec 13 14:31:01 2004
@@ -1,50 +1,44 @@
 package example.filesystem.callback;
 
-import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import example.filesystem.backend.FileSystem;
 import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.ws.resource.example.filesystem.CommentDocument;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.xmlbeans.XmlString;
 
 import javax.xml.namespace.QName;
 
-import example.filesystem.backend.FileSystem;
-
-
 /**
- * @author Sal Campana
+ * Callback for the fs:Callback RP.
  */
-public class CommentCallback  implements SetResourcePropertyCallback
+public class CommentCallback implements SetResourcePropertyCallback
 {
     FileSystem m_fileSystem;
 
-    public CommentCallback(FileSystem fileSystem)
+    public CommentCallback( FileSystem fileSystem )
     {
         m_fileSystem = fileSystem;
     }
 
-    public void deleteProperty(QName propQName)
+    public void deleteProperty( QName propQName )
     {
-       //can't delete!
-        throw new UnsupportedOperationException("Min Occurs is !, You cannot Delete!");
+        return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
     }
 
-    public void insertProperty(Object[] prop)
+    public void insertProperty( Object[] propElems )
     {
-        for (int i = 0; i < prop.length; i++)
-        {
-            CommentDocument o = (CommentDocument) prop[i];
-            m_fileSystem.setComment(o.getComment());
-        }
+        XmlString xString = (XmlString) propElems[0];
+        m_fileSystem.setComment( xString.getStringValue() );
     }
 
-    public void updateProperty(Object[] prop)
+    public void updateProperty( Object[] prop )
     {
-       insertProperty(prop);
+        insertProperty( prop );
     }
 
-    public ResourceProperty refreshProperty(ResourceProperty prop)
+    public ResourceProperty refreshProperty( ResourceProperty prop )
     {
-        CommentDocument o = (CommentDocument) prop.get(0);
-        o.setComment(m_fileSystem.getComment());
+        XmlString xString = (XmlString) prop.get( 0 );
+        xString.setStringValue( m_fileSystem.getComment() );
         return prop;
     }
 }

Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java&r1=111751&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java	Mon Dec 13 14:31:01 2004
@@ -85,7 +85,7 @@
     String EXPECTED_ADDRESSING_HEADER = "EXPECTED_ADDRESSING_HEADER";
 
     /**
-     * @msg  dialect
+     * @msg Dialect: {0}
      */
     String DIALECT = "DIALECT";
 

Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java&r1=111751&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/UnknownQueryExpressionDialectFaultException.java	Mon Dec 13 14:31:01 2004
@@ -16,51 +16,50 @@
 package org.apache.ws.resource.properties.faults;
 
 import org.apache.ws.resource.faults.BaseFaultException;
-import org.apache.ws.resource.properties.ResourceProperties1_2Constants;
 import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.properties.ResourceProperties1_2Constants;
 
 import javax.xml.namespace.QName;
 import java.net.URI;
 
 /**
- * LOG-DONE
- * WS-ResourceProperties UnknownQueryExpressionDialect fault type implemented as a Java exception.
+ * LOG-DONE WS-ResourceProperties UnknownQueryExpressionDialect fault type implemented as a Java exception.
  *
  * @author Ian P. Springer
  */
 public class UnknownQueryExpressionDialectFaultException
-   extends BaseFaultException
+        extends BaseFaultException
 {
-   /**
-    * DOCUMENT_ME
-    */
-   private static final QName NAME =
-      new QName( ResourceProperties1_2Constants.NSURI_WSRP_SCHEMA, "UnknownQueryExpressionDialectFault",
-                 ResourceProperties1_2Constants.NSPREFIX_WSRP_SCHEMA );
-   private URI                m_dialect;
+    /**
+     * DOCUMENT_ME
+     */
+    private static final QName NAME =
+            new QName( ResourceProperties1_2Constants.NSURI_WSRP_SCHEMA, "UnknownQueryExpressionDialectFault",
+                    ResourceProperties1_2Constants.NSPREFIX_WSRP_SCHEMA );
+    private URI m_dialect;
 
-   /**
-    * Constructs a new BaseFaultException with the specified SOAP message and actor.
-    *
-    * @param dialect the URI of the unsupported dialect
-    */
-   public UnknownQueryExpressionDialectFaultException( URI dialect )
-   {
-      super( NAME );
-      m_dialect = dialect;
-      setDescription( new String[]
-                      {
-                         MSG.getMessage( Keys.DIALECT + ": " + dialect)
-                      } );
-   }
+    /**
+     * Constructs a new BaseFaultException with the specified SOAP message and actor.
+     *
+     * @param dialect the URI of the unsupported dialect
+     */
+    public UnknownQueryExpressionDialectFaultException( URI dialect )
+    {
+        super( NAME );
+        m_dialect = dialect;
+        setDescription( new String[]
+        {
+            MSG.getMessage( Keys.DIALECT, dialect )
+        } );
+    }
 
-   /**
-    * Returns the URI of the unsupported dialect.
-    *
-    * @return the URI of the unsupported dialect
-    */
-   public URI getDialect(  )
-   {
-      return m_dialect;
-   }
+    /**
+     * Returns the URI of the unsupported dialect.
+     *
+     * @return the URI of the unsupported dialect
+     */
+    public URI getDialect()
+    {
+        return m_dialect;
+    }
 }

Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java&r1=111751&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourceProperty.java	Mon Dec 13 14:31:01 2004
@@ -27,6 +27,7 @@
 import org.apache.ws.util.i18n.Messages;
 import org.apache.xmlbeans.XmlAnySimpleType;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
 import org.w3c.dom.Element;
 import javax.xml.soap.SOAPElement;
 import java.util.ArrayList;
@@ -304,9 +305,8 @@
       for ( int i = 0; i < m_propElems.size(  ); i++ )
       {
          XmlObject propXBean = (XmlObject) m_propElems.get( i );
-         buf.append( propXBean.toString(  ) );
+         buf.append( propXBean.xmlText( new XmlOptions().setSaveOuter().setSavePrettyPrint() ) );
       }
-
       return buf.toString(  );
    }
 

Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java&r1=111751&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java	Mon Dec 13 14:31:01 2004
@@ -16,305 +16,350 @@
 package org.apache.ws.resource.properties.impl;
 
 import org.apache.commons.lang.SerializationException;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.ResourcePropertyMetaData;
 import org.apache.ws.resource.properties.ResourcePropertySet;
 import org.apache.ws.resource.properties.ResourcePropertySetMetaData;
-import org.apache.ws.resource.i18n.MessagesImpl;
-import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.util.XmlBeanNameUtils;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.xmlbeans.SchemaProperty;
 import org.apache.xmlbeans.XmlObject;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPElement;
+import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
 /**
- * LOG-DONE
- * An Apache XMLBeans-based implementation of a resource property set.
+ * LOG-DONE An Apache XMLBeans-based implementation of a resource property set.
  *
  * @author Ian P. Springer
  */
 public class XmlBeansResourcePropertySet
-   implements ResourcePropertySet
+        implements ResourcePropertySet
 {
 
     private static final Log LOG = LogFactory.getLog( XmlBeansResourcePropertySet.class );
     private static final Messages MSG = MessagesImpl.getInstance();
 
-    private XmlObject                   m_propsDocXBean;
-   private XmlObject                   m_propsXBean;
-   private Document                    m_propsDocDOM;
-   private Map                         m_propsMap = new HashMap(  );
-   private ResourcePropertySetMetaData m_metaData;
-
-   /**
-    * Creates a new {@link XmlBeansResourcePropertySet} object.
-    *
-    * @param propsDocXBean DOCUMENT_ME
-    */
-   public XmlBeansResourcePropertySet( XmlObject propsDocXBean )
-   throws MetaDataViolationException
-   {
-      if ( !XmlBeanUtils.isDocument( propsDocXBean ) )
-      {
-         throw new IllegalArgumentException( MSG.getMessage( Keys.XMLOBJECT_DOC, propsDocXBean.getClass().getName() ));
-      }
-
-      m_propsDocXBean    = propsDocXBean;
-      m_propsXBean       = XmlBeanUtils.getRootElement( m_propsDocXBean );
-      m_metaData         = new XmlBeansResourcePropertySetMetaData( m_propsDocXBean.schemaType(  ) );
-      initProperties(  );
-   }
-
-   /**
-    * @return
-    */
-   public boolean isEmpty(  )
-   {
-      return m_propsMap.isEmpty(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public ResourcePropertySetMetaData getMetaData(  )
-   {
-      return m_metaData;
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param prop DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public boolean add( ResourceProperty prop )
-   throws MetaDataViolationException
-   {
-      if ( !m_metaData.isOpenContent(  ) )
-      {
-         throw new MetaDataViolationException( MSG.getMessage( Keys.NON_ANY_PROP_CANNOT_BE_REMOVED) );
-      }
-
-      if ( m_propsMap.containsKey( prop.getMetaData(  ).getName(  ) ) )
-      {
-         throw new MetaDataViolationException( MSG.getMessage( Keys.PROP_DOC_ALREADY_CONTAINS_PROPERTY,prop.getMetaData(  ).getName(  )));
-      }
-
-      addProperty( prop );
-      return true;
-   }
-
-   /**
-    * @throws MetaDataViolationException
-    */
-   public void clear(  )
-   throws MetaDataViolationException
-   {
-      LOG.debug(MSG.getMessage( Keys.CLEAR_PROP_SET));
-      Collection props = m_propsMap.values(  );
-      for ( Iterator iterator = props.iterator(  ); iterator.hasNext(  ); )
-      {
-         ResourceProperty prop = (ResourceProperty) iterator.next(  );
-         prop.clear(  );
-         m_propsMap.remove( prop.getMetaData(  ).getName(  ) );
-      }
-   }
-
-   /**
-    * A factory method for creating
-    *
-    * @param metaData
-    *
-    * @return
-    */
-   public ResourceProperty create( ResourcePropertyMetaData metaData )
-   {
-      return new XmlBeansResourceProperty( metaData, this );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param propName DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public ResourceProperty get( QName propName )
-   {
-      return (ResourceProperty) m_propsMap.get( propName );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public Iterator iterator(  )
-   {
-      return m_propsMap.values(  ).iterator(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param propName DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public boolean remove( QName propName )
-   throws MetaDataViolationException
-   {
-      if ( !m_metaData.isOpenContent(  ) )
-      {
-         throw new MetaDataViolationException( MSG.getMessage( Keys.NON_ANY_PROP_CANNOT_BE_REMOVED) );
-      }
-      LOG.debug(MSG.getMessage( Keys.REMOVING_PROP,propName.toString()));
-      ResourceProperty resourceProp = (ResourceProperty) m_propsMap.get( propName );
-      resourceProp.clear(  );
-      m_propsMap.remove( propName );
-      return true;
-   }
-
-   /**
-    * @return
-    */
-   public int size(  )
-   {
-      return m_propsMap.size(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    *
-    * @throws SerializationException DOCUMENT_ME
-    */
-   public Element toElement(  )
-   throws SerializationException
-   {
-      // TODO: should this method return a Document instead of an Element?
-      synchronized ( this )
-      {
-         if ( m_propsDocDOM == null )
-         {
-            m_propsDocDOM = (Document) m_propsDocXBean.newDomNode(  ); // create and cache
-         }
-      }
-
-      return m_propsDocDOM.getDocumentElement(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    *
-    * @throws SerializationException DOCUMENT_ME
-    */
-   public SOAPElement toSOAPElement(  )
-   throws SerializationException
-   {
-      try
-      {
-         return XmlBeanUtils.toSOAPElement( m_propsXBean );
-      }
-      catch ( Exception e )
-      {
-         throw new SerializationException( e );
-      }
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public String toString(  )
-   {
-      return toXML(  );
-   }
-
-   /**
-    * @return
-    */
-   public String toXML(  )
-   {
-      return m_propsDocXBean.toString(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public XmlObject toXmlObject(  )
-   {
-      return m_propsDocXBean;
-   }
-
-   private ResourceProperty addProperty( ResourceProperty prop )
-   {
-      Iterator iter = prop.iterator(  );
-      while ( iter.hasNext(  ) )
-      {
-         XmlObject propElemXBean = (XmlObject) iter.next(  );
-         XmlBeanUtils.addChildElement( m_propsDocXBean, propElemXBean );
-      }
-
-      addPropertyToMap( prop );
-      return prop;
-   }
-
-   private void addPropertyToMap( ResourceProperty resourceProp )
-   {
-       QName name = resourceProp.getMetaData(  ).getName(  );
-       LOG.debug(MSG.getMessage( Keys.ADDING_PROP, name.toString()));
-      m_propsMap.put( name,
-                      resourceProp );
-   }
-
-   private XmlBeansResourceProperty createProperty( SchemaProperty elemSchemaProp,
-                                                    boolean        isReadOnly )
-   {
-      return new XmlBeansResourceProperty( new XmlBeansResourcePropertyMetaData( elemSchemaProp, isReadOnly ),
-                                           this );
-   }
-
-   private void initProperties(  )
-   throws MetaDataViolationException
-   {
-      SchemaProperty[] propElemDefs = m_propsXBean.schemaType(  ).getElementProperties(  );
-      for ( int i = 0; i < propElemDefs.length; i++ )
-      {
-         XmlBeansResourceProperty prop = createProperty( propElemDefs[i], false );
-         populateProperty( prop );
-         addPropertyToMap( prop );
-      }
-   }
-
-   private void populateProperty( XmlBeansResourceProperty prop )
-   throws MetaDataViolationException
-   {
-      XmlObject[] propXBeans = XmlBeanUtils.getChildElements( m_propsXBean,
-                                                              prop.getMetaData(  ).getName(  ) );
-      for ( int j = 0; j < propXBeans.length; j++ )
-      {
-         prop.load( propXBeans[j] );
-      }
-   }
+    private XmlObject m_propsDocXBean;
+    private XmlObject m_propsXBean;
+    private Document m_propsDocDOM;
+    private Map m_propsMap = new HashMap();
+    private ResourcePropertySetMetaData m_metaData;
+
+    /**
+     * Creates a new {@link XmlBeansResourcePropertySet} object.
+     *
+     * @param propsDocXBean DOCUMENT_ME
+     */
+    public XmlBeansResourcePropertySet( XmlObject propsDocXBean )
+            throws MetaDataViolationException
+    {
+        if ( !XmlBeanUtils.isDocument( propsDocXBean ) )
+        {
+            throw new IllegalArgumentException( MSG.getMessage( Keys.XMLOBJECT_DOC, propsDocXBean.getClass().getName() ) );
+        }
+
+        m_propsDocXBean = propsDocXBean;
+        m_propsXBean = getPropsDocRootElem();
+        m_metaData = new XmlBeansResourcePropertySetMetaData( m_propsDocXBean.schemaType() );
+        initProperties();
+    }
+
+    /**
+     * Gets the XmlBean Java classname representing the resource property document.
+     *
+     * @param resourcePropsDocElemQName the QName of the resource property document
+     *
+     * @return XmlBean classname that represents the resource property document
+     */
+    protected String getPropsDocClassName( QName resourcePropsDocElemQName )
+    {
+        String resourcePropertiesClassName =
+                XmlBeanNameUtils.getElementXmlBeanClassName( resourcePropsDocElemQName );
+
+        if ( resourcePropertiesClassName == null )
+        {
+            throw new NoClassDefFoundError( "Could not determine name of the Resource Properties Document XML Bean class for document element: "
+                    + resourcePropsDocElemQName );
+        }
+
+        return resourcePropertiesClassName;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isEmpty()
+    {
+        return m_propsMap.isEmpty();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public ResourcePropertySetMetaData getMetaData()
+    {
+        return m_metaData;
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param prop DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public boolean add( ResourceProperty prop )
+            throws MetaDataViolationException
+    {
+        if ( !m_metaData.isOpenContent() )
+        {
+            throw new MetaDataViolationException( MSG.getMessage( Keys.NON_ANY_PROP_CANNOT_BE_REMOVED ) );
+        }
+
+        if ( m_propsMap.containsKey( prop.getMetaData().getName() ) )
+        {
+            throw new MetaDataViolationException( MSG.getMessage( Keys.PROP_DOC_ALREADY_CONTAINS_PROPERTY, prop.getMetaData().getName() ) );
+        }
+
+        addProperty( prop );
+        return true;
+    }
+
+    /**
+     * @throws MetaDataViolationException
+     */
+    public void clear()
+            throws MetaDataViolationException
+    {
+        LOG.debug( MSG.getMessage( Keys.CLEAR_PROP_SET ) );
+        Collection props = m_propsMap.values();
+        for ( Iterator iterator = props.iterator(); iterator.hasNext(); )
+        {
+            ResourceProperty prop = (ResourceProperty) iterator.next();
+            prop.clear();
+            m_propsMap.remove( prop.getMetaData().getName() );
+        }
+    }
+
+    /**
+     * A factory method for creating
+     *
+     * @param metaData
+     *
+     * @return
+     */
+    public ResourceProperty create( ResourcePropertyMetaData metaData )
+    {
+        return new XmlBeansResourceProperty( metaData, this );
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public ResourceProperty get( QName propName )
+    {
+        return (ResourceProperty) m_propsMap.get( propName );
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public Iterator iterator()
+    {
+        return m_propsMap.values().iterator();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public boolean remove( QName propName )
+            throws MetaDataViolationException
+    {
+        if ( !m_metaData.isOpenContent() )
+        {
+            throw new MetaDataViolationException( MSG.getMessage( Keys.NON_ANY_PROP_CANNOT_BE_REMOVED ) );
+        }
+        LOG.debug( MSG.getMessage( Keys.REMOVING_PROP, propName.toString() ) );
+        ResourceProperty resourceProp = (ResourceProperty) m_propsMap.get( propName );
+        resourceProp.clear();
+        m_propsMap.remove( propName );
+        return true;
+    }
+
+    /**
+     * @return
+     */
+    public int size()
+    {
+        return m_propsMap.size();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     *
+     * @throws SerializationException DOCUMENT_ME
+     */
+    public Element toElement()
+            throws SerializationException
+    {
+        // TODO: should this method return a Document instead of an Element?
+        synchronized ( this )
+        {
+            if ( m_propsDocDOM == null )
+            {
+                m_propsDocDOM = (Document) m_propsDocXBean.newDomNode(); // create and cache
+            }
+        }
+
+        return m_propsDocDOM.getDocumentElement();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     *
+     * @throws SerializationException DOCUMENT_ME
+     */
+    public SOAPElement toSOAPElement()
+            throws SerializationException
+    {
+        try
+        {
+            return XmlBeanUtils.toSOAPElement( m_propsXBean );
+        }
+        catch ( Exception e )
+        {
+            throw new SerializationException( e );
+        }
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public String toString()
+    {
+        return toXML();
+    }
+
+    /**
+     * @return
+     */
+    public String toXML()
+    {
+        return m_propsDocXBean.toString();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public XmlObject toXmlObject()
+    {
+        return m_propsDocXBean;
+    }
+
+    private ResourceProperty addProperty( ResourceProperty prop )
+    {
+        Iterator iter = prop.iterator();
+        while ( iter.hasNext() )
+        {
+            XmlObject propElemXBean = (XmlObject) iter.next();
+            XmlBeanUtils.addChildElement( m_propsDocXBean, propElemXBean );
+        }
+
+        addPropertyToMap( prop );
+        return prop;
+    }
+
+    private void addPropertyToMap( ResourceProperty resourceProp )
+    {
+        QName name = resourceProp.getMetaData().getName();
+        LOG.debug( MSG.getMessage( Keys.ADDING_PROP, name.toString() ) );
+        m_propsMap.put( name,
+                resourceProp );
+    }
+
+    private XmlBeansResourceProperty createProperty( SchemaProperty elemSchemaProp,
+                                                     boolean isReadOnly )
+    {
+        return new XmlBeansResourceProperty( new XmlBeansResourcePropertyMetaData( elemSchemaProp, isReadOnly ),
+                this );
+    }
+
+    private void initProperties()
+            throws MetaDataViolationException
+    {
+        SchemaProperty[] propElemDefs = m_propsXBean.schemaType().getElementProperties();
+        for ( int i = 0; i < propElemDefs.length; i++ )
+        {
+            XmlBeansResourceProperty prop = createProperty( propElemDefs[i], false );
+            populateProperty( prop );
+            addPropertyToMap( prop );
+        }
+    }
+
+    private void populateProperty( XmlBeansResourceProperty prop )
+            throws MetaDataViolationException
+    {
+        XmlObject[] propXBeans = XmlBeanUtils.getChildElements( m_propsXBean,
+                prop.getMetaData().getName() );
+        for ( int j = 0; j < propXBeans.length; j++ )
+        {
+            prop.load( propXBeans[j] );
+        }
+    }
+
+    private XmlObject getPropsDocRootElem()
+    {
+        XmlObject propsXBean = XmlBeanUtils.getRootElement( m_propsDocXBean );
+        if ( propsXBean == null )
+        {
+            // user did not initialize the props doc root element, so do it for them...
+            String propsElemJavaPropName = m_propsDocXBean.schemaType().getElementProperties()[0].getJavaPropertyName();
+            try
+            {
+                Method addNewMethod = m_propsDocXBean.getClass().getMethod( "addNew" + propsElemJavaPropName, new Class[0] );
+                propsXBean = (XmlObject) addNewMethod.invoke( m_propsDocXBean, new Object[0] );
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+                throw new RuntimeException( e );
+            }
+        }
+        return propsXBean;
+    }
+
 }

Added: incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanNameUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanNameUtils.java?view=auto&rev=111752
==============================================================================
--- (empty file)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanNameUtils.java	Mon Dec 13 14:31:01 2004
@@ -0,0 +1,80 @@
+/*=============================================================================*
+ *  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.util;
+
+import org.apache.xmlbeans.impl.common.NameUtil;
+
+import javax.xml.namespace.QName;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer
+ */
+public class XmlBeanNameUtils
+{
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propsDocElemQName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public static String getElementXmlBeanClassName( final QName propsDocElemQName )
+    {
+       return getDocumentElementXmlBeanClassName( propsDocElemQName ) + "."
+              + getElementXmlBeanUnqualifiedClassName( propsDocElemQName );
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propsDocElemQName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public static String getElementXmlBeanUnqualifiedClassName( QName propsDocElemQName )
+    {
+       String props_xml_bean_class_name = NameUtil.getClassNameFromQName( propsDocElemQName );
+       return props_xml_bean_class_name.substring( props_xml_bean_class_name.lastIndexOf( '.' ) + 1 );
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propsDocElemQName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public static String getDocumentElementXmlBeanClassName( QName propsDocElemQName )
+    {
+       return NameUtil.getClassNameFromQName( propsDocElemQName ) + "Document";
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param propsDocElemQName DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public static String getDocumentElementXmlBeanFactoryClassName( QName propsDocElemQName )
+    {
+       return getDocumentElementXmlBeanClassName( propsDocElemQName ) + "$Factory";
+    }
+
+}

Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java&r1=111751&p2=incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java	Mon Dec 13 14:31:01 2004
@@ -173,15 +173,20 @@
         if ( isDocument( docXBean ) )
         {
             XmlCursor xCursor = docXBean.newCursor();
-            xCursor.toFirstChild();
-            rootElemXBean = xCursor.getObject();
+            if ( xCursor.toFirstChild() )
+            {
+               rootElemXBean = xCursor.getObject();
+            }
+            else
+            {
+               rootElemXBean = null;
+            }
             xCursor.dispose();
         }
         else
         {
             rootElemXBean = docXBean;
         }
-
         return rootElemXBean;
     }
 
@@ -436,4 +441,5 @@
 
         return xBean;
     }
-}
\ No newline at end of file
+
+}

Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java&r1=111751&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java	(original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiCallback.java	Mon Dec 13 14:31:01 2004
@@ -12,13 +12,18 @@
 public class SushiCallback implements SetResourcePropertyCallback
 {
     private SushiPlate m_plate;
-    boolean m_deleteInvoked, m_insertInvoked, m_updateInvoked;
+    private boolean m_deleteInvoked, m_insertInvoked, m_updateInvoked;
 
     public SushiCallback( SushiPlate plate )
     {
         m_plate = plate;
     }
 
+    public SushiPlate getPlate()
+    {
+        return m_plate;
+    }
+
     public ResourceProperty refreshProperty( ResourceProperty prop )
     {
         QName propName = getPropName( prop );
@@ -29,9 +34,8 @@
             String pieces = ebi.getNumberOfPieces();
             try
             {
-                XmlIntImpl xmlstring = (XmlIntImpl) prop.get( 0 );
-                XmlBeanUtils.setValue( xmlstring, pieces );
-
+                XmlIntImpl ebiElem = (XmlIntImpl) prop.get( 0 );
+                XmlBeanUtils.setValue( ebiElem, pieces );
             }
             catch ( Exception e )
             {
@@ -72,17 +76,17 @@
 
     }
 
-    public boolean isDeleteInvoked()
+    public boolean deleteWasInvoked()
     {
         return m_deleteInvoked;
     }
 
-    public boolean isInsertInvoked()
+    public boolean insertWasInvoked()
     {
         return m_insertInvoked;
     }
 
-    public boolean isUpdateInvoked()
+    public boolean updateWasInvoked()
     {
         return m_updateInvoked;
     }

Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java&r1=111751&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java	(original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java	Mon Dec 13 14:31:01 2004
@@ -17,15 +17,13 @@
 
 import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
 import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InsertDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InsertType;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesResponseDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
 
 import javax.xml.namespace.QName;
 

Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java&r1=111751&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java	(original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/QueryResourcePropertiesProviderTestCase.java	Mon Dec 13 14:31:01 2004
@@ -23,6 +23,8 @@
 import org.apache.ws.resource.properties.SushiPropertyQNames;
 import org.apache.ws.resource.properties.SushiResource;
 import org.apache.ws.resource.properties.SushiResourceContext;
+import org.apache.ws.resource.properties.faults.QueryEvaluationErrorFaultException;
+import org.apache.ws.resource.properties.faults.UnknownQueryExpressionDialectFaultException;
 import org.apache.ws.resource.properties.query.QueryConstants;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.xmlbeans.XmlException;
@@ -31,6 +33,8 @@
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesResponseDocument;
 
+import java.net.URI;
+
 /**
  * Test case for {@link QueryResourcePropertiesProvider}.
  *
@@ -42,20 +46,56 @@
     /**
      * DOCUMENT_ME
      */
-    public void testQueryResourceProperties()
+    public void testQueryResourceProperties() throws Exception
     {
         m_resourceContext = new SushiResourceContext();
-        QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse = queryAll();
+        QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse = queryResourceProperties( "*" );
         XmlObject[] allPropElems = XmlBeanUtils.getChildElements( queryResourcePropertiesResponse );
         assertNotNull( allPropElems );
         assertTrue( allPropElems.length == 8 );
     }
 
+    /**
+     * DOCUMENT_ME
+     */
+    public void testQueryWithInvalidDialect() throws Exception
+    {
+        m_resourceContext = new SushiResourceContext();
+        try
+        {
+            QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse response = queryResourceProperties( "*", new URI( "http://blah.com/NotADialect" ) );
+            fail( response != null ? "Expected fault, but received response." : null );
+        }
+        catch ( UnknownQueryExpressionDialectFaultException expectedFault )
+        {
+            return;
+        }
+
+    }
+
+    /**
+     * DOCUMENT_ME
+     */
+    public void testQueryWithInvalidExpr() throws Exception
+    {
+        m_resourceContext = new SushiResourceContext();
+        try
+        {
+            QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse response = queryResourceProperties( "\\/\\/\\/\\/\\/" );
+            fail( response != null ? "Expected fault, but received response." : null );
+        }
+        catch ( QueryEvaluationErrorFaultException expectedFault )
+        {
+            return;
+        }
+
+    }
+
     public void testQueryOpenContent() throws XmlException
     {
         m_resourceContext = new SushiResourceContext();
         insertXsdAnyPropElem();
-        QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse = queryAll();
+        QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse = queryResourceProperties( "*" );
         XmlObject[] allPropElems = XmlBeanUtils.getChildElements( queryResourcePropertiesResponse );
         assertNotNull( allPropElems );
         assertTrue( allPropElems.length == 9 );
@@ -79,7 +119,7 @@
 
         //check whats there
         QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse =
-                queryAll();
+                queryResourceProperties( "*" );
         XmlObject[] ebiPropElems =
                 XmlBeanUtils.getChildElements( queryResourcePropertiesResponse, SushiPropertyQNames.EBI );
         String value = XmlBeanUtils.getValue( ebiPropElems[0] );
@@ -90,7 +130,7 @@
         ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
         resourceProp.setCallback( callback );
 
-        queryResourcePropertiesResponse = queryAll();
+        queryResourcePropertiesResponse = queryResourceProperties( "*" );
 
         ebiPropElems = XmlBeanUtils.getChildElements( queryResourcePropertiesResponse, SushiPropertyQNames.EBI );
         assertNotNull( ebiPropElems );
@@ -98,25 +138,19 @@
         assertEquals( plate.getEbi().getNumberOfPieces(), value );
     }
 
-    /**
-     * DOCUMENT_ME
-     *
-     * @throws Exception DOCUMENT_ME
-     */
-    protected void setUp()
-            throws Exception
+    private QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourceProperties( String xPathExpr )
     {
-        //initResourcePropsDoc();
+        return queryResourceProperties( xPathExpr, QueryConstants.DIALECT_URI__XPATH1_0 );
     }
 
-    private QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryAll()
+    private QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourceProperties( String xPathExpr, URI dialect )
     {
         QueryResourcePropertiesProvider provider = new QueryResourcePropertiesProvider( m_resourceContext );
         QueryResourcePropertiesDocument doc = QueryResourcePropertiesDocument.Factory.newInstance();
         QueryResourcePropertiesDocument.QueryResourceProperties queryResourceProperties = doc.addNewQueryResourceProperties();
         QueryExpressionType queryExpressionType = queryResourceProperties.addNewQueryExpression();
-        queryExpressionType.setDialect( QueryConstants.DIALECT_URI__XPATH1_0.toString() );
-        XmlBeanUtils.setValue( queryExpressionType, "*" );
+        queryExpressionType.setDialect( dialect.toString() );
+        XmlBeanUtils.setValue( queryExpressionType, xPathExpr );
         QueryResourcePropertiesResponseDocument queryResourcePropertiesResponseDocument = provider.queryResourceProperties( doc );
         QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse queryResourcePropertiesResponse =
                 queryResourcePropertiesResponseDocument.getQueryResourcePropertiesResponse();

Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java?view=diff&rev=111752&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java&r1=111751&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java&r2=111752
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java	(original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/SetResourcePropertiesProviderTestCase.java	Mon Dec 13 14:31:01 2004
@@ -43,19 +43,23 @@
 public class SetResourcePropertiesProviderTestCase
         extends AbstractWsrpPortTypeImplTestCase
 {
+    private SushiCallback m_callback;
 
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        m_callback = new SushiCallback( new SushiPlate() );
+    }
     /* ===================================== TESTS FOR 'INSERT' ====================================== */
 
     public void testInsertResourcePropertiesCallback() throws XmlException, ResourceException, ResourceContextException
     {
         m_resourceContext = new SushiResourceContext();
         //build callback obj
-        SushiPlate plate = new SushiPlate();
-        SushiCallback callback = new SushiCallback( plate );
         //setup callback on resource prop
         SushiResource resource = (SushiResource) m_resourceContext.getResource();
         ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
-        resourceProp.setCallback( callback );
+        resourceProp.setCallback( m_callback );
 
         SetResourcePropertiesProvider set_provider = new SetResourcePropertiesProvider( m_resourceContext );
         InsertDocument insertDoc = InsertDocument.Factory.newInstance();
@@ -71,8 +75,8 @@
 
         assertNotNull( getResourcePropertyResponse );
         XmlObject[] childElements = XmlBeanUtils.getChildElements( getResourcePropertyResponse, SushiPropertyQNames.EBI );
-        assertTrue( childElements.length == 2 );
-        assertTrue( callback.isInsertInvoked() );
+        assertEquals( 2, childElements.length );
+        assertTrue( m_callback.insertWasInvoked() );
     }
 
     public void testInsertResourceProperty()
@@ -93,7 +97,7 @@
 
         assertNotNull( getResourcePropertyResponse );
         XmlObject[] childElements = XmlBeanUtils.getChildElements( getResourcePropertyResponse, SushiPropertyQNames.EBI );
-        assertTrue( childElements.length == 2 );
+        assertEquals( 2, childElements.length );
     }
 
     public void testInsertAnyIntoOpenContent() throws XmlException
@@ -149,11 +153,6 @@
     public void testDeleteResourcePropertiesCallback() throws ResourceException, ResourceContextException, XmlException
     {
         m_resourceContext = new SushiResourceContext();
-        //build callback obj
-        SushiPlate plate = new SushiPlate();
-        SushiCallback callback = new SushiCallback( plate );
-
-        //insert a prop
         SetResourcePropertiesProvider set_provider = new SetResourcePropertiesProvider( m_resourceContext );
         InsertDocument insertDoc = InsertDocument.Factory.newInstance();
         InsertType insertType = insertDoc.addNewInsert();
@@ -168,7 +167,7 @@
         //setup callback on resource prop
         SushiResource resource = (SushiResource) m_resourceContext.getResource();
         ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.IKA );
-        resourceProp.setCallback( callback );
+        resourceProp.setCallback( m_callback );
 
         DeleteDocument deleteDoc = DeleteDocument.Factory.newInstance();
         DeleteType deleteType = deleteDoc.addNewDelete();
@@ -178,7 +177,7 @@
         GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse = getResourceProperty( SushiPropertyQNames.OHTORO );
 
         assertNotNull( getResourcePropertyResponse );
-        assertTrue( callback.isDeleteInvoked() );
+        assertTrue( m_callback.deleteWasInvoked() );
     }
 
     /* ===================================== TESTS FOR 'UPDATE' ====================================== */
@@ -210,7 +209,7 @@
         set_provider.updateResourceProperty( updateDoc.getUpdate() );
 
         assertPropHasOneElemWithGivenValue( SushiPropertyQNames.EBI, newValue );
-        assertTrue( callback.isUpdateInvoked() );
+        assertTrue( callback.updateWasInvoked() );
     }
 
     public void testUpdateOpenContent() throws XmlException

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