001/*
002 * Copyright 2006-2007 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 */
016
017package org.springframework.batch.core.launch.support;
018
019/**
020 * 
021 * This interface should be implemented when an environment calling the batch
022 * framework has specific requirements regarding the operating system process
023 * return status.
024 * 
025 * @author Stijn Maller
026 * @author Lucas Ward
027 * @author Dave Syer
028 */
029public interface ExitCodeMapper {
030
031        static int JVM_EXITCODE_COMPLETED = 0;
032
033        static int JVM_EXITCODE_GENERIC_ERROR = 1;
034
035        static int JVM_EXITCODE_JOB_ERROR = 2;
036
037        public static final String NO_SUCH_JOB = "NO_SUCH_JOB";
038
039        public static final String JOB_NOT_PROVIDED = "JOB_NOT_PROVIDED";
040
041        /**
042         * Convert the exit code from String into an integer that the calling
043         * environment as an operating system can interpret as an exit status.
044         * @param exitCode The exit code which is used internally.
045         * @return The corresponding exit status as known by the calling
046         * environment.
047         */
048        public int intValue(String exitCode);
049
050}