From commits-return-5001-apmail-airavata-commits-archive=airavata.apache.org@airavata.apache.org Fri Feb 7 19:54:52 2014 Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9ADB4106CE for ; Fri, 7 Feb 2014 19:54:52 +0000 (UTC) Received: (qmail 49060 invoked by uid 500); 7 Feb 2014 19:54:51 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 48977 invoked by uid 500); 7 Feb 2014 19:54:50 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 48957 invoked by uid 99); 7 Feb 2014 19:54:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Feb 2014 19:54:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E1C2591F7EE; Fri, 7 Feb 2014 19:54:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: smarru@apache.org To: commits@airavata.apache.org Date: Fri, 07 Feb 2014 19:54:50 -0000 Message-Id: <069ae1ac6fff458a884d2d41c1bc5815@git.apache.org> In-Reply-To: <0905af6da6794d35b8ecd73f13611797@git.apache.org> References: <0905af6da6794d35b8ecd73f13611797@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: Added a script to generate data model as java beans and add the license header and check changes files. Addressing AIRAVATA-991 Added a script to generate data model as java beans and add the license header and check changes files. Addressing AIRAVATA-991 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8697b2df Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8697b2df Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8697b2df Branch: refs/heads/master Commit: 8697b2dff7f9e3298aa9a41927e79fb405372135 Parents: fac34c0 Author: Suresh Marru Authored: Fri Feb 7 14:53:59 2014 -0500 Committer: Suresh Marru Committed: Fri Feb 7 14:53:59 2014 -0500 ---------------------------------------------------------------------- .../experiment/AdvancedInputDataHandling.java | 40 +-- .../experiment/AdvancedOutputDataHandling.java | 35 ++- .../model/experiment/BasicMetadata.java | 266 +++++++++++++++++-- .../ComputationalResourceScheduling.java | 91 ++++--- .../model/experiment/ConfigurationData.java | 70 ++--- .../experiment/QualityOfServiceParams.java | 35 ++- airavata-api/generate-thrift-files.sh | 39 +-- .../experimentModel.thrift | 6 +- 8 files changed, 419 insertions(+), 163 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/8697b2df/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/AdvancedInputDataHandling.java ---------------------------------------------------------------------- diff --git a/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/AdvancedInputDataHandling.java b/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/AdvancedInputDataHandling.java index 26c6287..d13fc69 100644 --- a/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/AdvancedInputDataHandling.java +++ b/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/AdvancedInputDataHandling.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ /** * Autogenerated by Thrift Compiler (0.9.1) * @@ -36,7 +52,7 @@ import org.slf4j.LoggerFactory; * A structure holding specified input data handling. * */ -public class AdvancedInputDataHandling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class AdvancedInputDataHandling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AdvancedInputDataHandling"); private static final org.apache.thrift.protocol.TField STAGE_INPUT_FILES_TO_WORKING_DIR_FIELD_DESC = new org.apache.thrift.protocol.TField("stageInputFilesToWorkingDir", org.apache.thrift.protocol.TType.BOOL, (short)1); @@ -50,10 +66,10 @@ public class AdvancedInputDataHandling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class AdvancedOutputDataHandling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AdvancedOutputDataHandling"); private static final org.apache.thrift.protocol.TField OUTPUTDATA_DIR_FIELD_DESC = new org.apache.thrift.protocol.TField("outputdataDir", org.apache.thrift.protocol.TType.STRING, (short)2); @@ -49,9 +65,9 @@ public class AdvancedOutputDataHandling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class BasicMetadata implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BasicMetadata"); private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField EXPERIMENT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField EXPERIMENT_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentDescription", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField SHARE_EXPERIMENT_PUBLICLY_FIELD_DESC = new org.apache.thrift.protocol.TField("shareExperimentPublicly", org.apache.thrift.protocol.TType.BOOL, (short)4); + private static final org.apache.thrift.protocol.TField PROJECT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("projectID", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField EXPERIMENT_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentDescription", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField SHARE_EXPERIMENT_PUBLICLY_FIELD_DESC = new org.apache.thrift.protocol.TField("shareExperimentPublicly", org.apache.thrift.protocol.TType.BOOL, (short)5); + private static final org.apache.thrift.protocol.TField EXPERIMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentID", org.apache.thrift.protocol.TType.STRING, (short)6); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -62,17 +80,21 @@ public class BasicMetadata implements org.apache.thrift.TBase byName = new HashMap(); @@ -91,10 +113,14 @@ public class BasicMetadata implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class ComputationalResourceScheduling implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ComputationalResourceScheduling"); private static final org.apache.thrift.protocol.TField AIRAVATA_AUTO_SCHEDULE_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataAutoSchedule", org.apache.thrift.protocol.TType.BOOL, (short)1); @@ -57,17 +73,17 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< schemes.put(TupleScheme.class, new ComputationalResourceSchedulingTupleSchemeFactory()); } - public boolean airavataAutoSchedule; // required - public boolean overrideManualScheduledParams; // required - public String resourceHostId; // optional - public int totalCPUCount; // optional - public int nodeCount; // optional - public int numberOfThreads; // optional - public String queueName; // optional - public int wallTimeLimit; // optional - public int jobStartTime; // optional - public int totalPhysicalMemory; // optional - public String ComputationalProjectAccount; // optional + private boolean airavataAutoSchedule; // required + private boolean overrideManualScheduledParams; // required + private String resourceHostId; // optional + private int totalCPUCount; // optional + private int nodeCount; // optional + private int numberOfThreads; // optional + private String queueName; // optional + private int wallTimeLimit; // optional + private int jobStartTime; // optional + private int totalPhysicalMemory; // optional + private String ComputationalProjectAccount; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -270,10 +286,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.airavataAutoSchedule; } - public ComputationalResourceScheduling setAiravataAutoSchedule(boolean airavataAutoSchedule) { + public void setAiravataAutoSchedule(boolean airavataAutoSchedule) { this.airavataAutoSchedule = airavataAutoSchedule; setAiravataAutoScheduleIsSet(true); - return this; } public void unsetAiravataAutoSchedule() { @@ -293,10 +308,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.overrideManualScheduledParams; } - public ComputationalResourceScheduling setOverrideManualScheduledParams(boolean overrideManualScheduledParams) { + public void setOverrideManualScheduledParams(boolean overrideManualScheduledParams) { this.overrideManualScheduledParams = overrideManualScheduledParams; setOverrideManualScheduledParamsIsSet(true); - return this; } public void unsetOverrideManualScheduledParams() { @@ -316,9 +330,8 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.resourceHostId; } - public ComputationalResourceScheduling setResourceHostId(String resourceHostId) { + public void setResourceHostId(String resourceHostId) { this.resourceHostId = resourceHostId; - return this; } public void unsetResourceHostId() { @@ -340,10 +353,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.totalCPUCount; } - public ComputationalResourceScheduling setTotalCPUCount(int totalCPUCount) { + public void setTotalCPUCount(int totalCPUCount) { this.totalCPUCount = totalCPUCount; setTotalCPUCountIsSet(true); - return this; } public void unsetTotalCPUCount() { @@ -363,10 +375,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.nodeCount; } - public ComputationalResourceScheduling setNodeCount(int nodeCount) { + public void setNodeCount(int nodeCount) { this.nodeCount = nodeCount; setNodeCountIsSet(true); - return this; } public void unsetNodeCount() { @@ -386,10 +397,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.numberOfThreads; } - public ComputationalResourceScheduling setNumberOfThreads(int numberOfThreads) { + public void setNumberOfThreads(int numberOfThreads) { this.numberOfThreads = numberOfThreads; setNumberOfThreadsIsSet(true); - return this; } public void unsetNumberOfThreads() { @@ -409,9 +419,8 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.queueName; } - public ComputationalResourceScheduling setQueueName(String queueName) { + public void setQueueName(String queueName) { this.queueName = queueName; - return this; } public void unsetQueueName() { @@ -433,10 +442,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.wallTimeLimit; } - public ComputationalResourceScheduling setWallTimeLimit(int wallTimeLimit) { + public void setWallTimeLimit(int wallTimeLimit) { this.wallTimeLimit = wallTimeLimit; setWallTimeLimitIsSet(true); - return this; } public void unsetWallTimeLimit() { @@ -456,10 +464,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.jobStartTime; } - public ComputationalResourceScheduling setJobStartTime(int jobStartTime) { + public void setJobStartTime(int jobStartTime) { this.jobStartTime = jobStartTime; setJobStartTimeIsSet(true); - return this; } public void unsetJobStartTime() { @@ -479,10 +486,9 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.totalPhysicalMemory; } - public ComputationalResourceScheduling setTotalPhysicalMemory(int totalPhysicalMemory) { + public void setTotalPhysicalMemory(int totalPhysicalMemory) { this.totalPhysicalMemory = totalPhysicalMemory; setTotalPhysicalMemoryIsSet(true); - return this; } public void unsetTotalPhysicalMemory() { @@ -502,9 +508,8 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< return this.ComputationalProjectAccount; } - public ComputationalResourceScheduling setComputationalProjectAccount(String ComputationalProjectAccount) { + public void setComputationalProjectAccount(String ComputationalProjectAccount) { this.ComputationalProjectAccount = ComputationalProjectAccount; - return this; } public void unsetComputationalProjectAccount() { @@ -1024,8 +1029,14 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< public void validate() throws org.apache.thrift.TException { // check for required fields - // alas, we cannot check 'airavataAutoSchedule' because it's a primitive and you chose the non-beans generator. - // alas, we cannot check 'overrideManualScheduledParams' because it's a primitive and you chose the non-beans generator. + if (!isSetAiravataAutoSchedule()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataAutoSchedule' is unset! Struct:" + toString()); + } + + if (!isSetOverrideManualScheduledParams()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'overrideManualScheduledParams' is unset! Struct:" + toString()); + } + // check for sub-struct validity } @@ -1159,14 +1170,6 @@ public class ComputationalResourceScheduling implements org.apache.thrift.TBase< iprot.readFieldEnd(); } iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - if (!struct.isSetAiravataAutoSchedule()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataAutoSchedule' was not found in serialized data! Struct: " + toString()); - } - if (!struct.isSetOverrideManualScheduledParams()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'overrideManualScheduledParams' was not found in serialized data! Struct: " + toString()); - } struct.validate(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/8697b2df/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/ConfigurationData.java ---------------------------------------------------------------------- diff --git a/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/ConfigurationData.java b/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/ConfigurationData.java index fd3a254..071b203 100644 --- a/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/ConfigurationData.java +++ b/airavata-api/datamodel/src/main/java/org/apache/airavata/model/experiment/ConfigurationData.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ /** * Autogenerated by Thrift Compiler (0.9.1) * @@ -37,7 +53,7 @@ import org.slf4j.LoggerFactory; * * */ -public class ConfigurationData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class ConfigurationData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConfigurationData"); private static final org.apache.thrift.protocol.TField BASIC_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("basicMetadata", org.apache.thrift.protocol.TType.STRUCT, (short)1); @@ -57,16 +73,16 @@ public class ConfigurationData implements org.apache.thrift.TBase experimentInputs; // optional - public ComputationalResourceScheduling computationalResourceScheduling; // optional - public AdvancedInputDataHandling advanceInputDataHandling; // optional - public AdvancedOutputDataHandling advanceOutputDataHandling; // optional - public QualityOfServiceParams qosParams; // optional + private BasicMetadata basicMetadata; // optional + private String applicationId; // optional + private String applicationVersion; // optional + private String workflowTemplateId; // optional + private String worklfowTemplateVersion; // optional + private Map experimentInputs; // optional + private ComputationalResourceScheduling computationalResourceScheduling; // optional + private AdvancedInputDataHandling advanceInputDataHandling; // optional + private AdvancedOutputDataHandling advanceOutputDataHandling; // optional + private QualityOfServiceParams qosParams; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -246,9 +262,8 @@ public class ConfigurationData implements org.apache.thrift.TBase experimentInputs) { + public void setExperimentInputs(Map experimentInputs) { this.experimentInputs = experimentInputs; - return this; } public void unsetExperimentInputs() { @@ -401,9 +411,8 @@ public class ConfigurationData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { +@SuppressWarnings("all") public class QualityOfServiceParams implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("QualityOfServiceParams"); private static final org.apache.thrift.protocol.TField START_EXECUTION_AT_FIELD_DESC = new org.apache.thrift.protocol.TField("startExecutionAt", org.apache.thrift.protocol.TType.STRING, (short)1); @@ -49,9 +65,9 @@ public class QualityOfServiceParams implements org.apache.thrift.TBase/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" | wc -l) +VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" | wc -l) if [ "$VERSION" -ne 1 ] ; then # Nope: bail echo "****************************************************" @@ -46,20 +46,27 @@ fi # Initialize the thrift arguements. # Since most of the Airavata API and Data Models have includes, use recursive option by defualt. -THRIFT_ARGS='-r' +# Generate all the files in target directory +THRIFT_ARGS="-r -o $BUILD_DIR" + # Ensure output directories are created -THRIFT_ARGS="${THRIFT_ARGS} -o $BUILD_DIR" mkdir -p $BUILD_DIR -rm -rf $BUILD_DIR/gen-java -for f in src/main/thrift/*.thrift; do - thrift ${THRIFT_ARGS} --gen java $f || fail unable to generate java thrift classes - thrift ${THRIFT_ARGS} --gen php $f || fail unable to generate python thrift classes -done + + +# Generate the Airavata Data Model. Use Java Beans to generate to take advantage of the bean style +# with members being private and setters returning voids. + +# First remove and previously generated files +rm -rf $BUILD_DIR/gen-javabean + +# the airavataDataModel.thrift includes rest of data models. +thrift ${THRIFT_ARGS} --gen java:beans $THRIFT_IDL_DIR/airavataDataModel.thrift || fail unable to generate java bean thrift classes + # For all generated thrift code, suppress all warnings and add the LICENSE header -find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public class /@SuppressWarnings("all") public class /' -find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public enum /@SuppressWarnings("all") public enum /' -for f in $(find $BUILD_DIR/gen-java -name '*.java'); do +find $BUILD_DIR/gen-javabean -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public class /@SuppressWarnings("all") public class /' +#find $BUILD_DIR/gen-javabean -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public enum /@SuppressWarnings("all") public enum /' +for f in $(find $BUILD_DIR/gen-javabean -name '*.java'); do cat - $f >${f}-with-license <