1 // SECTION-START[License Header] 2 // <editor-fold defaultstate="collapsed" desc=" Generated License "> 3 /* 4 * Copyright (c) 2010 The JOMC Project 5 * Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * o Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * o Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in 17 * the documentation and/or other materials provided with the 18 * distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * $Id: SequenceOperations.java 2244 2010-06-29 07:58:09Z schulte2005 $ 33 * 34 */ 35 // </editor-fold> 36 // SECTION-END 37 package org.jomc.sequences; 38 39 // SECTION-START[Documentation] 40 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 41 /** 42 * Provides operations performed with sequences. 43 * 44 * <p> 45 * This specification declares a multiplicity of {@code One}. 46 * An application assembler may provide either no or one implementation of this specification. 47 * </p> 48 * 49 * <p> 50 * Use of class {@link org.jomc.ObjectManager ObjectManager} is supported for accessing implementations. 51 * <pre> 52 * SequenceOperations object = ObjectManagerFactory.getObjectManager( getClass().getClassLoader() ).getObject( SequenceOperations.class ); 53 * SequenceOperations object = ObjectManagerFactory.getObjectManager( getClass().getClassLoader() ).getObject( SequenceOperations.class, "<i>implementation name</i>" ); 54 * </pre> 55 * </p> 56 * 57 * <p> 58 * This specification applies to {@code Singleton} scope. 59 * The same singleton object is returned whenever requested. 60 * </p> 61 * 62 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 63 * @version $Id: SequenceOperations.java 2244 2010-06-29 07:58:09Z schulte2005 $ 64 */ 65 // </editor-fold> 66 // SECTION-END 67 // SECTION-START[Annotations] 68 // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> 69 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) 70 // </editor-fold> 71 // SECTION-END 72 public interface SequenceOperations 73 { 74 // SECTION-START[SequenceOperations] 75 76 /** 77 * Gets the next value for a named sequence. 78 * 79 * @param sequenceName The name of the sequence to get the next value of. 80 * 81 * @return The next value of the sequence with name {@code name}. 82 * 83 * @throws SequenceNotFoundException if no sequence exists for {@code sequenceName}. 84 * @throws SequenceLimitException if the sequence with name {@code sequenceName} reached its maximum value. 85 * @throws SequencesSystemException if getting the value fails. 86 */ 87 long getNextSequenceValue( String sequenceName ) 88 throws SequenceNotFoundException, SequenceLimitException, SequencesSystemException; 89 90 /** 91 * Gets multiple next values for a named sequence. 92 * 93 * @param sequenceName The name of the sequence to get values of. 94 * @param numValues The number of values to get from the sequence with name {@code sequenceName} - must be positive. 95 * 96 * @return An array of next values of the sequence with name {@code name} with a length equal to {@code numValues}. 97 * 98 * @throws SequenceNotFoundException if no sequence exists for {@code sequenceName}. 99 * @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 }