You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Eric Pugh <ep...@upstate.com> on 2006/04/03 18:40:12 UTC

Re: svn commit: r386104 - in /jakarta/turbine/fulcrum/trunk/cache:./ src/java/org/apache/fulcrum/cache/ src/java/org/apache/fulcrum/cache/impl/src/test/ src/test/org/apache/fulcrum/cache/ xdocs/

Hi all,

Only that I had used it with Hibernate.  I already have the  
dependency on EHCache in my project, so I was just sticking with  
that.  I'd be happy to see support for JCS added to the fulcrum-cache  
project as well!

Eric

On Mar 15, 2006, at 7:56 PM, Scott Eade wrote:

> epugh@apache.org wrote:
>> Add support for caching using EHCache.
>>
> Hi Eric,
>
> EHCache is a fork of our very own JCS - is there any particular  
> reason for favouring it over JCS?
>
> Just curious.
>
> Scott
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


New commits ahead, was: Re: svn commit: r386104 - in /jakarta/turbine/fulcrum/trunk/cache...

Posted by Thomas Vandahl <tv...@apache.org>.
Scott Eade wrote:
> Thomas, you may well be able to commit this yourself now that commit 
> access has been opened up for all of Jakarta (with the exception of poi 
> for legal reasons).
> 
> Not sure if there is any new etiquette with regards to jumping in to new 
> sub-projects.  It is probably better to post a quick note to the dev 
> list (this one) saying "hey, I am about to do this (commit thing_x)... - 
> shout now if you would rather I submitted it as a patch".

Ok, now. I would like to add a couple of methods to Fulcrum XSLT which 
allow to give parameters to the stylesheets. I also added a lot of 
comments  and fixed the JavaDoc.

Furthermore I added some more functionality to the ConfigurationService. 
It is now possible to use JNDI resources, XML files and the System 
properties as a configuration source, just like Commons configuration 
does when using the Configuration factory. Properties and XML files can 
be marked optional.

***
I have an Implementation of the GlobalCacheService ready which uses JCS. 
If only a release of a current version would be available  at ibilio! 
Aaron, please! I cannot commit this unless JCS is officially available!
***

As I wrote before, I changed the TurbineYaafiService to implement 
AvalonComponentService. Siegfried, please let me know if you prefer a 
new source file (may be two different derived classes of one Base class) 
or a change of the existing file.

If anything of this does not suit you, please speak now. Otherwise I 
will commit the patches next week.

Bye, Thomas
(Torque Committer)


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: svn commit: r386104 - in /jakarta/turbine/fulcrum/trunk/cache:./ src/java/org/apache/fulcrum/cache/ src/java/org/apache/fulcrum/cache/impl/src/test/ src/test/org/apache/fulcrum/cache/ xdocs/

Posted by Scott Eade <se...@backstagetech.com.au>.
Thomas, you may well be able to commit this yourself now that commit 
access has been opened up for all of Jakarta (with the exception of poi 
for legal reasons).

Not sure if there is any new etiquette with regards to jumping in to new 
sub-projects.  It is probably better to post a quick note to the dev 
list (this one) saying "hey, I am about to do this (commit thing_x)... - 
shout now if you would rather I submitted it as a patch".

Scott

Thomas Vandahl wrote:
> Eric Pugh wrote:
>> Hi all,
>>
>> Only that I had used it with Hibernate.  I already have the 
>> dependency on EHCache in my project, so I was just sticking with 
>> that.  I'd be happy to see support for JCS added to the fulcrum-cache 
>> project as well!
>
> I've got something ready using JCS which implements GlobalCacheService 
> and can be used as a drop-in replacement of the standard implementation.
>
> However I have yet to see my XSLT-patches reach SVN...
> Eric, would you mind trying again to add my changes to the XSLT 
> component of Fulcrum?
>
> I have also a patch to offer which makes the TurbineYaafiService play 
> nicely as a drop-in replacement for AvalonComponentService, if anybody 
> cares.
>
>
> Bye, Thomas.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Patch for TurbineYaafiService - WAS Re: svn commit: r386104 - in /....

Posted by Thomas Vandahl <tv...@apache.org>.
Hi Siegfried,

Siegfried Goeschl wrote:
> please send me the patch regarding the TurbineYaafiService ... or what 
> was wrong with the implementation?

Not exactly wrong, it was just not implementing AvalonComponentService 
but some other (similar) interface. However AvalonComponentService is 
subject to special care inside Turbine 2.3, so I decided to adjust that 
a little bit. :-)

