Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2211 - development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2211 - development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl
  • Date: Tue, 05 Apr 2005 13:28:52 -0400

Author: mcconnell AT dpml.net
Date: Tue Apr 5 13:28:44 2005
New Revision: 2211

Modified:

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
Log:
correct type creator to use updated part descriptor

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
Tue Apr 5 13:28:44 2005
@@ -43,6 +43,7 @@
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.PartDescriptor;
+import net.dpml.meta.info.PartDescriptor.Operation;
import net.dpml.meta.info.Type;

import net.dpml.meta.info.builder.BuildException;
@@ -475,19 +476,62 @@
try
{
String key = config.getAttribute( "key" );
+ Configuration[] children = config.getChildren( "operation" );
+ Operation[] operations = buildOperations( children );
+ return new PartDescriptor( key, operations );
+ }
+ catch( ConfigurationException e )
+ {
+ final String error =
+ "Mallformed configuration - check usage of key, type and/or
semantic attributes.";
+ throw new BuildException( error, e );
+ }
+ }
+
+ /**
+ * A utility method to build an operation array.
+ *
+ * @param configs the operation configurations
+ * @return the created Operation array
+ * @throws BuildException if an error occurs
+ */
+ protected Operation[] buildOperations( final Configuration[] configs )
+ throws BuildException
+ {
+ Operation[] operations = new Operation[ configs.length ];
+ for( int i=0; i<configs.length; i++ )
+ {
+ operations[i] = buildOperation( configs[i] );
+ }
+ return operations;
+ }
+
+ /**
+ * A utility method to build a {@link Operation}
+ * object from specified configuration.
+ *
+ * @param config the operation configuration
+ * @return the created Operation
+ * @throws BuildException if an error occurs
+ */
+ protected Operation buildOperation( final Configuration config )
+ throws BuildException
+ {
+ try
+ {
String type = config.getAttribute( "type" );
String semantic = config.getAttribute( "semantic", "get" );
if( "get".equals( semantic ) )
{
- return new PartDescriptor( key, type, PartDescriptor.GET );
+ return new Operation( PartDescriptor.GET, type );
}
if( "create".equals( semantic ) )
{
- return new PartDescriptor( key, type, PartDescriptor.CREATE
);
+ return new Operation( PartDescriptor.CREATE, type );
}
if( "release".equals( semantic ) )
{
- return new PartDescriptor( key, type, PartDescriptor.RELEASE
);
+ return new Operation( PartDescriptor.RELEASE, type );
}
else
{
@@ -499,8 +543,9 @@
catch( ConfigurationException e )
{
final String error =
- "Mallformed configuration - check usage of key, type and/or
semantic attributes.";
+ "Mallformed configuration - check usage of type and/or
semantic attributes.";
throw new BuildException( error, e );
}
}
+
}



  • svn commit: r2211 - development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl, mcconnell, 04/05/2005

Archive powered by MHonArc 2.6.24.

Top of Page