View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.cms;
17  
18  import java.io.File;
19  import java.io.IOException;
20  import java.io.InputStream;
21  import java.io.OutputStream;
22  import java.util.List;
23  import java.util.Properties;
24  
25  import org.seasar.tuigwaa.cms.core.Page;
26  import org.seasar.tuigwaa.cms.core.Resource;
27  import org.seasar.tuigwaa.system.TgwException;
28  import org.seasar.tuigwaa.system.TgwSecurityException;
29  
30  import com.isenshi.util.Diff;
31  
32  /***
33   * @author nishioka
34   */
35  public interface ContentsStoreService {
36  	
37  	public static final String DEFAULT_ENCODING = "Windows-31J";
38  
39  	public static final int RETRIEVETYPE_PAGE = 0;
40  
41  	public static final int RETRIEVETYPE_FOLDER = 1;
42  
43  	public static final int RETRIEVETYPE_PAGEFOLDER = 2;
44  
45  	// [Start] ----- Page Basic CRUD -------
46  
47  	public Page getPage(String siteName, String pagePath)
48  			throws TgwSecurityException;
49  
50  	public void createPage(Page page) throws TgwResourceCreationException;
51  
52  	public void createFolder(String siteName, String folderPath)
53  			throws TgwSecurityException, TgwResourceAlreadyExistsException;
54  
55  	public void createResource(String siteName, String path,
56  			String contentType, int contentLength, InputStream data)
57  			throws TgwResourceCreationException;
58  
59  	public void delete(String siteName, String path);
60  
61  	public void rename(String siteName, String pagePath, String newPageName)
62  			throws TgwResourceAlreadyExistsException;
63  
64  	public void move(String siteName, String pagePath, String newParentPath)
65  			throws TgwResourceAlreadyExistsException;
66  	
67  	public void copy(String srcSiteName, String srcPath, String destSiteName, String destPath) throws TgwException;
68  
69  	// [End] ----- Page Basic CRUD -------
70  
71  	// [Start] ----- Page Property -----
72  
73  	public void setProperty(String siteName, String path, Properties props)
74  			throws TgwResourceNotFoundException,TgwSecurityException,TgwException;
75  
76  	public Properties getProperty(String siteName, String path)
77  			throws TgwResourceNotFoundException,TgwSecurityException,TgwException;
78  
79  	public void removeProperty(String siteName, String path, String key)
80  			throws TgwResourceNotFoundException, TgwSecurityException, TgwException;
81  
82  	// [End] ----- Page Property -----
83  
84  	// [Start] ----- Resource Util -----
85  
86  	public Resource getResource(String siteName, String pagePath) throws TgwSecurityException;
87  
88  	public void writeResource(String siteName, String path, OutputStream os)
89  			throws IOException;
90  
91  	public List search(String siteName, String keyword) throws TgwSearchFailedException;
92  
93  	public List getLatestContents(String siteName, int size) throws TgwSearchFailedException;
94  
95  	/***
96  	 * リソースの存在をチェックする
97  	 * @param siteName サイト名
98  	 * @param pagePath リソースへのパス
99  	 * @param pageOnly 該当リソースがページであるかのチェックを行うか否かをあらわすフラグ
100 	 * @return リソースが存在していたら真、存在しない場合は偽、また pageOnly が真の場合はリソースが存在し、
101 	 * かつ、それがフォルダでない場合にのみ真を返す
102 	 * @throws TgwSecurityException 該当のリソースをチェックする権限がない場合にスローされる
103 	 */
104 	public boolean isExistResource(String siteName, String pagePath, boolean pageOnly) throws TgwSecurityException;
105 
106 	/***
107 	 * @deprecated
108 	 */
109 	public boolean isExist(String siteName, String pagePath) throws TgwSecurityException;
110 	
111 	/***
112 	 * @deprecated
113 	 */	
114 	public boolean isExistPage(String siteName, String pagePath) throws TgwSecurityException;
115 	
116 	/***
117 	 * @deprecated
118 	 */
119 	public String getContent(Resource resource) throws TgwSecurityException;
120 
121 	public Diff getDiff(String siteName, String pagePath, String oldVersion);
122 
123 	public List getHistory(String siteName, String pagePath);
124 
125 	/***
126 	 * @deprecated
127 	 */
128 	public boolean checkVersion(Resource resource, String version);
129 
130 	public void copyFromFileSystem(File srcDirectory, String targetSiteName)
131 			throws TgwResourceCreationException, TgwSecurityException;
132 
133 	public void copyToFileSystem(String targetSiteName, String srcPath,
134 			File srcDirectory) throws TgwSecurityException, IOException;
135 
136 	// [End] ----- Page Util -----
137 
138 	// [Start] ----- Attachment CRUD -------
139 
140 	public void createAttachment(String siteName, String pagePath,
141 			String fileName, String contentType, int contentLength,
142 			InputStream data) throws TgwSecurityException,TgwResourceCreationException;
143 
144 	public void writeAttachment(String siteName, String pagePath,
145 			String fileName, OutputStream os) throws IOException;
146 
147 	public List getAttachmentFileList(String siteName, String pagePath)
148 			throws TgwSecurityException;
149 
150 	public Resource getAttachmentResource(String siteName, String pagePath,
151 			String fileName) throws TgwSecurityException, TgwResourceNotFoundException;
152 
153 	public void createThumbnail(Resource resource, OutputStream os, int width,
154 			String formatName);
155 
156 	// [End] ----- Attachment CRUD -------
157 
158 	// [Start]----- Resource Getter -----		
159 	
160 	public List getPageOrFolderList(String siteName, String folderPath)
161 			throws TgwSecurityException;
162 
163 	public List getRecursivePageOrFolderList(String siteName, String folderPath)
164 			throws TgwSecurityException;
165 
166 	public List getPageList(String siteName, String folderPath)
167 			throws TgwSecurityException;
168 
169 	public List getRecursivePageList(String siteName, String folderPath)
170 			throws TgwSecurityException;
171 
172 	public List getRecursiveFolderList(String siteName, String folderPath)
173 			throws TgwSecurityException;
174 
175 	public List getFolderList(String siteName, String folderPath)
176 			throws TgwSecurityException;
177 
178 	// [End]----- Resource Getter -----
179 
180 	// [Strat] ----- Security -----
181 
182 	public boolean hasPermission(String siteName, String path, String role);
183 
184 	public void setPermissions(String siteName, String path,
185 			String[] grantRoles, String[] denyRoles);
186 
187 	// [End] ----- Security -----
188 
189 	public void refreshCache(String siteName);
190 	
191 	public void refreshCache(String path, boolean isSite);
192 
193 }