1 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 ; 44 45 55 public class CmsResourceTypePage extends A_CmsResourceType { 56 57 58 private static final int C_RESOURCE_TYPE_ID = 97; 59 60 61 private static final String C_RESOURCE_TYPE_NAME = A_CmsImport.RESOURCE_TYPE_LEGACY_PAGE_NAME; 62 63 64 private static boolean m_staticFrozen; 65 66 67 private static int m_staticTypeId; 68 69 72 public CmsResourceTypePage() { 73 74 super(); 75 m_typeId = C_RESOURCE_TYPE_ID; 76 m_typeName = C_RESOURCE_TYPE_NAME; 77 } 78 79 84 public static int getStaticTypeId() { 85 86 return m_staticTypeId; 87 } 88 89 94 public static String getStaticTypeName() { 95 96 return C_RESOURCE_TYPE_NAME; 97 } 98 99 102 public CmsResource createResource( 103 CmsObject cms, 104 CmsSecurityManager securityManager, 105 String resourcename, 106 byte[] content, 107 List properties) { 108 109 throw new RuntimeException ("createResource(): The resource type 'page' is deprecated and not longer supported!"); 110 } 111 112 115 public int getLoaderId() { 116 117 return CmsXmlTemplateLoader.C_RESOURCE_LOADER_ID; 118 } 119 120 123 public void initConfiguration(String name, String id, String className) throws CmsConfigurationException { 124 125 if ((OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) && m_staticFrozen) { 126 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 (getStaticTypeId()))); 132 } 133 134 if (!C_RESOURCE_TYPE_NAME.equals(name)) { 135 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 m_staticFrozen = true; 145 146 super.initConfiguration(C_RESOURCE_TYPE_NAME, id, className); 147 m_staticTypeId = m_typeId; 149 } 150 151 } | Popular Tags |