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 */ 016 017package org.ametys.plugins.repository.metadata; 018 019import java.io.InputStream; 020import java.io.OutputStream; 021import java.util.Date; 022 023import org.ametys.plugins.repository.AmetysRepositoryException; 024 025/** 026 * Resource that is modifiable 027 */ 028public interface ModifiableResource extends Resource 029{ 030 /** 031 * Rename the current metadata 032 * @param newName the new name 033 * @throws AmetysRepositoryException if an error occurs. 034 */ 035 public void rename(String newName) throws AmetysRepositoryException; 036 037 /** 038 * Set the mime type. 039 * @param mimeType the mime type of the data. 040 * @throws AmetysRepositoryException if an error occurs. 041 */ 042 public void setMimeType(String mimeType) throws AmetysRepositoryException; 043 044 /** 045 * Returns an OuputStream to write the data stream. 046 * @return an OuputStream to write the data stream. 047 * @throws AmetysRepositoryException if an error occurs. 048 */ 049 public OutputStream getOutputStream() throws AmetysRepositoryException; 050 051 /** 052 * Set the data stream. 053 * @param stream the data stream. 054 * @throws AmetysRepositoryException if an error occurs. 055 */ 056 public void setInputStream(InputStream stream) throws AmetysRepositoryException; 057 058 /** 059 * Set the encoding if the data stream, if it is a character stream. 060 * @param encoding the encoding of the data stream. 061 * @throws AmetysRepositoryException if an error occurs. 062 */ 063 public void setEncoding(String encoding) throws AmetysRepositoryException; 064 065 /** 066 * Set the last modification date. 067 * @param lastModifiedDate the last modification date. 068 * @throws AmetysRepositoryException if an error occurs. 069 */ 070 public void setLastModified(Date lastModifiedDate) throws AmetysRepositoryException; 071}