Added: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java (added) +++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,132 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. The ASF licenses this file to You +* under the Apache License, Version 2.0 (the "License"); you may not +* use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.jackrabbit.jcr2spi.xml; + +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import org.xml.sax.Locator; +import org.xml.sax.Attributes; +import org.apache.jackrabbit.util.Text; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; + +import javax.jcr.Workspace; +import javax.jcr.RepositoryException; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.TransformerConfigurationException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.FileInputStream; + +/** + * WorkspaceContentHandler... + */ +public class WorkspaceContentHandler implements ContentHandler { + + private static Logger log = LoggerFactory.getLogger(WorkspaceContentHandler.class); + + private final String parentAbsPath; + private final int uuidBehavior; + private final Workspace workspace; + + private final File tmpFile; + private final ContentHandler delegatee; + + public WorkspaceContentHandler(Workspace workspace, String parentAbsPath, int uuidBehavior) throws RepositoryException { + this.workspace = workspace; + this.parentAbsPath = parentAbsPath; + this.uuidBehavior = uuidBehavior; + + try { + String tmpName = Text.md5(parentAbsPath); + this.tmpFile = File.createTempFile("___" + tmpName, ".xml"); + + SAXTransformerFactory stf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + TransformerHandler th = stf.newTransformerHandler(); + th.setResult(new StreamResult(new FileOutputStream(tmpFile))); + th.getTransformer().setParameter(OutputKeys.METHOD, "xml"); + th.getTransformer().setParameter(OutputKeys.ENCODING, "UTF-8"); + th.getTransformer().setParameter(OutputKeys.INDENT, "no"); + this.delegatee = th; + + } catch (FileNotFoundException e) { + throw new RepositoryException(e); + } catch (IOException e) { + throw new RepositoryException(e); + } catch (TransformerConfigurationException e) { + throw new RepositoryException(e); + } + } + + public void endDocument() throws SAXException { + delegatee.endDocument(); + + try { + workspace.importXML(parentAbsPath, new FileInputStream(tmpFile), uuidBehavior); + } catch (IOException e) { + throw new SAXException(e); + } catch (RepositoryException e) { + throw new SAXException(e); + } finally { + tmpFile.delete(); + } + } + + public void startDocument() throws SAXException { + delegatee.startDocument(); + } + + public void characters(char ch[], int start, int length) throws SAXException { + delegatee.characters(ch, start, length); + } + + public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { + delegatee.ignorableWhitespace(ch, start, length); + } + + public void endPrefixMapping(String prefix) throws SAXException { + delegatee.endPrefixMapping(prefix); + } + + public void skippedEntity(String name) throws SAXException { + delegatee.skippedEntity(name); + } + + public void setDocumentLocator(Locator locator) { + delegatee.setDocumentLocator(locator); + } + + public void processingInstruction(String target, String data) throws SAXException { + delegatee.processingInstruction(target, data); + } + + public void startPrefixMapping(String prefix, String uri) throws SAXException { + delegatee.startPrefixMapping(prefix, uri); + } + + public void endElement(String namespaceURI, String localName, String qName) throws SAXException { + delegatee.endElement(namespaceURI, localName, qName); + } + + public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { + delegatee.startElement(namespaceURI, localName, qName, atts); + } +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/maven.xml URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/maven.xml?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/maven.xml (added) +++ jackrabbit/trunk/contrib/spi/maven.xml Wed Jul 12 06:33:19 2006 @@ -0,0 +1,25 @@ + + + + + + + + + + Propchange: jackrabbit/trunk/contrib/spi/maven.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/project.properties URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/project.properties?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/project.properties (added) +++ jackrabbit/trunk/contrib/spi/project.properties Wed Jul 12 06:33:19 2006 @@ -0,0 +1,12 @@ +maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.1-pfd/ +maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/ + +#------------------------------------------------------- +jackrabbit.build.version.jackrabbit=1.0-SNAPSHOT +jackrabbit.build.version.jcr=1.0 +jackrabbit.build.version.spi=0.1-dev + + +# compile options +maven.compile.source=1.4 +maven.compile.target=1.4 Propchange: jackrabbit/trunk/contrib/spi/project.properties ------------------------------------------------------------------------------ svn = Propchange: jackrabbit/trunk/contrib/spi/project.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/project.xml URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/project.xml?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/project.xml (added) +++ jackrabbit/trunk/contrib/spi/project.xml Wed Jul 12 06:33:19 2006 @@ -0,0 +1,24 @@ + + + + + + + 3 + org.apache.jackrabbit + SPI Contribution + 0.1-dev + 2006 + + + Propchange: jackrabbit/trunk/contrib/spi/project.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/spi/maven.xml URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/maven.xml?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/maven.xml (added) +++ jackrabbit/trunk/contrib/spi/spi/maven.xml Wed Jul 12 06:33:19 2006 @@ -0,0 +1,27 @@ + + + + + + + + Propchange: jackrabbit/trunk/contrib/spi/spi/maven.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/spi/project.properties URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/project.properties?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/project.properties (added) +++ jackrabbit/trunk/contrib/spi/spi/project.properties Wed Jul 12 06:33:19 2006 @@ -0,0 +1,2 @@ +maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.1-pfd/ +maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/ Propchange: jackrabbit/trunk/contrib/spi/spi/project.properties ------------------------------------------------------------------------------ svn = Propchange: jackrabbit/trunk/contrib/spi/spi/project.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/spi/project.xml URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/project.xml?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/project.xml (added) +++ jackrabbit/trunk/contrib/spi/spi/project.xml Wed Jul 12 06:33:19 2006 @@ -0,0 +1,64 @@ + + + + + + + ${basedir}/../project.xml + jackrabbit-spi + Service Provider Interface (SPI) + org.apache.jackrabbit.spi.* + + + + + + + + org.apache.jackrabbit + jackrabbit-jcr-commons + ${jackrabbit.build.version.jackrabbit} + + + + jsr170 + jcr + ${jackrabbit.build.version.jcr} + http://jcp.org/en/jsr/detail?id=170 + + + + + + + + ${basedir}/src/main/java + + + src/main/java + + **/*.xml + **/*.xsd + **/*.properties + **/*.dtd + + + + + + Propchange: jackrabbit/trunk/contrib/spi/spi/project.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,282 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +import javax.jcr.ItemExistsException; +import javax.jcr.PathNotFoundException; +import javax.jcr.AccessDeniedException; +import javax.jcr.UnsupportedRepositoryOperationException; +import javax.jcr.RepositoryException; +import javax.jcr.ValueFormatException; +import javax.jcr.lock.LockException; +import javax.jcr.nodetype.ConstraintViolationException; +import javax.jcr.version.VersionException; +import java.io.InputStream; + +/** + * Batch... + */ +public interface Batch { + + /** + * @param parentId + * @param nodeName Name of the node to be created + * @param nodetypeName + * @param uuid UUID of the node to be created or null. If due + * to an import the uuid of the resulting node is already defined, it must + * be passed as separate uuid parameter, indicating a binding value for + * the server. Otherwise the uuid must be null. + * @throws javax.jcr.ItemExistsException + * @throws javax.jcr.PathNotFoundException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.nodetype.NoSuchNodeTypeException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Node#addNode(String) + * @see javax.jcr.Node#addNode(String, String) + * @see javax.jcr.Session#importXML(String, java.io.InputStream, int) + * @see javax.jcr.query.Query#storeAsNode(String) + */ + public void addNode(NodeId parentId, QName nodeName, QName nodetypeName, String uuid) throws RepositoryException; + + /** + * + * @param parentId + * @param propertyName Name of the property to be created + * @param value + * @param propertyType + * @throws ValueFormatException + * @throws VersionException + * @throws LockException + * @throws ConstraintViolationException + * @throws PathNotFoundException + * @throws ItemExistsException + * @throws AccessDeniedException + * @throws UnsupportedRepositoryOperationException + * @throws RepositoryException + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value) + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value, int) + * @see javax.jcr.Node#setProperty(String, String) + * @see javax.jcr.Node#setProperty(String, String, int) + * @see javax.jcr.Node#setProperty(String, java.util.Calendar) + * @see javax.jcr.Node#setProperty(String, boolean) + * @see javax.jcr.Node#setProperty(String, double) + * @see javax.jcr.Node#setProperty(String, long) + * @see javax.jcr.Node#setProperty(String, javax.jcr.Node) + * @see javax.jcr.Session#importXML(String, java.io.InputStream, int) + * @see javax.jcr.query.Query#storeAsNode(String) + */ + public void addProperty(NodeId parentId, QName propertyName, String value, int propertyType) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException, ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException; + + /** + * @param parentId + * @param propertyName Name of the property to be created + * @param values + * @param propertyType the property type + * @throws javax.jcr.ValueFormatException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.PathNotFoundException + * @throws javax.jcr.ItemExistsException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value[]) + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value[], int) + * @see javax.jcr.Node#setProperty(String, String[]) + * @see javax.jcr.Node#setProperty(String, String[], int) + * @see javax.jcr.Session#importXML(String, java.io.InputStream, int) + */ + public void addProperty(NodeId parentId, QName propertyName, String[] values, int propertyType) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException, ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException; + + /** + * + * @param parentId + * @param propertyName Name of the property to be created + * @param value + * @param propertyType + * @throws ValueFormatException + * @throws VersionException + * @throws LockException + * @throws ConstraintViolationException + * @throws PathNotFoundException + * @throws ItemExistsException + * @throws AccessDeniedException + * @throws UnsupportedRepositoryOperationException + * @throws RepositoryException + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value, int) + * @see javax.jcr.Node#setProperty(String, String, int) + * @see javax.jcr.Node#setProperty(String, java.io.InputStream) + * @see javax.jcr.Session#importXML(String, java.io.InputStream, int) + */ + public void addProperty(NodeId parentId, QName propertyName, InputStream value, int propertyType) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException, ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException; + + /** + * @param parentId + * @param propertyName Name of the property to be created + * @param values + * @param propertyType the property type + * @throws javax.jcr.ValueFormatException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.PathNotFoundException + * @throws javax.jcr.ItemExistsException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value[]) + * @see javax.jcr.Node#setProperty(String, javax.jcr.Value[], int) + * @see javax.jcr.Node#setProperty(String, String[]) + * @see javax.jcr.Node#setProperty(String, String[], int) + * @see javax.jcr.Session#importXML(String, java.io.InputStream, int) + */ + public void addProperty(NodeId parentId, QName propertyName, InputStream[] values, int propertyType) throws RepositoryException; + + /** + * + * @param propertyId + * @param value + * @param propertyType + * @throws ValueFormatException + * @throws VersionException + * @throws LockException + * @throws ConstraintViolationException + * @throws AccessDeniedException + * @throws UnsupportedRepositoryOperationException + * @throws RepositoryException + * @see javax.jcr.Property#setValue(javax.jcr.Value) + * @see javax.jcr.Property#setValue(String) + * @see javax.jcr.Property#setValue(long) + * @see javax.jcr.Property#setValue(double) + * @see javax.jcr.Property#setValue(java.util.Calendar) + * @see javax.jcr.Property#setValue(boolean) + * @see javax.jcr.Property#setValue(javax.jcr.Node) + */ + public void setValue(PropertyId propertyId, String value, int propertyType) throws RepositoryException; + + /** + * @param propertyId + * @param values + * @param propertyType the type of the property + * @throws javax.jcr.ValueFormatException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Property#setValue(javax.jcr.Value[]) + * @see javax.jcr.Property#setValue(String[]) + */ + public void setValue(PropertyId propertyId, String[] values, int propertyType) throws RepositoryException; + + /** + * + * @param propertyId + * @param value + * @param propertyType + * @throws ValueFormatException + * @throws VersionException + * @throws LockException + * @throws ConstraintViolationException + * @throws AccessDeniedException + * @throws UnsupportedRepositoryOperationException + * @throws RepositoryException + * @see javax.jcr.Property#setValue(javax.jcr.Value) + * @see javax.jcr.Property#setValue(java.io.InputStream) + */ + public void setValue(PropertyId propertyId, InputStream value, int propertyType) throws RepositoryException; + + /** + * @param propertyId + * @param values + * @param propertyType the type of the property + * @throws javax.jcr.ValueFormatException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Property#setValue(javax.jcr.Value[]) + */ + public void setValue(PropertyId propertyId, InputStream[] values, int propertyType) throws RepositoryException; + + /** + * @param itemId + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Item#remove() + */ + public void remove(ItemId itemId) throws RepositoryException; + + /** + * @param parentId + * @param srcNodeId + * @param beforeNodeId + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.ItemNotFoundException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Node#orderBefore(String, String) + */ + public void reorderNodes(NodeId srcNodeId, NodeId parentId, NodeId beforeNodeId) throws RepositoryException; + + /** + * @param nodeId + * @param mixinNodeTypeIds + * @throws javax.jcr.nodetype.NoSuchNodeTypeException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Node#addMixin(String) + */ + public void setMixins(NodeId nodeId, QName[] mixinNodeTypeIds) throws RepositoryException; + + /** + * @param srcNodeId + * @param destParentNodeId + * @param destName + * @throws javax.jcr.ItemExistsException + * @throws javax.jcr.PathNotFoundException + * @throws javax.jcr.version.VersionException + * @throws javax.jcr.nodetype.ConstraintViolationException + * @throws javax.jcr.lock.LockException + * @throws javax.jcr.AccessDeniedException + * @throws javax.jcr.UnsupportedRepositoryOperationException + * @throws javax.jcr.RepositoryException + * @see javax.jcr.Session#move(String, String) + */ + public void move(NodeId srcNodeId, NodeId destParentNodeId, QName destName) throws RepositoryException; +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; +import org.apache.jackrabbit.name.Path; + +/** + * Event is similar to the regular JCR Event and adds additional + * information about the affected item. + */ +public interface Event { + + /** + * An event of this type is generated when a node is added. + */ + public static final int NODE_ADDED = javax.jcr.observation.Event.NODE_ADDED; + + /** + * An event of this type is generated when a node is removed. + */ + public static final int NODE_REMOVED = javax.jcr.observation.Event.NODE_REMOVED; + + /** + * An event of this type is generated when a property is added. + */ + public static final int PROPERTY_ADDED = javax.jcr.observation.Event.PROPERTY_ADDED; + + /** + * An event of this type is generated when a property is removed. + */ + public static final int PROPERTY_REMOVED = javax.jcr.observation.Event.PROPERTY_REMOVED; + + /** + * An event of this type is generated when a property is changed. + */ + public static final int PROPERTY_CHANGED = javax.jcr.observation.Event.PROPERTY_CHANGED; + + /** + * Returns the type of this event: a constant defined by this interface. + * One of: + * + * + * @return the type of this event. + */ + public int getType(); + + /** + * @return the path of the affected item. E.g. the added/removed node or the + * property that was added/removed/changed. + */ + public Path getQPath(); + + /** + * @return the id of the affected item. + */ + public ItemId getItemId(); + + /** + * @return the id of the parent node of the affected item. + */ + public NodeId getParentId(); + + /** + * @return the uuid of the 'associated' node of this event or null + * if the node is not referenceable. + * @see javax.jcr.observation.ObservationManager#addEventListener + */ + public String getUUID(); + + /** + * @return the name of the primary node type of the 'associated' node of + * this event. + * @see javax.jcr.observation.ObservationManager#addEventListener + */ + public QName getPrimaryNodeTypeName(); + + /** + * @return the names of the mixin types of the 'associated' node of this + * event. + * @see javax.jcr.observation.ObservationManager#addEventListener + */ + public QName[] getMixinTypeNames(); + + /** + * Returns the user ID connected with this event. This is the string + * returned by getUserID of the session that caused the event. + * + * @return a String. + */ + public String getUserID(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import javax.jcr.RangeIterator; + +/** + * EventIterator + */ +public interface EventIterator extends RangeIterator { + + /** + * Returns the next Event in the iteration. + * + * @return the next Event in the iteration. + * @throws java.util.NoSuchElementException if iteration has no more Events. + */ + public Event nextEvent(); + +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventIterator.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +/** + * An event listener. + *

+ * An EventListener can be registered via the + * {@link org.apache.jackrabbit.spi.RepositoryService} object. Event listeners + * are notified asynchronously, and see events after they occur and the transaction + * is committed. An event listener only sees events for which the session that + * registered it has sufficient access rights. + */ +public interface EventListener { + + /** + * Gets called when an event occurs. + * + * @param events The event set recieved. + */ + public void onEvent(EventIterator events); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/EventListener.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; +import org.apache.jackrabbit.name.Path; + +/** + * IdFactory... + */ +public interface IdFactory { + + public PropertyId createPropertyId(NodeId parentId, QName propertyName); + + public NodeId createNodeId(NodeId parentId, Path relativePath); + + public NodeId createNodeId(String uuid, Path relativePath); + + public NodeId createNodeId(String uuid); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import javax.jcr.RangeIterator; + +/** + * IdIterator... + */ +public interface IdIterator extends RangeIterator { + /** + * Returns the next item id in the iteration. + * + * @return the next item id in the iteration. + * @throws java.util.NoSuchElementException if no more ids are left. + */ + public ItemId nextId(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdIterator.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.Path; + +/** + * ItemId... + */ +public interface ItemId { + + public boolean denotesNode(); + + public String getUUID(); + + public Path getRelativePath(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +/** + * ItemInfo... + */ +public interface ItemInfo { + + /** + * @return the id of the parent item info + */ + public NodeId getParentId(); + + /** + * @return Return the qualified representation of the item name + */ + public QName getQName(); + + /** + * @return Return true if this ItemInfo denotes a node, false otherwise + */ + public boolean denotesNode(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +/** + * LockInfo... + */ +public interface LockInfo { + + /** + * Id of the node this LockInfo was requested for. Note, that + * the id does not represent the id of the lock-holding node. + * + * @return + */ + // TODO: review if this is needed + public NodeId getNodeId(); + + public String getLockToken(); + + public String getOwner(); + + public boolean isDeep(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/LockInfo.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +/** + * NodeId... + */ +public interface NodeId extends ItemId { + +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeId.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +/** + * NodeInfo... + */ +public interface NodeInfo extends ItemInfo { + + /** + * @return identifier for the item that is based on this info object. the id + * can either be an absolute path or a uuid (+ relative path). + * @see RepositoryService#getNodeInfo(SessionInfo, NodeId) + */ + public NodeId getId(); + + /** + * @return QName representing the name of the primary nodetype + */ + public QName getNodetype(); + + /** + * @return array of QName representing the names of mixin nodetypes. + */ + public QName[] getMixins(); + + /** + * @return ids of the properties that are referencing the node based on this + * info object or an empty array if the node is not referenceable or no references + * exist. + * @see PropertyInfo#getId() + */ + public PropertyId[] getReferences(); + + /** + * @return ids of children nodes + * @see NodeInfo#getId() + */ + public IdIterator getNodeIds(); + + /** + * @return ids of children properties + * @see PropertyInfo#getId() + */ + public IdIterator getPropertyIds(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +/** + * PropertyId... + */ +public interface PropertyId extends ItemId { + + public NodeId getParentId(); + + public QName getQName(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyId.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import java.io.InputStream; + +/** + * PropertyInfo... + */ +public interface PropertyInfo extends ItemInfo { + + /** + * @return identifier for the item that is based on this info object. the id + * can either be an absolute path or a uuid (+ relative path). + * @see RepositoryService#getNodeInfo(SessionInfo, NodeId) + */ + public PropertyId getId(); + + /** + * @return + * @see javax.jcr.PropertyType + */ + public int getType(); + + /** + * @return true if the Property based on this info object is + * multivalue. + * @see javax.jcr.nodetype.PropertyDefinition#isMultiple() + */ + public boolean isMultiValued(); + + /** + * @return String representation of the property value(s) + */ + public String[] getValues(); + + /** + * @return InputStream representation of the property value(s) + */ + public InputStream[] getValuesAsStream(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +import javax.jcr.nodetype.ItemDefinition; + +/** + * QItemDefinition is the qualified SPI representation of + * an {@link ItemDefinition item definition}. It refers to QNames + * only and is thus isolated from session-specific namespace mappings. + * + * @see javax.jcr.nodetype.ItemDefinition + */ +public interface QItemDefinition { + + public static final QItemDefinition[] EMPTY_ARRAY = new QItemDefinition[0]; + + /** + * Gets the name of the child item. + * + * @return the name of the child item. + */ + QName getQName(); + + /** + * Gets the name of the declaring node type. + * + * @return the name of the declaring node type. + */ + QName getDeclaringNodeType(); + + /** + * Determines whether the item is 'autoCreated'. + * + * @return the 'autoCreated' flag. + */ + boolean isAutoCreated(); + + /** + * Gets the 'onParentVersion' attribute of the item. + * + * @return the 'onParentVersion' attribute. + */ + int getOnParentVersion(); + + /** + * Determines whether the item is 'protected'. + * + * @return the 'protected' flag. + */ + boolean isProtected(); + + /** + * Determines whether the item is 'mandatory'. + * + * @return the 'mandatory' flag. + */ + boolean isMandatory(); + + /** + * Determines whether this item definition defines a residual set of + * child items. + * + * @return true if this definition defines a residual set; + * false otherwise. + */ + boolean definesResidual(); + + /** + * Determines whether this item definition defines a node. + * + * @return true if this is a node definition; + * false otherwise (i.e. it is a property definition). + */ + boolean definesNode(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QItemDefinition.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +import javax.jcr.nodetype.NodeDefinition; + +/** + * QNodeDefinition is the qualified SPI representation of + * a {@link NodeDefinition node definition}. It refers to QNames only + * and is thus isolated from session-specific namespace mappings. + * + * @see javax.jcr.nodetype.NodeDefinition + */ +public interface QNodeDefinition extends QItemDefinition { + + public static final QNodeDefinition[] EMPTY_ARRAY = new QNodeDefinition[0]; + + /** + * Returns the name of the default primary type. + * + * @return the name of the default primary type. + */ + QName getDefaultPrimaryType(); + + /** + * Returns the array of names of the required primary types. + * + * @return the array of names of the required primary types. + */ + QName[] getRequiredPrimaryTypes(); + + /** + * Reports whether this node can have same-name siblings. + * + * @return the 'allowsSameNameSiblings' flag. + */ + boolean allowsSameNameSiblings(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeDefinition.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +import java.util.Collection; + +/** + * QNodeTypeDefinition... + */ +public interface QNodeTypeDefinition { + + /** + * Returns the name of the node type being defined or + * null if not set. + * + * @return the name of the node type or null if not set. + */ + QName getQName(); + + /** + * Returns an array containing the names of the supertypes or + * null if not set. + * + * @return an array listing the names of the supertypes or + * null if not set. + */ + QName[] getSupertypes(); + + /** + * Returns the value of the mixin flag. + * + * @return true if this is a mixin node type; false otherwise. + */ + boolean isMixin(); + + /** + * Returns the value of the orderableChildNodes flag. + * + * @return true if nodes of this node type can have orderable child nodes; false otherwise. + */ + boolean hasOrderableChildNodes(); + + /** + * Returns the name of the primary item (one of the child items of the + * node's of this node type) or null if not set. + * + * @return the name of the primary item or null if not set. + */ + QName getPrimaryItemName(); + + /** + * Returns an array containing the property definitions or + * null if not set. + * + * @return an array containing the property definitions or + * null if not set. + */ + QPropertyDefinition[] getPropertyDefs(); + + /** + * Returns an array containing the child node definitions or + * null if not set. + * + * @return an array containing the child node definitions or + * null if not set. + */ + QNodeDefinition[] getChildNodeDefs(); + + /** + * Returns a collection of node type QNames that are being + * referenced by this node type definition (e.g. as supertypes, as + * required/default primary types in child node definitions, as REFERENCE + * value constraints in property definitions). + *

+ * Note that self-references (e.g. a child node definition that specifies + * the declaring node type as the default primary type) are not considered + * dependencies. + * + * @return a collection of node type QNames + */ + Collection getDependencies(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import javax.jcr.RangeIterator; + +/** + * QNodeTypeDefinitionIterator... + */ +public interface QNodeTypeDefinitionIterator extends RangeIterator { + + /** + * Returns the next QNodeTypeDefinition in the iteration. + * + * @return the next QNodeTypeDefinition in the iteration. + * @throws java.util.NoSuchElementException if no more ids are left. + */ + public QNodeTypeDefinition nextDefinition(); +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinitionIterator.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import javax.jcr.nodetype.PropertyDefinition; +import java.io.InputStream; + +/** + * QPropertyDefinition is the qualified SPI representation of + * a {@link PropertyDefinition property definition}. It refers to + * qualified default values and value constraints only and is thus isolated + * from session-specific namespace mappings. + * + * @see javax.jcr.nodetype.PropertyDefinition + */ +public interface QPropertyDefinition extends QItemDefinition { + + public static final QPropertyDefinition[] EMPTY_ARRAY = new QPropertyDefinition[0]; + + /** + * Returns the required type. + * + * @return the required type. + */ + int getRequiredType(); + + /** + * Returns the array of value constraints. + * + * @return the array of value constraints. + */ + String[] getValueConstraints(); + + /** + * Returns the array of default values. + * + * @return the array of default values. + */ + String[] getDefaultValues(); + + /** + * Returns the array of default values. + * + * @return the array of default values. + */ + InputStream[] getDefaultValuesAsStream(); + + /** + * Reports whether this property can have multiple values. + * + * @return the 'multiple' flag. + */ + boolean isMultiple(); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QPropertyDefinition.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java?rev=421270&view=auto ============================================================================== --- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java (added) +++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java Wed Jul 12 06:33:19 2006 @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi; + +import org.apache.jackrabbit.name.QName; + +import java.io.InputStream; + +/** + * QueryInfo... + */ +public interface QueryInfo { + + /** + * @return an array of String representing the node ids present in the + * query result + * @see javax.jcr.query.QueryResult#getNodes() + */ + public IdIterator getNodeIds(); + + /** + * @return an array of QName representing the column names of the query + * result. + * @see javax.jcr.query.QueryResult#getColumnNames() + */ + public QName[] getColumnNames(); + + /** + * @return an array of String representing the values present in a single + * row of the query result + * @see javax.jcr.query.Row#getValue(String) + * @see javax.jcr.query.Row#getValues() + */ + public String[] getValues(NodeId nodeId); + + /** + * todo really needed? rather use RepositoryService.getPropertyInfo(id).getValuesAsStream() + * @return an array of InputStream representing the values present in a single + * row of the query result + * @see javax.jcr.query.Row#getValue(String) + * @see javax.jcr.query.Row#getValues() + */ + public InputStream[] getValuesAsStream(NodeId nodeId); +} Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url