1 29 30 package com.caucho.jcr.base; 31 32 import org.xml.sax.ContentHandler ; 33 import org.xml.sax.SAXException ; 34 35 import javax.jcr.*; 36 import javax.jcr.lock.LockException; 37 import javax.jcr.nodetype.ConstraintViolationException; 38 import javax.jcr.nodetype.NoSuchNodeTypeException; 39 import javax.jcr.version.VersionException; 40 import java.io.IOException ; 41 import java.io.InputStream ; 42 import java.io.OutputStream ; 43 44 47 abstract public class BaseSession implements Session { 48 private boolean _isActive = true; 49 50 53 abstract public Repository getRepository(); 54 55 58 public String getUserID() 59 { 60 return null; 61 } 62 63 68 public Object getAttribute(String name) 69 { 70 return null; 71 } 72 73 76 public String [] getAttributeNames() 77 { 78 return new String [0]; 79 } 80 81 84 public Workspace getWorkspace() 85 { 86 throw new UnsupportedOperationException (); 87 } 88 89 94 public Session impersonate(Credentials credentials) 95 throws LoginException, RepositoryException 96 { 97 throw new UnsupportedRepositoryOperationException(getClass().getName()); 98 } 99 100 103 abstract public Node getRootNode() 104 throws RepositoryException; 105 106 111 public Node getNodeByUUID(String uuid) 112 throws ItemNotFoundException, 113 RepositoryException 114 { 115 throw new UnsupportedRepositoryOperationException(getClass().getName()); 116 } 117 118 125 public Item getItem(String absPath) 126 throws PathNotFoundException, 127 RepositoryException 128 { 129 throw new UnsupportedRepositoryOperationException(getClass().getName()); 130 } 131 132 137 public boolean itemExists(String absPath) 138 throws RepositoryException 139 { 140 try { 141 return getItem(absPath) != null; 142 } catch (PathNotFoundException e) { 143 return false; 144 } 145 } 146 147 153 public void move(String srcAbsPath, String destAbsPath) 154 throws ItemExistsException, 155 PathNotFoundException, 156 VersionException, 157 ConstraintViolationException, 158 LockException, 159 RepositoryException 160 { 161 throw new UnsupportedRepositoryOperationException(getClass().getName()); 162 } 163 164 167 public void save() 168 throws AccessDeniedException, 169 ItemExistsException, 170 ConstraintViolationException, 171 InvalidItemStateException, 172 VersionException, LockException, 173 NoSuchNodeTypeException, 174 RepositoryException 175 { 176 throw new UnsupportedRepositoryOperationException(getClass().getName()); 177 } 178 179 182 public void refresh(boolean keepChanges) 183 throws RepositoryException 184 { 185 throw new UnsupportedRepositoryOperationException(getClass().getName()); 186 } 187 188 191 public boolean hasPendingChanges() 192 throws RepositoryException 193 { 194 return false; 195 } 196 197 200 public ValueFactory getValueFactory() 201 throws UnsupportedRepositoryOperationException, 202 RepositoryException 203 { 204 throw new UnsupportedRepositoryOperationException(getClass().getName()); 205 } 206 207 213 public void checkPermission(String absPath, String actions) 214 throws java.security.AccessControlException , 215 RepositoryException 216 { 217 } 218 219 224 public ContentHandler getImportContentHandler(String parentAbsPath, 225 int uuidBehavior) 226 throws PathNotFoundException, 227 ConstraintViolationException, 228 VersionException, 229 LockException, 230 RepositoryException 231 { 232 throw new UnsupportedRepositoryOperationException(getClass().getName()); 233 } 234 235 241 public void importXML(String parentAbsPath, 242 InputStream in, 243 int uuidBehavior) 244 throws IOException , 245 PathNotFoundException, 246 ItemExistsException, 247 ConstraintViolationException, 248 VersionException, 249 InvalidSerializedDataException, 250 LockException, 251 RepositoryException 252 { 253 throw new UnsupportedRepositoryOperationException(getClass().getName()); 254 } 255 256 262 public void exportSystemView(String absPath, 263 ContentHandler contentHandler, 264 boolean skipBinary, 265 boolean noRecurse) 266 throws PathNotFoundException, 267 SAXException , 268 RepositoryException 269 { 270 throw new UnsupportedRepositoryOperationException(getClass().getName()); 271 } 272 273 279 public void exportSystemView(String absPath, 280 OutputStream out, 281 boolean skipBinary, 282 boolean noRecurse) 283 throws IOException , 284 PathNotFoundException, 285 RepositoryException 286 { 287 throw new UnsupportedRepositoryOperationException(getClass().getName()); 288 } 289 290 296 public void exportDocumentView(String absPath, 297 ContentHandler contentHandler, 298 boolean skipBinary, 299 boolean noRecurse) 300 throws PathNotFoundException, 301 SAXException , 302 RepositoryException 303 { 304 throw new UnsupportedRepositoryOperationException(getClass().getName()); 305 } 306 307 313 public void exportDocumentView(String absPath, 314 OutputStream out, 315 boolean skipBinary, 316 boolean noRecurse) 317 throws IOException , 318 PathNotFoundException, 319 RepositoryException 320 { 321 throw new UnsupportedRepositoryOperationException(getClass().getName()); 322 } 323 324 330 public void setNamespacePrefix(String newPrefix, 331 String existingUri) 332 throws NamespaceException, 333 RepositoryException 334 { 335 throw new UnsupportedRepositoryOperationException(getClass().getName()); 336 } 337 338 341 public String [] getNamespacePrefixes() 342 throws RepositoryException 343 { 344 throw new UnsupportedRepositoryOperationException(getClass().getName()); 345 } 346 347 350 public String getNamespaceURI(String prefix) 351 throws NamespaceException, 352 RepositoryException 353 { 354 return null; 355 } 356 357 360 public String getNamespacePrefix(String uri) 361 throws NamespaceException, 362 RepositoryException 363 { 364 return null; 365 } 366 367 370 public void logout() 371 { 372 _isActive = false; 373 } 374 375 378 public boolean isLive() 379 { 380 return _isActive; 381 } 382 383 386 public void addLockToken(String lt) 387 throws LockException, 388 RepositoryException 389 { 390 throw new UnsupportedRepositoryOperationException(getClass().getName()); 391 } 392 393 396 public String [] getLockTokens() 397 { 398 return new String [0]; 399 } 400 401 404 public void removeLockToken(String lt) 405 { 406 } 407 } 408 | Popular Tags |