1 54 55 package org.apache.jetspeed.services.cms; 56 57 58 59 import java.util.*; 61 62 import org.apache.turbine.services.*; 64 66 import org.apache.jetspeed.services.cms.manager.CmsFactory; 68 import org.apache.jetspeed.services.cms.manager.CmsManager; 69 import org.apache.jetspeed.services.cms.JetspeedCMSException; 70 71 72 79 public class DefaultCmsService 80 extends BaseService 81 implements CmsService 82 { 83 84 88 private Hashtable cmsRepositories = new Hashtable(); 89 90 93 private final static String DEFAULT_NAMESPACE_VALUE = "jetspeed"; 94 95 99 public void init() throws InitializationException 100 { 101 try 103 { 104 this.getCmsManager(); 105 } 106 catch( JetspeedCMSException e) 107 { 108 throw new InitializationException("CMSService: Unable to retrieve default CMSManager"); 109 } 110 111 setInit(true); 112 } 113 114 public CmsManager getCmsManager() throws JetspeedCMSException 115 { 116 return this.getCmsManager(DEFAULT_NAMESPACE_VALUE); 117 } 118 119 public CmsManager getCmsManager(String nameSpace) throws JetspeedCMSException 120 { 121 CmsManager cms = null; 122 123 try 124 { 125 cms = (CmsManager) cmsRepositories.get(nameSpace); 126 127 if (cms == null) 128 { 129 cms = CmsFactory.getCmsManagerInstance(nameSpace); 130 cmsRepositories.put(nameSpace, cms); 131 } 132 } 133 catch (Exception e) 134 { 135 throw new JetspeedCMSException("System Error : impossible to access to the content repository"); 136 } 137 138 return cms; 139 } 140 } 141 | Popular Tags |