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 java.io.InputStream;
27  
28  /**
29   * The interface for a ModeShape sequencer that processes a property as a stream to extract information from the content and store
30   * in the repository.
31   * <p>
32   * ModeShape creates a new StreamSequencer instance each time a sequencing operation is to be performed on some input data.
33   * Therefore, implementations must provide a no-argument constructor. Implementations may also define Java-bean style property
34   * setters that will be used to pass sequencer configuration properties to the sequencer instance.
35   * </p>
36   */
37  public interface StreamSequencer {
38  
39      /**
40       * Sequence the data found in the supplied stream, placing the output information into the supplied map.
41       * <p>
42       * ModeShape's SequencingService determines the sequencers that should be executed by monitoring the changes to one or more
43       * workspaces that it is monitoring. Changes in those workspaces are aggregated and used to determine which sequencers should
44       * be called. If the sequencer implements this interface, then this method is called with the property that is to be sequenced
45       * along with the interface used to register the output. The framework takes care of all the rest.
46       * </p>
47       * 
48       * @param stream the stream with the data to be sequenced; never <code>null</code>
49       * @param output the output from the sequencing operation; never <code>null</code>
50       * @param context the context for the sequencing operation; never <code>null</code>
51       */
52      void sequence( InputStream stream,
53                     SequencerOutput output,
54                     StreamSequencerContext context );
55  }