/** * Copyright © 2013 enioka. All rights reserved * Authors: Marc-Antoine GOUILLART (marc-antoine.gouillart@enioka.com) * Pierre COPPEE (pierre.coppee@enioka.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.enioka.jqm.api; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** * The definition of all a payload that can be run by the JQM engines. It contains all the metadata needed to create an execution request * {@link JobRequest}. */ @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class JobDef implements Serializable { private static final long serialVersionUID = -3276834477433922990L; private Integer id; private String description; private boolean canBeRestarted = true; private Queue queue; private String applicationName; private String application; private String module; private String keyword1; private String keyword2; private String keyword3; private boolean highlander = false; private Map<String, String> parameters = new HashMap<String, String>(); /** * A technical ID without any meaning. Generated by the database. */ public Integer getId() { return id; } void setId(Integer id) { this.id = id; } /** * True if instances of this {@link JobDef} can be restarted (i.e. run with exactly the same parameters and context). Default is true. */ public boolean isRestartable() { return canBeRestarted; } /** * See {@link #isCanBeRestarted()} */ void setCanBeRestarted(final boolean canBeRestarted) { this.canBeRestarted = canBeRestarted; } /** * The applicative key of the {@link JobDef}. {@link JobDef} are always retrieved through this name.<br> * Max length is 100. */ public String getApplicationName() { return applicationName; } /** * See {@link #getApplicationName()} */ void setApplicationName(final String applicationName) { this.applicationName = applicationName; } /** * An optional classification tag (default is NULL).<br> * Max length is 50. */ public String getApplication() { return application; } /** * See {@link #getApplication()} */ void setApplication(final String application) { this.application = application; } /** * An optional classification tag (default is NULL).<br> * Max length is 50. */ public String getModule() { return module; } /** * See {@link #getModule()} */ void setModule(final String module) { this.module = module; } /** * An optional classification tag (default is NULL).<br> * Max length is 50. */ public String getKeyword1() { return keyword1; } /** * See {@link #getKeyword1()} */ void setKeyword1(final String keyword1) { this.keyword1 = keyword1; } /** * An optional classification tag (default is NULL).<br> * Max length is 50. */ public String getKeyword2() { return keyword2; } /** * See {@link #getKeyword2()} */ void setKeyword2(final String keyword2) { this.keyword2 = keyword2; } /** * An optional classification tag (default is NULL).<br> * Max length is 50. */ public String getKeyword3() { return keyword3; } /** * See {@link #getKeyword3()} */ void setKeyword3(final String keyword3) { this.keyword3 = keyword3; } /** * Set to true to enable Highlander mode: never more than one concurrent execution of the same {@link JobDef} inside the whole cluster. * Default is false. */ public boolean isHighlander() { return highlander; } /** * See {@link #isHighlander()} */ void setHighlander(final boolean highlander) { this.highlander = highlander; } /** * The {@link Queue} on which the instances created from this {@link JobDef} should run. This is only the "default" queue - it may be * overloaded inside the execution request. */ public Queue getDefaultQueue() { return queue; } /** * See {@link #getQueue()} */ void setQueue(final Queue queue) { this.queue = queue; } /** * Parameters (i.e. key/value pairs) that should be present for all instances created from this JobDef. This list may be empty.<br> * These are only the "default" parameters - each parameter may be overloaded inside the execution request (which may even specify * parameters which are not present in the default parameters). */ public Map<String, String> getParameters() { return parameters; } void addParameter(String key, String value) { this.parameters.put(key, value); } /** * A (compulsory) description of what this paylod does.<br> * Max length is 1024. */ public String getDescription() { return description; } /** * See {@link #getDescription()} */ void setDescription(String description) { this.description = description; } }