1 29 30 package com.caucho.jcr.base; 31 32 import com.caucho.util.L10N; 33 34 import javax.jcr.*; 35 import javax.jcr.lock.Lock; 36 import javax.jcr.lock.LockException; 37 import javax.jcr.nodetype.ConstraintViolationException; 38 import javax.jcr.nodetype.NoSuchNodeTypeException; 39 import javax.jcr.nodetype.NodeDefinition; 40 import javax.jcr.nodetype.NodeType; 41 import javax.jcr.version.Version; 42 import javax.jcr.version.VersionException; 43 import javax.jcr.version.VersionHistory; 44 import java.io.InputStream ; 45 import java.util.Calendar ; 46 47 50 public class BaseNode extends BaseItem implements Node { 51 private static final L10N L = new L10N(BaseNode.class); 52 55 public boolean isNode() 56 { 57 return true; 58 } 59 60 65 public Node addNode(String relPath) 66 throws ItemExistsException, 67 PathNotFoundException, 68 VersionException, 69 ConstraintViolationException, 70 LockException, 71 RepositoryException 72 { 73 throw new UnsupportedOperationException (getClass().getName()); 74 } 75 76 82 public Node addNode(String relPath, 83 String primaryNodeTypeName) 84 throws ItemExistsException, 85 PathNotFoundException, 86 NoSuchNodeTypeException, 87 LockException, 88 VersionException, 89 ConstraintViolationException, 90 RepositoryException 91 { 92 throw new UnsupportedOperationException (getClass().getName()); 93 } 94 95 101 public void orderBefore(String srcChildRelPath, 102 String destChildRelPath) 103 throws UnsupportedRepositoryOperationException, 104 VersionException, 105 ConstraintViolationException, 106 ItemNotFoundException, 107 LockException, 108 RepositoryException 109 { 110 throw new UnsupportedOperationException (getClass().getName()); 111 } 112 113 114 120 public Property setProperty(String name, Value value) 121 throws ValueFormatException, 122 VersionException, 123 LockException, 124 ConstraintViolationException, 125 RepositoryException 126 { 127 throw new UnsupportedOperationException (getClass().getName()); 128 } 129 130 137 public Property setProperty(String name, Value value, int type) 138 throws ValueFormatException, 139 VersionException, 140 LockException, 141 ConstraintViolationException, 142 RepositoryException 143 { 144 throw new UnsupportedOperationException (getClass().getName()); 145 } 146 147 153 public Property setProperty(String name, Value[] values) 154 throws ValueFormatException, 155 VersionException, 156 LockException, 157 ConstraintViolationException, 158 RepositoryException 159 { 160 throw new UnsupportedOperationException (getClass().getName()); 161 } 162 163 170 public Property setProperty(String name, 171 Value[] values, 172 int type) 173 throws ValueFormatException, 174 VersionException, 175 LockException, 176 ConstraintViolationException, 177 RepositoryException 178 { 179 throw new UnsupportedOperationException (getClass().getName()); 180 } 181 182 188 public Property setProperty(String name, String [] values) 189 throws ValueFormatException, 190 VersionException, 191 LockException, 192 ConstraintViolationException, 193 RepositoryException 194 { 195 throw new UnsupportedOperationException (getClass().getName()); 196 } 197 198 205 public Property setProperty(String name, String [] values, int type) 206 throws ValueFormatException, 207 VersionException, 208 LockException, 209 ConstraintViolationException, 210 RepositoryException 211 { 212 throw new UnsupportedOperationException (getClass().getName()); 213 } 214 215 222 public Property setProperty(String name, String value) 223 throws ValueFormatException, 224 VersionException, 225 LockException, 226 ConstraintViolationException, 227 RepositoryException 228 { 229 throw new UnsupportedOperationException (getClass().getName()); 230 } 231 232 239 public Property setProperty(String name, String value, int type) 240 throws ValueFormatException, 241 VersionException, 242 LockException, 243 ConstraintViolationException, 244 RepositoryException 245 { 246 throw new UnsupportedOperationException (getClass().getName()); 247 } 248 249 255 public Property setProperty(String name, InputStream value) 256 throws ValueFormatException, 257 VersionException, 258 LockException, 259 ConstraintViolationException, 260 RepositoryException 261 { 262 throw new UnsupportedOperationException (getClass().getName()); 263 } 264 265 271 public Property setProperty(String name, boolean value) 272 throws ValueFormatException, 273 VersionException, 274 LockException, 275 ConstraintViolationException, 276 RepositoryException 277 { 278 throw new UnsupportedOperationException (getClass().getName()); 279 } 280 281 287 public Property setProperty(String name, double value) 288 throws ValueFormatException, 289 VersionException, 290 LockException, 291 ConstraintViolationException, 292 RepositoryException 293 { 294 throw new UnsupportedOperationException (getClass().getName()); 295 } 296 297 303 public Property setProperty(String name, long value) 304 throws ValueFormatException, 305 VersionException, 306 LockException, 307 ConstraintViolationException, 308 RepositoryException 309 { 310 throw new UnsupportedOperationException (getClass().getName()); 311 } 312 313 319 public Property setProperty(String name, Calendar value) 320 throws ValueFormatException, 321 VersionException, 322 LockException, 323 ConstraintViolationException, 324 RepositoryException 325 { 326 throw new UnsupportedOperationException (getClass().getName()); 327 } 328 329 335 public Property setProperty(String name, Node value) 336 throws ValueFormatException, 337 VersionException, 338 LockException, 339 ConstraintViolationException, 340 RepositoryException 341 { 342 throw new UnsupportedOperationException (getClass().getName()); 343 } 344 345 350 public Node getNode(String relPath) 351 throws PathNotFoundException, 352 RepositoryException 353 { 354 String []segments = relPath.split("/"); 355 356 Node node = this; 357 for (int i = 0; i < segments.length; i++) { 358 String subPath = segments[i]; 359 360 if (subPath.length() == 0) 361 continue; 362 363 Node nextNode = null; 364 365 NodeIterator iter = node.getNodes(); 366 while (iter.hasNext()) { 367 Node subNode = iter.nextNode(); 368 369 if (subPath.equals(subNode.getName())) { 370 nextNode = subNode; 371 break; 372 } 373 } 374 375 if (nextNode == null) { 376 throw new PathNotFoundException(L.l("'{0}' is an unknown node in {1}", 377 relPath, this)); 378 } 379 380 node = nextNode; 381 } 382 383 return node; 384 } 385 386 389 public NodeIterator getNodes() 390 throws RepositoryException 391 { 392 throw new UnsupportedOperationException (getClass().getName()); 393 } 394 395 398 public NodeIterator getNodes(String namePattern) 399 throws RepositoryException 400 { 401 throw new UnsupportedOperationException (getClass().getName()); 402 } 403 404 407 public Property getProperty(String relPath) 408 throws PathNotFoundException, 409 RepositoryException 410 { 411 int p = relPath.lastIndexOf('/'); 412 413 if (p >= 0) { 414 String nodePath = relPath.substring(0, p); 415 String tailPath = relPath.substring(p + 1); 416 417 return getNode(nodePath).getProperty(tailPath); 418 } 419 420 throw new PathNotFoundException(L.l("'{0}' is an unknown property in {1}'", 421 relPath, this)); 422 } 423 424 427 public PropertyIterator getProperties() 428 throws RepositoryException 429 { 430 throw new UnsupportedOperationException (getClass().getName()); 431 } 432 433 437 public PropertyIterator getProperties(String namePattern) 438 throws RepositoryException 439 { 440 throw new UnsupportedOperationException (getClass().getName()); 441 } 442 443 446 public Item getPrimaryItem() 447 throws ItemNotFoundException, 448 RepositoryException 449 { 450 throw new UnsupportedOperationException (getClass().getName()); 451 } 452 453 456 public String getUUID() 457 throws UnsupportedRepositoryOperationException, 458 RepositoryException 459 { 460 throw new UnsupportedOperationException (getClass().getName()); 461 } 462 463 466 public int getIndex() 467 throws RepositoryException 468 { 469 return 0; 470 } 471 472 475 public PropertyIterator getReferences() 476 throws RepositoryException 477 { 478 throw new UnsupportedOperationException (getClass().getName()); 479 } 480 481 486 public boolean hasNode(String relPath) 487 throws RepositoryException 488 { 489 try { 490 return getNode(relPath) != null; 491 } catch (PathNotFoundException e) { 492 return false; 493 } 494 } 495 496 501 public boolean hasProperty(String relPath) 502 throws RepositoryException 503 { 504 try { 505 return getProperty(relPath) != null; 506 } catch (PathNotFoundException e) { 507 return false; 508 } 509 } 510 511 514 public boolean hasNodes() 515 throws RepositoryException 516 { 517 return false; 518 } 519 520 523 public boolean hasProperties() 524 throws RepositoryException 525 { 526 return false; 527 } 528 529 532 public NodeType getPrimaryNodeType() 533 throws RepositoryException 534 { 535 return BaseNodeType.NT_BASE; 536 } 537 538 541 public NodeType[] getMixinNodeTypes() 542 throws RepositoryException 543 { 544 return new NodeType[0]; 545 } 546 547 550 public boolean isNodeType(String nodeTypeName) 551 throws RepositoryException 552 { 553 NodeType nodeType = getPrimaryNodeType(); 554 555 if (nodeType.getName().equals(nodeTypeName)) 556 return true; 557 558 NodeType []superTypes = nodeType.getSupertypes(); 559 560 for (int i = superTypes.length - 1; i >= 0; i--) { 561 if (superTypes[i].getName().equals(nodeTypeName)) 562 return true; 563 } 564 565 return false; 566 } 567 568 571 public void addMixin(String mixinName) 572 throws NoSuchNodeTypeException, 573 VersionException, 574 ConstraintViolationException, 575 LockException, 576 RepositoryException 577 { 578 throw new UnsupportedOperationException (getClass().getName()); 579 } 580 581 584 public void removeMixin(String mixinName) 585 throws NoSuchNodeTypeException, 586 VersionException, 587 ConstraintViolationException, 588 LockException, 589 RepositoryException 590 { 591 throw new UnsupportedOperationException (getClass().getName()); 592 } 593 594 597 public boolean canAddMixin(String mixinName) 598 throws NoSuchNodeTypeException, 599 RepositoryException 600 { 601 return false; 602 } 603 604 607 public NodeDefinition getDefinition() 608 throws RepositoryException 609 { 610 throw new UnsupportedOperationException (getClass().getName()); 611 } 612 613 616 public Version checkin() 617 throws VersionException, 618 UnsupportedRepositoryOperationException, 619 InvalidItemStateException, 620 LockException, 621 RepositoryException 622 { 623 throw new UnsupportedOperationException (getClass().getName()); 624 } 625 626 629 public void checkout() 630 throws UnsupportedRepositoryOperationException, 631 LockException, 632 RepositoryException 633 { 634 throw new UnsupportedOperationException (getClass().getName()); 635 } 636 637 640 public void doneMerge(Version version) 641 throws VersionException, 642 InvalidItemStateException, 643 UnsupportedRepositoryOperationException, 644 RepositoryException 645 { 646 throw new UnsupportedOperationException (getClass().getName()); 647 } 648 649 652 public void cancelMerge(Version version) 653 throws VersionException, 654 InvalidItemStateException, 655 UnsupportedRepositoryOperationException, 656 RepositoryException 657 { 658 throw new UnsupportedOperationException (getClass().getName()); 659 } 660 661 664 public void update(String srcWorkspaceName) 665 throws NoSuchWorkspaceException, 666 AccessDeniedException, 667 LockException, 668 InvalidItemStateException, 669 RepositoryException 670 { 671 throw new UnsupportedOperationException (getClass().getName()); 672 } 673 674 677 public NodeIterator merge(String srcWorkspace, boolean bestEffort) 678 throws NoSuchWorkspaceException, 679 AccessDeniedException, 680 MergeException, 681 LockException, 682 InvalidItemStateException, 683 RepositoryException 684 { 685 throw new UnsupportedOperationException (getClass().getName()); 686 } 687 688 691 public String getCorrespondingNodePath(String workspaceName) 692 throws ItemNotFoundException, 693 NoSuchWorkspaceException, 694 AccessDeniedException, 695 RepositoryException 696 { 697 throw new UnsupportedOperationException (getClass().getName()); 698 } 699 700 703 public boolean isCheckedOut() 704 throws RepositoryException 705 { 706 throw new UnsupportedOperationException (getClass().getName()); 707 } 708 709 712 public void restore(String versionName, boolean removeExisting) 713 throws VersionException, 714 ItemExistsException, 715 UnsupportedRepositoryOperationException, 716 LockException, 717 InvalidItemStateException, 718 RepositoryException 719 { 720 throw new UnsupportedOperationException (getClass().getName()); 721 } 722 723 726 public void restore(Version version, boolean removeExisting) 727 throws VersionException, 728 ItemExistsException, 729 UnsupportedRepositoryOperationException, 730 LockException, 731 RepositoryException 732 { 733 throw new UnsupportedOperationException (getClass().getName()); 734 } 735 736 739 public void restore(Version version, 740 String relPath, 741 boolean removeExisting) 742 throws PathNotFoundException, 743 ItemExistsException, 744 VersionException, 745 ConstraintViolationException, 746 UnsupportedRepositoryOperationException, 747 LockException, 748 InvalidItemStateException, 749 RepositoryException 750 { 751 throw new UnsupportedOperationException (getClass().getName()); 752 } 753 754 757 public void restoreByLabel(String versionLabel, 758 boolean removeExisting) 759 throws VersionException, 760 ItemExistsException, 761 UnsupportedRepositoryOperationException, 762 LockException, 763 InvalidItemStateException, 764 RepositoryException 765 { 766 throw new UnsupportedOperationException (getClass().getName()); 767 } 768 769 772 public VersionHistory getVersionHistory() 773 throws UnsupportedRepositoryOperationException, 774 RepositoryException 775 { 776 throw new UnsupportedOperationException (getClass().getName()); 777 } 778 779 782 public Version getBaseVersion() 783 throws UnsupportedRepositoryOperationException, 784 RepositoryException 785 { 786 throw new UnsupportedOperationException (getClass().getName()); 787 } 788 789 792 public Lock lock(boolean isDeep, boolean isSessionScoped) 793 throws UnsupportedRepositoryOperationException, 794 LockException, 795 AccessDeniedException, 796 InvalidItemStateException, 797 RepositoryException 798 { 799 throw new UnsupportedOperationException (getClass().getName()); 800 } 801 802 805 public Lock getLock() 806 throws UnsupportedRepositoryOperationException, 807 LockException, 808 AccessDeniedException, 809 RepositoryException 810 { 811 throw new UnsupportedOperationException (getClass().getName()); 812 } 813 814 817 public void unlock() 818 throws UnsupportedRepositoryOperationException, 819 LockException, 820 AccessDeniedException, 821 InvalidItemStateException, 822 RepositoryException 823 { 824 throw new UnsupportedOperationException (getClass().getName()); 825 } 826 827 830 public boolean holdsLock() 831 throws RepositoryException 832 { 833 return false; 834 } 835 836 839 public boolean isLocked() 840 throws RepositoryException 841 { 842 return false; 843 } 844 } 845 | Popular Tags |