KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/legacy/CmsResourceTypePage.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.importexport.A_CmsImport;
41 import org.opencms.main.OpenCms;
42
43 import java.util.List JavaDoc;
44
45 /**
46  * Describes the resource type "page".<p>
47  *
48  * @author Alexander Kandzior (a.kandzior@alkacon.com)
49  *
50  * @version $Revision: 1.9 $
51  * @since 5.1
52  *
53  * @deprecated Will not be supported past the OpenCms 6 release.
54  */

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

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

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

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

102     public CmsResource createResource(
103         CmsObject cms,
104         CmsSecurityManager securityManager,
105         String JavaDoc resourcename,
106         byte[] content,
107         List JavaDoc properties) {
108
109         throw new RuntimeException JavaDoc("createResource(): The resource type 'page' 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 CmsXmlTemplateLoader.C_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
151 }
Popular Tags