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 2005/02/14 21:08:04 UTC
svn commit: r153840 - in incubator/apollo/trunk/src:
java/org/apache/ws/resource/ java/org/apache/ws/resource/properties/impl/
test/org/apache/ws/resource/properties/
test/org/apache/ws/resource/properties/impl/
Author: ips
Date: Mon Feb 14 12:08:02 2005
New Revision: 153840
URL: http://svn.apache.org/viewcvs?view=rev&rev=153840
Log:
WS-RMD stuff
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/ResourceDefinition.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySet.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaData.java
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractResourcePropertiesTestCase.java
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiMetadata.wsrmd
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/ResourceDefinition.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/ResourceDefinition.java?view=diff&r1=153839&r2=153840
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/ResourceDefinition.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/ResourceDefinition.java Mon Feb 14 12:08:02 2005
@@ -25,10 +25,25 @@
public interface ResourceDefinition extends ResourceCapability
{
- Service getService();
-
+ /**
+ * Returns the last portion of the service endpoint URL for this resource definition.
+ *
+ * @return the last portion of the service endpoint URL for this resource definition
+ */
String getName();
+ /**
+ * Returns the JWSDL Service for this resource definition.
+ *
+ * @return the JWSDL Service for this resource definition
+ */
+ Service getService();
+
+ /**
+ * Returns the service endpoint URL for this resource definition.
+ *
+ * @return the service endpoint URL for this resource definition
+ */
String getEndpointURL();
}
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&r1=153839&r2=153840
==============================================================================
--- 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 Feb 14 12:08:02 2005
@@ -38,10 +38,8 @@
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
/**
* LOG-DONE An Apache XMLBeans-based implementation of a resource property set.
@@ -69,16 +67,16 @@
public XmlBeansResourcePropertySet( XmlObject propsDocXBean )
throws MetaDataViolationException
{
- this( propsDocXBean, null );
+ this( propsDocXBean, new XmlBeansResourcePropertySetMetaData( propsDocXBean.schemaType() ) );
}
/**
* Creates a new {@link XmlBeansResourcePropertySet} object.
*
* @param propsDocXBean DOCUMENT_ME
- * @param readOnlyPropNames names of any properties that should be made read-only
+ * @param metaData metadata describing this property set
*/
- public XmlBeansResourcePropertySet( XmlObject propsDocXBean, QName[] readOnlyPropNames )
+ public XmlBeansResourcePropertySet( XmlObject propsDocXBean, ResourcePropertySetMetaData metaData )
throws MetaDataViolationException
{
if ( !XmlBeanUtils.isDocument( propsDocXBean ) )
@@ -88,8 +86,8 @@
}
m_propsDocXBean = propsDocXBean;
m_propsXBean = getPropsDocRootElem();
- m_metaData = new XmlBeansResourcePropertySetMetaData( m_propsDocXBean.schemaType() );
- initProperties( readOnlyPropNames );
+ m_metaData = metaData;
+ initProperties( metaData );
}
/**
@@ -333,31 +331,17 @@
this );
}
- private void initProperties( QName[] readOnlyPropNames )
+ private void initProperties( ResourcePropertySetMetaData setMetaData )
throws MetaDataViolationException
{
- Set readOnlyPropNameSet = toSet( readOnlyPropNames );
SchemaProperty[] propElemDefs = m_propsXBean.schemaType().getElementProperties();
for ( int i = 0; i < propElemDefs.length; i++ )
{
XmlBeansResourceProperty prop = createProperty( propElemDefs[i],
- readOnlyPropNameSet.contains( propElemDefs[i].getName() ) );
+ setMetaData.getPropertyMetaData( propElemDefs[i].getName() ).isReadOnly() );
populateProperty( prop );
addPropertyToMap( prop );
}
- }
-
- private static Set toSet( Object[] array )
- {
- Set set = new HashSet();
- if ( array != null )
- {
- for ( int i = 0; i < array.length; i++ )
- {
- set.add( array[i] );
- }
- }
- return set;
}
private void populateProperty( XmlBeansResourceProperty prop )
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaData.java?view=diff&r1=153839&r2=153840
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaData.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaData.java Mon Feb 14 12:08:02 2005
@@ -34,6 +34,8 @@
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
/**
* LOG-DONE Apache XMLBeans-based implementation of resource property set metadata.
@@ -57,7 +59,7 @@
*/
public XmlBeansResourcePropertySetMetaData( SchemaType schemaType )
{
- this( schemaType, null );
+ this( schemaType, new QName[0] );
}
/**
@@ -82,6 +84,27 @@
}
/**
+ * Creates a new {@link XmlBeansResourcePropertySetMetaData} object.
+ *
+ * @param schemaType DOCUMENT_ME
+ */
+ public XmlBeansResourcePropertySetMetaData( SchemaType schemaType, QName[] readOnlyPropNames )
+ {
+ if ( !schemaType.isDocumentType() )
+ {
+ throw new IllegalArgumentException( MSG.getMessage( Keys.SCHEMA_MUST_BE_DOC ) );
+ }
+ m_schemaType = schemaType;
+ SchemaProperty[] elemTypes = m_schemaType.getElementProperties()[0].getType().getElementProperties();
+ Set readOnlyPropNameSet = toSet( readOnlyPropNames );
+ for ( int i = 0; i < elemTypes.length; i++ )
+ {
+ m_propMetaDatas.put( elemTypes[i].getName(),
+ new XmlBeansResourcePropertyMetaData( elemTypes[i], readOnlyPropNameSet.contains( elemTypes[i].getName() ) ) );
+ }
+ }
+
+ /**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
@@ -168,6 +191,19 @@
}
}
return null;
+ }
+
+ private static Set toSet( Object[] array )
+ {
+ Set set = new HashSet();
+ if ( array != null )
+ {
+ for ( int i = 0; i < array.length; i++ )
+ {
+ set.add( array[i] );
+ }
+ }
+ return set;
}
}
Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractResourcePropertiesTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractResourcePropertiesTestCase.java?view=diff&r1=153839&r2=153840
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractResourcePropertiesTestCase.java (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractResourcePropertiesTestCase.java Mon Feb 14 12:08:02 2005
@@ -18,10 +18,13 @@
import junit.framework.TestCase;
import org.apache.commons.io.CopyUtils;
import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySetMetaData;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.impl.common.XmlErrorPrinter;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.oasisOpen.docs.wsrf.x2004.x10.wsrfWSResourceMetadataDescriptor10Draft01.DefinitionsDocument;
+import org.oasisOpen.docs.wsrf.x2004.x10.wsrfWSResourceMetadataDescriptor10Draft01.MetadataDescriptorType;
import java.io.File;
import java.io.FileOutputStream;
@@ -42,7 +45,8 @@
public static final String NSURI_SUSHI = "http://ws.apache.org/resource/properties/test/sushi";
protected static final String RESOURCE_PATH_SUSHI_PROPS_XSD = "org/apache/ws/resource/properties/SushiProperties.xsd";
- protected static final String RESOURCE_PATH_SUSHI_PROPS_XML = "org/apache/ws/resource/properties/SushiProperties.xml";;
+ protected static final String RESOURCE_PATH_SUSHI_PROPS_XML = "org/apache/ws/resource/properties/SushiProperties.xml";
+ protected static final String RESOURCE_PATH_SUSHI_METADATA_XML = "org/apache/ws/resource/properties/SushiMetadata.wsrmd";
protected static final File BASE_TMP_DIR = new File( System.getProperty( "java.io.tmpdir" ), "ws.apache.org/apollo" );;
protected static final File SRC_DIR = new File( BASE_TMP_DIR, "generated_src" );
@@ -95,7 +99,12 @@
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream( RESOURCE_PATH_SUSHI_PROPS_XML );
XmlObject propsDocXBean = XmlObject.Factory.parse( in );
in.close();
- m_resourcePropSet = new XmlBeansResourcePropertySet( propsDocXBean );
+ in = Thread.currentThread().getContextClassLoader().getResourceAsStream( RESOURCE_PATH_SUSHI_METADATA_XML );
+ DefinitionsDocument metadataDocXBean = (DefinitionsDocument) XmlObject.Factory.parse( in );
+ MetadataDescriptorType metadataDesc = metadataDocXBean.getDefinitions().getMetadataDescriptorArray( 0 );
+ in.close();
+ ResourcePropertySetMetaData propSetMetaData = new XmlBeansResourcePropertySetMetaData( propsDocXBean.schemaType(), metadataDesc );
+ m_resourcePropSet = new XmlBeansResourcePropertySet( propsDocXBean, propSetMetaData );
}
private static boolean compileSchema( File xsdFile )
Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiMetadata.wsrmd
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiMetadata.wsrmd?view=diff&r1=153839&r2=153840
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiMetadata.wsrmd (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiMetadata.wsrmd Mon Feb 14 12:08:02 2005
@@ -1,6 +1,15 @@
<?xml version="1.0"?>
-<Blah />
+<Definitions xmlns="http://docs.oasis-open.org/wsrf/2004/10/wsrf-WSResourceMetadataDescriptor-1.0-draft-01.xsd"
+ xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
+ xmlns:tns="http://ws.apache.org/resource/properties/test/sushi"
+ targetNamespace="http://ws.apache.org/resource/properties/test/sushi">
-<!-- TODO -->
+ <MetadataDescriptor name="SushiMetadataDescriptor" interface="tns:SushiPortType">
+ <Property path="tns:Hamachi" mutability="mutable" modifiability="read-write" />
+ <Property path="tns:Ohtoro" mutability="mutable" modifiability="read-only" />
+
+ </MetadataDescriptor>
+
+</Definitions>
Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java?view=diff&r1=153839&r2=153840
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java Mon Feb 14 12:08:02 2005
@@ -21,6 +21,7 @@
import junit.textui.TestRunner;
import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
import org.apache.ws.resource.properties.SushiPropertyQNames;
+import org.apache.ws.resource.properties.ResourcePropertyMetaData;
/**
* Test case for {@link XmlBeansResourcePropertySet}.
@@ -76,6 +77,23 @@
{
assertEquals( SushiPropertyQNames.OPEN_SUSHI_PROPERTIES,
m_resourcePropSet.getMetaData().getName( ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws Exception DOCUMENT_ME
+ */
+ public void testPropertyMetaDatas( )
+ throws Exception
+ {
+ ResourcePropertyMetaData[] propMetaDatas = m_resourcePropSet.getMetaData().getPropertyMetaDatas();
+ assertEquals( 9, propMetaDatas.length );
+ for ( int i = 0; i < propMetaDatas.length; i++ )
+ {
+ boolean expectedReadOnly = propMetaDatas[i].getName().equals( SushiPropertyQNames.OHTORO );
+ assertEquals( expectedReadOnly, propMetaDatas[i].isReadOnly() );
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org