Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2212 - development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro

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: r2212 - development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro
  • Date: Tue, 05 Apr 2005 13:34:01 -0400

Author: mcconnell AT dpml.net
Date: Tue Apr 5 13:33:59 2005
New Revision: 2212

Modified:

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


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
Tue Apr 5 13:33:59 2005
@@ -43,24 +43,6 @@
//-------------------------------------------------------------------

/**
- * A map of the 'get' part descriptors published by the component type
- * and keyed by entry key.
- */
- 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.
*/
private final Type m_type;
@@ -77,29 +59,7 @@
public PartsInvocationHandler( Type type )
throws NullPointerException
{
- assertNotNull( type, "type" );
-
m_type = type;
-
- PartDescriptor[] entries = m_type.getPartDescriptors();
- for( int i=0; i<entries.length; i++ )
- {
- PartDescriptor p = entries[i];
- String key = p.getKey();
- 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 );
- }
- }
}

//-------------------------------------------------------------------
@@ -121,126 +81,6 @@
public Object invoke( final Object proxy, final Method method, final
Object[] args )
throws Throwable, NullPointerException
{
- if( proxy == null )
- throw new NullPointerException( "proxy" );
- if( method == null )
- throw new NullPointerException( "method" );
-
- Class source = method.getDeclaringClass();
- if( Object.class == method.getDeclaringClass() )
- {
- return method.invoke( this, args );
- }
-
- PartDescriptor descriptor = getPartDescriptor( method );
- if( null == descriptor )
- {
- final String error =
- "Illegal request for an undeclared part ["
- + descriptor.getKey()
- + "] withing the component type ["
- + m_type.getInfo().getClassname()
- + "].";
- throw new IllegalArgumentException( error );
- }
-
- //
- // we have a valid key
- //
-
- final String error =
- "The request to "
- + PartDescriptor.toString( descriptor.getSemantic() )
- + " the internal part ["
- + descriptor.getType()
- + "] from the 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 )
- {
- String name = method.getName();
- if( name.startsWith( "get" ) )
- {
- return formatKey( name.substring( 3 ) );
- }
- else if( name.startsWith( "create" ) )
- {
- return formatKey( name.substring( 6 ) );
- }
- else if( name.startsWith( "release" ) )
- {
- return formatKey( name.substring( 7 ) );
- }
- else
- {
- final String error =
- "Invalid method accessor ["
- + name
- + "]";
- throw new IllegalArgumentException( error );
- }
- }
-
- private String formatKey( String key )
- {
- if( key.length() < 1 )
- {
- throw new IllegalArgumentException( "key" );
- }
- String first = key.substring( 0, 1 ).toLowerCase();
- String remainder = key.substring( 1 );
- return first + remainder;
- }
-
- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
- private void assertNotNull( Object object, String key )
- throws NullPointerException
- {
- if( null == object )
- {
- throw new NullPointerException( key );
- }
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
- buffer.append( "[parts {" );
- PartDescriptor[] entries = m_type.getPartDescriptors();
- for( int i=0; i<entries.length; i++ )
- {
- PartDescriptor p = entries[i];
- buffer.append( p.toString() );
- }
- buffer.append( "}]" );
- return buffer.toString();
+ throw new UnsupportedOperationException( "parts" );
}
}



  • svn commit: r2212 - development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro, mcconnell, 04/05/2005

Archive powered by MHonArc 2.6.24.

Top of Page