View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.portal.expire;
18  
19  //jetspeed stuff
20  
21  import org.apache.jetspeed.portal.*;
22  
23  //java stuff
24  import java.util.*;
25  
26  /***
27  Handles content expiration
28  
29  @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
30  @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
31  */
32  public abstract class BaseExpire implements Expire {
33  
34      private boolean expired = false;
35      private long creationTime;
36      private Hashtable properties = new Hashtable();
37      private Portlet portlet = null;
38      
39      /***
40      @see Expire#init
41      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
42      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
43      */
44      public void init() {
45          this.setCreationTime( System.currentTimeMillis() );
46      }
47      
48      /***
49      @see Expire#isExpired
50      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
51      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
52      */
53      public boolean isExpired() {
54          return this.expired;
55      }
56  
57      /***
58      @see Expire#setExpired
59      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
60      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
61      */
62      public void setExpired( boolean expired ) {
63          this.expired = expired;
64      }
65  
66      /***
67      @see Expire#getCreationTime
68      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
69      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
70      */
71      public long getCreationTime() {
72          return this.creationTime;
73      }
74    
75      /***
76      @see Expire#setCreationTime
77      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
78      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
79      */
80      public void setCreationTime( long creationTime ) {
81          
82          this.creationTime = creationTime;
83      }
84      
85      /***
86      @see Expire#setProperty
87      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
88      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
89      */
90      public void setProperty( String name, String value ) {
91          this.properties.put( name, value );
92      }
93  
94      /***
95      @see Expire#getProperty
96      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
97      @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
98      */
99      public String getProperty( String name ) {
100         return (String)this.properties.get( name );
101     }
102 
103     /***
104     Get the Portlet on which this is based.
105     
106     @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
107     @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
108     */
109     public Portlet getPortlet() {
110         return this.portlet;
111     }
112     
113     /***
114     Set the Portlet on which this is based.
115     
116     @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
117     @version $Id: BaseExpire.java,v 1.5 2004/02/23 03:24:40 jford Exp $
118     */
119     public void setPortlet( Portlet portlet ) {
120         this.portlet = portlet;
121     }
122     
123     
124     
125 }
126