incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: incubator-altrmi/src/java/org/apache/altrmi/blocks/authentication DefaultAuthenticatorBlock.java DefaultAuthenticator.java
Date Tue, 15 Jul 2003 07:08:10 GMT
hammant     2003/07/15 00:08:10

  Modified:    src/java/org/apache/altrmi/blocks/autopublishing
                        AutoPublisher.java
               src/java/org/apache/altrmi/blocks/publishing
                        AbstractPublisher.java RmiPublisher.java
               src/java/org/apache/altrmi/blocks/subscription
                        AbstractSubscriber.java RmiSubscriber.java
                        SocketCustomStreamSubscriber.java
                        SocketObjectStreamSubscriber.java
  Added:       src/java/org/apache/altrmi/blocks/authentication
                        DefaultAuthenticatorBlock.java
  Removed:     src/java/org/apache/altrmi/blocks/authentication
                        DefaultAuthenticator.java
  Log:
  Big Refactor. Removal of accidental duplicate instances. Make comps more fail-safe
  
  Revision  Changes    Path
  1.4       +5 -5      incubator-altrmi/src/java/org/apache/altrmi/blocks/autopublishing/AutoPublisher.java
  
  Index: AutoPublisher.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/autopublishing/AutoPublisher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AutoPublisher.java	17 Feb 2003 20:27:39 -0000	1.3
  +++ AutoPublisher.java	15 Jul 2003 07:08:09 -0000	1.4
  @@ -79,7 +79,7 @@
       implements Configurable, ApplicationListener
   {
       private String m_publisherName;
  -    private Publisher m_altrmiPublisher;
  +    private Publisher m_publisher;
       private Map m_publications;
       private Vector m_events = new Vector();
   
  @@ -109,7 +109,7 @@
       {
           if( m_publisherName.equals( event.getName() ) )
           {
  -            m_altrmiPublisher = (Publisher)event.getBlock();
  +            m_publisher = (Publisher)event.getBlock();
           }
   
           if( m_publications.containsKey( event.getName() ) )
  @@ -140,7 +140,7 @@
   
               try
               {
  -                m_altrmiPublisher.publish( block, pi.getPublishAsName(),
  +                m_publisher.publish( block, pi.getPublishAsName(),
                       this.getClass().getClassLoader().loadClass( pi.getInterfaceToPublish()
) );
               }
               catch( PublicationException e )
  @@ -171,7 +171,7 @@
   
                   try
                   {
  -                    m_altrmiPublisher.unPublish( block, pi.getPublishAsName() );
  +                    m_publisher.unPublish( block, pi.getPublishAsName() );
                   }
                   catch( PublicationException e )
                   {
  
  
  
  1.4       +1 -1      incubator-altrmi/src/java/org/apache/altrmi/blocks/publishing/AbstractPublisher.java
  
  Index: AbstractPublisher.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/publishing/AbstractPublisher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractPublisher.java	17 Feb 2003 20:27:39 -0000	1.3
  +++ AbstractPublisher.java	15 Jul 2003 07:08:09 -0000	1.4
  @@ -1 +1 @@
  -/* ====================================================================
 * The Apache Software
License, Version 1.1
 *
 * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
* reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification,
are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions
of source code must retain the above copyright
 *    notice, this list of conditions and the
following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
 *    the documentation
and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation
included with the redistribution,
 *    if any, must include the following acknowledgment:
*    "This product includes software developed by the
 *    Apache Software Foundation (http://www.apache.org/)."
*    Alternately, this acknowledgment may appear in the software
 *    itself, if and wherever
such third-party acknowledgments
 *    normally appear.
 *
 * 4. The names "Incubator", "AltRMI",
and "Apache Software Foundation"
 *    must not be used to endorse or promote products derived
from this
 *    software without prior written permission. For written
 *    permission, please
contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called
"Apache",
 *    nor may "Apache" appear in their name, without prior written
 *    permission
of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED
OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE
FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
*
 * This software consists of voluntary contributions made by many
 * individuals on behalf
of the Apache Software Foundation. For more
 * information on the Apache Software Foundation,
please see
 * <http://www.apache.org/>.
 */
package org.apache.altrmi.blocks.publishing;



import
java.io.File;

import java.net.MalformedURLException;

import java.net.URL;

import java.util.StringTokenizer;

import
java.util.Vector;

import org.apache.avalon.framework.activity.Initializable;

import org.apache.avalon.framework.activity.Startable;

import
org.apache.avalon.framework.configuration.Configurable;

import org.apache.avalon.framework.configuration.Configuration;

import
org.apache.avalon.framework.configuration.ConfigurationException;

import org.apache.avalon.framework.context.Context;

import
org.apache.avalon.framework.context.Contextualizable;

import org.apache.avalon.framework.logger.AbstractLogEnabled;

import
org.apache.avalon.framework.service.ServiceException;

import org.apache.avalon.framework.service.ServiceManager;

import
org.apache.avalon.framework.service.Serviceable;

import org.apache.altrmi.common.MethodRequest;

import
org.apache.altrmi.server.Authenticator;

import org.apache.altrmi.server.Publisher;

import
org.apache.altrmi.server.ClassRetriever;

import org.apache.altrmi.server.MethodInvocationHandler;

import
org.apache.altrmi.server.PublicationDescription;

import org.apache.altrmi.server.PublicationException;

import
org.apache.altrmi.server.impl.AbstractServer;
import org.apache.altrmi.server.impl.LogEnabledServerMonitor;

import
org.apache.altrmi.server.impl.classretrievers.AbstractDynamicGeneratorClassRetriever;

import
org.apache.altrmi.server.impl.classretrievers.BcelDynamicGeneratorClassRetriever;

import
org.apache.altrmi.server.impl.classretrievers.JarFileClassRetriever;

import org.apache.altrmi.server.impl.classretrievers.NoClassRetriever;

import
org.apache.avalon.framework.context.ContextException;



/**

 * Abstract Publisher.

 *

* @author Paul Hammant

 * @author Thomas Kiesgen

 * @version $Revision$

 */

public abstract
class AbstractPublisher

    extends AbstractLogEnabled

    implements Publisher, Startable,
Serviceable, Contextualizable, Configurable,

    Initializable

{

    private AbstractServer
m_abstractServer;

    private ClassRetriever m_classRetriever;

    private Authenticator
m_altrmiAuthenticator;

    protected File m_baseDirectory;

    private boolean m_isDynamicPublisher
= false;



    /**

     *

     * @param configuration

     * @throws ConfigurationException

    */

    public void configure( Configuration configuration )

        throws ConfigurationException

   {

        String classRetrieverType = configuration.getChild( "classRetrieverType" ).getValue();



       if( classRetrieverType.equals( "jarFile" ) )

        {

            StringTokenizer
st =

                new StringTokenizer( configuration.getChild( "generatedClassJarURLs"
).getValue(),

                                     "," );

            Vector vector = new
Vector();



            while( st.hasMoreTokens() )

            {

                try

               {

                    String url = st.nextToken();



                   
if( url.startsWith( "./" ) )

                    {

                        File file = new
File( m_baseDirectory, url.substring( 2, url.length() ) );



                        vector.add(
file.toURL() );

                    }

                    else

                    {

                       vector.add( new URL( url ) );

                    }

            
   }

                catch( MalformedURLException e )

                {

              
     getLogger()

                        .debug( "Can't create URL from config element 'generatedClassJarURLs'",

                               e );

                }

            }



            URL[]
urls = new URL[ vector.size() ];



            vector.copyInto( urls );



            m_classRetriever
= new JarFileClassRetriever( urls );

        }

        else if( classRetrieverType.equals(
"none" ) )

        {

            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 'bcel', 'jarFile' or 'none'" );

        }

    }



    /**

     * contextualize as per
Contextualizable interface

     * @param context

     */

    public void contextualize(
final Context context ) throws ContextException

    {

        m_baseDirectory = ( File )
context.get("app.home");

    }



    /**

     * Service as per Serviceable interface

    * @param manager a service manager

     * @throws ServiceException if a problem during
servicing

     * @phoenix:dependency name="org.apache.altrmi.server.Authenticator"

    
*/

    public void service( ServiceManager manager )

        throws ServiceException

 
  {

        m_altrmiAuthenticator =

            (Authenticator)manager.lookup( Authenticator.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

   {

        if( getLogger().isDebugEnabled() )

            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

   {

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

    }



    /**

     *

     * @param
object

     * @param asName

     * @throws PublicationException

     */

    public void
unPublish( Object object, String asName ) throws PublicationException

    {

        if(
getLogger().isDebugEnabled() )

            getLogger().debug( "Unpublishing object [nane:
" + asName + ", impl: " + object + "]" );



        m_abstractServer.unPublish( object, asName
);

    }



    /**

     *

     * @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: " + asName + ", existing:
" + object + ", new: " + 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;
        LogEnabledServerMonitor sm = new LogEnabledServerMonitor();
       sm.enableLogging(getLogger());
        m_abstractServer.setServerMonitor(sm);
    }

}

  \ No newline at end of file
  +/* ====================================================================
 * The Apache Software
License, Version 1.1
 *
 * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
* reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification,
are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions
of source code must retain the above copyright
 *    notice, this list of conditions and the
following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
 *    the documentation
and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation
included with the redistribution,
 *    if any, must include the following acknowledgment:
*    "This product includes software developed by the
 *    Apache Software Foundation (http://www.apache.org/)."
*    Alternately, this acknowledgment may appear in the software
 *    itself, if and wherever
such third-party acknowledgments
 *    normally appear.
 *
 * 4. The names "Incubator", "AltRMI",
and "Apache Software Foundation"
 *    must not be used to endorse or promote products derived
from this
 *    software without prior written permission. For written
 *    permission, please
contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called
"Apache",
 *    nor may "Apache" appear in their name, without prior written
 *    permission
of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED
OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE
FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
*
 * This software consists of voluntary contributions made by many
 * individuals on behalf
of the Apache Software Foundation. For more
 * information on the Apache Software Foundation,
please see
 * <http://www.apache.org/>.
 */
package org.apache.altrmi.blocks.publishing;



import
java.io.File;

import java.net.MalformedURLException;

import java.net.URL;

import java.util.StringTokenizer;

import
java.util.Vector;

import org.apache.avalon.framework.activity.Initializable;

import org.apache.avalon.framework.activity.Startable;

import
org.apache.avalon.framework.configuration.Configurable;

import org.apache.avalon.framework.configuration.Configuration;

import
org.apache.avalon.framework.configuration.ConfigurationException;

import org.apache.avalon.framework.context.Context;

import
org.apache.avalon.framework.context.Contextualizable;

import org.apache.avalon.framework.logger.AbstractLogEnabled;

import
org.apache.avalon.framework.service.ServiceException;

import org.apache.avalon.framework.service.ServiceManager;

import
org.apache.avalon.framework.service.Serviceable;

import org.apache.altrmi.common.MethodRequest;

import
org.apache.altrmi.server.Authenticator;

import org.apache.altrmi.server.Publisher;

import
org.apache.altrmi.server.ClassRetriever;

import org.apache.altrmi.server.MethodInvocationHandler;

import
org.apache.altrmi.server.PublicationDescription;

import org.apache.altrmi.server.PublicationException;

import
org.apache.altrmi.server.impl.AbstractServer;
import org.apache.altrmi.server.impl.LogEnabledServerMonitor;

import
org.apache.altrmi.server.impl.classretrievers.AbstractDynamicGeneratorClassRetriever;

import
org.apache.altrmi.server.impl.classretrievers.BcelDynamicGeneratorClassRetriever;

import
org.apache.altrmi.server.impl.classretrievers.JarFileClassRetriever;

import org.apache.altrmi.server.impl.classretrievers.NoClassRetriever;

import
org.apache.avalon.framework.context.ContextException;



/**

 * Abstract Publisher.

 *

* @author Paul Hammant

 * @author Thomas Kiesgen

 * @version $Revision$

 */

public abstract
class AbstractPublisher

    extends AbstractLogEnabled

    implements Publisher, Startable,
Serviceable, Contextualizable, Configurable,

    Initializable

{

    private AbstractServer
m_abstractServer;

    protected ClassRetriever m_classRetriever;

    protected Authenticator
m_authenticator;

    protected File m_baseDirectory;

    private boolean m_isDynamicPublisher
= false;



    /**

     *

     * @param configuration

     * @throws ConfigurationException

    */

    public void configure( Configuration configuration )

        throws ConfigurationException

   {

        String classRetrieverType = configuration.getChild( "classRetrieverType" ).getValue();



       if( classRetrieverType.equals( "jarFile" ) )

        {

            StringTokenizer
st =

                new StringTokenizer( configuration.getChild( "generatedClassJarURLs"
).getValue(),

                                     "," );

            Vector vector = new
Vector();



            while( st.hasMoreTokens() )

            {

                try

               {

                    String url = st.nextToken();



                   
if( url.startsWith( "./" ) )

                    {

                        File file = new
File( m_baseDirectory, url.substring( 2, url.length() ) );



                        vector.add(
file.toURL() );

                    }

                    else

                    {

                       vector.add( new URL( url ) );

                    }

            
   }

                catch( MalformedURLException e )

                {

              
     getLogger()

                        .debug( "Can't create URL from config element 'generatedClassJarURLs'",

                               e );

                }

            }



            URL[]
urls = new URL[ vector.size() ];



            vector.copyInto( urls );



            m_classRetriever
= new JarFileClassRetriever( urls );

        }

        else if( classRetrieverType.equals(
"none" ) )

        {

            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 'bcel', 'jarFile' or 'none'" );

        }

    }



    /**

     * contextualize as per
Contextualizable interface

     * @param context

     */

    public void contextualize(
final Context context ) throws ContextException

    {

        m_baseDirectory = ( File )
context.get("app.home");

    }



    /**

     * Service as per Serviceable interface

    * @param manager a service manager

     * @throws ServiceException if a problem during
servicing

     * @phoenix:dependency name="org.apache.altrmi.server.Authenticator"

    
*/

    public void service( ServiceManager manager )

        throws ServiceException

 
  {

        m_authenticator =

            (Authenticator)manager.lookup( Authenticator.class.getName()
);

    }



    /**

     * initialize as per Initializable interface

     * @throws Exception

    */

    public void initialize() throws Exception

    {


    }



    /**

     *

    * @param implementation

     * @param asName

     * @param interfaceToExpose

     *
@throws PublicationException

     */

    public void publish( Object implementation, String
asName, Class interfaceToExpose )

        throws PublicationException

    {

        if(
getLogger().isDebugEnabled() )

            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

    {

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

    }



    /**

     *

     * @param object

     * @param asName

    * @throws PublicationException

     */

    public void unPublish( Object object, String
asName ) throws PublicationException

    {

        if( getLogger().isDebugEnabled() )

           getLogger().debug( "Unpublishing object [nane: " + asName + ", impl: " + object
+ "]" );



        m_abstractServer.unPublish( object, asName );

    }



    /**

    
*

     * @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: " + asName + ", existing: " + object + ", new: " + 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;
    }

}

  \ No newline at end of file
  
  
  
  1.4       +6 -3      incubator-altrmi/src/java/org/apache/altrmi/blocks/publishing/RmiPublisher.java
  
  Index: RmiPublisher.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/publishing/RmiPublisher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RmiPublisher.java	17 Feb 2003 20:27:39 -0000	1.3
  +++ RmiPublisher.java	15 Jul 2003 07:08:09 -0000	1.4
  @@ -54,11 +54,11 @@
    */
   package org.apache.altrmi.blocks.publishing;
   
  +import org.apache.altrmi.server.impl.LogEnabledServerMonitor;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.altrmi.server.impl.rmi.RmiServer;
   
   /**
    * @phoenix:block
  @@ -99,7 +99,10 @@
       public void initialize() throws Exception
       {
   
  -        setAbstractServer( new RmiServer( m_host, m_port ) );
  +        LogEnabledServerMonitor sm = new LogEnabledServerMonitor(getLogger());
  +
  +        //TODO-PH-NOW
  +        //setAbstractServer( new RmiServer( new InvocationHandlerAdaptor(cr,aa,sm,ccf),
sm,  m_host, m_port ) );
   
           setupLogger( getAbstractServer() );
           super.initialize();
  
  
  
  1.4       +15 -15    incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/AbstractSubscriber.java
  
  Index: AbstractSubscriber.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/AbstractSubscriber.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractSubscriber.java	25 May 2003 16:49:55 -0000	1.3
  +++ AbstractSubscriber.java	15 Jul 2003 07:08:09 -0000	1.4
  @@ -79,6 +79,7 @@
   {
       protected Factory m_altrmiFactory;
       protected HostContext m_hostContext;
  +    private String m_proxyClassLocation;
   
       /**
        * Pass the <code>Configuration</code> to the <code>Configurable</code>
  @@ -90,20 +91,8 @@
       public void configure( Configuration configuration ) throws ConfigurationException
       {
   
  -        String proxyClassLocation = configuration.getChild( "proxyClassLocation" ).getValue();
  +        m_proxyClassLocation = configuration.getChild( "m_proxyClassLocation" ).getValue();
   
  -        if( proxyClassLocation.equals( "client" ) )
  -        {
  -            m_altrmiFactory = new ClientSideClassFactory();
  -        }
  -        else if( proxyClassLocation.equals( "server" ) )
  -        {
  -            m_altrmiFactory = new ServerSideClassFactory();
  -        }
  -        else
  -        {
  -            throw new ConfigurationException( "proxyClassLocation must be 'client' or 'server'"
);
  -        }
       }
   
       public Object lookup( String publishedName ) throws ConnectionException
  @@ -131,7 +120,18 @@
        */
       public void initialize() throws Exception
       {
  -        m_altrmiFactory.setHostContext( m_hostContext );
  +        if( m_proxyClassLocation.equals( "client" ) )
  +        {
  +            m_altrmiFactory = new ClientSideClassFactory(m_hostContext, false);
  +        }
  +        else if( m_proxyClassLocation.equals( "server" ) )
  +        {
  +            m_altrmiFactory = new ServerSideClassFactory(m_hostContext, false);
  +        }
  +        else
  +        {
  +            throw new IllegalArgumentException( "proxyClassLocation must be 'client' or
'server'" );
  +        }
       }
   
       public void close()
  
  
  
  1.3       +2 -2      incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/RmiSubscriber.java
  
  Index: RmiSubscriber.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/RmiSubscriber.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RmiSubscriber.java	17 Feb 2003 20:27:39 -0000	1.2
  +++ RmiSubscriber.java	15 Jul 2003 07:08:09 -0000	1.3
  @@ -98,7 +98,7 @@
       public void initialize()
           throws Exception
       {
  -        m_hostContext = new RmiHostContext( m_host, m_port );
  +        m_hostContext = new RmiHostContext.WithSimpleDefaults( m_host, m_port );
           super.initialize();
       }
   }
  
  
  
  1.4       +8 -2      incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/SocketCustomStreamSubscriber.java
  
  Index: SocketCustomStreamSubscriber.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/SocketCustomStreamSubscriber.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SocketCustomStreamSubscriber.java	17 Feb 2003 20:27:39 -0000	1.3
  +++ SocketCustomStreamSubscriber.java	15 Jul 2003 07:08:09 -0000	1.4
  @@ -57,6 +57,10 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.altrmi.client.impl.socket.SocketCustomStreamHostContext;
  +import org.apache.altrmi.client.impl.DefaultClientMonitor;
  +import org.apache.altrmi.client.impl.AvalonFrameworkClientMonitor;
  +import org.apache.altrmi.client.impl.DefaultConnectionPinger;
  +import org.apache.altrmi.common.DefaultThreadPool;
   
   /**
    * @phoenix:block
  @@ -97,7 +101,9 @@
       public void initialize()
           throws Exception
       {
  -        m_hostContext = new SocketCustomStreamHostContext( m_host, m_port );
  +        m_hostContext = new SocketCustomStreamHostContext.WithCurrentClassLoader( new DefaultThreadPool(),
  +                new AvalonFrameworkClientMonitor(getLogger()),
  +                new DefaultConnectionPinger(),  m_host, m_port );
           super.initialize();
       }
   }
  
  
  
  1.4       +5 -2      incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/SocketObjectStreamSubscriber.java
  
  Index: SocketObjectStreamSubscriber.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/blocks/subscription/SocketObjectStreamSubscriber.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SocketObjectStreamSubscriber.java	17 Feb 2003 20:27:39 -0000	1.3
  +++ SocketObjectStreamSubscriber.java	15 Jul 2003 07:08:10 -0000	1.4
  @@ -57,6 +57,9 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.altrmi.client.impl.socket.SocketObjectStreamHostContext;
  +import org.apache.altrmi.client.impl.AvalonFrameworkClientMonitor;
  +import org.apache.altrmi.client.impl.DefaultConnectionPinger;
  +import org.apache.altrmi.common.DefaultThreadPool;
   
   /**
    * @phoenix:block
  @@ -97,7 +100,7 @@
       public void initialize()
           throws Exception
       {
  -        m_hostContext = new SocketObjectStreamHostContext( m_host, m_port );
  +        m_hostContext = new SocketObjectStreamHostContext.WithCurrentClassLoader( new DefaultThreadPool(),
new AvalonFrameworkClientMonitor(getLogger()), new DefaultConnectionPinger(),  m_host, m_port
);
           super.initialize();
       }
   }
  
  
  
  1.1                  incubator-altrmi/src/java/org/apache/altrmi/blocks/authentication/DefaultAuthenticatorBlock.java
  
  Index: DefaultAuthenticatorBlock.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Incubator", "AltRMI", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.altrmi.blocks.authentication;
          //org.apache.avalon.excalibur.altrmi.blockpublishing.authentication.DefaultAuthenticatorBlock
  
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.altrmi.common.Authentication;
  import org.apache.altrmi.common.AuthenticationException;
  import org.apache.altrmi.server.Authenticator;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.altrmi.server.Authenticator"
   *
   * @author Paul Hammant
   * @version $Revision: 1.1 $
   */
  public class DefaultAuthenticatorBlock
      implements Authenticator, Initializable
  {
      private Authenticator m_authenticator;
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize()
          throws Exception
      {
          m_authenticator =
              new org.apache.altrmi.server.impl.DefaultAuthenticator();
      }
  
      public void checkAuthority( Authentication authentication, String publishedName )
          throws AuthenticationException
      {
          m_authenticator.checkAuthority( authentication, publishedName );
      }
  
      public String getTextToSign()
      {
          return m_authenticator.getTextToSign();
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message