1 /* 2 * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/ContentStore.java,v 1.9 2004/07/28 09:34:42 ib Exp $ 3 * $Revision: 1.9 $ 4 * $Date: 2004/07/28 09:34:42 $ 5 * 6 * ==================================================================== 7 * 8 * Copyright 1999-2002 The Apache Software Foundation 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 */ 23 24 package org.apache.slide.store; 25 26 import org.apache.slide.common.Service; 27 import org.apache.slide.common.ServiceAccessException; 28 import org.apache.slide.common.Uri; 29 import org.apache.slide.content.NodeRevisionContent; 30 import org.apache.slide.content.NodeRevisionDescriptor; 31 import org.apache.slide.content.RevisionAlreadyExistException; 32 import org.apache.slide.content.RevisionNotFoundException; 33 34 /** 35 * Store service. 36 * 37 * @version $Revision: 1.9 $ 38 */ 39 public interface ContentStore extends Service { 40 41 42 // ------------------------------------------------------ Interface Methods 43 44 45 /** 46 * Retrieve revision content. 47 * 48 * @param uri Uri 49 * @param revisionDescriptor Node revision descriptor 50 */ 51 NodeRevisionContent retrieveRevisionContent 52 (Uri uri, NodeRevisionDescriptor revisionDescriptor) 53 throws ServiceAccessException, RevisionNotFoundException; 54 55 56 /** 57 * Create revision content. 58 * <p> 59 * Notes: 60 * <ul> 61 * <li>If a content length is specified by the revisionDescriptor 62 * (ie, revisionDescriptor.getContentLength != -1), then 63 * the ContentStore MUST enforce it, and throw a ServiceAccessException 64 * if an incorrect number of bytes are read. It MUST also revert any 65 * changes made to the underlying repository.</li> 66 * <li>If a content length is not specified by the revisionDescriptor 67 * (ie, revisionDescriptor.getContentLength == -1), then the ContentStore 68 * MUST read all the bytes available and then call 69 * revisionDescriptor.setContentLength(numberOfBytesRead).</li> 70 * </ul> 71 * 72 * @param uri Uri 73 * @param revisionDescriptor Node revision descriptor 74 * @param revisionContent Node revision content 75 */ 76 void createRevisionContent 77 (Uri uri, NodeRevisionDescriptor revisionDescriptor, 78 NodeRevisionContent revisionContent) 79 throws ServiceAccessException, RevisionAlreadyExistException; 80 81 82 /** 83 * Modify revision content. 84 * <p> 85 * Notes: 86 * <ul> 87 * <li>If a content length is specified by the revisionDescriptor 88 * (ie, revisionDescriptor.getContentLength != -1), then 89 * the ContentStore MUST enforce it, and throw a ServiceAccessException 90 * if an incorrect number of bytes are read. It MUST also revert any 91 * changes made to the unedrlying repository.</li> 92 * <li>If a content length is not specified by the revisionDescriptor 93 * (ie, revisionDescriptor.getContentLength == -1), then the ContentStore 94 * MUST read all the bytes available and then call 95 * revisionDescriptor.setContentLength(numberOfBytesRead).</li> 96 * </ul> 97 * 98 * @param uri Uri 99 * @param revisionDescriptor Node revision descriptor 100 * @param revisionContent Node revision content 101 */ 102 void storeRevisionContent 103 (Uri uri, NodeRevisionDescriptor revisionDescriptor, 104 NodeRevisionContent revisionContent) 105 throws ServiceAccessException, RevisionNotFoundException; 106 107 108 /** 109 * Remove revision content. 110 * 111 * @param uri Uri 112 * @param revisionDescriptor Node revision descriptor 113 */ 114 void removeRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor) 115 throws ServiceAccessException; 116 117 } 118