001/* 002 * Copyright 2019 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.odfweb.repository; 017 018import org.apache.avalon.framework.service.ServiceException; 019import org.apache.avalon.framework.service.ServiceManager; 020 021import org.ametys.odf.ODFHelper; 022import org.ametys.web.data.type.ModelItemTypeExtensionPoint; 023import org.ametys.web.repository.page.virtual.AbstractConfigurableVirtualPageFactory; 024 025/** 026 * Common class for factories of ODF virtual pages 027 */ 028public abstract class AbstractOdfPageFactory extends AbstractConfigurableVirtualPageFactory 029{ 030 /** The odf page handler */ 031 protected OdfPageHandler _odfPageHandler; 032 /** The odf page cache */ 033 protected ODFPageCache _pageCache; 034 /** The ODF helper */ 035 protected ODFHelper _odfHelper; 036 037 @Override 038 public void service(ServiceManager manager) throws ServiceException 039 { 040 super.service(manager); 041 042 _odfHelper = (ODFHelper) manager.lookup(ODFHelper.ROLE); 043 _odfPageHandler = (OdfPageHandler) manager.lookup(OdfPageHandler.ROLE); 044 _pageCache = (ODFPageCache) manager.lookup(ODFPageCache.ROLE); 045 } 046 047 ODFPageCache getODFPageCache() 048 { 049 return _pageCache; 050 } 051 052 OdfPageHandler getODFPageHandler() 053 { 054 return _odfPageHandler; 055 } 056 057 ModelItemTypeExtensionPoint getZoneDataTypeEP() 058 { 059 return _pageDataTypeExtensionPoint; 060 } 061 062 ModelItemTypeExtensionPoint getZoneItemDataTypeEP() 063 { 064 return _pageDataTypeExtensionPoint; 065 } 066 067 FirstLevelPageFactory getFirstLevelPageFactory() 068 { 069 return (FirstLevelPageFactory) _ametysObjectFactoryEP.getExtension(FirstLevelPageFactory.class.getName()); 070 } 071 072 SecondLevelPageFactory getSecondLevelPageFactory() 073 { 074 return (SecondLevelPageFactory) _ametysObjectFactoryEP.getExtension(SecondLevelPageFactory.class.getName()); 075 } 076 077 ProgramPageFactory getProgramPageFactory() 078 { 079 return (ProgramPageFactory) _ametysObjectFactoryEP.getExtension(ProgramPageFactory.class.getName()); 080 } 081 082 CoursePageFactory getCoursePageFactory() 083 { 084 return (CoursePageFactory) _ametysObjectFactoryEP.getExtension(CoursePageFactory.class.getName()); 085 } 086}