taylor      01/05/09 00:21:04

  Modified:    src/java/org/apache/jetspeed/util/customization
                        PSMLDocument.java
  Log:
  enabled glucode customizer to use profiler service
  
  Revision  Changes    Path
  1.2       +35 -12    
jakarta-jetspeed/src/java/org/apache/jetspeed/util/customization/PSMLDocument.java
  
  Index: PSMLDocument.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/customization/PSMLDocument.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PSMLDocument.java 2001/05/08 06:26:11     1.1
  +++ PSMLDocument.java 2001/05/09 07:21:01     1.2
  @@ -73,7 +73,10 @@
   import org.apache.jetspeed.util.PSMLManager;
   import org.apache.jetspeed.util.MimeType;
   import org.apache.jetspeed.profiler.*;
  +import org.apache.jetspeed.services.Profiler;
  +import org.apache.jetspeed.om.profile.*;
   
  +
   // Turbine
   import org.apache.turbine.om.security.User;
   import org.apache.turbine.util.Log;
  @@ -84,14 +87,14 @@
   
   /**
    *
  - *   PSMLDocument is a class that represents the psml document itself. This class
  - *   will fetch the user psml document in the RunData object. After modifications
  - *   have been made, it can write the document back to the original file or to a
  - *   new file.
  + *     PSMLDocument is a class that represents the psml document itself. This class
  + *     will fetch the user psml document in the RunData object. After modifications
  + *     have been made, it can write the document back to the original file or to a
  + *     new file.
    *
  - *   @author <a href="mailto:[EMAIL PROTECTED]";>Peter Yoo </a>
  - *   @author <a href="mailto:[EMAIL PROTECTED]";>Ernest Ros </a>
  - *   @version $Id: PSMLDocument.java,v 1.1 2001/05/08 06:26:11 taylor Exp $
  + *     @author <a href="mailto:[EMAIL PROTECTED]";>Peter Yoo </a>
  + *     @author <a href="mailto:[EMAIL PROTECTED]";>Ernest Ros </a>
  + *     @version $Id: PSMLDocument.java,v 1.2 2001/05/09 07:21:01 taylor Exp $
    *
    */
   public class PSMLDocument
  @@ -146,7 +149,27 @@
       this.psmlFilePath = 
JetspeedResources.getString(JetspeedResources.PSML_BASE_URL_KEY);
   
       MimeType mimetype = new MimeType("text/html");
  -    String psmlURL = profiler.getUserURL( rundata.getUser().getUserName(), 
mimetype.HTML );
  +
  +    String psmlURL = "";
  +    if (JetspeedResources.getBoolean("services.Profiler.enable", false))
  +    {
  +        try {
  +            Profile profile = Profiler.getProfile( rundata, mimetype );
  +            psmlURL = profile.getURL();
  +        }
  +        catch (Exception e)
  +        {
  +            Log.note("Profiled URL doesn't exist, using default");
  +            try {
  +                Profile profile = Profiler.getProfile( null, mimetype );
  +                psmlURL = profile.getURL();
  +            }
  +            catch (ProfileException ex)
  +                {} // url will be null
  +        }
  +    }
  +    else
  +        psmlURL = profiler.getUserURL( rundata.getUser().getUserName(), 
mimetype.HTML );
   
       try
       {
  @@ -161,8 +184,8 @@
             theReader = pde.getReader();
   
           }
  -         catch (FileNotFoundException fnfe)
  -         {
  +        catch (FileNotFoundException fnfe)
  +        {
   
             pde = JetspeedDiskCache.getInstance().getEntry( this.psmlFilePath + 
defaultFileName );
             theReader = pde.getReader();
  @@ -176,12 +199,12 @@
             this.portlets = Portlets.unmarshal(theReader);
   
           }
  -             catch (ValidationException ve)
  +        catch (ValidationException ve)
           {
   
             throw new CustomizerException("The psml file is invalid.");
   
  -             }
  +        }
           catch (MarshalException me)
           {
   
  
  
  

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

Reply via email to