portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources VariableResourcesService.java
Date Tue, 01 May 2001 13:26:19 GMT
raphael     01/05/01 06:26:19

  Modified:    src/java/org/apache/jetspeed/services/resources
                        VariableResourcesService.java
  Log:
  Update service so that getResources() works and return a VariableResourceInstance
  rather than a TurbineResourceInstance
  
  Revision  Changes    Path
  1.8       +37 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/VariableResourcesService.java
  
  Index: VariableResourcesService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/VariableResourcesService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VariableResourcesService.java	2001/04/03 00:26:32	1.7
  +++ VariableResourcesService.java	2001/05/01 13:26:17	1.8
  @@ -62,9 +62,8 @@
   import javax.servlet.ServletContext;
   
   // Turbine stuff.
  -//import org.apache.turbine.util.Configurations;
  -//import org.apache.turbine.util.ExtendedProperties;
   import org.apache.velocity.runtime.configuration.Configuration;
  +import org.apache.turbine.services.resources.ResourceService;
   import org.apache.turbine.services.resources.TurbineResourceService;
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.InitializationException;
  @@ -98,7 +97,7 @@
    *  </p>
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: VariableResourcesService.java,v 1.7 2001/04/03 00:26:32 raphael Exp $
  + * @version $Id: VariableResourcesService.java,v 1.8 2001/05/01 13:26:17 raphael Exp $
    */
   public class VariableResourcesService extends TurbineResourceService
   {
  @@ -216,6 +215,17 @@
           return path;
       }
       
  +    protected void setVariables(Hashtable vars)
  +    {
  +        synchronized (this)
  +        {
  +            this.variables = vars;
  +            this.strings = new Hashtable();
  +            this.vectors = new Hashtable();
  +            this.arrays = new Hashtable();
  +        }
  +    }
  +    
       protected String substituteString( String base ) {
           if (base == null) return null;
           
  @@ -354,5 +364,29 @@
   
           return std;
       }
  +
  +    /**
  +     * The purpose of this method is to extract a subset of configuraton
  +     * resources sharing a common name prefix. The prefix is stripped
  +     * from the names of the resulting resources.
  +     *
  +     * @param prefix the common name prefix
  +     * @return A ResourceService providing the subset of configuration.
  +     */
  +    public ResourceService getResources(String prefix)
  +    {
  +        Configuration config = getConfiguration().subset(prefix);
  +        
  +        if (config == null)
  +        {
  +            return null;
  +        }
  +        
  +        VariableResourcesService res = new VariableResourcesService();
  +        try { res.init(config); } catch (Exception e) {}
  +        res.setVariables(this.variables);
  +        return (ResourceService)res;
  +    }
  +
   
   }
  
  
  

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


Mime
View raw message