001: package org.sakaibrary.osid.repository.xserver;
002:
003: /*******************************************************************************
004: * Copyright (c) 2003, 2004, 2005 The Regents of the University of Michigan,
005: * Trustees of Indiana University, Board of Trustees of the Leland Stanford,
006: * Jr., University, and The MIT Corporation
007: *
008: * Licensed under the Educational Community License Version 1.0 (the "License");
009: * By obtaining, using and/or copying this Original Work, you agree that you
010: * have read, understand, and will comply with the terms and conditions of the
011: * Educational Community License. You may obtain a copy of the License at:
012: *
013: * http://cvs.sakaiproject.org/licenses/license_1_0.html
014: *
015: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
021: * SOFTWARE.
022: *
023: *******************************************************************************/
024:
025: public class NotePartStructure implements
026: org.osid.repository.PartStructure {
027: private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
028: .getLog("org.sakaibrary.osid.repository.xserver.NotePartStructure");
029:
030: private org.osid.shared.Id NOTE_PART_STRUCTURE_ID = null;
031: private org.osid.shared.Type type = new Type("sakaibrary",
032: "partStructure", "note",
033: "Note attached to resource metadata");
034: private String displayName = "Note";
035: private String description = "A Note can be any addition to the metadata "
036: + "of a resource";
037: private boolean mandatory = false;
038: private boolean populatedByRepository = false;
039: private boolean repeatable = true;
040:
041: private static NotePartStructure notePartStructure;
042:
043: private NotePartStructure() {
044: try {
045: this .NOTE_PART_STRUCTURE_ID = Managers.getIdManager()
046: .getId("k12ydf93k0we79s7234d98932g4423999");
047: } catch (Throwable t) {
048: LOG
049: .warn("NotePartStructure() failed to get partStructure id: "
050: + t.getMessage());
051: }
052: }
053:
054: protected static synchronized NotePartStructure getInstance() {
055: if (notePartStructure == null) {
056: notePartStructure = new NotePartStructure();
057: }
058: return notePartStructure;
059: }
060:
061: public String getDisplayName()
062: throws org.osid.repository.RepositoryException {
063: return this .displayName;
064: }
065:
066: public String getDescription()
067: throws org.osid.repository.RepositoryException {
068: return this .description;
069: }
070:
071: public boolean isMandatory()
072: throws org.osid.repository.RepositoryException {
073: return this .mandatory;
074: }
075:
076: public boolean isPopulatedByRepository()
077: throws org.osid.repository.RepositoryException {
078: return this .populatedByRepository;
079: }
080:
081: public boolean isRepeatable()
082: throws org.osid.repository.RepositoryException {
083: return this .repeatable;
084: }
085:
086: public void updateDisplayName(String displayName)
087: throws org.osid.repository.RepositoryException {
088: throw new org.osid.repository.RepositoryException(
089: org.osid.OsidException.UNIMPLEMENTED);
090: }
091:
092: public org.osid.shared.Id getId()
093: throws org.osid.repository.RepositoryException {
094: return this .NOTE_PART_STRUCTURE_ID;
095: }
096:
097: public org.osid.shared.Type getType()
098: throws org.osid.repository.RepositoryException {
099: return this .type;
100: }
101:
102: public org.osid.repository.RecordStructure getRecordStructure()
103: throws org.osid.repository.RepositoryException {
104: return RecordStructure.getInstance();
105: }
106:
107: public boolean validatePart(org.osid.repository.Part part)
108: throws org.osid.repository.RepositoryException {
109: return true;
110: }
111:
112: public org.osid.repository.PartStructureIterator getPartStructures()
113: throws org.osid.repository.RepositoryException {
114: return new PartStructureIterator(new java.util.Vector());
115: }
116:
117: }
|