KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > registry > base > BaseContentURL


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.om.registry.base;
18
19 import org.apache.jetspeed.om.registry.ContentURL;
20
21 /**
22  * Bean like implementation of the ContentURL interface suitable for
23  * Castor serialization.
24  *
25  * @see org.apache.jetspeed.om.registry.Security
26  * @author <a HREF="mailto:taylor@apache.org">David Sean Taylor</a>
27  * @version $Id: BaseContentURL.java,v 1.4 2004/02/23 03:08:26 jford Exp $
28  */

29 public class BaseContentURL implements ContentURL
30 {
31     private String JavaDoc url;
32     private boolean cacheKey = true;
33
34     /**
35      * Implements the equals operation so that 2 elements are equal if
36      * all their member values are equal.
37      */

38     public boolean equals(Object JavaDoc object)
39     {
40         if (object==null)
41         {
42             return false;
43         }
44
45         BaseContentURL obj = (BaseContentURL)object;
46
47         if (cacheKey != obj.cacheKey)
48         {
49             return false;
50         }
51
52         if (url!=null)
53         {
54             if(!url.equals(obj.url))
55             {
56                 return false;
57             }
58         }
59         else
60         {
61             if (obj.url!=null)
62             {
63                 return false;
64             }
65         }
66
67         return true;
68     }
69
70     /** @return the string URL */
71     public String JavaDoc getURL()
72     {
73         return url;
74     }
75
76     /** Sets the string URL
77      *
78      * @param value the new URL value
79      */

80     public void setURL(String JavaDoc value)
81     {
82         this.url = value;
83     }
84
85     public boolean isCacheKey()
86     {
87         return cacheKey;
88     }
89
90     public void setCachedOnURL(boolean cacheKey)
91     {
92         this.cacheKey = cacheKey;
93     }
94
95     public boolean getCachedOnURL()
96     {
97         return this.cacheKey;
98     }
99
100 }
Popular Tags