001    /*
002     * JBoss, Home of Professional Open Source.
003     * Copyright 2008, Red Hat Middleware LLC, and individual contributors
004     * as indicated by the @author tags. See the copyright.txt file in the
005     * distribution for a full listing of individual contributors.
006     *
007     * This is free software; you can redistribute it and/or modify it
008     * under the terms of the GNU Lesser General Public License as
009     * published by the Free Software Foundation; either version 2.1 of
010     * the License, or (at your option) any later version.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * Lesser General Public License for more details.
016     *
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this software; if not, write to the Free
019     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021     */
022    package org.jboss.dna.graph.sequencers;
023    
024    import org.jboss.dna.graph.properties.Name;
025    import org.jboss.dna.graph.properties.NamespaceRegistry;
026    import org.jboss.dna.graph.properties.Path;
027    import org.jboss.dna.graph.properties.ValueFactories;
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         * Get the factories that can be used to create {@link Path paths} and other property values.
039         * 
040         * @return the collection of factories; never null
041         * @deprecated Replaced by {@link SequencerContext#getFactories()}.
042         */
043        @Deprecated
044        ValueFactories getFactories();
045    
046        /**
047         * Convenience method to get the namespace registry used by the {@link ValueFactories#getNameFactory() name value factory}.
048         * 
049         * @return the namespace registry; never <code>null</code>
050         * @deprecated Replaced by {@link SequencerContext#getNamespaceRegistry()}.
051         */
052        @Deprecated
053        NamespaceRegistry getNamespaceRegistry();
054    
055        /**
056         * Set the supplied property on the supplied node.
057         * <p>
058         * The {@link #getFactories() value factories} should be used to create paths, names, and values. These factories can be used
059         * to create new values or convert values from one property type to another. (Note that each of the factories have methods
060         * that create values from all of the property types.)
061         * </p>
062         * <p>
063         * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
064         * {@link #getFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
065         * </p>
066         * 
067         * @param nodePath the path to the node containing the property; may not be null
068         * @param propertyName the name of the property to be set
069         * @param values the value(s) for the property; may be empty if any existing property is to be removed
070         */
071        void setProperty( String nodePath,
072                          String propertyName,
073                          Object... values );
074    
075        /**
076         * Set the supplied reference on the supplied node.
077         * <p>
078         * This method is provided as a convenience, but it identical to creating a {@link Path} and {@link Name} using the
079         * {@link #getFactories() factories} and calling {@link #setProperty(Path, Name, Object...)}.
080         * </p>
081         * 
082         * @param nodePath the path to the node containing the property; may not be null
083         * @param propertyName the name of the property to be set
084         * @param paths the paths to the referenced property, which may be absolute paths or relative to the sequencer output node;
085         *        may be empty if any existing property is to be removed
086         */
087        void setReference( String nodePath,
088                           String propertyName,
089                           String... paths );
090    
091        /**
092         * Set the supplied property on the supplied node.
093         * <p>
094         * The {@link #getFactories() value factories} should be used to create paths, names, and values. These factories can be used
095         * to create new values or convert values from one property type to another. (Note that each of the factories have methods
096         * that create values from all of the property types.)
097         * </p>
098         * 
099         * @param nodePath the path to the node containing the property; may not be null
100         * @param propertyName the name of the property to be set
101         * @param values the value(s) for the property; may be empty if any existing property is to be removed
102         */
103        void setProperty( Path nodePath,
104                          Name propertyName,
105                          Object... values );
106    }