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