001 /*
002 * JBoss DNA (http://www.jboss.org/dna)
003 * See the COPYRIGHT.txt file distributed with this work for information
004 * regarding copyright ownership. Some portions may be licensed
005 * to Red Hat, Inc. under one or more contributor license agreements.
006 * See the AUTHORS.txt file in the distribution for a full listing of
007 * individual contributors.
008 *
009 * Unless otherwise indicated, all code in JBoss DNA is licensed
010 * to you under the terms of the GNU Lesser General Public License as
011 * published by the Free Software Foundation; either version 2.1 of
012 * the License, or (at your option) any later version.
013 *
014 * JBoss DNA is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017 * Lesser General Public License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this software; if not, write to the Free
021 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
023 */
024 package org.jboss.dna.jcr.cache;
025
026 import java.util.List;
027 import java.util.Set;
028 import java.util.UUID;
029 import org.jboss.dna.graph.Location;
030 import org.jboss.dna.graph.property.Name;
031 import org.jboss.dna.jcr.NodeDefinitionId;
032
033 /**
034 * A representation of a node. This is the information that is kept in the cache.
035 */
036 public interface NodeInfo {
037
038 /**
039 * @return location
040 */
041 public Location getOriginalLocation();
042
043 /**
044 * @return uuid
045 */
046 public UUID getUuid();
047
048 /**
049 * @return parent
050 */
051 public UUID getParent();
052
053 /**
054 * @return primaryTypeName
055 */
056 public Name getPrimaryTypeName();
057
058 /**
059 * Get the names of the mixin types for this node.
060 *
061 * @return the unmodifiable list of mixin type names; never null but possibly empty
062 */
063 public List<Name> getMixinTypeNames();
064
065 /**
066 * @return definition
067 */
068 public NodeDefinitionId getDefinitionId();
069
070 /**
071 * Get the children for this node. Generally, clients should not hold onto the returned object but instead should simply use
072 * it and discard the reference. This is because implementations are not required to return the same instance with each call
073 * (although immutable implementations are expected to always return the same instance).
074 *
075 * @return the immutable children; never null but possibly empty
076 */
077 public Children getChildren();
078
079 /**
080 * Return true of this node has at least one property.
081 *
082 * @return true if there is at least one property, or false if there are none
083 */
084 public boolean hasProperties();
085
086 /**
087 * Return the number of properties on this node.
088 *
089 * @return the number of properties; never negative
090 */
091 public int getPropertyCount();
092
093 /**
094 * Get the names of the properties that are owned by this node.
095 *
096 * @return the unmodifiable set of property names
097 */
098 public Set<Name> getPropertyNames();
099
100 /**
101 * Get this node's property that has the supplied name.
102 *
103 * @param name the property name; may not be null
104 * @return the property information, or null if this node has no property with the supplied name
105 */
106 public PropertyInfo getProperty( Name name );
107
108 /**
109 * Indicates whether the node represented by this {@link NodeInfo} is new (i.e., does not yet exist in the persistent
110 * repository).
111 *
112 * @return {@code true} if the node represented by this {@link NodeInfo} has not yet been saved to the persistent repository.
113 * @see javax.jcr.Item#isNew()
114 */
115 public boolean isNew();
116
117 /**
118 * Indicates whether the node represented by this {@link NodeInfo} is modified (i.e., exists in the persistent repository with
119 * different child items).
120 *
121 * @return {@code true} if the immediate child items of the node represented by this {@link NodeInfo} have been modified since
122 * the last time the node was saved to the persistent repository
123 * @see javax.jcr.Item#isModified()
124 */
125 public boolean isModified();
126 }