avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing AbstractPublisher.java RmiPublisher.java SocketStreamPublisher.java
Date Thu, 05 Sep 2002 21:15:46 GMT
hammant     2002/09/05 14:15:46

  Modified:    src/java/org/apache/avalon/cornerstone/blocks/transport/autopublishing
                        AutoPublisher.java
               src/java/org/apache/avalon/cornerstone/blocks/transport/publishing
                        AbstractPublisher.java RmiPublisher.java
                        SocketStreamPublisher.java
  Log:
  Fix dupe 'service' in xinfo.  Add bcel support from Thomas Kiesgen
  
  Revision  Changes    Path
  1.14      +2 -2      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/autopublishing/AutoPublisher.java
  
  Index: AutoPublisher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/autopublishing/AutoPublisher.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AutoPublisher.java	2 Aug 2002 18:57:40 -0000	1.13
  +++ AutoPublisher.java	5 Sep 2002 21:15:46 -0000	1.14
  @@ -94,7 +94,7 @@
               try
               {
                   m_altrmiPublisher.publish( block, pi.getPublishAsName(),
  -                                           Class.forName( pi.getInterfaceToPublish() )
);
  +                    this.getClass().getClassLoader().loadClass( pi.getInterfaceToPublish()
) );
               }
               catch( PublicationException e )
               {
  
  
  
  1.20      +116 -9    jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/AbstractPublisher.java
  
  Index: AbstractPublisher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/AbstractPublisher.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AbstractPublisher.java	12 Jul 2002 00:13:11 -0000	1.19
  +++ AbstractPublisher.java	5 Sep 2002 21:15:46 -0000	1.20
  @@ -34,11 +34,14 @@
   import org.apache.excalibur.altrmi.server.impl.AbstractServer;
   import org.apache.excalibur.altrmi.server.impl.classretrievers.JarFileClassRetriever;
   import org.apache.excalibur.altrmi.server.impl.classretrievers.NoClassRetriever;
  +import org.apache.excalibur.altrmi.server.impl.classretrievers.AbstractDynamicGeneratorClassRetriever;
  +import org.apache.excalibur.altrmi.server.impl.classretrievers.BcelDynamicGeneratorClassRetriever;
   
   /**
  - * @phoenix:service name="org.apache.excalibur.altrmi.server.AltrmiPublisher"
  + * Abstract Publisher.
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  + * @author Thomas Kiesgen
    * @version $Revision$
    */
   public abstract class AbstractPublisher
  @@ -50,7 +53,13 @@
       private ClassRetriever m_classRetriever;
       private AltrmiAuthenticator m_altrmiAuthenticator;
       protected File m_baseDirectory;
  +    private boolean m_isDynamicPublisher = false;
   
  +    /**
  +     *
  +     * @param configuration
  +     * @throws ConfigurationException
  +     */
       public void configure( Configuration configuration )
           throws ConfigurationException
       {
  @@ -98,19 +107,39 @@
           {
               m_classRetriever = new NoClassRetriever();
           }
  +        else if( classRetrieverType.equals( "bcel" ) )
  +        {
  +            AbstractDynamicGeneratorClassRetriever generator = new BcelDynamicGeneratorClassRetriever();
  +            File classGenDir = new File( m_baseDirectory, configuration.getChild( "classGenDir"
).getValue( "" ) );
  +            generator.setClassGenDir( classGenDir.getAbsolutePath() );
  +            m_classRetriever = generator;
  +
  +            m_isDynamicPublisher = true;
  +            getLogger().debug( "setting classgen dir for generator to " + classGenDir.getAbsolutePath()
);
  +            getLogger().debug( "setting class retriever to bcel dynamic generator" );
  +        }
  +
  +
           else
           {
               throw new ConfigurationException(
  -                "classRetrieverType must be 'baseMobileClass', 'jarFile' or 'none'" );
  +                "classRetrieverType must be 'bcel', 'jarFile' or 'none'" );
           }
       }
   
  +    /**
  +     * contextualize as per Contextualizable interface
  +     * @param context
  +     */
       public void contextualize( final Context context )
       {
           m_baseDirectory = ( (BlockContext)context ).getBaseDirectory();
       }
   
       /**
  +     * Service as per Serviceable interface
  +     * @param manager a service manager
  +     * @throws ServiceException if a problem during servicing
        * @phoenix:dependency name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator"
        */
       public void service( ServiceManager manager )
  @@ -120,12 +149,23 @@
               (AltrmiAuthenticator)manager.lookup( AltrmiAuthenticator.class.getName() );
       }
   
  +    /**
  +     * initialize as per Initializable interface
  +     * @throws Exception
  +     */
       public void initialize() throws Exception
       {
           m_abstractServer.setClassRetriever( m_classRetriever );
           m_abstractServer.setAuthenticator( m_altrmiAuthenticator );
       }
   
  +    /**
  +     *
  +     * @param implementation
  +     * @param asName
  +     * @param interfaceToExpose
  +     * @throws PublicationException
  +     */
       public void publish( Object implementation, String asName, Class interfaceToExpose
)
           throws PublicationException
       {
  @@ -133,9 +173,25 @@
               getLogger().debug( "Publishing object [as: " + asName + ", impl: " + implementation
                                 + ", interf: "+ interfaceToExpose + "]" );
   
  +        if( m_isDynamicPublisher )
  +        {
  +            ( ( AbstractDynamicGeneratorClassRetriever ) m_classRetriever ).generate( asName,
interfaceToExpose, this.getClass().getClassLoader() );
  +                if( getLogger().isDebugEnabled() )
  +                {
  +                    getLogger().debug( "generated dynamic proxy for published interface
" + asName );
  +                }
  +        }
  +
           m_abstractServer.publish( implementation, asName, interfaceToExpose );
       }
   
  +    /**
  +     * Publish an service
  +     * @param implementation
  +     * @param asName
  +     * @param publicationDescription
  +     * @throws PublicationException
  +     */
       public void publish(
           Object implementation, String asName, PublicationDescription publicationDescription
)
           throws PublicationException
  @@ -143,50 +199,101 @@
           if( getLogger().isDebugEnabled() )
               getLogger().debug( "Publishing object [as: " + asName + ", impl: " + implementation
+ "]" );
   
  +        if( m_isDynamicPublisher )
  +        {
  +            ( ( AbstractDynamicGeneratorClassRetriever ) m_classRetriever ).generate( asName,
publicationDescription, this.getClass().getClassLoader() );
  +                if( getLogger().isDebugEnabled() )
  +                {
  +                    getLogger().debug( "generated dynamic proxy for published interface
" + asName );
  +                }
  +        }
  +
  +
  +
           m_abstractServer.publish( implementation, asName, publicationDescription );
       }
   
  -    public void unPublish( Object o, String s ) throws PublicationException
  +    /**
  +     *
  +     * @param object
  +     * @param asName
  +     * @throws PublicationException
  +     */
  +    public void unPublish( Object object, String asName ) throws PublicationException
       {
           if( getLogger().isDebugEnabled() )
  -            getLogger().debug( "Unpublishing object [nane: " + s + ", impl: " + o + "]"
);
  +            getLogger().debug( "Unpublishing object [nane: " + asName + ", impl: " + object
+ "]" );
   
  -        m_abstractServer.unPublish( o, s );
  +        m_abstractServer.unPublish( object, asName );
       }
   
  -    public void replacePublished( Object o, String s, Object o1 ) throws PublicationException
  +    /**
  +     *
  +     * @param object
  +     * @param asName
  +     * @param o1
  +     * @throws PublicationException
  +     */
  +    public void replacePublished( Object object, String asName, Object o1 ) throws PublicationException
       {
           if( getLogger().isDebugEnabled() )
  -            getLogger().debug( "Replacing published object [nane: " + s + ", existing:
" + o + ", new: " + o1 + "]" );
  +            getLogger().debug( "Replacing published object [nane: " + asName + ", existing:
" + object + ", new: " + o1 + "]" );
   
  -        m_abstractServer.replacePublished( o, s, o1 );
  +        m_abstractServer.replacePublished( object, asName, o1 );
       }
   
  +    /**
  +     *
  +     * @throws Exception
  +     */
       public void start() throws Exception
       {
           m_abstractServer.start();
       }
   
  +    /**
  +     *
  +     * @throws Exception
  +     */
       public void stop() throws Exception
       {
           m_abstractServer.stop();
       }
   
  +    /**
  +     *
  +     * @param request
  +     * @param publishedName
  +     * @return
  +     */
       public MethodInvocationHandler getMethodInvocationHandler( MethodRequest request, String
publishedName )
       {
           return m_abstractServer.getMethodInvocationHandler( request, publishedName );
       }
   
  +    /**
  +     *
  +     * @param publishedName
  +     * @return
  +     */
       public MethodInvocationHandler getMethodInvocationHandler(String publishedName)
       {
           return m_abstractServer.getMethodInvocationHandler( publishedName );
       }
   
  +    /**
  +     *
  +     * @return
  +     */
       protected AbstractServer getAbstractServer()
       {
           return m_abstractServer;
       }
   
  +    /**
  +     *
  +     * @param abstractServer
  +     */
       protected void setAbstractServer( AbstractServer abstractServer )
       {
           m_abstractServer = abstractServer;
  
  
  
  1.13      +4 -2      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/RmiPublisher.java
  
  Index: RmiPublisher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/RmiPublisher.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RmiPublisher.java	12 Jul 2002 00:13:11 -0000	1.12
  +++ RmiPublisher.java	5 Sep 2002 21:15:46 -0000	1.13
  @@ -59,7 +59,9 @@
       }
   
       /**
  -     * @phoenix:dependency name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator"
  +     * Service as per Serviceable interface
  +     * @param manager a service manager
  +     * @throws ServiceException if a problem during servicing
        */
       public void service( ServiceManager manager )
           throws ServiceException
  
  
  
  1.8       +4 -3      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/SocketStreamPublisher.java
  
  Index: SocketStreamPublisher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/SocketStreamPublisher.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SocketStreamPublisher.java	13 Jul 2002 19:56:11 -0000	1.7
  +++ SocketStreamPublisher.java	5 Sep 2002 21:15:46 -0000	1.8
  @@ -21,7 +21,6 @@
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  -import org.apache.excalibur.altrmi.server.impl.socket.PartialSocketCustomStreamServer;
   
   /**
    * @phoenix:block
  @@ -77,7 +76,9 @@
       }
   
       /**
  -     * @phoenix:dependency name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator"
  +     * Service as per Serviceable interface
  +     * @param manager a service manager
  +     * @throws ServiceException if a problem during servicing
        * @phoenix:dependency name="org.apache.avalon.cornerstone.services.sockets.SocketManager"
        * @phoenix:dependency name="org.apache.avalon.cornerstone.services.connection.ConnectionManager"
        */
  
  
  

--
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