KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > legacy > CmsResourceTypeCompatiblePlain


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/legacy/CmsResourceTypeCompatiblePlain.java,v $
3  * Date : $Date: 2006/03/27 14:53:03 $
4  * Version: $Revision: 1.9 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 Alkacon Software (http://www.alkacon.com)
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 Alkacon Software, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package com.opencms.legacy;
33
34 import org.opencms.configuration.CmsConfigurationException;
35 import org.opencms.db.CmsSecurityManager;
36 import org.opencms.file.CmsObject;
37 import org.opencms.file.CmsResource;
38 import org.opencms.file.types.A_CmsResourceType;
39 import org.opencms.file.types.Messages;
40 import org.opencms.loader.CmsDumpLoader;
41 import org.opencms.main.OpenCms;
42
43 import java.util.List JavaDoc;
44
45 /**
46  * Describes the resource type "compatiblePlain" (that only exists for backward compatibility for
47  * some very old OpenCms version).<p>
48  *
49  * @author Alexander Kandzior (a.kandzior@alkacon.com)
50  * @version $Revision: 1.9 $
51  *
52  * @deprecated Will not be supported past the OpenCms 6 release.
53  */

54 public class CmsResourceTypeCompatiblePlain extends A_CmsResourceType {
55
56     /** The type id of this resource. */
57     private static final int C_RESOURCE_TYPE_ID = 98;
58
59     /** The name of this resource. */
60     private static final String JavaDoc C_RESOURCE_TYPE_NAME = "compatiblePlain";
61
62     /** Indicates that the static configuration of the resource type has been frozen. */
63     private static boolean m_staticFrozen;
64
65     /** The static type id of this resource type. */
66     private static int m_staticTypeId;
67
68     /**
69      * Default constructor, used to initialize member variables.<p>
70      */

71     public CmsResourceTypeCompatiblePlain() {
72
73         super();
74         m_typeId = C_RESOURCE_TYPE_ID;
75         m_typeName = C_RESOURCE_TYPE_NAME;
76     }
77
78     /**
79      * Returns the static type id of this (default) resource type.<p>
80      *
81      * @return the static type id of this (default) resource type
82      */

83     public static int getStaticTypeId() {
84
85         return m_staticTypeId;
86     }
87
88     /**
89      * Returns the static type name of this (default) resource type.<p>
90      *
91      * @return the static type name of this (default) resource type
92      */

93     public static String JavaDoc getStaticTypeName() {
94
95         return C_RESOURCE_TYPE_NAME;
96     }
97
98     /**
99      * @see org.opencms.file.types.A_CmsResourceType#createResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, java.lang.String, byte[], java.util.List)
100      */

101     public CmsResource createResource(
102         CmsObject cms,
103         CmsSecurityManager securityManager,
104         String JavaDoc resourcename,
105         byte[] content,
106         List JavaDoc properties) {
107
108         throw new RuntimeException JavaDoc(
109             "createResource(): The resource type 'compatiblePlain' is deprecated and not longer supported");
110     }
111
112     /**
113      * @see org.opencms.file.types.I_CmsResourceType#getLoaderId()
114      */

115     public int getLoaderId() {
116
117         return CmsDumpLoader.RESOURCE_LOADER_ID;
118     }
119
120     /**
121      * @see org.opencms.file.types.A_CmsResourceType#initConfiguration(java.lang.String, java.lang.String, String)
122      */

123     public void initConfiguration(String JavaDoc name, String JavaDoc id, String JavaDoc className) throws CmsConfigurationException {
124
125         if ((OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) && m_staticFrozen) {
126             // configuration already frozen
127
throw new CmsConfigurationException(org.opencms.configuration.Messages.get().container(
128                 org.opencms.file.types.Messages.ERR_CONFIG_FROZEN_3,
129                 this.getClass().getName(),
130                 getStaticTypeName(),
131                 new Integer JavaDoc(getStaticTypeId())));
132         }
133
134         if (!C_RESOURCE_TYPE_NAME.equals(name)) {
135             // default resource type MUST have default name
136
throw new CmsConfigurationException(Messages.get().container(
137                 Messages.ERR_INVALID_RESTYPE_CONFIG_NAME_3,
138                 this.getClass().getName(),
139                 C_RESOURCE_TYPE_NAME,
140                 name));
141         }
142
143         // freeze the configuration
144
m_staticFrozen = true;
145
146         super.initConfiguration(C_RESOURCE_TYPE_NAME, id, className);
147         // set static members with values from the configuration
148
m_staticTypeId = m_typeId;
149     }
150 }
Popular Tags