001/*
002 *  Copyright 2010 Anyware Services
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 */
016package org.ametys.plugins.explorer.resources;
017
018import java.io.InputStream;
019import java.util.Date;
020
021import org.ametys.core.user.UserIdentity;
022import org.ametys.plugins.repository.AmetysRepositoryException;
023import org.ametys.plugins.repository.dublincore.DublinCoreAwareAmetysObject;
024
025/**
026 * Common interface for a resource file of a resources explorer node.
027 */
028public interface Resource extends DublinCoreAwareAmetysObject
029{
030    /**
031     * Returns the data stream.
032     * @return the data stream.
033     * @throws AmetysRepositoryException if an error occurs.
034     */
035    public InputStream getInputStream () throws AmetysRepositoryException;
036    
037    /**
038     * Retrieves the creation date.
039     * @return the creation date.
040     * @throws AmetysRepositoryException if an error occurs.
041     */
042    public Date getCreationDate() throws AmetysRepositoryException;
043    
044    /**
045     * Returns the last modification date.
046     * @return the last modification date.
047     * @throws AmetysRepositoryException if an error occurs.
048     */
049    public Date getLastModified () throws AmetysRepositoryException;
050    
051    /**
052     * Returns the length of the data stream.
053     * @return the length of the data stream.
054     * @throws AmetysRepositoryException if an error occurs.
055     */
056    public long getLength() throws AmetysRepositoryException;
057    
058    /**
059     * Returns the last contributor of this resource.
060     * @return the last contributor of this resource.
061     * @throws AmetysRepositoryException if an error occurs.
062     */
063    public UserIdentity getCreator() throws AmetysRepositoryException;
064    
065    /**
066     * Retrieves the login of the last contributor.
067     * @return the login of the last contributor.
068     * @throws AmetysRepositoryException if an error occurs.
069     */
070    public UserIdentity getLastContributor() throws AmetysRepositoryException;
071    
072    /**
073     * Returns the keywords of this resource, as a String array.
074     * @return the keywords of this resource.
075     * @throws AmetysRepositoryException if an error occurs.
076     */
077    public String[] getKeywords() throws AmetysRepositoryException;
078    
079    /**
080     * Returns the keywords of this resource, as a comme-separated String.
081     * @return the keywords of this resource.
082     * @throws AmetysRepositoryException if an error occurs.
083     */
084    public String getKeywordsAsString() throws AmetysRepositoryException;
085    
086    /**
087     * Returns the data mime-type.
088     * @return the data mime-type.
089     * @throws AmetysRepositoryException if an error occurs.
090     */
091    public String getMimeType()  throws AmetysRepositoryException;
092    
093    /**
094     * Returns the path of this resource in its hierarchy (which is a subset of the whole repository).
095     * @return the path of this resource in its hierarchy.
096     * @throws AmetysRepositoryException if an error occurs.
097     */
098    public String getResourcePath() throws AmetysRepositoryException;
099}