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     * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
010     * is licensed 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.graph.sequencer;
025    
026    import org.jboss.dna.graph.property.Name;
027    import org.jboss.dna.graph.property.Path;
028    
029    /**
030     * Interface for sequencers to use to generate their output.
031     * 
032     * @author Randall Hauch
033     * @author John Verhaeg
034     */
035    public interface SequencerOutput {
036    
037        /**
038         * Set the supplied property on the supplied node.
039         * <p>
040         * The {@link StreamSequencerContext#getValueFactories() value factories} should be used to create paths, names, and values. These
041         * factories can be used to create new values or convert values from one property type to another. (Note that each of the
042         * factories have methods that create values from all of the property types.)
043         * </p>
044         * <p>
045         * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
046         * {@link StreamSequencerContext#getValueFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
047         * </p>
048         * 
049         * @param nodePath the path to the node containing the property; may not be null
050         * @param propertyName the name of the property to be set
051         * @param values the value(s) for the property; may be empty if any existing property is to be removed
052         */
053        void setProperty( String nodePath,
054                          String propertyName,
055                          Object... values );
056    
057        /**
058         * Set the supplied reference on the supplied node.
059         * <p>
060         * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
061         * {@link StreamSequencerContext#getValueFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
062         * </p>
063         * 
064         * @param nodePath the path to the node containing the property; may not be null
065         * @param propertyName the name of the property to be set
066         * @param paths the paths to the referenced property, which may be absolute paths or relative to the sequencer output node;
067         *        may be empty if any existing property is to be removed
068         */
069        void setReference( String nodePath,
070                           String propertyName,
071                           String... paths );
072    
073        /**
074         * Set the supplied property on the supplied node.
075         * <p>
076         * The {@link StreamSequencerContext#getValueFactories() value factories} should be used to create paths, names, and values. These
077         * factories can be used to create new values or convert values from one property type to another. (Note that each of the
078         * factories have methods that create values from all of the property types.)
079         * </p>
080         * 
081         * @param nodePath the path to the node containing the property; may not be null
082         * @param propertyName the name of the property to be set
083         * @param values the value(s) for the property; may be empty if any existing property is to be removed
084         */
085        void setProperty( Path nodePath,
086                          Name propertyName,
087                          Object... values );
088    }