01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/tool/tags/sakai_2-4-1/tool-api/api/src/java/org/sakaiproject/tool/api/ToolManager.java $
03: * $Id: ToolManager.java 7523 2006-04-09 13:03:23Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.api;
21:
22: import java.io.File;
23: import java.io.InputStream;
24: import java.util.Set;
25:
26: import org.w3c.dom.Document;
27:
28: /**
29: * <p>
30: * ToolManager holds registration of Tools available in this Sakai installation.
31: * </p>
32: */
33: public interface ToolManager {
34: /**
35: * Add this tool to the registry.
36: * @param tool The Tool to register.
37: */
38: void register(Tool tool);
39:
40: /**
41: * Add tools in this XML DOM to the registry, using the Tool XML schema.
42: * @param toolXml The parsed XML DOM in which tools to be added to the registry are to be found.
43: */
44: void register(Document toolXml);
45:
46: /**
47: * Add tools in this file of Tool XML schema to the registry.
48: * @param toolXmlFile The file of Tool schema XML in which tools to be added to the registry are to be found.
49: */
50: void register(File toolXmlFile);
51:
52: /**
53: * Add tools in this stream of Tool XML schema to the registry.
54: * @param toolXmlFile The file of Tool schema XML in which tools to be added to the registry are to be found.
55: */
56: void register(InputStream toolXmlStream);
57:
58: /**
59: * Find a tool with this well known id in the registry.
60: * @param id The tool's well known id.
61: * @return The Tool object that has this id, or null if not found.
62: */
63: Tool getTool(String id);
64:
65: /**
66: * Find a set of tools that meet the critieria.
67: * A tool must have a category in the categories criteria (unless it is empty or null) to be returned.
68: * A tool must have a keyword in the keywords criteria (unless it is empty or null) to be returned.
69: * If both categories and keywords criteria are specified, the tool must meet both criteria to be returned.
70: * If neither criteria are specified, all registered tools are returned.
71: * @param categories A Set (String) of category values; if null or empty no category criteria is specified.
72: * @param keywords A Set (String) of keyword values; if null or empty no keyword criteria is specified.
73: * @return A Set (Tool) of Tool objects that meet the criteria, or an empty set if none found.
74: */
75: Set findTools(Set categories, Set keywords);
76:
77: /**
78: * Access the Tool associated with the current request / thread
79: * @return The current Tool, or null if there is none.
80: */
81: Tool getCurrentTool();
82:
83: /**
84: * Access the Tool Placement associated with the current request / thread
85: * @return The current Tool Placement, or null if there is none.
86: */
87: Placement getCurrentPlacement();
88:
89: // TODO: unregister...
90: }
|