001: /*
002: * Copyright 2004 Outerthought bvba and Schaubroeck nv
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.outerj.daisy.repository.schema;
017:
018: import org.outerj.daisy.repository.ValueType;
019: import org.outerj.daisy.repository.RepositoryException;
020: import org.outerj.daisy.repository.LinkExtractorInfos;
021:
022: /**
023: * Allows querying and manipulation of the Repository Schema.
024: *
025: * <p>The RepositorySchema can be retrieved via {@link org.outerj.daisy.repository.Repository#getRepositorySchema()}.
026: *
027: * <p>The Repository Schema defines the types of documents that can be stored
028: * in the repository. See {@link DocumentType} for more information about what
029: * constitutes a Document Type.
030: *
031: * <p>The various get methods all take a parameter "updateable". If true,
032: * the returned object can be modified and saved, and is caller-specific.
033: * If false, the returned object is not updateable (thus immutable), and the same object
034: * instance can be returned to different callers (i.e. it is threadsafe). The
035: * returned objects can in that case be retrieved from a cache, allowing very fast
036: * access to the schema information. So in general, if you don't need to modify
037: * the schema information, supply <tt>false</tt> for the updateable parameter.
038: */
039: public interface RepositorySchema {
040: /**
041: * @deprecated Use createDocumentType instead.
042: */
043: DocumentType createNewDocumentType(String name);
044:
045: /**
046: * Creates a new document type with the given name. The document type is
047: * not created immediately in the repository, to do this you need to call
048: * the save() method on the returned object.
049: */
050: DocumentType createDocumentType(String name);
051:
052: void deleteDocumentType(long documentTypeId)
053: throws RepositoryException;
054:
055: /**
056: * @deprecated Use createFieldType instead.
057: */
058: FieldType createNewFieldType(String name, ValueType valueType);
059:
060: FieldType createFieldType(String name, ValueType valueType);
061:
062: FieldType createFieldType(String name, ValueType valueType,
063: boolean multiValue);
064:
065: FieldType createFieldType(String name, ValueType valueType,
066: boolean multiValue, boolean hierarchical);
067:
068: void deleteFieldType(long fieldTypeId) throws RepositoryException;
069:
070: /**
071: * @deprecated Use createPartType instead.
072: */
073: PartType createNewPartType(String name, String mimeTypes);
074:
075: PartType createPartType(String name, String mimeTypes);
076:
077: void deletePartType(long partTypeId) throws RepositoryException;
078:
079: void addListener(RepositorySchemaListener listener);
080:
081: void removeListener(RepositorySchemaListener listener);
082:
083: DocumentTypes getAllDocumentTypes(boolean updateable)
084: throws RepositoryException;
085:
086: FieldTypes getAllFieldTypes(boolean updateable)
087: throws RepositoryException;
088:
089: PartTypes getAllPartTypes(boolean updateable)
090: throws RepositoryException;
091:
092: /**
093: * @throws PartTypeNotFoundException in case the part type does not exist.
094: */
095: PartType getPartTypeById(long id, boolean updateable)
096: throws RepositoryException;
097:
098: /**
099: * @throws PartTypeNotFoundException in case the part type does not exist.
100: */
101: PartType getPartTypeByName(String name, boolean updateable)
102: throws RepositoryException;
103:
104: /**
105: * @throws PartTypeNotFoundException in case the part type does not exist.
106: */
107: PartType getPartType(String nameOrId, boolean updateable)
108: throws RepositoryException;
109:
110: /**
111: * @throws FieldTypeNotFoundException in case the field type does not exist.
112: */
113: FieldType getFieldTypeById(long id, boolean updateable)
114: throws RepositoryException;
115:
116: /**
117: * @throws FieldTypeNotFoundException in case the field type does not exist.
118: */
119: FieldType getFieldTypeByName(String name, boolean updateable)
120: throws RepositoryException;
121:
122: FieldType getFieldType(String nameOrId, boolean updateable)
123: throws RepositoryException;
124:
125: /**
126: * @throws DocumentTypeNotFoundException in case the document type does not exist.
127: */
128: DocumentType getDocumentTypeById(long id, boolean updateable)
129: throws RepositoryException;
130:
131: /**
132: * @throws DocumentTypeNotFoundException in case the document type does not exist.
133: */
134: DocumentType getDocumentTypeByName(String name, boolean updateable)
135: throws RepositoryException;
136:
137: /**
138: * @param nameOrId if this starts with a digit, will do getDocumentTypeById, otherwise ByName
139: */
140: DocumentType getDocumentType(String nameOrId, boolean updateable)
141: throws RepositoryException;
142:
143: /**
144: * Returns information about the available link extractors.
145: */
146: LinkExtractorInfos getLinkExtractors() throws RepositoryException;
147: }
|