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 ra...@apache.org on 2001/06/07 00:27:39 UTC

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

raphael     01/06/06 15:27:39

  Modified:    src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
  Log:
  [fix] switch method for monitoring PSML files to depend on getRealPath()
  rather than getResource() to fix issue with Catalina
  
  Revision  Changes    Path
  1.2       +23 -14    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CastorPsmlManagerService.java	2001/06/04 17:30:43	1.1
  +++ CastorPsmlManagerService.java	2001/06/06 22:27:37	1.2
  @@ -67,6 +67,7 @@
   import org.apache.turbine.services.TurbineBaseService;
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.TurbineServices;
  +import org.apache.turbine.services.servlet.TurbineServlet;
   import org.apache.turbine.services.resources.ResourceService;
   
   //castor support
  @@ -97,7 +98,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.1 2001/06/04 17:30:43 raphael Exp $
  + * @version $Id: CastorPsmlManagerService.java,v 1.2 2001/06/06 22:27:37 raphael Exp $
    */
   public class CastorPsmlManagerService extends TurbineBaseService
       implements PsmlManagerService
  @@ -404,22 +405,30 @@
       {
           File f = null;
   
  -        try
  +        f = new File(fileOrUrl);
  +            
  +        if (f.exists())
           {
  -            //FIXME: this will fail for relative URLs, should we
  -            //support them ?
  -            URL url = new URL(fileOrUrl);
  -                
  -            // ok it's an URL, use diskcache and get the file name 
  -            // through the cache
  -                
  -            f = JetspeedDiskCache.getInstance().getEntry(fileOrUrl).getFile();
  -                
  +            return f;
           }
  -        catch (IOException e)
  +        else        
           {
  -            Log.note("PSMLManager: "+fileOrUrl+" is not a URL or not in cache, trying as file");
  -            f = new File(fileOrUrl);
  +            // try as a relative path
  +            f = new File(TurbineServlet.getRealPath(fileOrUrl));
  +            if (f.exists())
  +            {
  +                return f;
  +            }
  +            
  +            // try through the disk cache
  +            try
  +            {
  +                f = JetspeedDiskCache.getInstance().getEntry(fileOrUrl).getFile();
  +            }
  +            catch (Exception e)
  +            {
  +                Log.error("PSMLManager: unabel to retrieve file from diskcache for "+fileOrUrl,e);
  +            }
           }
           
           return f;
  
  
  

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


Re: cvs commit:jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanagerCastorPsmlManagerService.java

Posted by Raphaël Luta <ra...@networks.groupvu.com>.
Jon Stevens wrote:
> 
> on 6/6/01 3:27 PM, "raphael@apache.org" <ra...@apache.org> wrote:
> 
> > +            f = new File(TurbineServlet.getRealPath(fileOrUrl));
> 
> This is not right. You should use TurbineConfig. Dependencies on
> TurbineServlet are bad.
> 

Huh, TurbineServlet is the service that encapsulates the ServletConfig (either real
or TurbineConfig) to provide access to it from anywhere in the code.
I don't understand how dependency on it could be bad (or you could use TurbineConfig
there for this matter).

(Since this is service, I could have stored a reference to the ServletConfig in
 init(ServletCOnfig) though)

--
Raphael Luta - raphael.luta@networks.groupvu.com
Vivendi Universal Networks - Paris

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


[Off-topic] Open Source and commercial companies

Posted by Santiago Gala <sg...@hisitech.com>.
David Sean Taylor wrote:

>>-- 
>>"Open source is not available to commercial companies."
>>            -Steve Balmer, CEO Microsoft
>><http://www.suntimes.com/output/tech/cst-fin-micro01.html>
>>
> 
> lie lie lie lie lie
> 


The bad thing is that the first part of the paragraph shows that 
Microsoft has passed from ignoring OS to fearing it, and now they try to 
hide the fear under the "healthy" stuff. The good thing is that the 
blatant lie about Government funding and the linux license and the use 
of words like "cancer" later on shows they still have fear.

We're winning, slowly and cautiously (as it should be) :-)


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




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


RE: cvs commit:jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanagerCastorPsmlManagerService.java

Posted by David Sean Taylor <da...@bluesunrise.com>.
> -- 
> "Open source is not available to commercial companies."
>             -Steve Balmer, CEO Microsoft
> <http://www.suntimes.com/output/tech/cst-fin-micro01.html>

lie lie lie lie lie


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


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

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/6/01 3:27 PM, "raphael@apache.org" <ra...@apache.org> wrote:

> +            f = new File(TurbineServlet.getRealPath(fileOrUrl));

This is not right. You should use TurbineConfig. Dependencies on
TurbineServlet are bad.

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


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