Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2161 - in development/main/metro: activation/providers/metro/src/main/net/dpml/activation/metro meta/api/src/main/net/dpml/meta/info

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: r2161 - in development/main/metro: activation/providers/metro/src/main/net/dpml/activation/metro meta/api/src/main/net/dpml/meta/info
  • Date: Sun, 27 Mar 2005 17:10:13 -0500

Author: mcconnell AT dpml.net
Date: Sun Mar 27 17:10:12 2005
New Revision: 2161

Modified:

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
Log:
Enhancing the error message.

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
Sun Mar 27 17:10:12 2005
@@ -43,10 +43,22 @@
//-------------------------------------------------------------------

/**
- * A map of the part descriptors published by the component type
+ * A map of the 'get' part descriptors published by the component type
* and keyed by entry key.
*/
- private final Map m_entries = new Hashtable();
+ private final Map m_getters = new Hashtable();
+
+ /**
+ * A map of the 'create' part descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_creators = new Hashtable();
+
+ /**
+ * A map of the 'release' part descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_releasors = new Hashtable();

/**
* The component type.
@@ -75,7 +87,19 @@
{
PartDescriptor p = entries[i];
String key = p.getKey();
- m_entries.put( key, p );
+ int semantic = p.getSemantic();
+ if( PartDescriptor.GET == semantic )
+ {
+ m_getters.put( key, p );
+ }
+ else if( PartDescriptor.CREATE == semantic )
+ {
+ m_creators.put( key, p );
+ }
+ else if( PartDescriptor.RELEASE == semantic )
+ {
+ m_releasors.put( key, p );
+ }
}
}

@@ -109,15 +133,12 @@
return method.invoke( this, args );
}

- String name = method.getName();
- String key = getKeyFromMethod( method );
- PartDescriptor entry = (PartDescriptor) m_entries.get( key );
-
- if( null == entry )
+ PartDescriptor descriptor = getPartDescriptor( method );
+ if( null == descriptor )
{
final String error =
"Illegal request for an undeclared part ["
- + key
+ + descriptor.getKey()
+ "] withing the component type ["
+ m_type.getInfo().getClassname()
+ "].";
@@ -129,13 +150,36 @@
//

final String error =
- "The request for the internal part ["
- + entry.getType()
+ "The request to "
+ + PartDescriptor.toString( descriptor.getSemantic() )
+ + " the internal part ["
+ + descriptor.getType()
+ "] from the key ["
- + key
+ + descriptor.getKey()
+ "] could not be completed as this function is not implemented.";
throw new UnsupportedOperationException( error );
+ }

+ private PartDescriptor getPartDescriptor( Method method )
+ {
+ String name = method.getName();
+ String key = getKeyFromMethod( method );
+ if( name.startsWith( "get" ) )
+ {
+ return (PartDescriptor) m_getters.get( key );
+ }
+ else if( name.startsWith( "create" ) )
+ {
+ return (PartDescriptor) m_creators.get( key );
+ }
+ else if( name.startsWith( "release" ) )
+ {
+ return (PartDescriptor) m_releasors.get( key );
+ }
+ else
+ {
+ return null;
+ }
}

private String getKeyFromMethod( Method method )

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
Sun Mar 27 17:10:12 2005
@@ -57,6 +57,26 @@
public static final int CREATE = 1;
public static final int RELEASE = -1;

+ public static String toString( int semantic )
+ {
+ if( CREATE == semantic )
+ {
+ return "create";
+ }
+ else if( GET == semantic )
+ {
+ return "get";
+ }
+ else if( RELEASE == semantic )
+ {
+ return "release";
+ }
+ else
+ {
+ return "?";
+ }
+ }
+
/**
* The key.
*/



  • svn commit: r2161 - in development/main/metro: activation/providers/metro/src/main/net/dpml/activation/metro meta/api/src/main/net/dpml/meta/info, mcconnell, 03/27/2005

Archive powered by MHonArc 2.6.24.

Top of Page