taylor      2004/06/25 14:43:53

  Modified:    src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java
  Log:
  Patch from Bob Fleischman
  
  http://nagoya.apache.org/jira/browse/JS1-480
  
  Default Group PSML is now configurable for new Group PSML
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.57      +42 -7     
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.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- JetspeedProfilerService.java      23 Feb 2004 03:35:24 -0000      1.56
  +++ JetspeedProfilerService.java      25 Jun 2004 21:43:53 -0000      1.57
  @@ -104,6 +104,7 @@
       private final static String CONFIG_SECURITY         = "security";
       private final static String CONFIG_ROLE_FALLBACK    = "rolefallback";
       private final static String CONFIG_NEWUSER_TEMPLATE  = "newuser.template";
  + private final static String CONFIG_NEWGROUP_TEMPLATE = "newgroup.template";
       private final static String CONFIG_NEWUSER_MEDIA     = "newuser.media_types";
       private final static String CONFIG_FALLBACK_LANGUAGE = "fallback.language";
       private final static String CONFIG_FALLBACK_COUNTRY = "fallback.country";
  @@ -118,8 +119,8 @@
       private final static boolean DEFAULT_CONFIG_SECURITY = false;
       private final static boolean DEFAULT_CONFIG_ROLE_FALLBACK = true;
       private final static String DEFAULT_CONFIG_NEWUSER_TEMPLATE = null;
  -    private final static String [] DEFAULT_CONFIG_NEWUSER_MEDIA =
  -    { "html", "wml" };
  + private final static String DEFAULT_CONFIG_NEWGROUP_TEMPLATE = "Jetspeed";
  + private final static String [] DEFAULT_CONFIG_NEWUSER_MEDIA = { "html", "wml" };
       private final static String DEFAULT_CONFIG_ROLE_MERGE_CONTROL = "TabControl";
       private final static String DEFAULT_CONFIG_ROLE_MERGE_CONTROLLER = 
"TabController";
   
  @@ -142,6 +143,8 @@
   
       // MODIFIED: A. Kempf
       String newUserTemplate = DEFAULT_CONFIG_NEWUSER_TEMPLATE;
  + // added by Bob Fleischman - June 2004
  + String newGroupTemplate = DEFAULT_CONFIG_NEWGROUP_TEMPLATE;
   
       boolean useSecurity = false;   // use security features
       boolean useRoleFallback = true;
  @@ -166,6 +169,8 @@
           Profile current = null;
           CapabilityMap map;
   
  + String newTemplate;
  +
           if (data == null)
           {
               map = CapabilityMapFactory.getDefaultCapabilityMap();
  @@ -180,12 +185,24 @@
           if (newUserTemplate == null)
               return current;
   
  + // If we see a group use it, else fall back to the prrior method
  + // Remember that Roles can also have profiles so it is not enough to just check 
for profile.getGroup() == null
  + // newTemplate is then passed into the createProfile call a few lines later
  + if (profile.getGroup() != null)
  + {
  + newTemplate = newGroupTemplate;
  + }
  + else
  + {
  + newTemplate = newUserTemplate;
  + }
  +
           if (mediaTypes != null)
           {
               Profile dummy;
               for (int ix=0; ix < mediaTypes.length; ix++)
               {
  -                dummy = createProfile(data, profile, mediaTypes[ix], 
newUserTemplate);
  + dummy = createProfile(data, profile, mediaTypes[ix], newTemplate);
                   if (mediaTypes[ix].equalsIgnoreCase(mediaType))
                       current = dummy;
               }
  @@ -819,6 +836,8 @@
   
           newUserTemplate = serviceConf.getString( CONFIG_NEWUSER_TEMPLATE, 
DEFAULT_CONFIG_NEWUSER_TEMPLATE );
   
  + newGroupTemplate = serviceConf.getString( CONFIG_NEWGROUP_TEMPLATE, 
DEFAULT_CONFIG_NEWGROUP_TEMPLATE );
  +
           useFallbackToRoot = serviceConf.getBoolean( CONFIG_FALLBACK_TO_ROOT, 
useFallbackToRoot );
   
           useFallbackLanguage = serviceConf.getBoolean( CONFIG_FALLBACK_LANGUAGE, 
useFallbackLanguage );
  @@ -1005,8 +1024,20 @@
         if ((contentType == null) || (contentType.length() < 2))
           contentType = "html";
   
  -      if ((from == null) || (from.length() < 2))
  -        from = "turbine";
  + if ((from == null) || (from.length() < 2))
  + {
  +//
  +// This is just for groups - Roles will continue to be treated like users
  +//
  + if (profile.getGroup() != null)
  + from = DEFAULT_CONFIG_NEWGROUP_TEMPLATE;
  + else
  + from = DEFAULT_CONFIG_NEWUSER_TEMPLATE;
  + }
  +
  +// turbine was hardcoded here - RMF June 2004
  +// if ((from == null) || (from.length() < 2))
  +// from = "turbine";
   
   
           if ((null == profile.getDocument()) || 
(!profile.getMediaType().equalsIgnoreCase (contentType)))
  @@ -1018,7 +1049,11 @@
               try
               {
                   ProfileLocator locator = createLocator();
  -                locator.setUser( JetspeedSecurity.getUser(from) );
  + // If group is not null assume this is a Group we are requesting
  + if (profile.getGroup() != null)
  + locator.setGroup( JetspeedSecurity.getGroup(from) );
  + else
  + locator.setUser( JetspeedSecurity.getUser(from) );
   
                   locator.setMediaType(contentType);
                   PSMLDocument doc = fallback(locator);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to