You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2001/07/09 09:35:45 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager CastorPsmlManagerService.java PsmlManagerService.java

taylor      01/07/09 00:35:44

  Modified:    src/java/org/apache/jetspeed/services Profiler.java
                        PsmlManager.java
               src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java ProfilerService.java
               src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
                        PsmlManagerService.java
  Log:
  - refactoring of Profiler and PSMLManager interfaces.
  - deprecated old methods to soon be removed when refactoring completed.
  
  Revision  Changes    Path
  1.9       +17 -61    jakarta-jetspeed/src/java/org/apache/jetspeed/services/Profiler.java
  
  Index: Profiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/Profiler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Profiler.java	2001/07/07 21:06:17	1.8
  +++ Profiler.java	2001/07/09 07:35:37	1.9
  @@ -55,6 +55,7 @@
   package org.apache.jetspeed.services;
   
   import org.apache.jetspeed.om.profile.Profile;
  +import org.apache.jetspeed.om.profile.ProfileLocator;
   import org.apache.jetspeed.om.profile.ProfileException;
   import org.apache.jetspeed.services.profiler.ProfilerService;
   import org.apache.turbine.services.TurbineServices;
  @@ -64,6 +65,7 @@
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.util.MimeType;
   import java.io.IOException;
  +import java.util.Iterator;
   
   /**
    * <P>This is a commodity static accessor class around the 
  @@ -72,7 +74,7 @@
    * @see org.apache.jetspeed.services.profiler.Profiler
    * @see org.apache.jetspeed.services.profiler.ProfilerService
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  - * @version $Id: Profiler.java,v 1.8 2001/07/07 21:06:17 taylor Exp $
  + * @version $Id: Profiler.java,v 1.9 2001/07/09 07:35:37 taylor Exp $
    */
   public class Profiler
   {
  @@ -116,24 +118,8 @@
       }
   
       /**
  -     * @see ProfilerService#setSessionProfile
  -     */
  -    public static void setSessionProfile(RunData rundata, Profile profile)
  -    {
  -        getService().setSessionProfile( rundata, profile );
  -    }
  -
  -    /**
  -     * @see ProfilerService#getSessionProfile
  -     */
  -    public static Profile getSessionProfile(RunData rundata)
  -        throws ProfileException
  -    {
  -        return getService().getSessionProfile( rundata );
  -    }
  -
  -    /**
        * @see ProfilerService#createUserProfile
  +     * @deprecated
        */
       public static Profile createUserProfile(RunData rundata, User user)
           throws IOException, ProfileException
  @@ -143,6 +129,7 @@
   
       /**
        * @see ProfilerService#createUserProfile
  +     * @deprecated
        */
       public static Profile createUserProfile(RunData rundata, User user, MimeType mt)
           throws IOException, ProfileException
  @@ -152,6 +139,7 @@
   
       /**
        * @see ProfilerService#removeUserProfile
  +     * @deprecated
        */
       public static void removeUserProfile(RunData rundata, User user)
           throws IOException, ProfileException
  @@ -160,68 +148,36 @@
       }
   
       /**
  -     * @see ProfilerService#storeCookie
  -     */
  -    public static void storeCookie(RunData rundata)
  -    {
  -       getService().storeCookie( rundata );
  -    }
  -
  -    /**
        * @see ProfilerService#makeDynamicURI
        */
  -     public static DynamicURI makeDynamicURI( RunData data )
  +     public static DynamicURI makeDynamicURI( RunData data, ProfileLocator locator )
           throws ProfileException
        {
  -        return getService().makeDynamicURI( data );
  +        return getService().makeDynamicURI( data, locator );
        }
   
  -    /**
  -     * @see ProfilerService#setSecurity
  -     */
  -    public void setSecurity( boolean flag )
  -    {
  -        getService().setSecurity(flag);
  -    }
  -
  -    /**
  -     * @see ProfilerService#getSecurity
  -     */
  -    public boolean getSecurity()
  -    {
  -        return getService().getSecurity();
  -    }
  -
  -    /**
  -     * @see ProfilerService#setLanguageProfiling
  -     */
  -    public void setLanguageProfiling( boolean flag )
  -    {
  -        getService().setLanguageProfiling(flag);
  -    }
  -
       /**
  -     * @see ProfilerService#getLanguageProfiling
  +     * @see ProfilerService#createProfile
        */
  -    public boolean getLanguageProfiling()
  +    public static Profile createProfile( ProfileLocator locator )
       {
  -        return getService().getLanguageProfiling();
  +        return getService().createProfile( locator );
       }
   
       /**
  -     * @see ProfilerService#setResourceNameCaching
  +     * @see ProfilerService#removeProfile
        */
  -    public void setResourceNameCaching( boolean flag )
  +    public void removeProfile(ProfileLocator locator)
       {
  -        getService().setResourceNameCaching(flag);
  +        getService().removeProfile( locator );
       }
   
       /**
  -     * @see ProfilerService#getResourceNameCaching
  +     * @see ProfilerService#list
        */
  -    public boolean getResourceNameCaching()
  +    public Iterator list( ProfileLocator locator )
       {
  -        return getService().getResourceNameCaching();
  +        return getService().list( locator );
       }
   
   }
  
  
  
  1.2       +34 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/services/PsmlManager.java
  
  Index: PsmlManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/PsmlManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PsmlManager.java	2001/06/04 17:30:27	1.1
  +++ PsmlManager.java	2001/07/09 07:35:38	1.2
  @@ -57,12 +57,14 @@
   import org.apache.jetspeed.services.psmlmanager.PsmlManagerService;
   import org.apache.jetspeed.om.profile.PSMLDocument;
   import org.apache.turbine.services.TurbineServices;
  +import org.apache.jetspeed.om.profile.ProfileLocator;
  +import java.util.Iterator;
   
   /**
    * Static accessor for the PsmlManagerService
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  - * @version $Id: PsmlManager.java,v 1.1 2001/06/04 17:30:27 raphael Exp $
  + * @version $Id: PsmlManager.java,v 1.2 2001/07/09 07:35:38 taylor Exp $
    */
   public class PsmlManager
   {
  @@ -83,6 +85,7 @@
        * For this implementation, the name must be the document
        * URL or absolute filepath
        *
  +     * @deprecated
        * @param name the name of the document to retrieve
        */
       public static PSMLDocument getDocument( String name )
  @@ -90,6 +93,16 @@
           return getService().getDocument(name);
       }
   
  +    /**
  +     * Returns a PSML document for the given locator
  +     *
  +     * @param locator The locator descriptor of the document to be retrieved.
  +     */
  +    public static PSMLDocument getDocument( ProfileLocator locator )
  +    {
  +        return getService().getDocument(locator);
  +    }
  +
       /** Save the PSML document on disk, using its name as filepath
        * 
        * @param doc the document to save
  @@ -109,5 +122,25 @@
       {
           return getService().saveDocument(fileOrUrl, doc);
       }
  +
  +    /** Create a new document.
  +     *
  +     * @param The description of the new profile to be created.
  +     * @return The newly created document.
  +     */
  +    public static PSMLDocument createDocument( ProfileLocator locator )
  +    {
  +        return getService().createDocument( locator );
  +    }
  +
  +    /** Get a list of profiles given a profile locator criteria.
  +     *
  +     * @param The profile locator criteria.
  +     */
  +    public static Iterator list( ProfileLocator locator )
  +    {
  +        return getService().list( locator );
  +    }
  +
   }
   
  
  
  
  1.10      +38 -73    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JetspeedProfilerService.java	2001/07/07 21:06:19	1.9
  +++ JetspeedProfilerService.java	2001/07/09 07:35:40	1.10
  @@ -59,6 +59,7 @@
   import java.util.HashMap;
   import java.util.Enumeration;
   import java.util.Locale;
  +import java.util.Iterator;
   
   // java.io
   import java.io.File;
  @@ -129,7 +130,7 @@
    *
    * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
    * @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
  - * @version $Id: JetspeedProfilerService.java,v 1.9 2001/07/07 21:06:19 taylor Exp $
  + * @version $Id: JetspeedProfilerService.java,v 1.10 2001/07/09 07:35:40 taylor Exp $
    */
   
   public class JetspeedProfilerService  extends TurbineBaseService
  @@ -226,67 +227,8 @@
       public void shutdown() {
       }
   
  -    /**
  -     *  turn on/off security checking when accessing profile resources
  -     *
  -     * @param flag indicates to turn security on with true, off with false.
  -     */
  -    public void setSecurity( boolean flag )
  -    {
  -        useSecurity = flag;
  -    }
  -
  -    /**
  -     *  get status of security checking when accessing profile resources
  -     *
  -     * @return the security-checking status: true in on, false is off
  -     */
  -    public boolean getSecurity()
  -    {
  -        return useSecurity;
  -    }
  -
  -    /**
  -     *  turn on/off NLS (language support) when accessing profile resources
  -     *
  -     * @param flag indicates to turn NLS on with true, off with false.
  -     */
  -    public void setLanguageProfiling( boolean flag )
  -    {
  -        useLanguage = flag;
  -    }
  -
  -    /**
  -     *  get status of NLS (language support) when accessing profile resources
  -     *
  -     * @return the language profiling status: true in on, false is off
  -     */
  -    public boolean getLanguageProfiling()
  -    {
  -        return useLanguage;
  -    }
  -
  -    /**
  -     *  turn on/off caching of resource names
  -     *
  -     * @param flag indicates to turn caching on with true, off with false.
  -     */
  -    public void setResourceNameCaching( boolean flag )
  -    {
  -        useNameCache = flag;
  -    }
   
       /**
  -     *  get status of caching of resource names
  -     *
  -     * @return the resource caching status: true in on, false is off
  -     */
  -    public boolean getResourceNameCaching()
  -    {
  -        return useNameCache;
  -    }
  -
  -    /**
        *  get the Profile object using the Rundata state and capability map
        *  this is the mapping functionality of the profiler
        *
  @@ -450,16 +392,6 @@
           return profile;
       }
   
  -     /**
  -      * stores a cookie in response to the current resource
  -      *
  -      * @param rundata the rundata object for the current request
  -      */
  -     public void storeCookie(RunData rundata)
  -     {
  -        // TODO: write me
  -     }
  -
       /**
        * Gets a resource's URL based on RunData and the CapabilityMap
        *
  @@ -633,7 +565,7 @@
               resource.append( param );
               if ( -1 == param.indexOf( PATH_EXTENSION_DELIMITER ) )
                   resource.append( resourceExt );
  -            profile.setPage( param );
  +            profile.setName( param );
           }
           return resource.toString();
       }
  @@ -909,7 +841,7 @@
         * @param rundata the rundata object for the current request
         * @return new dynamic URI with full path
         */
  -    public DynamicURI makeDynamicURI( RunData data )
  +    public DynamicURI makeDynamicURI( RunData data, ProfileLocator locator )
           throws ProfileException
       {
           DynamicURI uri = new DynamicURI( data );
  @@ -922,7 +854,7 @@
               if (null != role)
                   uri.addPathInfo(PARAM_ROLE, role);
           }
  -        String page = profile.getPage();
  +        String page = profile.getName();
           if (null != page)
               uri.addPathInfo(PARAM_PAGE, page);
   
  @@ -932,6 +864,7 @@
      /**
        *  Removes a user profile and all of its resources (psml) for a given user.
        *
  +     * @deprecated
        * @param rundata the rundata object for the current request
        * @param user the new user to create
        */
  @@ -946,4 +879,36 @@
           String realPath = TurbineServlet.getRealPath(finalPath);
           DirectoryUtils.rmdir(realPath);
      }
  +
  +    /** Create a new profile.
  +     *
  +     * @param The description of the new profile to be created.
  +     * @return The newly created profile.
  +     */
  +    public Profile createProfile( ProfileLocator locator )
  +    {
  +        // TODO: implement
  +        return null;
  +    }
  +
  +   /**
  +     *  Removes a profile.
  +     *
  +     * @param The profile locator criteria.
  +     */
  +    public void removeProfile( ProfileLocator locator )
  +    {
  +        // IMPLEMENT ME:
  +    }
  +
  +    /** Get a list of profiles given a profile locator criteria.
  +     *
  +     * @param The profile locator criteria.
  +     */
  +    public Iterator list( ProfileLocator locator )
  +    {
  +        // TODO: implement
  +        return null;
  +    }
  +
   }
  
  
  
  1.8       +18 -59    jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/ProfilerService.java
  
  Index: ProfilerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/ProfilerService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProfilerService.java	2001/07/07 21:06:20	1.7
  +++ ProfilerService.java	2001/07/09 07:35:41	1.8
  @@ -63,13 +63,14 @@
   import org.apache.turbine.util.DynamicURI;
   import org.apache.jetspeed.util.MimeType;
   import java.io.IOException;
  +import java.util.Iterator;
   
   /**
    * <P>This interface is a facade for all profile related operations</P>
    * 
    * @see org.apache.jetspeed.om.profile.Profile
    * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
  - * @version $Id: ProfilerService.java,v 1.7 2001/07/07 21:06:20 taylor Exp $
  + * @version $Id: ProfilerService.java,v 1.8 2001/07/09 07:35:41 taylor Exp $
    */
   
   public interface ProfilerService extends Service
  @@ -87,13 +88,6 @@
        */
       public Profile getProfile(RunData rundata, CapabilityMap cm)
           throws ProfileException;
  -     /**
  -      * sets a profile as the current profile for this session
  -      *
  -      * @param rundata the rundata object for the current request
  -      * @param profile the profile object to set in the session context
  -      */
  -    public void setSessionProfile(RunData rundata, Profile profile);
   
       /**
        * get the Profile object using the Rundata state and capability map
  @@ -115,20 +109,12 @@
       public Profile getProfile(RunData data, MimeType mt)
           throws ProfileException;
   
  -     /**
  -      * gets the current profile for this session
  -      *
  -      * @param rundata the rundata object for the current request
  -      * @param profile the profile object to set in the session context
  -      */
  -    public Profile getSessionProfile(RunData rundata)
  -        throws ProfileException;
  -
       /**
        *  create a user profile and its resources (psml) for a new user
        *
        * @param rundata the rundata object for the current request
        * @param user the new user to create
  +     * @deprecated
        * @return a new Profile object
        */
       public Profile createUserProfile(RunData rundata, User user)
  @@ -141,6 +127,7 @@
        * @param rundata the rundata object for the current request
        * @param user the new user to create
        * @param mt the specific mimeType to create a profile for
  +     * @deprecated
        * @return a new Profile object
        */
       public Profile createUserProfile(RunData rundata, User user, MimeType mt)
  @@ -150,66 +137,38 @@
        *  Removes a user profile and all of its resources (psml) for a given user.
        *
        * @param rundata the rundata object for the current request
  +     * @deprecated
        * @param user the new user to be removed
        */
       public void removeUserProfile(RunData rundata, User user)
           throws IOException, ProfileException;
   
        /**
  -      * stores a cookie in response to the current resource
  +      * Creates a dynamic URI
         *
         * @param rundata the rundata object for the current request
         */
  -     public DynamicURI makeDynamicURI( RunData data )
  +     public DynamicURI makeDynamicURI( RunData data, ProfileLocator locator )
           throws ProfileException;
  -
  -     /**
  -      * stores a cookie in response to the current resource
  -      *
  -      * @param rundata the rundata object for the current request
  -      */
  -     public void storeCookie(RunData rundata);
   
  -    /**
  -     *  turn on/off security checking when accessing profile resources
  +    /** Create a new profile.
        *
  -     * @param flag indicates to turn security on with true, off with false.
  +     * @param The description of the new profile to be created.
  +     * @return The newly created profile.
        */
  -    public void setSecurity( boolean flag );
  +    public Profile createProfile( ProfileLocator locator );
   
  -    /**
  -     *  get status of security checking when accessing profile resources
  -     *
  -     * @return the security-checking status: true in on, false is off
  -     */
  -    public boolean getSecurity();
  -
  -    /**
  -     *  turn on/off NLS (language support) when accessing profile resources
  -     *
  -     * @param flag indicates to turn NLS on with true, off with false.
  -     */
  -    public void setLanguageProfiling( boolean flag );
  -
  -    /**
  -     *  get status of NLS (language support) when accessing profile resources
  -     *
  -     * @return the language profiling status: true in on, false is off
  -     */
  -    public boolean getLanguageProfiling();
  -
  -    /**
  -     *  turn on/off caching of resource names
  +   /**
  +     *  Removes a profile.
        *
  -     * @param flag indicates to turn caching on with true, off with false.
  +     * @param The profile locator criteria.
        */
  -    public void setResourceNameCaching( boolean flag );
  +    public void removeProfile( ProfileLocator locator );
   
  -    /**
  -     *  get status of caching of resource names
  +    /** Get a list of profiles given a profile locator criteria.
        *
  -     * @return the resource caching status: true in on, false is off
  +     * @param The profile locator criteria.
        */
  -    public boolean getResourceNameCaching();
  +    public Iterator list( ProfileLocator locator );
   
   }
  
  
  
  1.3       +36 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
  
  Index: CastorPsmlManagerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CastorPsmlManagerService.java	2001/06/06 22:27:37	1.2
  +++ CastorPsmlManagerService.java	2001/07/09 07:35:43	1.3
  @@ -56,6 +56,7 @@
   
   //Jetspeed stuff
   import org.apache.jetspeed.cache.disk.JetspeedDiskCache;
  +import org.apache.jetspeed.om.profile.ProfileLocator;
   
   //Castor defined API
   import org.apache.jetspeed.xml.api.portletmarkup.Portlets;
  @@ -98,7 +99,7 @@
    * This service is responsible for loading and saving PSML documents.
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  - * @version $Id: CastorPsmlManagerService.java,v 1.2 2001/06/06 22:27:37 raphael Exp $
  + * @version $Id: CastorPsmlManagerService.java,v 1.3 2001/07/09 07:35:43 taylor Exp $
    */
   public class CastorPsmlManagerService extends TurbineBaseService
       implements PsmlManagerService
  @@ -170,6 +171,7 @@
        * For this implementation, the name must be the document
        * URL or absolute filepath
        *
  +     * @deprecated
        * @param name the name of the document to retrieve
        */
       public PSMLDocument getDocument( String name )
  @@ -208,6 +210,17 @@
           return doc;
       }
   
  +    /**
  +     * Returns a PSML document for the given locator
  +     *
  +     * @param locator The locator descriptor of the document to be retrieved.
  +     */
  +    public PSMLDocument getDocument( ProfileLocator locator )
  +    {
  +        // IMPLEMENT ME:
  +        return null;
  +    }
  +
       /** 
        * Load a PSMLDOcument from disk
        *
  @@ -510,5 +523,27 @@
           }
           
       }
  +
  +    /** Create a new document.
  +     *
  +     * @param The description of the new profile to be created.
  +     * @return The newly created document;
  +     */
  +    public PSMLDocument createDocument( ProfileLocator locator )
  +    {
  +        // TODO: implement
  +        return null;
  +    }
  +
  +    /** Get a list of profiles given a profile locator criteria.
  +     *
  +     * @param The profile locator criteria.
  +     */
  +    public Iterator list( ProfileLocator locator )
  +    {
  +        // TODO: implement
  +        return null;
  +    }
  +
   }
   
  
  
  
  1.2       +26 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlManagerService.java
  
  Index: PsmlManagerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlManagerService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PsmlManagerService.java	2001/06/04 17:30:43	1.1
  +++ PsmlManagerService.java	2001/07/09 07:35:43	1.2
  @@ -54,14 +54,16 @@
   
   package org.apache.jetspeed.services.psmlmanager;
   
  +import java.util.Iterator;
   import org.apache.turbine.services.Service;
   import org.apache.jetspeed.om.profile.PSMLDocument;
  +import org.apache.jetspeed.om.profile.ProfileLocator;
   
   /**
    * This service is responsible for loading and saving PSML documents.
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  - * @version $Id: PsmlManagerService.java,v 1.1 2001/06/04 17:30:43 raphael Exp $
  + * @version $Id: PsmlManagerService.java,v 1.2 2001/07/09 07:35:43 taylor Exp $
    */
   public interface PsmlManagerService extends Service
   {
  @@ -74,10 +76,19 @@
        * For this implementation, the name must be the document
        * URL or absolute filepath
        *
  +     * @deprecated
        * @param name the name of the document to retrieve
        */
       public PSMLDocument getDocument( String name );
   
  +    /**
  +     * Returns a PSML document for the given locator
  +     *
  +     * @param locator The locator descriptor of the document to be retrieved.
  +     */
  +    public PSMLDocument getDocument( ProfileLocator locator );
  +
  +
       /** Save the PSML document on disk, using its name as filepath
        * 
        * @param doc the document to save
  @@ -93,5 +104,19 @@
        * @return true if the operation succeeded
        */
       public boolean saveDocument(String fileOrUrl, PSMLDocument doc);
  +
  +    /** Create a new document.
  +     *
  +     * @param The description of the new profile to be created.
  +     * @return The newly created document;
  +     */
  +    public PSMLDocument createDocument( ProfileLocator locator );
  +
  +    /** Get a list of profiles given a profile locator criteria.
  +     *
  +     * @param The profile locator criteria.
  +     */
  +    public Iterator list( ProfileLocator locator );
  +
   }
   
  
  
  

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