001: /**********************************************************************************
002: * $URL: $
003: * $Id: $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006, 2007 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.content.api;
021:
022: import java.util.Collection;
023: import java.util.Map;
024:
025: import org.sakaiproject.javax.Filter;
026:
027: /**
028: * <p>
029: * ResourceTypeRegistry is the API for managing definitions types of resources for the Resources tool.
030: * </p>
031: */
032: public interface ResourceTypeRegistry {
033: /**
034: * Access the definition of an action based on the id of the type in which it's defined and
035: * the id of the action within that type.
036: * @param typeId
037: * @param actionId
038: * @return
039: */
040: public ResourceToolAction getAction(String typeId, String actionId);
041:
042: /**
043: * Access a registered multi-item action.
044: * @param listActionId
045: * @return the action, or null if no multi-item action registered with that id.
046: */
047: public ServiceLevelAction getMultiItemAction(String listActionId);
048:
049: /**
050: * Access all multi-item actions that have been registered.
051: * @return
052: */
053: public Collection<ServiceLevelAction> getMultiItemActions();
054:
055: /**
056: * Access the definition of a particular resource type.
057: * @param typeId The id of the resource type.
058: * @return The ResourceType object which defines the requested type, or null if the type is not defined.
059: */
060: public ResourceType getType(String typeId);
061:
062: /**
063: * Access a collection (possibly empty) of all resource types that have been defined.
064: * @return
065: */
066: public Collection getTypes();
067:
068: /**
069: * Access a subset of the resource types that have been defined where membership in the subset is
070: * determined by whether the filter indicates that the ResourceType is accepted. The filter can
071: * accept a ResourceType object based on any attribute of the type that can be determined from the
072: * ResourceType object itself.
073: * @param filter
074: * @return
075: */
076: public Collection getTypes(Filter filter);
077:
078: /**
079: * In converting to the type registry, we need to use mimetype in some cases as a way to identify
080: * the resource-type of some existing resources. This method handles the mapping from mimetype
081: * to resource-type.
082: * @param contentType A mime type
083: * @return The "resource-type" for items with the given mime-type.
084: */
085: public String mimetype2resourcetype(String contentType);
086:
087: /**
088: * Create a new "pipe" that can be used as a conduit of information between the Resources tool
089: * and a helper that handles some part of an action.
090: * @param initializationId
091: * @param action
092: * @return
093: */
094: public ResourceToolActionPipe newPipe(String initializationId,
095: ResourceToolAction action);
096:
097: /**
098: * Register a ResourceType object to indicate that resources of that type can be defined in
099: * the Resources tool. If the InteractionAction object is null or if the type object's getId()
100: * method returns a null value, no type is registered.
101: * @param type
102: */
103: public void register(ResourceType type);
104:
105: /**
106: * @param context
107: * @param typeIds
108: */
109: public void setMapOfResourceTypesForContext(String context,
110: Map<String, Boolean> enabled);
111:
112: /**
113: * @param context
114: * @return
115: */
116: public Map<String, Boolean> getMapOfResourceTypesForContext(
117: String context);
118:
119: /**
120: * Access a collection (possibly empty) of all resource types that have been defined and
121: * enabled in the context (site).
122: * @return
123: */
124: public Collection<ResourceType> getTypes(String context);
125:
126: }
|