I'll send you a patch tomorrow as I have the code at work.

Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Patch for TurbineYaafiService - WAS Re: svn commit: r386104 - in /....

Posted by Thomas Vandahl <th...@tewisoft.de>.
Hi Siegfried,

Siegfried Goeschl wrote:
> I'm not good at reading diffs and I'm currently work at a customer site 
> but I think you return Component on lookup() instead of Object which 
> probably is not a good idea.

Yes, I know. This is what AvalonComponentService requires. It also 
requires ComponentExceptions to be thrown when in reality a 
ServiceException is more appropriate. I wanted the service to be an 
exact implementation of ACS as it is in Turbine 2.3

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Patch for TurbineYaafiService - WAS Re: svn commit: r386104 - in /....

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Thomas,

I'm not good at reading diffs and I'm currently work at a customer site 
but I think you return Component on lookup() instead of Object which 
probably is not a good idea.

http://wiki.apache.org/avalon/ContainerStory

Cheers,

Siegfried Goeschl


Thomas Vandahl wrote:
> Hi Siegfried,
> 
> Siegfried Goeschl wrote:
> 
>> please send me the patch regarding the TurbineYaafiService ... or what 
>> was wrong with the implementation?
> 
> 
> Here we go. I implemented AvalonComponentService and changed the return 
> types, parameter types and exception types to comply with that. Then I 
> shifted the logger creation into the configuration creation. The logger 
> uses "avalon" now as category which is the value of AVALON_LOG_CATEGORY 
> as defined in the interface.
> 
> I hope everything I did is ok with you. I look forward to your comments.
> 
> Bye, Thomas.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: /yaafi/contrib/TurbineYaafiComponentService.java
> ===================================================================
> --- /yaafi/contrib/TurbineYaafiComponentService.java	(revision 388478)
> +++ /yaafi/contrib/TurbineYaafiComponentService.java	(working copy)
> @@ -22,7 +22,10 @@
>  
>  import org.apache.avalon.framework.activity.Disposable;
>  import org.apache.avalon.framework.activity.Initializable;
> +import org.apache.avalon.framework.component.Component;
> +import org.apache.avalon.framework.component.ComponentException;
>  import org.apache.avalon.framework.logger.Log4JLogger;
> +import org.apache.avalon.framework.service.ServiceException;
>  import org.apache.commons.configuration.Configuration;
>  import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
>  import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
> @@ -31,28 +34,30 @@
>  import org.apache.turbine.Turbine;
>  import org.apache.turbine.services.InitializationException;
>  import org.apache.turbine.services.TurbineBaseService;
> +import org.apache.turbine.services.avaloncomponent.AvalonComponentService;
>  import org.apache.turbine.services.servlet.TurbineServlet;
>  
>  /**
>   * An implementation of Turbine service initializing the YAAFI container
>   *
>   * @author <a href="mailto:siegfried.goescfl@it20one.at">Siegfried Goeschl</a>
> + * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
>   */
>  public class TurbineYaafiComponentService
>          extends TurbineBaseService
> -        implements YaafiComponentService, Initializable, Disposable
> +        implements AvalonComponentService, Initializable, Disposable
>  {
> -	/** property to lookup the container configuration file */
> -	public final String CONTAINER_CONFIGURATION_KEY = "containerConfiguration";
> +    /** property to lookup the container configuration file */
> +    public final String CONTAINER_CONFIGURATION_KEY = "containerConfiguration";
>  
> -	/** the default value for the container configuration file */
> -	public final String CONTAINER_CONFIGURATION_VALUE = "/WEB-INF/conf/containerConfiguration.xml";
> +    /** the default value for the container configuration file */
> +    public final String CONTAINER_CONFIGURATION_VALUE = "/WEB-INF/conf/containerConfiguration.xml";
>  
>      /** property to lookup the properties file */
> -	public final String COMPONENT_PARAMETERS_KEY = "parameters";
> +    public final String COMPONENT_PARAMETERS_KEY = "parameters";
>  
> -	/** the default value for the parameter file */
> -	public final String COMPONENT_PARAMETERS_VALUE = "/WEB-INF/conf/parameters.properties";
> +    /** the default value for the parameter file */
> +    public final String COMPONENT_PARAMETERS_VALUE = "/WEB-INF/conf/parameters.properties";
>  
>      /** YAFFI container */
>      private ServiceContainer container;
> @@ -75,7 +80,7 @@
>       *
>       * @throws InitializationException Something went wrong in the init stage
>       */
> -    public void init( Object data )
> +    public void init()
>          throws InitializationException
>      {
>          try
> @@ -134,22 +139,15 @@
>          this.logger.info( "Using the following home : " + home.getAbsolutePath() );
>  
>          // create the configuration for YAAFI
> -        
> -        ServiceContainerConfiguration config = this.createServiceContainerConfiguration(conf);
> -        
> -        config.setLogger( this.createAvalonLogger( "yaafi" ) );
> -        config.setApplicationRootDir( home );
> +        ServiceContainerConfiguration config = this.createServiceContainerConfiguration(conf, home.getAbsolutePath());
>  
>          try
>          {
> -            this.container = ServiceContainerFactory.create(
> -                config
> -                );
> +            this.container = ServiceContainerFactory.create(config);
>          }
>          catch (Throwable t)
>          {
> -            String msg = "Initializing YAAFI failed";
> -            this.logger.error(msg,t);
> +            this.logger.error("Initializing YAAFI failed", t);
>          }
>      }
>  
> @@ -172,90 +170,98 @@
>       * @return an instance of the named component
>       * @throws Exception generic exception
>       */
> -    public Object lookup(String path) throws Exception
> +    public Component lookup(String path) throws ComponentException
>      {
> -        return this.container.lookup(path);
> +        try
> +        {
> +            return (Component)this.container.lookup(path);
> +        }
> +        catch (ServiceException e)
> +        {
> +            throw new ComponentException(e.getKey(), e.getMessage(), e);
> +        }
>      }
>  
>      /**
>       * Releases the component
>       *
> -     * @param source. The path to the handler for this component For example, if the object is a
> -     *            java.sql.Connection object sourced from the "/turbine-merlin/datasource"
> -     *            component, the call would be :- release("/turbine-merlin/datasource", conn);
>       * @param component the component to release
>       */
> -    public void release(Object component)
> +    public void release(Component component)
>      {
>          this.container.release( component );
>      }
> -    
> +
>      /**
>       * Create a ServiceContainerConfiguration based on the Turbine configuration
> -     * 
> +     *
>       * @param conf the Turbine configuration
> +     * @param appRoot the absolute path to the application root directory
>       * @return the YAAFI configuration
>       * @throws IOException creating the YAAFI configuration failed
>       */
> -    protected ServiceContainerConfiguration createServiceContainerConfiguration( Configuration conf )
> -    	throws IOException
> +    protected ServiceContainerConfiguration createServiceContainerConfiguration( Configuration conf, String appRoot )
> +        throws IOException
>      {
>          ServiceContainerConfiguration result = new ServiceContainerConfiguration();
>  
> +        result.setLogger( this.createAvalonLogger(AVALON_LOG_CATEGORY));
> +        result.setApplicationRootDir(appRoot);
> +
>          // are we using a "containerConfiguration.xml" ?!
> -        
> +
>          if( conf.containsKey(CONTAINER_CONFIGURATION_KEY) )
>          {
> -	        // determine the container configuration file
> -	        
> -	        String containerConfiguration = conf.getString(
> -	            CONTAINER_CONFIGURATION_KEY
> -	            );
> -	        
> -	        result.loadContainerConfiguration(containerConfiguration);
> -        }    
> -	    else if( conf.containsKey(COMPONENT_ROLE_KEY) )
> -	    {		         
> -	        // determine the location of the role configuraton file
> -	
> -	        String roleConfigurationFileName = conf.getString(
> -	            COMPONENT_ROLE_KEY,
> -	            COMPONENT_ROLE_VALUE
> -	            );
> -	
> -	        // determine the location of component configuration file
> -	
> -	        String componentConfigurationFileName = conf.getString(
> -	            COMPONENT_CONFIG_KEY,
> -	            COMPONENT_CONFIG_VALUE
> -	            );
> -	
> -	        // determine the location of parameters file
> -	
> -	        String parametersFileName = conf.getString(
> -	            COMPONENT_PARAMETERS_KEY,
> -	            COMPONENT_PARAMETERS_VALUE
> -	            );
> -	        
> -	        result.setComponentRolesLocation( roleConfigurationFileName );
> -	        result.setComponentConfigurationLocation( componentConfigurationFileName );
> -	        result.setParametersLocation( parametersFileName );
> -	    }
> -	    else
> +            // determine the container configuration file
> +
> +            String containerConfiguration = conf.getString(
> +                CONTAINER_CONFIGURATION_KEY
> +                );
> +
> +            result.loadContainerConfiguration(containerConfiguration);
> +        }
> +        else if( conf.containsKey(COMPONENT_ROLE_KEY) )
>          {
> -	        // determine the container configuration file
> -	        
> -	        String containerConfiguration = conf.getString(
> -	            CONTAINER_CONFIGURATION_KEY,
> -	            CONTAINER_CONFIGURATION_VALUE
> -	            );
> -	        
> -	        result.loadContainerConfiguration(containerConfiguration);
> -        }    
> -        
> +            // determine the location of the role configuraton file
> +
> +            String roleConfigurationFileName = conf.getString(
> +                COMPONENT_ROLE_KEY,
> +                COMPONENT_ROLE_VALUE
> +                );
> +
> +            // determine the location of component configuration file
> +
> +            String componentConfigurationFileName = conf.getString(
> +                COMPONENT_CONFIG_KEY,
> +                COMPONENT_CONFIG_VALUE
> +                );
> +
> +            // determine the location of parameters file
> +
> +            String parametersFileName = conf.getString(
> +                COMPONENT_PARAMETERS_KEY,
> +                COMPONENT_PARAMETERS_VALUE
> +                );
> +
> +            result.setComponentRolesLocation( roleConfigurationFileName );
> +            result.setComponentConfigurationLocation( componentConfigurationFileName );
> +            result.setParametersLocation( parametersFileName );
> +        }
> +        else
> +        {
> +            // determine the container configuration file
> +
> +            String containerConfiguration = conf.getString(
> +                CONTAINER_CONFIGURATION_KEY,
> +                CONTAINER_CONFIGURATION_VALUE
> +                );
> +
> +            result.loadContainerConfiguration(containerConfiguration);
> +        }
> +
>          return result;
>      }
> -    
> +
>      /**
>       * Create the Avalon logger to be passed to YAAFI
>       * @param name the name of the logger
> @@ -263,6 +269,6 @@
>       */
>      protected org.apache.avalon.framework.logger.Logger createAvalonLogger( String name )
>      {
> -        return new Log4JLogger( Logger.getLogger( name ) );        
> +        return new Log4JLogger( Logger.getLogger( name ) );
>      }
>  }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Patch for TurbineYaafiService - WAS Re: svn commit: r386104 - in /....

