KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > template > cache > CmsElementDescriptor


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/template/cache/CmsElementDescriptor.java,v $
3 * Date : $Date: 2005/05/17 13:47:27 $
4 * Version: $Revision: 1.1 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.template.cache;
30
31
32 /**
33  * This descriptor is used to locate CmsElement-Objects with the
34  * CmsElementLocator. It is the key for a CmsElement.
35  *
36  * @author Andreas Schouten
37  *
38  * @deprecated Will not be supported past the OpenCms 6 release.
39  */

40 public class CmsElementDescriptor {
41
42     /**
43      * The name of the class for this descriptor.
44      */

45     private String JavaDoc m_className;
46
47     /**
48      * The name of the template-file for this descriptor.
49      */

50     private String JavaDoc m_templateName;
51
52     /**
53      * The constructor to create a new CmsElementDescriptor.
54      *
55      * @param className the name of the class for this descriptor.
56      * @param templateName the name of the template for this descriptor.
57      */

58     public CmsElementDescriptor(String JavaDoc className, String JavaDoc templateName) {
59         m_className = className;
60         m_templateName = templateName;
61     }
62
63     /**
64      * Returns the key of this descriptor.
65      *
66      * @return the key of this descriptor.
67      */

68     public String JavaDoc getKey() {
69         return m_className + "|" + m_templateName;
70     }
71
72     /**
73      * Get the class name for the element defined.
74      * @return Class name for the element.
75      */

76     public String JavaDoc getClassName() {
77         return m_className;
78     }
79
80     /**
81      * Get the template name for the element defined.
82      * @return Template name for the element.
83      */

84     public String JavaDoc getTemplateName() {
85         return m_templateName;
86     }
87
88     /**
89      * We have to return a hashcode for the hashtable. We can use the hashcode
90      * from the Strings m_className and m_templatename.
91      * @return The hashCode.
92      */

93     public int hashCode(){
94         return (m_className + m_templateName).hashCode();
95     }
96
97     /**
98      * Compares the overgiven object with this object.
99      *
100      * @return true, if the object is identically else it returns false.
101      */

102     public boolean equals(Object JavaDoc obj) {
103         // check if the object is a CmsElementDescriptor object
104
if (obj instanceof CmsElementDescriptor) {
105             // same key ?
106
if (((CmsElementDescriptor)obj).getKey().equals(getKey()) ){
107                 return true;
108             }
109         }
110         return false;
111     }
112
113     /**
114      * toString methode
115      */

116     public String JavaDoc toString(){
117         return m_className + " | " + m_templateName;
118     }
119 }
Popular Tags