001/*
002 * Copyright 2006-2008 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.batch.item.database.support;
017
018import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
019
020/**
021 * Factory for creating {@link DataFieldMaxValueIncrementer} implementations
022 * based upon a provided string.
023 * 
024 * @author Lucas Ward
025 *
026 */
027public interface DataFieldMaxValueIncrementerFactory {
028
029        /**
030         * Return the {@link DataFieldMaxValueIncrementer} for the provided database type.
031         * 
032         * @param databaseType string represented database type
033         * @param incrementerName incrementer name to create. In many cases this may be the
034         *  sequence name
035         * @return incrementer
036         * @throws IllegalArgumentException if databaseType is invalid type, or incrementerName
037         * is null.
038         */
039        public DataFieldMaxValueIncrementer getIncrementer(String databaseType, String incrementerName);
040        
041        /**
042         * Returns boolean indicated whether or not the provided string is supported by this
043         * factory.
044         *
045         * @param databaseType {@link String} containing the database type.
046         * @return true if the incrementerType is supported by this database type. Else false is returned.
047         */
048        public boolean isSupportedIncrementerType(String databaseType);
049
050        /**
051         * Returns the list of supported database incrementer types
052         *
053         * @return  an array of {@link String}s containing the supported incrementer types.
054         */
055        public String[] getSupportedIncrementerTypes();
056}