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.ade.client;
029
030import org.opencms.ade.containerpage.client.CmsContainerpageEditor;
031import org.opencms.ade.contenteditor.client.CmsContentEditorEntryPoint;
032import org.opencms.ade.editprovider.client.CmsDirectEditEntryPoint;
033import org.opencms.ade.galleries.client.CmsGallery;
034import org.opencms.ade.postupload.client.CmsPostUploadDialogEntryPoint;
035import org.opencms.ade.properties.client.CmsPropertiesEntryPoint;
036import org.opencms.ade.publish.client.CmsPublishEntryPoint;
037import org.opencms.ade.sitemap.client.CmsSitemapView;
038import org.opencms.ade.upload.client.CmsUpload;
039import org.opencms.gwt.client.A_CmsEntryPoint;
040import org.opencms.gwt.client.CmsCoreProvider;
041import org.opencms.gwt.shared.CmsCoreData;
042import org.opencms.gwt.shared.CmsCoreData.ModuleKey;
043
044import com.google.gwt.core.client.EntryPoint;
045
046/**
047 * Main OpenCms entry point, will delegate to the requested module.<p>
048 */
049public class OpenCmsEntryPoint extends A_CmsEntryPoint {
050
051    /**
052     * @see org.opencms.gwt.client.A_CmsEntryPoint#onModuleLoad()
053     */
054    @SuppressWarnings("incomplete-switch")
055    @Override
056    public void onModuleLoad() {
057
058        EntryPoint entry = null;
059        ModuleKey key = getModuleKey();
060        if (key != null) {
061            switch (key) {
062                case containerpage:
063                    entry = new CmsContainerpageEditor();
064                    break;
065                case contenteditor:
066                    entry = new CmsContentEditorEntryPoint();
067                    break;
068                case galleries:
069                    entry = new CmsGallery();
070                    break;
071                case postupload:
072                    entry = new CmsPostUploadDialogEntryPoint();
073                    break;
074                case publish:
075                    entry = new CmsPublishEntryPoint();
076                    break;
077                case sitemap:
078                    entry = new CmsSitemapView();
079                    break;
080                case upload:
081                    entry = new CmsUpload();
082                    break;
083                case editprovider:
084                    entry = new CmsDirectEditEntryPoint();
085                    break;
086                case properties:
087                    entry = new CmsPropertiesEntryPoint();
088                    break;
089            }
090        }
091
092        if (entry != null) {
093            entry.onModuleLoad();
094        }
095    }
096
097    /**
098     * Returns the key to the requested module.<p>
099     *
100     * @return the module key
101     */
102    private ModuleKey getModuleKey() {
103
104        String key = CmsCoreProvider.getMetaElementContent(CmsCoreData.META_PARAM_MODULE_KEY);
105        ModuleKey result = ModuleKey.valueOf(key);
106        return result;
107    }
108}