001/* 002 * ModeShape (http://www.modeshape.org) 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.modeshape.web.client; 017 018import org.modeshape.web.shared.RemoteException; 019import java.util.Collection; 020import org.modeshape.web.shared.JcrNode; 021import org.modeshape.web.shared.JcrNodeType; 022import org.modeshape.web.shared.JcrPermission; 023import org.modeshape.web.shared.JcrRepositoryDescriptor; 024import org.modeshape.web.shared.ResultSet; 025import com.google.gwt.user.client.rpc.RemoteService; 026import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; 027import java.util.Date; 028import org.modeshape.web.shared.BackupParams; 029import org.modeshape.web.shared.RepositoryName; 030import org.modeshape.web.shared.RestoreParams; 031import org.modeshape.web.shared.Stats; 032 033/** 034 * The client side stub for the RPC service. 035 */ 036@RemoteServiceRelativePath("jcr") 037public interface JcrService extends RemoteService { 038 039 /** 040 * Initial URI requested by user. 041 * 042 * @return URI as text. 043 */ 044 public String getRequestedURI(); 045 046 /** 047 * Currently logged in user. 048 * 049 * @return user's name of null if not logged in. 050 * @throws RemoteException 051 */ 052 public String getUserName() throws RemoteException; 053 054 /** 055 * Lists all available repositories. 056 * 057 * @return collection of object representing repository. 058 * @throws RemoteException if there is a problem communicating with a remote service 059 */ 060 public Collection<RepositoryName> getRepositories() throws RemoteException; 061 062 /** 063 * Searches repositories with given criteria 064 * 065 * @param criteria the parameter for searching repository 066 * @return collection of object representing repository. 067 * @throws RemoteException if there is a problem communicating with a remote service 068 */ 069 public Collection<RepositoryName> findRepositories(String criteria) throws RemoteException; 070 071 /** 072 * Enlists workspaces available for the given repository and user previously 073 * logged in. 074 * 075 * @param repositoryName the name of the repository. 076 * @return names of the available workspaces or empty array. 077 * @throws RemoteException 078 */ 079 public String[] getWorkspaces(String repositoryName) throws RemoteException; 080 081 082 /** 083 * Provides access for the given user to the given repository. 084 * 085 * @param userName the name of the user 086 * @param password the user's password 087 * @throws RemoteException if there is a problem using the repository 088 */ 089 public void login(String userName, String password) throws RemoteException; 090 091 /** 092 * Logs out from all repositories. 093 */ 094 public String logout(); 095 096 /** 097 * Gets node at the given path. 098 * 099 * @param repository 100 * @param workspace 101 * @param path 102 * @return 103 * @throws RemoteException 104 */ 105 public JcrNode node(String repository, String workspace, String path) throws RemoteException; 106 107 /** 108 * Gets set of child nodes for the node at the given path. 109 * 110 * @param repository 111 * @param workspace 112 * @param path 113 * @param index 114 * @param count 115 * @return 116 * @throws RemoteException 117 */ 118 public Collection<JcrNode> childNodes(String repository, String workspace, String path, int index, int count) throws RemoteException; 119 120 /** 121 * Gets repository capabilities. 122 * 123 *@param repository the repository 124 * @return description of the repository capabilities. 125 */ 126 public JcrRepositoryDescriptor repositoryInfo(String repository) throws RemoteException; 127 128 /** 129 * Gets all registered node types. 130 * 131 * @param repository 132 * @param workspace 133 * @return the node types 134 * @throws RemoteException if there is a problem using the repository 135 */ 136 public Collection<JcrNodeType> nodeTypes(String repository, String workspace) throws RemoteException; 137 138 /** 139 * Gets supported query languages. 140 * 141 * @param repository 142 * @param workspace 143 * @return language names 144 * @throws RemoteException if there is a problem using the repository 145 */ 146 public String[] supportedQueryLanguages(String repository, String workspace) throws RemoteException; 147 148 /** 149 * Executes query. 150 * 151 * @param repository 152 * @param workspace 153 * @param text the query text. 154 * @param lang query language name 155 * @return Query result 156 * @throws RemoteException if there is a problem using the repository 157 */ 158 public ResultSet query(String repository, String workspace, String text, 159 String lang) throws RemoteException; 160 161 /** 162 * Adds new node. 163 * 164 * @param repository 165 * @param workspace 166 * @param path the path to the parent node 167 * @param name the name of node to add 168 * @param primaryType the primary type of the node to add. 169 * @return the node 170 * @throws RemoteException if there is a problem using the repository 171 */ 172 public JcrNode addNode(String repository, 173 String workspace, 174 String path, 175 String name, 176 String primaryType) throws RemoteException; 177 178 179 /** 180 * 181 * @param repository 182 * @param workspace 183 * @param path 184 * @param name 185 * @throws RemoteException 186 */ 187 public void renameNode(String repository, String workspace, String path, String name) throws RemoteException; 188 189 /** 190 * Deletes node. 191 * 192 * @param repository 193 * @param workspace 194 * @param path the pass to the node to be deleted. 195 * @throws RemoteException if there is a problem using the repository 196 */ 197 public void removeNode(String repository, String workspace, String path) throws RemoteException; 198 199 /** 200 * Adds mixin to the node. 201 * 202 * @param repository 203 * @param workspace 204 * @param path the path to the node 205 * @param mixin mixin to add 206 * @throws RemoteException Any exception on the server side 207 */ 208 public void addMixin(String repository, String workspace, String path, 209 String mixin) throws RemoteException; 210 211 /** 212 * Removes mixin from the given node. 213 * 214 * @param repository 215 * @param workspace 216 * @param path the path to the node 217 * @param mixin mixin to remove 218 * @throws RemoteException any server side exception. 219 */ 220 public void removeMixin(String repository, String workspace, String path, 221 String mixin) throws RemoteException; 222 223 public void setProperty(JcrNode node, String name, String value) 224 throws RemoteException; 225 226 public void setProperty(JcrNode node, String name, Boolean value) 227 throws RemoteException; 228 229 public void setProperty(JcrNode node, String name, Date value) 230 throws RemoteException; 231 232 233 /** 234 * Creates empty access list for given principal. 235 * 236 * @param repository 237 * @param workspace 238 * @param path the path to the node. 239 * @param principal the principal name 240 * @throws RemoteException 241 */ 242 public void addAccessList(String repository, String workspace,String path, 243 String principal) throws RemoteException; 244 245 246 /** 247 * Deletes access list. 248 * 249 * @param repository 250 * @param workspace 251 * @param path 252 * @param principal 253 * @throws RemoteException 254 */ 255 public void removeAccessList( String repository, 256 String workspace, 257 String path, 258 String principal ) throws RemoteException; 259 260 public void updateAccessList(String repository, String workspace, String path, String principal, 261 JcrPermission permission, boolean enabled) throws RemoteException; 262 263 /** 264 * Reads list of primary types. 265 * 266 * @param repository 267 * @param workspace 268 * @param superType 269 * @param allowAbstract true if allow to load abstract node types. 270 * @return list of type names. 271 * @throws RemoteException 272 */ 273 public String[] getPrimaryTypes(String repository, String workspace, 274 String superType, 275 boolean allowAbstract) throws RemoteException; 276 277 /** 278 * Reads list of mixin types. 279 * 280 * @param repository 281 * @param workspace 282 * @param allowAbstract true if allow to load abstract node types. 283 * @return list of type names. 284 * @throws RemoteException 285 */ 286 public String[] getMixinTypes(String repository, String workspace,boolean allowAbstract) throws RemoteException; 287 288 /** 289 * Saves changes in the current session. 290 * 291 * @param repository 292 * @param workspace 293 * @throws RemoteException if there is a problem using the repository 294 */ 295 public void save(String repository, String workspace) throws RemoteException; 296 297 public void backup(String repository, String name, BackupParams params) throws RemoteException; 298 public void restore(String repository, String name, RestoreParams params) throws RemoteException; 299 300 public void export(String repository, String workspace, String path, String location, boolean skipBinary, boolean noRecurse) 301 throws RemoteException; 302 public void importXML(String repository, String workspace, String path, String location, int option) 303 throws RemoteException; 304 305 /** 306 * Reload session to the given workspace and repository. 307 * 308 * @param repository the repository name 309 * @param workspace the workspace name 310 * @param keepChanges true if session should keep modification and false 311 * otherwise 312 * @throws RemoteException 313 */ 314 public void refreshSession(String repository, String workspace, 315 boolean keepChanges) throws RemoteException; 316 317 /** 318 * Obtains repository metrics. 319 * 320 * @param repository 321 * @param param value metric name 322 * @param tu time window name 323 * @return 324 * @throws RemoteException 325 */ 326 public Collection<Stats> getValueStats(String repository, String param, String tu) throws RemoteException; 327 328 /** 329 * Obtains repository metrics. 330 * 331 * @param repository 332 * @param param duration metric name 333 * @param tu time window name 334 * @return 335 * @throws RemoteException 336 */ 337 public Collection<Stats> getDurationStats(String repository, String param, String tu) throws RemoteException; 338 339 /** 340 * Gets names of available value metrics. 341 * 342 * @return 343 * @throws RemoteException 344 */ 345 public String[] getValueMetrics() throws RemoteException; 346 /** 347 * Gets names of available duration metrics. 348 * 349 * @return 350 * @throws RemoteException 351 */ 352 public String[] getDurationMetrics() throws RemoteException; 353 354 355 /** 356 * Gets possible time frames. 357 * 358 * @return 359 * @throws RemoteException 360 */ 361 public String[] getTimeUnits() throws RemoteException; 362}