KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > jcr > base > BaseItem


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.jcr.base;
31
32 import javax.jcr.*;
33 import javax.jcr.lock.LockException;
34 import javax.jcr.nodetype.ConstraintViolationException;
35 import javax.jcr.nodetype.NoSuchNodeTypeException;
36 import javax.jcr.version.VersionException;
37
38 /**
39  * Represents a Node or Property in the repository.
40  */

41 public class BaseItem implements Item {
42   protected BaseItem()
43   {
44   }
45   
46   /**
47    * Returns the full absolute pathname of the item.
48    */

49   public String JavaDoc getPath()
50     throws RepositoryException
51   {
52     throw new UnsupportedOperationException JavaDoc(getClass().getName());
53   }
54   
55   /**
56    * Returns the tail name of the item.
57    */

58   public String JavaDoc getName()
59     throws RepositoryException
60   {
61     throw new UnsupportedOperationException JavaDoc(getClass().getName());
62   }
63
64   /**
65    * Returns the ancestor given by the depth.
66    */

67   public Item getAncestor(int depth)
68     throws ItemNotFoundException,
69        AccessDeniedException,
70        RepositoryException
71   {
72     Item item = this;
73     
74     for (; depth > 0; depth--) {
75       item = item.getParent();
76     }
77
78     return item;
79   }
80
81   /**
82    * Returns the parent node.
83    */

84   public Node getParent()
85     throws ItemNotFoundException,
86        AccessDeniedException,
87        RepositoryException
88   {
89     throw new UnsupportedOperationException JavaDoc(getClass().getName());
90   }
91
92   /**
93    * Returns the current depth of the item.
94    */

95   public int getDepth()
96     throws RepositoryException
97   {
98     throw new UnsupportedOperationException JavaDoc(getClass().getName());
99   }
100
101   /**
102    * Returns the owning session.
103    */

104   public Session getSession()
105     throws RepositoryException
106   {
107     throw new UnsupportedOperationException JavaDoc(getClass().getName());
108   }
109
110   /**
111    * Returns true for a node (directory).
112    */

113   public boolean isNode()
114   {
115     return false;
116   }
117
118   /**
119    * Returns true if the item is newly added to the repository.
120    */

121   public boolean isNew()
122   {
123     return false;
124   }
125   
126   /**
127    * Returns true if the item has been modified.
128    */

129   public boolean isModified()
130   {
131     return false;
132   }
133   
134   /**
135    * Returns true if the item is identical to another item.
136    */

137   public boolean isSame(Item otherItem)
138     throws RepositoryException
139   {
140     return this == otherItem;
141   }
142
143   /**
144    * Visits the node.
145    */

146   public void accept(ItemVisitor visitor)
147     throws RepositoryException
148   {
149     throw new UnsupportedOperationException JavaDoc(getClass().getName());
150   }
151
152   /**
153    * Saves changes to the item.
154    */

155   public void save()
156     throws AccessDeniedException,
157        ItemExistsException,
158        ConstraintViolationException,
159        InvalidItemStateException,
160        ReferentialIntegrityException,
161        VersionException,
162        LockException,
163        NoSuchNodeTypeException,
164        RepositoryException
165   {
166     throw new UnsupportedOperationException JavaDoc(getClass().getName());
167   }
168
169   /**
170    * Refreshes data from the backing store.
171    *
172    * @param keepChanges if true, changes are merged from the repository
173    */

174   public void refresh(boolean keepChanges)
175     throws InvalidItemStateException,
176        RepositoryException
177   {
178     throw new UnsupportedOperationException JavaDoc(getClass().getName());
179   }
180
181   /**
182    * Removes the item from the store.
183    */

184   public void remove()
185     throws VersionException,
186        LockException,
187        ConstraintViolationException,
188        RepositoryException
189   {
190     throw new UnsupportedOperationException JavaDoc(getClass().getName());
191   }
192 }
193
Popular Tags