portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Golden <ggol...@umich.edu>
Subject RE: cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/ser vices/psmlmanager CastorPsmlManagerService.java
Date Wed, 03 Apr 2002 15:57:49 GMT
David -

This is great!  I'm using JetspeedRunData.getProfile().getId() now as part
of my portlet instance keys.  Thanks!

Could you change it slightly - it returns something like

user/aUser/html/default.psml

which I really like, except for the ".psml" part.  It doesn't seem to belong
to an id, as it's really a file system extension.

user/aUser/html/default

Would be just perfect!

What do you think?

- Glenn
 
--------------------------------------------
Glenn R. Golden, Systems Research Programmer
University of Michigan School of Information
ggolden@umich.edu               734-615-1419
http://www-personal.si.umich.edu/~ggolden/
--------------------------------------------



> -----Original Message-----
> From: taylor@apache.org [mailto:taylor@apache.org] 
> Sent: Wednesday, April 03, 2002 1:41 AM
> To: jakarta-jetspeed-cvs@apache.org
> Subject: cvs commit: 
> jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlman
> ager CastorPsmlManagerService.java
> 
> 
> taylor      02/04/02 22:40:56
> 
>   Modified:    src/java/org/apache/jetspeed/om/profile
>                         BaseProfileLocator.java ProfileLocator.java
>                src/java/org/apache/jetspeed/services/portaltoolkit
>                         JetspeedPortalToolkitService.java
>                src/java/org/apache/jetspeed/services/psmlmanager
>                         CastorPsmlManagerService.java
>   Log:
>   - getId() function added to ProfileLocator returning a 
> unique id for psml resource
>   
>   Revision  Changes    Path
>   1.8       +114 -5    
> jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BaseP
> rofileLocator.java
>   
>   Index: BaseProfileLocator.java
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/pro
> file/BaseProfileLocator.java,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- BaseProfileLocator.java	25 Feb 2002 04:51:24 -0000	1.7
>   +++ BaseProfileLocator.java	3 Apr 2002 06:40:56 -0000	1.8
>   @@ -61,6 +61,7 @@
>    import org.apache.turbine.om.security.Group;
>    import org.apache.turbine.util.security.UnknownEntityException;
>    
>   +import org.apache.jetspeed.services.Profiler;
>    import org.apache.jetspeed.services.JetspeedSecurity;
>    import org.apache.turbine.services.TurbineServices;
>    import org.apache.turbine.services.ServiceBroker;
>   @@ -73,21 +74,83 @@
>     *
>     * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
>     * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
>   - * @version $Id: BaseProfileLocator.java,v 1.7 2002/02/25 
> 04:51:24 taylor Exp $
>   + * @version $Id: BaseProfileLocator.java,v 1.8 2002/04/03 
> 06:40:56 taylor Exp $
>    */
>    
>    public class BaseProfileLocator implements ProfileLocator, 
> Cloneable
>    {
>        // instance state
>   -    private String name;
>   -    private String mediaType;
>   -    private String language;
>   -    private String country;
>   +    private String name = null;
>   +    private String mediaType = null;
>   +    private String language = null;
>   +    private String country = null;
>        private User   user = null;
>        private Role   role = null;
>        private Group  group = null;
>        private boolean anonymous = false;
>    
>   +    private static final String DELIM = "/";
>   +
>   +    /*
>   +     * Gets the unique profile locator id, which is a 
> combination of the params
>   +     * This ID must follow the one of the 4 sequences below:
>   +     *
>   +     *   <username>/<mediaType>/<language>/<country>/<page>
>   +     *   <group>/<mediaType>/<language>/<country>/<page>
>   +     *   <role>/<mediaType>/<language>/<country>/<page>
  
>   +     *
>   +     * 
>   +     * @return The profile locator id
>   +     */
>   +   
>   +    public String getId()
>   +    {
>   +        StringBuffer id = new StringBuffer(128);
>   +
>   +        if (!anonymous && user != null)
>   +        {
>   +            id.append(Profiler.PARAM_USER).append(DELIM);
>   +            id.append(user.getUserName());
>   +        }
>   +        else if (group != null)
>   +        {
>   +            id.append(Profiler.PARAM_GROUP).append(DELIM);
>   +            id.append(group.getName());
>   +        }
>   +        else if (role != null)
>   +        {
>   +            id.append(Profiler.PARAM_ROLE).append(DELIM);
>   +            id.append(role.getName());        
>   +        }
>   +        else
>   +        {
>   +            id.append(Profiler.PARAM_ANON);
>   +        }
>   +        if (language != null)
>   +        {
>   +            id.append(DELIM);
>   +            id.append(language);
>   +        }
>   +        if (country != null)
>   +        {
>   +            id.append(DELIM);
>   +            id.append(country);
>   +        }
>   +        if (mediaType != null)
>   +        {
>   +            id.append(DELIM);
>   +            id.append(mediaType);
>   +        }
>   +        if (name != null)
>   +        {
>   +            id.append(DELIM);
>   +            id.append(name);
>   +        }
>   +        
>   +        return id.toString();
>   +    }
>   +
>   +
>       /** 
>         * @see Object#clone
>         * @return an instance copy of this object
>   @@ -266,6 +329,14 @@
>            return role;
>        }
>    
>   +    public String getRoleName()
>   +    {
>   +        if (null == role)
>   +            return null;
>   +
>   +        return role.getName();
>   +    }
>   +
>        /*
>         * Sets the role parameter for this profile.
>         *
>   @@ -276,6 +347,21 @@
>            this.role = role;
>        }
>    
>   +    public void setRoleByName( String roleName )
>   +    {
>   +        try
>   +        {        
>   +            Role temp = JetspeedSecurity.getRole(roleName);
>   +            if (null != temp)
>   +            {
>   +                role = temp;
>   +            }
>   +        }
>   +        catch (Exception e)
>   +        {
>   +        }
>   +    }
>   +
>        /*
>         * Gets the group parameter for this profile.
>         *
>   @@ -286,6 +372,14 @@
>            return group;
>        }
>    
>   +    public String getGroupName()
>   +    {
>   +        if (null == group)
>   +            return null;
>   +
>   +        return group.getName();
>   +    }
>   +
>        /*
>         * Sets the group parameter for this profile.
>         *
>   @@ -294,6 +388,21 @@
>        public void setGroup( Group group )
>        {
>            this.group = group;
>   +    }
>   +
>   +    public void setGroupByName( String groupName )
>   +    {
>   +        try
>   +        {
>   +            Group temp = JetspeedSecurity.getGroup(groupName);
>   +            if (null != temp)
>   +            {
>   +                group = temp;
>   +            }
>   +        }
>   +        catch (Exception e)
>   +        {
>   +        }
>        }
>    
>    
>   
>   
>   
>   1.3       +22 -1     
> jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/Profi
> leLocator.java
>   
>   Index: ProfileLocator.java
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/pro
> file/ProfileLocator.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- ProfileLocator.java	17 Jul 2001 16:41:06 -0000	1.2
>   +++ ProfileLocator.java	3 Apr 2002 06:40:56 -0000	1.3
>   @@ -65,12 +65,24 @@
>     *
>     *
>     * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
>   - * @version $Id: ProfileLocator.java,v 1.2 2001/07/17 
> 16:41:06 taylor Exp $
>   + * @version $Id: ProfileLocator.java,v 1.3 2002/04/03 
> 06:40:56 taylor Exp $
>    */
>    
>    public interface ProfileLocator
>    {
>        /*
>   +     * Gets the unique profile locator id, which is a 
> combination of the params
>   +     * This ID must follow the one of the 4 sequences below:
>   +     *
>   +     *   <username>/<mediaType>/<language>/<country>/<page>
>   +     *   <group>/<mediaType>/<language>/<country>/<page>
>   +     *   <role>/<mediaType>/<language>/<country>/<page>
  
>   +     *
>   +     * @return The profile locator id
>   +     */
>   +    String getId();
>   +
>   +    /*
>         * Gets the resource name parameter for this profile.
>         *
>         * @return The resource name parameter for this profile.
>   @@ -171,6 +183,9 @@
>         */
>        Role getRole();
>    
>   +    String getRoleName();
>   +
>   +
>        /*
>         * Sets the role parameter for this profile.
>         *
>   @@ -178,12 +193,16 @@
>         */
>        void setRole( Role role );
>    
>   +    void setRoleByName(String roleName);
>   +
>        /*
>         * Gets the group parameter for this profile.
>         *
>         * @return The group parameter for this profile.
>         */
>        Group getGroup();
>   +    
>   +    String getGroupName();
>    
>        /*
>         * Sets the group parameter for this profile.
>   @@ -191,6 +210,8 @@
>         * @param group The group parameter for this profile.
>         */
>        void setGroup( Group group );
>   +
>   +    void setGroupByName( String groupName );
>    
>       /** 
>         * @see Object#clone
>   
>   
>   
>   1.17      +4 -1      
> jakarta-jetspeed/src/java/org/apache/jetspeed/services/portalt
> oolkit/JetspeedPortalToolkitService.java
>   
>   Index: JetspeedPortalToolkitService.java
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/servic
> es/portaltoolkit/JetspeedPortalToolkitService.java,v
>   retrieving revision 1.16
>   retrieving revision 1.17
>   diff -u -r1.16 -r1.17
>   --- JetspeedPortalToolkitService.java	22 Mar 2002 
> 18:51:56 -0000	1.16
>   +++ JetspeedPortalToolkitService.java	3 Apr 2002 
> 06:40:56 -0000	1.17
>   @@ -85,7 +85,7 @@
>     * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
>     * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
>     *
>   - * @version $Id: JetspeedPortalToolkitService.java,v 1.16 
> 2002/03/22 18:51:56 taylor Exp $
>   + * @version $Id: JetspeedPortalToolkitService.java,v 1.17 
> 2002/04/03 06:40:56 taylor Exp $
>     */
>    public class JetspeedPortalToolkitService extends 
> TurbineBaseService
>        implements PortalToolkitService
>   @@ -697,5 +697,8 @@
>                this.value=value;
>            }
>        }
>   +
>   +    
>   +
>    }
>    
>   
>   
>   
>   1.19      +5 -1      
> jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlman
> ager/CastorPsmlManagerService.java
>   
>   Index: CastorPsmlManagerService.java
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/servic
> es/psmlmanager/CastorPsmlManagerService.java,v
>   retrieving revision 1.18
>   retrieving revision 1.19
>   diff -u -r1.18 -r1.19
>   --- CastorPsmlManagerService.java	25 Mar 2002 07:33:32 
> -0000	1.18
>   +++ CastorPsmlManagerService.java	3 Apr 2002 06:40:56 
> -0000	1.19
>   @@ -118,7 +118,7 @@
>     * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
>     * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
>     * @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
>   - * @version $Id: CastorPsmlManagerService.java,v 1.18 
> 2002/03/25 07:33:32 taylor Exp $
>   + * @version $Id: CastorPsmlManagerService.java,v 1.19 
> 2002/04/03 06:40:56 taylor Exp $
>     */
>    public class CastorPsmlManagerService extends TurbineBaseService
>        implements PsmlManagerService
>   @@ -377,6 +377,10 @@
>    
>            if (fileOrUrl!=null)
>            {
>   +            if (!fileOrUrl.endsWith(DEFAULT_EXT))
>   +            {
>   +                fileOrUrl = fileOrUrl.concat(DEFAULT_EXT);
>   +            }
>                
>                // load the document and add it to the watcher
>                // we'll assume the name is the the location 
> of the file
>   
>   
>   
> 
> --
> To unsubscribe, e-mail:   
> <mailto:jetspeed-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>
> 

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


Mime
View raw message