portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/cache/file FileCacheEntry.java FileCacheEventListener.java
Date Wed, 19 May 2004 20:19:50 GMT
weaver      2004/05/19 13:19:50

  Added:       components/file-cache/src/test/org/apache/jetspeed/cache/file
                        FileCopy.java TestFileCache.java
               components/file-cache/src/java/org/apache/jetspeed/cache/file
                        FileCache.java FileCacheEntryImpl.java
               components/file-cache/testdata default.psml
               components/file-cache project.xml project.properties
                        maven.xml .cvsignore
               commons/src/java/org/apache/jetspeed/cache/file
                        FileCacheEntry.java FileCacheEventListener.java
  Log:
  - FileCacheEntry refactored to an interface
  - file cache refactored to a separate component
  - removed container-based testing, it is unneeded just create an instance
    and test it ;)
  
  Revision  Changes    Path
  1.2       +111 -0    jakarta-jetspeed-2/components/file-cache/src/test/org/apache/jetspeed/cache/file/FileCopy.java
  
  
  
  
  1.2       +233 -0    jakarta-jetspeed-2/components/file-cache/src/test/org/apache/jetspeed/cache/file/TestFileCache.java
  
  
  
  
  1.2       +404 -0    jakarta-jetspeed-2/components/file-cache/src/java/org/apache/jetspeed/cache/file/FileCache.java
  
  
  
  
  1.1                  jakarta-jetspeed-2/components/file-cache/src/java/org/apache/jetspeed/cache/file/FileCacheEntryImpl.java
  
  Index: FileCacheEntryImpl.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.jetspeed.cache.file;
  
  import java.io.File;
  import java.util.Date;
  
  /**
   * FileCache entry keeps the cached content along with last access information.
   *
   *  @author David S. Taylor <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   *  @version $Id: FileCacheEntryImpl.java,v 1.1 2004/05/19 20:19:49 weaver Exp $
   */
  
  public class FileCacheEntryImpl implements FileCacheEntry
  {
      protected File file;
      protected Object document;
  
      protected long lastAccessed;
      protected Date lastModified;
  
      private FileCacheEntryImpl()
      {
      }
  
      /**
       * Constructs a FileCacheEntry object
       *
       * @param document The user specific content being cached
       * @param lastModified The document's last modified stamp
       */
      public FileCacheEntryImpl(File file, Object document)
      {
          this.file = file;
          this.document = document;
          this.lastModified = new Date(file.lastModified());
          this.lastAccessed = new Date().getTime();
      }
  
      /**
       * Get the file descriptor
       *
       * @return the file descriptor
       */
      public File getFile()
      {
          return this.file;
      }
  
      /**
       * Set the file descriptor
       *
       * @param file the new file descriptor
       */
      public void setFile(File file)
      {
          this.file = file;
      }
  
      /**
       * Set the cache's last accessed stamp
       *
       * @param lastAccessed the cache's last access stamp
       */
      public void setLastAccessed(long lastAccessed)
      {
          this.lastAccessed = lastAccessed;
      }
  
      /**
       * Get the cache's lastAccessed stamp
       *
       * @return the cache's last accessed stamp
       */
      public long getLastAccessed()
      {
          return this.lastAccessed;
      }
  
      /**
       * Set the cache's last modified stamp
       *
       * @param lastModified the cache's last modified stamp
       */
      public void setLastModified(Date lastModified)
      {
          this.lastModified = lastModified;
      }
  
      /**
       * Get the entry's lastModified stamp (which may be stale compared to file's stamp)
       *
       * @return the last modified stamp
       */
      public Date getLastModified()
      {
          return this.lastModified;
      }
  
      /**
       * Set the Document in the cache
       *
       * @param document the document being cached
       */
      public void setDocument(Object document)
      {
          this.document = document;
      }
  
      /**
       * Get the Document
       *
       * @return the document being cached
       */
      public Object getDocument()
      {
          return this.document;
      }
  
  }
  
  
  
  
  
  1.1                  jakarta-jetspeed-2/components/file-cache/testdata/default.psml
  
  Index: default.psml
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <portlets id="100" xmlns="http://xml.apache.org/jetspeed/2000/psml">
      <metainfo>
        <title>Default Jetspeed Page</title>
      </metainfo>
  
    <control name="TabControl"/>
  
    <controller name="CardPortletController">
      <parameter name="parameter" value="pane"/>
    </controller>
  
    <skin name="orange-grey"/>
  
    <portlets id="101">
      <controller name="RowController">
        <parameter name="sizes" value="66%,34%"/>
      </controller>
  
      <metainfo>
        <title>Home Page</title>
      </metainfo>
  
      <portlets id="102">
        <entry id="103" parent="JetspeedContent"/>
      </portlets>
  
      <portlets id="104">
        <entry id="105" parent="Jetspeed"/>
        <entry id="106" parent="Welcome"/>
      </portlets>
  
    </portlets>
  
    <portlets id="107">
      <metainfo>
        <title>RSS</title>
      </metainfo>
  
      <portlets id="108">
        <control name="TabControl"/>
        <controller name="CardPortletController">
          <parameter name="defaultcard" value="0"/>
          <parameter name="parameter" value="channel"/>
          <parameter name="ruler-size" value="0"/>
        </controller>      
  
        <entry id="109" parent="http://jakarta.apache.org/jetspeed/channels/jetspeed.rss">
          <control name="ClearPortletControl"/>
        </entry>
  
        <entry id="110" parent="http://jakarta.apache.org/jetspeed/channels/turbine.rss">
          <control name="ClearPortletControl"/>
        </entry>
  
        <entry id="111" parent="http://www.mozilla.org/news.rdf">
          <control name="ClearPortletControl"/>
          <parameter name="itemdisplayed" value="5"/>
        </entry>
  
        <entry id="112" parent="http://www.apacheweek.com/issues/apacheweek-headlines.xml">
          <control name="ClearPortletControl"/>
          <parameter name="showtitle" value="false"/>
          <parameter name="showdescription" value="false"/>
        </entry>
  
        <entry id="113" parent="http://www.xmlhack.com/rsscat.php">
          <control name="ClearPortletControl"/>
        </entry>
  
        <entry id="123" parent="BBCFrontPage">
          <control name="ClearPortletControl"/>
        </entry>
  
      </portlets>
    </portlets>
  
    <portlets id="114">
      <controller name="TwoColumns"/>
  
      <metainfo>
        <title>Dynamic</title>
      </metainfo>
  
      <portlets id="115">
        <entry id="116" parent="JetspeedContent"/>
        <layout>
        	<property name="row" value="0"/>
        	<property name="column" value="0"/>
        </layout>
      </portlets>
  
      <portlets id="117">
        <entry id="118" parent="HelloVelocity"/>
        <layout>
        	<property name="row" value="0"/>
        	<property name="column" value="1"/>
        </layout>
      </portlets>
  
      <portlets id="119">
        <entry id="120" parent="HelloVelocityCached"/>
        <entry id="808" parent="InstanceExample">
            <parameter name="country" value="Brazil"/>
        </entry>
        <entry id="809" parent="InstanceExample">
            <parameter name="country" value="Germany"/>
        </entry>
        <layout>
        	<property name="row" value="1"/>
        	<property name="column" value="1"/>
        </layout>
      </portlets>
  
      <portlets id="121">
        <entry id="122" parent="HelloJSP"/>
        <layout>
        	<property name="row" value="1"/>
        	<property name="column" value="0"/>
        </layout>
      </portlets>
      
    </portlets>
  </portlets>
  
  
  
  1.2       +121 -0    jakarta-jetspeed-2/components/file-cache/project.xml
  
  
  
  
  1.2       +42 -0     jakarta-jetspeed-2/components/file-cache/project.properties
  
  
  
  
  1.2       +42 -0     jakarta-jetspeed-2/components/file-cache/maven.xml
  
  
  
  
  1.2       +2 -0      jakarta-jetspeed-2/components/file-cache/.cvsignore
  
  
  
  
  1.2       +82 -0     jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/cache/file/FileCacheEntry.java
  
  
  
  
  1.2       +47 -0     jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/cache/file/FileCacheEventListener.java
  
  
  
  

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


Mime
View raw message