View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6   * See the AUTHORS.txt file in the distribution for a full listing of 
7   * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   *
14   * ModeShape 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. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.graph.sequencer;
25  
26  import org.modeshape.graph.property.Name;
27  import org.modeshape.graph.property.Path;
28  
29  /**
30   * Interface for sequencers to use to generate their output.
31   */
32  public interface SequencerOutput {
33  
34      /**
35       * Set the supplied property on the supplied node.
36       * <p>
37       * The {@link StreamSequencerContext#getValueFactories() value factories} should be used to create paths, names, and values.
38       * These factories can be used to create new values or convert values from one property type to another. (Note that each of
39       * the factories have methods that create values from all of the property types.)
40       * </p>
41       * <p>
42       * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
43       * {@link StreamSequencerContext#getValueFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
44       * </p>
45       * 
46       * @param nodePath the path to the node containing the property; may not be null
47       * @param propertyName the name of the property to be set
48       * @param values the value(s) for the property; may be empty if any existing property is to be removed
49       * @deprecated As of ModeShape 2.0, the preferred approach is to use {@link #setProperty(Path, Name, Object...)}, which
50       *             properly addresses the session having different namespace mappings. This method depends on the namespace
51       *             mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the
52       *             NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.
53       */
54      @Deprecated
55      void setProperty( String nodePath,
56                        String propertyName,
57                        Object... values );
58  
59      /**
60       * Set the supplied reference on the supplied node.
61       * <p>
62       * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
63       * {@link StreamSequencerContext#getValueFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
64       * </p>
65       * 
66       * @param nodePath the path to the node containing the property; may not be null
67       * @param propertyName the name of the property to be set
68       * @param paths the paths to the referenced property, which may be absolute paths or relative to the sequencer output node;
69       *        may be empty if any existing property is to be removed
70       * @deprecated As of ModeShape 2.0, the preferred approach is to use {@link #setProperty(Path, Name, Object...)}, which
71       *             properly addresses the session having different namespace mappings. This method depends on the namespace
72       *             mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the
73       *             NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.
74       */
75      @Deprecated
76      void setReference( String nodePath,
77                         String propertyName,
78                         String... paths );
79  
80      /**
81       * Set the supplied property on the supplied node.
82       * <p>
83       * The {@link StreamSequencerContext#getValueFactories() value factories} should be used to create paths, names, and values.
84       * These factories can be used to create new values or convert values from one property type to another. (Note that each of
85       * the factories have methods that create values from all of the property types.)
86       * </p>
87       * 
88       * @param nodePath the path to the node containing the property; may not be null
89       * @param propertyName the name of the property to be set
90       * @param values the value(s) for the property; may be empty if any existing property is to be removed
91       */
92      void setProperty( Path nodePath,
93                        Name propertyName,
94                        Object... values );
95  }