001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.xml.xml2json; 029 030import org.opencms.xml.xml2json.handler.CmsJsonHandlerContainerPage; 031import org.opencms.xml.xml2json.handler.CmsJsonHandlerFolder; 032import org.opencms.xml.xml2json.handler.CmsJsonHandlerJsp; 033import org.opencms.xml.xml2json.handler.CmsJsonHandlerList; 034import org.opencms.xml.xml2json.handler.CmsJsonHandlerResource; 035import org.opencms.xml.xml2json.handler.CmsJsonHandlerXmlContent; 036import org.opencms.xml.xml2json.handler.CmsJsonHandlerOnlineCachingWrapper; 037import org.opencms.xml.xml2json.handler.I_CmsJsonHandler; 038 039import java.util.ArrayList; 040import java.util.Arrays; 041import java.util.List; 042 043/** 044 * Provides default JSON handlers. 045 * 046 * <p>Some JSON handlers are always provided, they do not need to be loaded via ServiceLoader. 047 */ 048public class CmsDefaultJsonHandlers { 049 050 /** The folder handler instance. */ 051 private static CmsJsonHandlerFolder m_folderHandler = new CmsJsonHandlerFolder(); 052 053 /** The XML handler instance. */ 054 private static I_CmsJsonHandler m_xmlContentHandler = new CmsJsonHandlerOnlineCachingWrapper( 055 new CmsJsonHandlerXmlContent(), 056 "concurrencyLevel=4,maximumSize=10000"); 057 058 /** The JSP handler instance. */ 059 private static CmsJsonHandlerJsp m_jspHandler = new CmsJsonHandlerJsp(); 060 061 /** The container page handler instance. */ 062 private static CmsJsonHandlerContainerPage m_containerPageHandler = new CmsJsonHandlerContainerPage(); 063 064 /** The list handler instance. */ 065 private static CmsJsonHandlerList m_listJsonHandler = new CmsJsonHandlerList(); 066 067 /** The resource handler instance. */ 068 private static CmsJsonHandlerResource m_resourceJsonHandler = new CmsJsonHandlerResource(); 069 070 /** 071 * Gets the default JSON handlers. 072 * 073 * @return the list of default JSON handlers 074 */ 075 public static List<I_CmsJsonHandler> getHandlers() { 076 077 return new ArrayList<>( 078 Arrays.asList( 079 m_folderHandler, 080 m_xmlContentHandler, 081 m_jspHandler, 082 m_containerPageHandler, 083 m_listJsonHandler, 084 m_resourceJsonHandler)); 085 } 086 087}