001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/tool/tags/sakai_2-4-1/tool-api/api/src/java/org/sakaiproject/tool/cover/ToolManager.java $
003: * $Id: ToolManager.java 7523 2006-04-09 13:03:23Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 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.cover;
021:
022: import org.sakaiproject.component.cover.ComponentManager;
023:
024: /**
025: * <p>
026: * ToolManager is a static Cover for the {@link org.sakaiproject.tool.api.ToolManager ToolManager}; see that interface for usage details.
027: * </p>
028: */
029: public class ToolManager {
030: /** Possibly cached component instance. */
031: private static org.sakaiproject.tool.api.ToolManager m_instance = null;
032:
033: /**
034: * Access the component instance: special cover only method.
035: *
036: * @return the component instance.
037: */
038: public static org.sakaiproject.tool.api.ToolManager getInstance() {
039: if (ComponentManager.CACHE_COMPONENTS) {
040: if (m_instance == null)
041: m_instance = (org.sakaiproject.tool.api.ToolManager) ComponentManager
042: .get(org.sakaiproject.tool.api.ToolManager.class);
043: return m_instance;
044: } else {
045: return (org.sakaiproject.tool.api.ToolManager) ComponentManager
046: .get(org.sakaiproject.tool.api.ToolManager.class);
047: }
048: }
049:
050: public static void register(org.sakaiproject.tool.api.Tool param0) {
051: org.sakaiproject.tool.api.ToolManager manager = getInstance();
052: if (manager == null)
053: return;
054:
055: manager.register(param0);
056: }
057:
058: public static void register(org.w3c.dom.Document param0) {
059: org.sakaiproject.tool.api.ToolManager manager = getInstance();
060: if (manager == null)
061: return;
062:
063: manager.register(param0);
064: }
065:
066: public static void register(java.io.InputStream param0) {
067: org.sakaiproject.tool.api.ToolManager manager = getInstance();
068: if (manager == null)
069: return;
070:
071: manager.register(param0);
072: }
073:
074: public static void register(java.io.File param0) {
075: org.sakaiproject.tool.api.ToolManager manager = getInstance();
076: if (manager == null)
077: return;
078:
079: manager.register(param0);
080: }
081:
082: public static org.sakaiproject.tool.api.Tool getTool(
083: java.lang.String param0) {
084: org.sakaiproject.tool.api.ToolManager manager = getInstance();
085: if (manager == null)
086: return null;
087:
088: return manager.getTool(param0);
089: }
090:
091: public static java.util.Set findTools(java.util.Set param0,
092: java.util.Set param1) {
093: org.sakaiproject.tool.api.ToolManager manager = getInstance();
094: if (manager == null)
095: return null;
096:
097: return manager.findTools(param0, param1);
098: }
099:
100: public static org.sakaiproject.tool.api.Tool getCurrentTool() {
101: org.sakaiproject.tool.api.ToolManager manager = getInstance();
102: if (manager == null)
103: return null;
104:
105: return manager.getCurrentTool();
106: }
107:
108: public static org.sakaiproject.tool.api.Placement getCurrentPlacement() {
109: org.sakaiproject.tool.api.ToolManager manager = getInstance();
110: if (manager == null)
111: return null;
112:
113: return manager.getCurrentPlacement();
114: }
115: }
|