avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/embeddor DefaultEmbeddor.java ManagementInfo.java
Date Thu, 20 Jun 2002 11:31:53 GMT
colus       2002/06/20 04:31:53

  Modified:    src/java/org/apache/avalon/phoenix/components/embeddor
                        DefaultEmbeddor.java
  Removed:     src/java/org/apache/avalon/phoenix/components/embeddor
                        ManagementInfo.java
  Log:
  Refactor manageable component registeration.
  
  Revision  Changes    Path
  1.69      +46 -18    jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- DefaultEmbeddor.java	20 Jun 2002 11:08:01 -0000	1.68
  +++ DefaultEmbeddor.java	20 Jun 2002 11:31:53 -0000	1.69
  @@ -197,17 +197,7 @@
           {
               createComponents();
               setupComponents();
  -            final SystemManager systemManager = (SystemManager)getServiceManager().lookup(
SystemManager.ROLE );
  -            systemManager.register( ManagementInfo.EMBEDDOR.getName(), this, ManagementInfo.EMBEDDOR.getInterfaces()
);
  -            for( int i = 0; i < m_entrys.length; i++ )
  -            {
  -                System.out.println( m_entrys[ i ].getRole() );
  -                final ManagementInfo mi = ManagementInfo.getManagementInfoForRole( m_entrys[
i ].getRole() );
  -                if ( null != mi )
  -                {
  -                    systemManager.register( mi.getName(), m_entrys[ i ].getObject(), mi.getInterfaces()
);
  -                }
  -            }
  +            registerComponents();
           }
           catch( final Exception e )
           {
  @@ -302,14 +292,8 @@
           shutdown();
           try
           {
  +            unregisterComponents();
               shutdownComponents();
  -            final SystemManager systemManager = (SystemManager)getServiceManager().lookup(
SystemManager.ROLE );
  -            systemManager.unregister( ManagementInfo.EMBEDDOR.getName() );
  -            for( int i = 0; i < m_entrys.length; i++ )
  -            {
  -                final ManagementInfo mi = ManagementInfo.getManagementInfoForRole( m_entrys[
i ].getRole() );
  -                systemManager.unregister( mi.getName() );
  -            }
           }
           catch( final Exception e )
           {
  @@ -609,6 +593,50 @@
           {
               final String message = REZ.getString( "no-class.error", service.getName(),
classname );
               throw new CascadingException( message, cnfe );
  +        }
  +    }
  +
  +    /**
  +     * Register embeddor and it's components to <code>SystemManager</code>.
  +     */
  +    private void registerComponents()
  +        throws Exception
  +    {
  +        final SystemManager systemManager =
  +            (SystemManager)getServiceManager().lookup( SystemManager.ROLE );
  +        systemManager.register( ManagementRegistration.EMBEDDOR.getName(),
  +                                this, ManagementRegistration.EMBEDDOR.getInterfaces() );
  +
  +        for( int i = 0; i < m_entrys.length; i++ )
  +        {
  +            final ManagementRegistration registration =
  +                ManagementRegistration.getManagementInfoForRole( m_entrys[ i ].getRole()
);
  +            if ( null != registration )
  +            {
  +                systemManager.register( registration.getName(),
  +                                        m_entrys[ i ].getObject(), registration.getInterfaces()
);
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Unregister embeddor and it's components from <code>SystemManager</code>.
  +     */
  +    private void unregisterComponents()
  +        throws Exception
  +    {
  +        final SystemManager systemManager =
  +            (SystemManager)getServiceManager().lookup( SystemManager.ROLE );
  +        systemManager.unregister( ManagementRegistration.EMBEDDOR.getName() );
  +
  +        for( int i = 0; i < m_entrys.length; i++ )
  +        {
  +            final ManagementRegistration registration =
  +                ManagementRegistration.getManagementInfoForRole( m_entrys[ i ].getRole()
);
  +            if ( null != registration )
  +            {
  +                systemManager.unregister( registration.getName() );
  +            }
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message