Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/opencms/file/CmsResourceType.java


1   /*
2   * File   : $Source: /usr/local/cvs/opencms/src/com/opencms/file/Attic/CmsResourceType.java,v $
3   * Date   : $Date: 2003/04/01 15:20:18 $
4   * Version: $Revision: 1.15 $
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.file;
30  
31  import com.opencms.core.I_CmsConstants;
32  
33  import java.io.Serializable;
34  
35  /**
36   * Describes a resource-type. To determine the special launcher
37   * for a resource this resource-type is needed.
38   *
39   * @author Michael Emmerich
40   * @version $Revision: 1.15 $ $Date: 2003/04/01 15:20:18 $
41   */
42  public class CmsResourceType implements I_CmsConstants, Serializable {
43  
44       /**
45        * The id of resource type.
46        */
47      private int m_resourceType;
48  
49      /**
50       * The id of the launcher used by this resource.
51       */
52      private int m_launcherType;
53  
54      /**
55       * The resource type name.
56       */
57      private String m_resourceTypeName;
58  
59      /**
60       * The class name of the Java class launched by the launcher.
61       */
62      private String m_launcherClass;
63  
64  
65      /**
66       * Constructor, creates a new CmsResourceType object.
67       *
68       * @param resourceType The id of the resource type.
69       * @param launcherType The id of the required launcher.
70       * @param resourceTypeName The printable name of the resource type.
71       * @param launcherClass The Java class that should be invoked by the launcher.
72       * This value is <b> null </b> if the default invokation class should be used.
73       */
74      public CmsResourceType(int resourceType, int launcherType,
75                             String resourceTypeName, String launcherClass){
76  
77          m_resourceType=resourceType;
78          m_launcherType=launcherType;
79          m_resourceTypeName=resourceTypeName;
80          m_launcherClass=launcherClass;
81      }
82       /**
83       * Returns the name of the Java class loaded by the launcher.
84       * This method returns <b>null</b> if the default class for this type is used.
85       *
86       * @return the name of the Java class.
87       */
88       public String getLauncherClass() {
89           if ((m_launcherClass == null) || (m_launcherClass.length()<1)) {
90              return C_UNKNOWN_LAUNCHER;
91           } else {
92              return m_launcherClass;
93           }
94       }
95       /**
96       * Returns the launcher type needed for this resource-type.
97       *
98       * @return the launcher type for this resource-type.
99       */
100      public int getLauncherType() {
101          return m_launcherType;
102      }
103     /**
104      * Returns the name for this resource-type.
105      *
106      * @return the name for this resource-type.
107      */
108      public String getResourceName() {
109          return m_resourceTypeName;
110      }
111     /**
112      * Returns the type of this resource-type.
113      *
114      * @return the type of this resource-type.
115      */
116     public int getResourceType() {
117          return m_resourceType;
118      }
119     /**
120      * Returns a string-representation for this object.
121      * This can be used for debugging.
122      *
123      * @return string-representation for this object.
124      */
125      public String toString() {
126         StringBuffer output=new StringBuffer();
127         output.append("[ResourceType]:");
128         output.append(m_resourceTypeName);
129         output.append(" , Id=");
130         output.append(m_resourceType);
131         output.append(" , launcherType=");
132         output.append(m_launcherType);
133         output.append(" , launcherClass=");
134         output.append(m_launcherClass);
135         return output.toString();
136       }
137 }