001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/tool/tags/sakai_2-4-1/tool-api/api/src/java/org/sakaiproject/tool/api/Tool.java $
003: * $Id: Tool.java 9315 2006-05-12 02:09:45Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.api;
021:
022: import java.util.Properties;
023: import java.util.Set;
024:
025: /**
026: * <p>
027: * Tool models a Sakai user interface producing tool. Tool and its attributes are immutable.
028: * </p>
029: */
030: public interface Tool {
031: /** The request attribute name whose value if "true" requests producing a document fragment rather than a full document. */
032: public static final String FRAGMENT = "sakai.fragment";
033:
034: /** The request attribute name whose value if "true" requests producing a document suitable for aggregation in a portal. */
035: public static final String PORTLET = "sakai.portlet";
036:
037: /** The request attribute name containing the Tool definition for the current request. */
038: public static final String TOOL = "sakai.tool";
039:
040: /** The request attribute name containing the ToolSession for the current request. */
041: public static final String TOOL_SESSION = "sakai.tool.session";
042:
043: /** The request attribute name if present causes our wrapped requests to report the native URL rather than the Sakai set up URL information. */
044: public static final String NATIVE_URL = "sakai.request.native.url";
045:
046: /** The request attribute name containing the Tool placement for the current request. */
047: public static final String PLACEMENT = "sakai.tool.placement";
048:
049: /** The request attribute / URL parameter name containing the Tool placement id for the current request. */
050: public static final String PLACEMENT_ID = "sakai.tool.placement.id";
051:
052: /** Standard session attribute shared between client and helper: URL to redirect to when helper is done. */
053: public static final String HELPER_DONE_URL = "sakai.tool.helper.done.url";
054:
055: /** Standard session attribute shared between client and helper: end user message. */
056: public static final String HELPER_MESSAGE = "sakai.tool.helper.message";
057:
058: /**
059: * Access the well known id of the tool.
060: *
061: * @return The well known id of the tool.
062: */
063: String getId();
064:
065: /**
066: * Access the tool's home destination, if one is registered
067: * @return The tool's registered home destination, or null if not registered.
068: */
069: String getHome();
070:
071: /**
072: * Access the tool title.
073: *
074: * @return The tool title.
075: */
076: String getTitle();
077:
078: /**
079: * Access the tool description.
080: *
081: * @return The tool description.
082: */
083: String getDescription();
084:
085: /**
086: * Access the configuration properties from registration for the tool. Access is read only.
087: *
088: * @return The read-only configuration properties from registration for the tool.
089: */
090: Properties getRegisteredConfig();
091:
092: /**
093: * Access the configuration properties that may be configured (not the final ones) from registration for the tool. Access is read only.
094: *
095: * @return The read-only configuration properties from registration for the tool.
096: */
097: Properties getMutableConfig();
098:
099: /**
100: * Access the configuration properties that are final ones, may not be configured, from registration for the tool. Access is read only.
101: *
102: * @return The read-only configuration properties from registration for the tool.
103: */
104: Properties getFinalConfig();
105:
106: /**
107: * Access the keywords registered for this tool. Access is read only.
108: *
109: * @return The Set (String) of keywords registered for this tool.
110: */
111: Set getKeywords();
112:
113: /**
114: * Access the catagories registered for this tool. Access is read only.
115: *
116: * @return The Set (String) of categories registered for this tool.
117: */
118: Set getCategories();
119:
120: /**
121: * typesafe enumeration for access security.
122: */
123: public class AccessSecurity {
124: private static final int TOOL_SECURITY = 0;
125: private static final int PORTAL_SECURITY = 1;
126: private int m_type = -1;
127:
128: private AccessSecurity(int type) {
129: m_type = type;
130: }
131:
132: public static final AccessSecurity TOOL = new AccessSecurity(
133: TOOL_SECURITY);
134: public static final AccessSecurity PORTAL = new AccessSecurity(
135: PORTAL_SECURITY);
136: }
137:
138: /**
139: * Access the setting for this tool for the access security. Access is read only.
140: * @return ACCESS_SECURITY_PORTAL if the tool is configured to let the portal handle access security, or ACCESS_SECURITY_TOOL if it handles it internally.
141: */
142: AccessSecurity getAccessSecurity();
143: }
|