portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/WEB-INF/db jetspeed.properties jetspeed.script
Date Thu, 20 Nov 2003 02:51:03 GMT
taylor      2003/11/19 18:51:03

  Modified:    src/java/org/apache/jetspeed/modules/actions/controllers
                        PanedControllerAction.java
               src/java/org/apache/jetspeed/om/profile BaseProfile.java
                        Profile.java
               src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java
               webapp/WEB-INF/conf JetspeedResources.properties
                        JetspeedSecurity.properties
               webapp/WEB-INF/db jetspeed.properties jetspeed.script
  Added:       src/java/org/apache/jetspeed/services ServiceHelper.java
  Log:
  Profile and Locator class impls are configurable via the JetspeedResources.properties
  
  services.Profiler.profile.impl = org.apache.jetspeed.om.profile.BaseProfile
  services.Profiler.locator.impl = org.apache.jetspeed.om.profile.BaseProfileLocator
  
  Revision  Changes    Path
  1.12      +4 -3      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/PanedControllerAction.java
  
  Index: PanedControllerAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/PanedControllerAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PanedControllerAction.java	31 Oct 2003 14:34:37 -0000	1.11
  +++ PanedControllerAction.java	20 Nov 2003 02:51:03 -0000	1.12
  @@ -122,8 +122,9 @@
           if (portlet != null)
           {
               context.put("pane", portlet);        
  -
  -            if(!portlet.getAttribute("_menustate", "open", rundata).equals("closed"))
  +            String state = portlet.getAttribute("_menustate", "open", rundata);
  +            //System.out.println("State = [" + state +"]");
  +            // if(state == null || !state.equals("closed"))
               {   
                   cont.savePaneID(rundata, paneID);
               }
  
  
  
  1.18      +12 -7     jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BaseProfile.java
  
  Index: BaseProfile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BaseProfile.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- BaseProfile.java	4 Mar 2003 00:04:58 -0000	1.17
  +++ BaseProfile.java	20 Nov 2003 02:51:03 -0000	1.18
  @@ -1,7 +1,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -24,11 +24,11 @@
    *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "Apache" and "Apache Software Foundation" and
  - *     "Apache Jetspeed" must not be used to endorse or promote products
  + *    "Apache Jetspeed" 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" or
  + * 5. Products derived from this software may not be called "Apache",
    *    "Apache Jetspeed", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
  @@ -73,7 +73,12 @@
       public BaseProfile()
       {}
   
  -    public BaseProfile( ProfileLocator locator )
  +    public BaseProfile(ProfileLocator locator)
  +    {
  +        init(locator);
  +    }
  +
  +    public void init(ProfileLocator locator)
       {
           this.setAnonymous(locator.getAnonymous());
           this.setCountry(locator.getCountry());
  @@ -82,9 +87,9 @@
           this.setMediaType(locator.getMediaType());
           this.setName(locator.getName());
           this.setRole(locator.getRole());
  -        this.setUser(locator.getUser());
  +        this.setUser(locator.getUser());        
       }
  -
  +    
       /**
        * @see Object#clone
        * @return an instance copy of this object
  
  
  
  1.10      +15 -8     jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/Profile.java
  
  Index: Profile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/Profile.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Profile.java	4 Mar 2003 00:04:58 -0000	1.9
  +++ Profile.java	20 Nov 2003 02:51:03 -0000	1.10
  @@ -1,7 +1,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -24,11 +24,11 @@
    *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "Apache" and "Apache Software Foundation" and
  - *     "Apache Jetspeed" must not be used to endorse or promote products
  + *    "Apache Jetspeed" 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" or
  + * 5. Products derived from this software may not be called "Apache",
    *    "Apache Jetspeed", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
  @@ -65,7 +65,7 @@
   
   public interface Profile extends ProfileLocator
   {
  -    /*
  +    /**
        *  Gets the root set of portlets for this profile object.
        *
        *  @deprecated Will be removed with refactoring of profiler service.
  @@ -73,24 +73,31 @@
        */
       public PortletSet getRootSet();
   
  -    /*
  +    /**
        * Gets the psml document attached to this profile
        *
        * @return The PSML document for this profile.
        */
       public PSMLDocument getDocument();
   
  -    /*
  +    /**
        * Sets the psml document attached to this profile
        *
        * @param The PSML document for this profile.
        */
       public void setDocument(PSMLDocument document);
   
  -    /*
  +    /**
        * stores the resource by merging and rewriting the psml file
        *
        * @throws ProfileException if an error occurs storing the profile
        */
       public void store() throws ProfileException;
  +    
  +    /**
  +     * initialize a profile from a locator
  +     * 
  +     * @param locator
  +     */
  +    public void init(ProfileLocator locator);
   }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/ServiceHelper.java
  
  Index: ServiceHelper.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" 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",
   *    "Apache Jetspeed", 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.jetspeed.services;
  
  import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
  import org.apache.jetspeed.services.logging.JetspeedLogger;
  import org.apache.turbine.services.InitializationException;
  import org.apache.turbine.services.Service;
  
  /**
   * ServiceHelper
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: ServiceHelper.java,v 1.1 2003/11/20 02:51:03 taylor Exp $
   */
  public class ServiceHelper
  {
      private static final JetspeedLogger log = JetspeedLogFactoryService.getLogger(ServiceHelper.class.getName());
      
      /**
       * Load an implementation class from the configuration.
       * 
       * @param configurationName
       * @return
       * @throws CPSInitializationException
       */
      static public Class loadModelClass(Service service, String configurationName)
      throws InitializationException
      {
          String className = service.getConfiguration().getString(configurationName, null);
          if (null == className)
          {
              throw new InitializationException(configurationName + " implementation configuration
not found.");
          }
          try
          {
              return Class.forName(className);
              
          }
          catch (ClassNotFoundException e)
          {
              throw new InitializationException("Could not preload " + className + " implementation
class.", e);
          }            
      }
  
      /**
       * Creates objects given the class. 
       * Throws exceptions if the class is not found in the default class path, 
       * or the class is not an instance of CmsObject.
       * 
       * @param classe the class of object
       * @return the newly created object
       * @throws ContentManagementException
       */    
      public static Object createObject(Class classe)
      {
          Object object = null;
          try
          {
              object = classe.newInstance();
          }
          catch (Exception e)
          {
              log.error("Factory failed to create object: " + classe.getName(), e);      
     
          }
          
          return object;        
      }
      
  }
  
  
  
  1.54      +30 -20    jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
  
  Index: JetspeedProfilerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- JetspeedProfilerService.java	17 Nov 2003 14:53:02 -0000	1.53
  +++ JetspeedProfilerService.java	20 Nov 2003 02:51:03 -0000	1.54
  @@ -24,11 +24,11 @@
    *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "Apache" and "Apache Software Foundation" and
  - *     "Apache Jetspeed" must not be used to endorse or promote products
  + *    "Apache Jetspeed" 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" or
  + * 5. Products derived from this software may not be called "Apache",
    *    "Apache Jetspeed", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
  @@ -86,8 +86,6 @@
   import org.apache.jetspeed.om.profile.Portlets;
   import org.apache.jetspeed.om.profile.QueryLocator;
   import org.apache.jetspeed.om.profile.ProfileLocator;
  -import org.apache.jetspeed.om.profile.BaseProfileLocator;
  -import org.apache.jetspeed.om.profile.BaseProfile;
   import org.apache.jetspeed.om.profile.ProfileException;
   import org.apache.jetspeed.om.profile.psml.PsmlPortlets;
   import org.apache.jetspeed.om.profile.PSMLDocument;
  @@ -109,6 +107,7 @@
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.services.PsmlManager;
   import org.apache.jetspeed.services.PortalToolkit;
  +import org.apache.jetspeed.services.ServiceHelper;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.customlocalization.CustomLocalizationService;
  @@ -179,6 +178,10 @@
       private final static String MSG_MISSING_PARAMETER =
           "JetspeedProfilerService initialization failed. Missing parameter:";
   
  +    // pluggable Locator and Profile classes
  +    private Class profileClass = null;
  +    private Class locatorClass = null;
  +    
   
       // configuration parameters
       String root;                   // the root psml resource directory
  @@ -251,7 +254,7 @@
        */
       public synchronized void init(ServletConfig conf) throws InitializationException
       {
  -
  +        
           // already initialized
           if (getInit()) return;
   
  @@ -299,7 +302,6 @@
                   try
                   {
                       String paramRole = rundata.getParameters().getString(Profiler.PARAM_ROLE);
  -                	
                       Iterator roles = JetspeedSecurity.getRoles(user.getUserName());
                       if (roles != null)
                       {
  @@ -435,7 +437,8 @@
                   result = this.createProfile(locator, portlets);
   
               }
  -            catch (Exception e) {
  +            catch (Exception e) 
  +            {
                   logger.error("Exception",  e);
               }
           }
  @@ -622,14 +625,14 @@
               // dont use locale based fall back            
               profile.setLanguage(language);
   
  -			if(! language.equals("-1"))
  -			{
  -	            String country = rundata.getParameters().getString(Profiler.PARAM_COUNTRY);
  -	            if (country != null)
  -	            {
  -	                profile.setCountry(country);
  -	            }
  -			}
  +            if(! language.equals("-1"))
  +            {
  +                String country = rundata.getParameters().getString(Profiler.PARAM_COUNTRY);
  +                if (country != null)
  +                {
  +                    profile.setCountry(country);
  +                }
  +            }
           }
           else
           {
  @@ -845,6 +848,9 @@
        */
       private void initConfiguration() throws InitializationException
       {
  +        profileClass = ServiceHelper.loadModelClass(this, "profile.impl");
  +        locatorClass = ServiceHelper.loadModelClass(this, "locator.impl");
  +        
           // get configuration parameters from Jetspeed Resources
           ResourceService serviceConf = ((TurbineServices)TurbineServices.getInstance())
                                                        .getResources(ProfilerService.SERVICE_NAME);
  @@ -853,8 +859,10 @@
   
           resourceExt = serviceConf.getString( CONFIG_RESOURCE_EXT, DEFAULT_CONFIG_RESOURCE_EXT
);
           if (-1 == resourceExt.indexOf(PATH_EXTENSION_DELIMITER))
  +        {
               resourceExt = PATH_EXTENSION_DELIMITER + resourceExt;
  -
  +        }
  +        
           useSecurity = serviceConf.getBoolean( CONFIG_SECURITY, DEFAULT_CONFIG_SECURITY
);
   
           useRoleFallback = serviceConf.getBoolean( CONFIG_ROLE_FALLBACK, DEFAULT_CONFIG_ROLE_FALLBACK
);
  @@ -970,7 +978,7 @@
        */
       public Profile createProfile()
       {
  -        return new BaseProfile();
  +        return (Profile)ServiceHelper.createObject(this.profileClass);
       }
   
       /**
  @@ -981,7 +989,9 @@
        */
       public Profile createProfile(ProfileLocator locator)
       {
  -        return new BaseProfile(locator);
  +        Profile profile = (Profile)ServiceHelper.createObject(this.profileClass);
  +        profile.init(locator);
  +        return profile;
       }
   
       /**
  @@ -992,7 +1002,7 @@
        */
       public ProfileLocator createLocator()
       {
  -        return new BaseProfileLocator();
  +        return (ProfileLocator)ServiceHelper.createObject(this.locatorClass);
       }
   
       /**
  
  
  
  1.112     +5 -1      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties
  
  Index: JetspeedResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- JetspeedResources.properties	30 Oct 2003 01:53:17 -0000	1.111
  +++ JetspeedResources.properties	20 Nov 2003 02:51:03 -0000	1.112
  @@ -454,6 +454,10 @@
   # Control to use in merged profile
   services.Profiler.rolemerge.control=TabControl
   
  +# default profile and locator class impls
  +services.Profiler.profile.impl = org.apache.jetspeed.om.profile.BaseProfile
  +services.Profiler.locator.impl = org.apache.jetspeed.om.profile.BaseProfileLocator
  +
   #########################################
   # Template Locator Service              #
   #########################################
  
  
  
  1.71      +0 -0      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties
  
  Index: JetspeedSecurity.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  
  
  
  1.33      +1 -1      jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties
  
  Index: jetspeed.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jetspeed.properties	25 Aug 2003 06:18:41 -0000	1.32
  +++ jetspeed.properties	20 Nov 2003 02:51:03 -0000	1.33
  @@ -1,5 +1,5 @@
   #HSQL database
  -#Wed Aug 13 15:04:41 PDT 2003
  +#Wed Nov 19 18:08:27 PST 2003
   sql.strict_fk=false
   readonly=false
   sql.strong_fk=true
  
  
  
  1.36      +4 -2      jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.script
  
  Index: jetspeed.script
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.script,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jetspeed.script	25 Aug 2003 06:18:41 -0000	1.35
  +++ jetspeed.script	20 Nov 2003 02:51:03 -0000	1.36
  @@ -19,8 +19,8 @@
   CREATE TABLE COFFEES(COFFEE_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,COFFEE_NAME VARCHAR(50),SUPPLIER_ID
INTEGER,PRICE FLOAT,SALES INTEGER,TOTAL INTEGER)
   CREATE TABLE JETSPEED_ACL(ACL_ID INTEGER,SECURITY_ID INTEGER,RESOURCE VARCHAR,RESOURCE_TYPE
VARCHAR,ACTION VARCHAR,ALLOW_TYPE VARCHAR,PRINCIPAL VARCHAR,CONSTRAINT SYS_CT_17 UNIQUE(ACL_ID))
   CREATE INDEX JETSPEED_ACL_I_2 ON JETSPEED_ACL(SECURITY_ID)
  -GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
   GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
  +GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
   GRANT ALL ON CLASS "org.hsql.Library" TO PUBLIC
   CREATE USER SA PASSWORD "" ADMIN
   CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname"
  @@ -170,6 +170,8 @@
   INSERT INTO COFFEES VALUES(9,'KenyanGrade',2,7.99E0,1,2)
   INSERT INTO COFFEES VALUES(10,'JoeGrade',3,7.99E0,1,2)
   INSERT INTO COFFEES VALUES(11,'CantThinkOfAnymoreGrade',4,7.99E0,1,2)
  -/*C1*/CONNECT USER sa PASSWORD ""
  +/*C2*/CONNECT USER sa PASSWORD ""
  +SET AUTOCOMMIT TRUE
  +SET READONLY FALSE
   SET AUTOCOMMIT TRUE
   SET READONLY FALSE
  
  
  

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