All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.jackrabbit.spi.IdFactory Maven / Gradle / Ivy

/*
 * 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;

/**
 * IdFactory defines methods to construct new ItemIds.
 * This factory is intended to build ItemIds from the parameters
 * passed to the various create methods and should not make an attempt to
 * apply additional logic such as e.g. roundtrips to the server or resolution of
 * Paths. Similarly the SPI implementation namely the
 * {@link RepositoryService} must be able to deal with the various formats of
 * an ItemId, since a caller may not (yet) be aware of the uniqueID
 * part of an ItemId.
 */
public interface IdFactory {

    /**
     * Creates a new PropertyId from the given parent id and
     * property name.
     *
     * @param parentId
     * @param propertyName
     * @return a new PropertyId.
     */
    public PropertyId createPropertyId(NodeId parentId, Name propertyName);

    /**
     * Creates a new NodeId from the given parent id and
     * the given Path object.
     *
     * @param parentId
     * @param path
     * @return a new NodeId.
     */
    public NodeId createNodeId(NodeId parentId, Path path);

    /**
     * Creates a new NodeId from the given unique id (which identifies
     * an ancestor Node) and the given Path object.
     *
     * @param uniqueID
     * @param path
     * @return a new NodeId.
     * @see ItemId ItemId for a description of the uniqueID defined by the SPI
     * item identifiers.
     */
    public NodeId createNodeId(String uniqueID, Path path);

    /**
     * Creates a new NodeId from the given unique id.
     *
     * @param uniqueID
     * @return a new NodeId.
     * @see ItemId ItemId for a description of the uniqueID defined by the SPI
     * item identifiers.
     */
    public NodeId createNodeId(String uniqueID);    

    /**
     * Returns the JCR string representation of the given nodeId.
     *
     * @return a JCR node identifier string.
     * @see #fromJcrIdentifier(String)
     */
    public String toJcrIdentifier(NodeId nodeId);

    /**
     * Create a new NodeId from the given JCR string representation.
     *
     * @param jcrIdentifier
     * @return a new NodeId.
     * @see #toJcrIdentifier(NodeId)
     */
    public NodeId fromJcrIdentifier(String jcrIdentifier);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy