001    // SECTION-START[License Header]
002    // <editor-fold defaultstate="collapsed" desc=" Generated License ">
003    /*
004     *   Copyright (c) 2010 The JOMC Project
005     *   Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net>
006     *   All rights reserved.
007     *
008     *   Redistribution and use in source and binary forms, with or without
009     *   modification, are permitted provided that the following conditions
010     *   are met:
011     *
012     *     o Redistributions of source code must retain the above copyright
013     *       notice, this list of conditions and the following disclaimer.
014     *
015     *     o Redistributions in binary form must reproduce the above copyright
016     *       notice, this list of conditions and the following disclaimer in
017     *       the documentation and/or other materials provided with the
018     *       distribution.
019     *
020     *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
021     *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
022     *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
023     *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
024     *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025     *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026     *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
027     *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028     *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
029     *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
030     *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031     *
032     *   $Id: SequenceOperations.java 2244 2010-06-29 07:58:09Z schulte2005 $
033     *
034     */
035    // </editor-fold>
036    // SECTION-END
037    package org.jomc.sequences;
038    
039    // SECTION-START[Documentation]
040    // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
041    /**
042     * Provides operations performed with sequences.
043     *
044     * <p>
045     *   This specification declares a multiplicity of {@code One}.
046     *   An application assembler may provide either no or one implementation of this specification.
047     * </p>
048     *
049     * <p>
050     *   Use of class {@link org.jomc.ObjectManager ObjectManager} is supported for accessing implementations.
051     *   <pre>
052     * SequenceOperations object = ObjectManagerFactory.getObjectManager( getClass().getClassLoader() ).getObject( SequenceOperations.class );
053     * SequenceOperations object = ObjectManagerFactory.getObjectManager( getClass().getClassLoader() ).getObject( SequenceOperations.class, "<i>implementation name</i>" );
054     *   </pre>
055     * </p>
056     *
057     * <p>
058     *   This specification applies to {@code Singleton} scope.
059     *   The same singleton object is returned whenever requested.
060     * </p>
061     *
062     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
063     * @version $Id: SequenceOperations.java 2244 2010-06-29 07:58:09Z schulte2005 $
064     */
065    // </editor-fold>
066    // SECTION-END
067    // SECTION-START[Annotations]
068    // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
069    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
070    // </editor-fold>
071    // SECTION-END
072    public interface SequenceOperations
073    {
074        // SECTION-START[SequenceOperations]
075    
076        /**
077         * Gets the next value for a named sequence.
078         *
079         * @param sequenceName The name of the sequence to get the next value of.
080         *
081         * @return The next value of the sequence with name {@code name}.
082         *
083         * @throws SequenceNotFoundException if no sequence exists for {@code sequenceName}.
084         * @throws SequenceLimitException if the sequence with name {@code sequenceName} reached its maximum value.
085         * @throws SequencesSystemException if getting the value fails.
086         */
087        long getNextSequenceValue( String sequenceName )
088            throws SequenceNotFoundException, SequenceLimitException, SequencesSystemException;
089    
090        /**
091         * Gets multiple next values for a named sequence.
092         *
093         * @param sequenceName The name of the sequence to get values of.
094         * @param numValues The number of values to get from the sequence with name {@code sequenceName} - must be positive.
095         *
096         * @return An array of next values of the sequence with name {@code name} with a length equal to {@code numValues}.
097         *
098         * @throws SequenceNotFoundException if no sequence exists for {@code sequenceName}.
099         * @throws SequenceLimitException if the sequence with name {@code sequenceName} reached its maximum value.
100         * @throws SequencesSystemException if getting values fails.
101         */
102        long[] getNextSequenceValues( String sequenceName, int numValues )
103            throws SequenceNotFoundException, SequenceLimitException, SequencesSystemException;
104    
105        // SECTION-END
106    }