1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */18package org.apache.giraph.scripting;
1920import com.google.common.base.MoreObjects;
21import org.apache.giraph.graph.Language;
22import org.codehaus.jackson.annotate.JsonCreator;
23import org.codehaus.jackson.annotate.JsonProperty;
2425import com.google.common.base.Objects;
2627/**28 * A script that was deployed to the cluster.29 */30publicclassDeployedScript {
31/** How the script was deployed */32 @JsonProperty
33privatefinalDeployType deployType;
34/** Path to the script */35 @JsonProperty
36privatefinal String path;
37/** Programming language the script is written in */38 @JsonProperty
39privatefinalLanguage language;
4041/**42 * Constructor43 *44 * @param path String path to resource45 * @param deployType deployment type46 * @param language programming language47 */48 @JsonCreator
49publicDeployedScript(
50 @JsonProperty("path") String path,
51 @JsonProperty("deployType") DeployType deployType,
52 @JsonProperty("language") Language language) {
53this.path = path;
54this.deployType = deployType;
55this.language = language;
56 }
5758publicDeployType getDeployType() {
59return deployType;
60 }
6162public String getPath() {
63return path;
64 }
6566publicLanguage getLanguage() {
67return language;
68 }
6970 @Override
71publicint hashCode() {
72return Objects.hashCode(path, deployType, language);
73 }
7475 @Override
76publicboolean equals(Object obj) {
77if (this == obj) {
78returntrue;
79 }
80if (obj instanceof DeployedScript) {
81DeployedScript other = (DeployedScript) obj;
82return Objects.equal(path, other.path) &&
83 Objects.equal(deployType, other.deployType) &&
84 Objects.equal(language, other.language);
85 }
86return false;
87 }
8889 @Override
90public String toString() {
91return MoreObjects.toStringHelper(this)
92 .add("path", path)
93 .add("deployType", deployType)
94 .add("language", language)
95 .toString();
96 }
97 }