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 GmbH & Co. KG, 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.workplace.tools;
029
030import org.opencms.file.CmsObject;
031import org.opencms.workplace.CmsWorkplace;
032
033import java.util.Map;
034
035/**
036 * Interface for an admin tool handler.<p>
037 *
038 * These handlers are created and managed by the
039 * <code>{@link org.opencms.workplace.tools.CmsToolManager}</code>.<p>
040 *
041 * @since 6.0.0
042 */
043public interface I_CmsToolHandler {
044
045    /**
046     * Returns the help text if disabled.<p>
047     *
048     * @return the help text if disabled
049     */
050    String getDisabledHelpText();
051
052    /**
053     * Returns the group.<p>
054     *
055     * @return the group
056     */
057    String getGroup();
058
059    /**
060     * Returns the help text.<p>
061     *
062     * @return the help text
063     */
064    String getHelpText();
065
066    /**
067     * Returns the path to the icon.<p>
068     *
069     * @return the path to the icon
070     */
071    String getIconPath();
072
073    /**
074     * Returns the link to the tool.<p>
075     *
076     * @return the link
077     */
078    String getLink();
079
080    /**
081     * Returns the displayed name.<p>
082     *
083     * @return the name
084     */
085    String getName();
086
087    /**
088     * Returns the evaluated map of parameters.<p>
089     *
090     * @param wp the workplace context
091     *
092     * @return the parameters map
093     */
094    Map<String, String[]> getParameters(CmsWorkplace wp);
095
096    /**
097     * Returns the tool path to install the tool in.<p>
098     *
099     * @return the path
100     */
101    String getPath();
102
103    /**
104     * Returns the relative position in the group.<p>
105     *
106     * @return the position
107     */
108    float getPosition();
109
110    /**
111     * Returns the name for the menu or navbar.<p>
112     *
113     * @return the short name
114     */
115    String getShortName();
116
117    /**
118     * Returns an optional confirmation message, displayed in a js confirm dialog.<p>
119     *
120     * @return the confirmation message
121     */
122    String getConfirmationMessage();
123
124    /**
125     * Returns the path to an optional small(16x16) icon.<p>
126     *
127     * @return the path to an optional small(16x16) icon
128     */
129    String getSmallIconPath();
130
131    /**
132     * Returns the state of the admin tool for a given cms context.<p>
133     *
134     * @param cms the cms context
135     *
136     * @return <code>true</code> if enabled
137     */
138    boolean isEnabled(CmsObject cms);
139
140    /**
141     * Returns the visibility flag for a given cms context.<p>
142     *
143     * @param cms the cms context
144     *
145     * @return <code>true</code> if visible
146     */
147    boolean isVisible(CmsObject cms);
148
149    /**
150     * Returns the state of the admin tool for a given workplace context.<p>
151     *
152     * @param wp the workplace context
153     *
154     * @return <code>true</code> if enabled
155     */
156    boolean isEnabled(CmsWorkplace wp);
157
158    /**
159     * Returns the visibility flag for a given workplace context.<p>
160     *
161     * @param wp the workplace context
162     *
163     * @return <code>true</code> if visible
164     */
165    boolean isVisible(CmsWorkplace wp);
166
167    /**
168     * Main method that somehow setups the admin tool handler.<p>
169     *
170     * @param cms the admin context (at opencms-workplace (re-)initialization time)
171     * @param root the root context
172     * @param resourcePath the resource path of the file/folder to use as admin tool
173     *
174     * @return <code>false</code> if something goes wrong
175     */
176    boolean setup(CmsObject cms, CmsToolRootHandler root, String resourcePath);
177}