Posted by Thomas Vandahl <th...@tewisoft.de>.
Hi Siegfried,

Siegfried Goeschl wrote:
> please send me the patch regarding the TurbineYaafiService ... or what 
> was wrong with the implementation?

Here we go. I implemented AvalonComponentService and changed the return 
types, parameter types and exception types to comply with that. Then I 
shifted the logger creation into the configuration creation. The logger 
uses "avalon" now as category which is the value of AVALON_LOG_CATEGORY 
as defined in the interface.

I hope everything I did is ok with you. I look forward to your comments.

Bye, Thomas.


Patch for TurbineYaafiService - WAS Re: svn commit: r386104 - in /....

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Thomas,

please send me the patch regarding the TurbineYaafiService ... or what 
was wrong with the implementation?

Siegfried Goeschl

Thomas Vandahl wrote:
> Eric Pugh wrote:
> 
>> Hi all,
>>
>> Only that I had used it with Hibernate.  I already have the dependency 
>> on EHCache in my project, so I was just sticking with that.  I'd be 
>> happy to see support for JCS added to the fulcrum-cache project as well!
> 
> 
> I've got something ready using JCS which implements GlobalCacheService 
> and can be used as a drop-in replacement of the standard implementation.
> 
> However I have yet to see my XSLT-patches reach SVN...
> Eric, would you mind trying again to add my changes to the XSLT 
> component of Fulcrum?
> 
> I have also a patch to offer which makes the TurbineYaafiService play 
> nicely as a drop-in replacement for AvalonComponentService, if anybody 
> cares.
> 
> 
> Bye, Thomas.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: svn commit: r386104 - in /jakarta/turbine/fulcrum/trunk/cache:./ src/java/org/apache/fulcrum/cache/ src/java/org/apache/fulcrum/cache/impl/src/test/ src/test/org/apache/fulcrum/cache/ xdocs/

Posted by Thomas Vandahl <tv...@apache.org>.
Eric Pugh wrote:
> Hi all,
> 
> Only that I had used it with Hibernate.  I already have the dependency 
> on EHCache in my project, so I was just sticking with that.  I'd be 
> happy to see support for JCS added to the fulcrum-cache project as well!

I've got something ready using JCS which implements GlobalCacheService 
and can be used as a drop-in replacement of the standard implementation.

However I have yet to see my XSLT-patches reach SVN...
Eric, would you mind trying again to add my changes to the XSLT 
component of Fulcrum?

I have also a patch to offer which makes the TurbineYaafiService play 
nicely as a drop-in replacement for AvalonComponentService, if anybody 
cares.


Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org