sascha@115: /* sascha@115: * Copyright (c) 2011 by Intevation GmbH sascha@115: * sascha@115: * This program is free software under the LGPL (>=v2.1) sascha@115: * Read the file LGPL.txt coming with the software for details sascha@115: * or visit http://www.gnu.org/licenses/ if it does not exist. sascha@115: */ sascha@115: teichmann@475: package org.dive4elements.artifacts; sascha@115: sascha@115: import org.w3c.dom.Document; sascha@115: sascha@115: import java.io.IOException; sascha@115: import java.io.OutputStream; sascha@115: import java.io.Serializable; sascha@115: sascha@118: import java.util.Date; sascha@118: sascha@115: public interface ArtifactCollection sascha@115: extends Serializable sascha@115: { sascha@115: /** sascha@115: * Set a new identifier for this collection. sascha@115: * @param identifier New identifier for this collection. sascha@115: */ sascha@115: void setIdentifier(String identifier); sascha@115: sascha@115: /** sascha@115: * Identify this collection. sascha@115: * @return Returns unique string to identify this collection globally. sascha@115: */ sascha@115: String identifier(); sascha@115: sascha@159: String getName(); sascha@159: sascha@159: void setName(String name); sascha@159: sascha@118: Date getCreationTime(); sascha@118: sascha@118: void setCreationTime(Date creationTime); sascha@118: ingo@281: long getTTL(); ingo@281: ingo@281: void setTTL(long ttl); ingo@281: ingo@221: Document getAttribute(); ingo@221: ingo@221: void setAttribute(Document attribute); ingo@221: sascha@115: /** sascha@115: * Set a new owner of this collection. sascha@115: * @param user New owner for this collection. sascha@115: */ sascha@115: void setUser(User user); sascha@115: sascha@115: /** sascha@115: * Identify the owner of the collection. sascha@115: * @return Returns owner of the collection. sascha@115: */ sascha@115: User getUser(); // FIXME: Is ArtifactCollectionFactory needed? sascha@115: sascha@115: /** sascha@115: * When created by a factory this method is called to sascha@115: * initialize the collection. sascha@115: * @param identifier The identifier from collection database sascha@115: * @param factory The factory which created this collection. sascha@115: * @param context The global context of the runtime system. sascha@115: * @param data The data which can be use to setup a collection with sascha@115: * more details. sascha@115: */ sascha@115: void setup( sascha@115: String identifier, sascha@170: String name, sascha@170: Date creationTime, ingo@281: long ttl, sascha@115: ArtifactCollectionFactory factory, sascha@115: Object context, sascha@115: Document data); sascha@115: ingo@218: ingo@218: Document describe(CallContext context); ingo@218: sascha@115: //TODO: create LifeCycle interface sascha@115: /** sascha@115: * Called from artifact database when an artifact is sascha@115: * going to be removed from system. sascha@115: * @param context The global context of the runtime system. sascha@115: */ sascha@115: void endOfLife(Object context); sascha@115: sascha@115: /** sascha@115: * Internal hash of this collection. sascha@115: * @return Returns hash that should stay the same if the internal sascha@115: * value has not changed. Useful for caching sascha@115: */ sascha@115: String hash(); sascha@115: sascha@115: sascha@115: /** sascha@115: * Called from artifact database before an artifact is sascha@115: * going to be exported as xml document. sascha@115: * @param context The global context of the runtime system. sascha@115: */ sascha@115: void cleanup(Object context); sascha@115: sascha@116: void addArtifact(Artifact artifact, Document attributes, CallContext context); sascha@115: sascha@116: void removeArtifact(Artifact artifact, CallContext context); sascha@115: sascha@116: Artifact [] getArtifacts(CallContext context); sascha@115: sascha@116: Document getAttribute(Artifact artifactCall, CallContext context); sascha@116: sascha@116: void setAttribute(Artifact artifact, Document document, CallContext context); sascha@115: sascha@115: /** sascha@115: * Produce output for this collection. ingo@269: * @param type Specifies the output type of the action. sascha@115: * @param format Specifies the format of the output. sascha@115: * @param out Stream to write the result data to. sascha@115: * @param context The global context of the runtime system. sascha@115: * @throws IOException Thrown if an I/O occurs. sascha@115: */ sascha@115: void out( ingo@269: String type, sascha@115: Document format, sascha@115: OutputStream out, sascha@115: CallContext context) sascha@115: throws IOException; sascha@115: } sascha@115: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :