001: /**********************************************************************************
002: *
003: * $Id: BaseEntityProducer.java 10984 2006-06-21 18:49:31Z ggolden@umich.edu $
004: *
005: ***********************************************************************************
006: *
007: * Copyright (c) 2006 The Regents of the University of California, The MIT Corporation
008: *
009: * Licensed under the Educational Community License, Version 1.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.opensource.org/licenses/ecl1.php
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: *
021: **********************************************************************************/package org.sakaiproject.tool.gradebook.facades.sakai2impl;
022:
023: import java.util.*;
024:
025: import org.apache.commons.logging.Log;
026: import org.apache.commons.logging.LogFactory;
027:
028: import org.w3c.dom.Document;
029: import org.w3c.dom.Element;
030:
031: import org.sakaiproject.entity.api.Entity;
032: import org.sakaiproject.entity.api.EntityProducer;
033: import org.sakaiproject.entity.api.HttpAccess;
034: import org.sakaiproject.entity.api.Reference;
035: import org.sakaiproject.entity.api.ResourceProperties;
036: import org.sakaiproject.entity.cover.EntityManager;
037:
038: /**
039: * Utility class that provides safe defaults for all EntityProducer methods.
040: * By subclassing, developers can focus only on the methods they
041: * actually need to customize. External configuration files can be used to
042: * set their label, reference root, and service name. The public "init()" method can be
043: * used to register as an EntityProducer.
044: */
045: public class BaseEntityProducer implements EntityProducer {
046: private static final Log log = LogFactory
047: .getLog(BaseEntityProducer.class);
048:
049: private String label; // This should always be set.
050: private String referenceRoot = null;
051: private String serviceName = null;
052:
053: /**
054: * Register this class as an EntityProducer.
055: */
056: public void init() {
057: EntityManager.registerEntityProducer(this , referenceRoot);
058: }
059:
060: public void setLabel(String label) {
061: this .label = label;
062: }
063:
064: public String getReferenceRoot() {
065: return referenceRoot;
066: }
067:
068: public void setReferenceRoot(String referenceRoot) {
069: this .referenceRoot = referenceRoot;
070: }
071:
072: /**
073: * Although not required, the service name is frequently used. As a
074: * convenience, it's also settable by this bean.
075: */
076: public String getServiceName() {
077: return serviceName;
078: }
079:
080: public void setServiceName(String serviceName) {
081: this .serviceName = serviceName;
082: }
083:
084: // EntityProducer methods begin here.
085:
086: public String getLabel() {
087: return label;
088: }
089:
090: public boolean willArchiveMerge() {
091: return false;
092: }
093:
094: public String archive(String siteId, Document doc, Stack stack,
095: String archivePath, List attachments) {
096: return null;
097: }
098:
099: public String merge(String siteId, Element root,
100: String archivePath, String fromSiteId, Map attachmentNames,
101: Map userIdTrans, Set userListAllowImport) {
102: return null;
103: }
104:
105: public boolean parseEntityReference(String reference, Reference ref) {
106: return false;
107: }
108:
109: public String getEntityDescription(Reference ref) {
110: return null;
111: }
112:
113: public ResourceProperties getEntityResourceProperties(Reference ref) {
114: return null;
115: }
116:
117: public Entity getEntity(Reference ref) {
118: return null;
119: }
120:
121: public String getEntityUrl(Reference ref) {
122: return null;
123: }
124:
125: public Collection getEntityAuthzGroups(Reference ref, String userId) {
126: return null;
127: }
128:
129: public HttpAccess getHttpAccess() {
130: return null;
131: }
132: }
|