http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java deleted file mode 100644 index 30bd778..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java +++ /dev/null @@ -1,1049 +0,0 @@ -/** - * - * 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.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.airavata.cloud.aurora.client.sdk; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -/** - * Description of an Aurora job. One task will be scheduled for each instance within the job. - */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") -public class JobConfiguration implements org.apache.thrift.TBase<JobConfiguration, JobConfiguration._Fields>, java.io.Serializable, Cloneable, Comparable<JobConfiguration> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobConfiguration"); - - private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRUCT, (short)9); - private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRUCT, (short)7); - private static final org.apache.thrift.protocol.TField CRON_SCHEDULE_FIELD_DESC = new org.apache.thrift.protocol.TField("cronSchedule", org.apache.thrift.protocol.TType.STRING, (short)4); - private static final org.apache.thrift.protocol.TField CRON_COLLISION_POLICY_FIELD_DESC = new org.apache.thrift.protocol.TField("cronCollisionPolicy", org.apache.thrift.protocol.TType.I32, (short)5); - private static final org.apache.thrift.protocol.TField TASK_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("taskConfig", org.apache.thrift.protocol.TType.STRUCT, (short)6); - private static final org.apache.thrift.protocol.TField INSTANCE_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceCount", org.apache.thrift.protocol.TType.I32, (short)8); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new JobConfigurationStandardSchemeFactory()); - schemes.put(TupleScheme.class, new JobConfigurationTupleSchemeFactory()); - } - - /** - * Key for this job. If not specified name, owner.role, and a reasonable default environment are - * used to construct it server-side. - */ - public JobKey key; // required - /** - * Owner of this job. - */ - public Identity owner; // required - /** - * If present, the job will be handled as a cron job with this crontab-syntax schedule. - */ - public String cronSchedule; // optional - /** - * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. - * - * @see CronCollisionPolicy - */ - public CronCollisionPolicy cronCollisionPolicy; // required - /** - * Task configuration for this job. - */ - public TaskConfig taskConfig; // required - /** - * The number of instances in the job. Generated instance IDs for tasks will be in the range - * [0, instances). - */ - public int instanceCount; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * Key for this job. If not specified name, owner.role, and a reasonable default environment are - * used to construct it server-side. - */ - KEY((short)9, "key"), - /** - * Owner of this job. - */ - OWNER((short)7, "owner"), - /** - * If present, the job will be handled as a cron job with this crontab-syntax schedule. - */ - CRON_SCHEDULE((short)4, "cronSchedule"), - /** - * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. - * - * @see CronCollisionPolicy - */ - CRON_COLLISION_POLICY((short)5, "cronCollisionPolicy"), - /** - * Task configuration for this job. - */ - TASK_CONFIG((short)6, "taskConfig"), - /** - * The number of instances in the job. Generated instance IDs for tasks will be in the range - * [0, instances). - */ - INSTANCE_COUNT((short)8, "instanceCount"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 9: // KEY - return KEY; - case 7: // OWNER - return OWNER; - case 4: // CRON_SCHEDULE - return CRON_SCHEDULE; - case 5: // CRON_COLLISION_POLICY - return CRON_COLLISION_POLICY; - case 6: // TASK_CONFIG - return TASK_CONFIG; - case 8: // INSTANCE_COUNT - return INSTANCE_COUNT; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __INSTANCECOUNT_ISSET_ID = 0; - private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.CRON_SCHEDULE}; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobKey.class))); - tmpMap.put(_Fields.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Identity.class))); - tmpMap.put(_Fields.CRON_SCHEDULE, new org.apache.thrift.meta_data.FieldMetaData("cronSchedule", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.CRON_COLLISION_POLICY, new org.apache.thrift.meta_data.FieldMetaData("cronCollisionPolicy", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CronCollisionPolicy.class))); - tmpMap.put(_Fields.TASK_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("taskConfig", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConfig.class))); - tmpMap.put(_Fields.INSTANCE_COUNT, new org.apache.thrift.meta_data.FieldMetaData("instanceCount", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobConfiguration.class, metaDataMap); - } - - public JobConfiguration() { - } - - public JobConfiguration( - JobKey key, - Identity owner, - CronCollisionPolicy cronCollisionPolicy, - TaskConfig taskConfig, - int instanceCount) - { - this(); - this.key = key; - this.owner = owner; - this.cronCollisionPolicy = cronCollisionPolicy; - this.taskConfig = taskConfig; - this.instanceCount = instanceCount; - setInstanceCountIsSet(true); - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public JobConfiguration(JobConfiguration other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetKey()) { - this.key = new JobKey(other.key); - } - if (other.isSetOwner()) { - this.owner = new Identity(other.owner); - } - if (other.isSetCronSchedule()) { - this.cronSchedule = other.cronSchedule; - } - if (other.isSetCronCollisionPolicy()) { - this.cronCollisionPolicy = other.cronCollisionPolicy; - } - if (other.isSetTaskConfig()) { - this.taskConfig = new TaskConfig(other.taskConfig); - } - this.instanceCount = other.instanceCount; - } - - public JobConfiguration deepCopy() { - return new JobConfiguration(this); - } - - @Override - public void clear() { - this.key = null; - this.owner = null; - this.cronSchedule = null; - this.cronCollisionPolicy = null; - this.taskConfig = null; - setInstanceCountIsSet(false); - this.instanceCount = 0; - } - - /** - * Key for this job. If not specified name, owner.role, and a reasonable default environment are - * used to construct it server-side. - */ - public JobKey getKey() { - return this.key; - } - - /** - * Key for this job. If not specified name, owner.role, and a reasonable default environment are - * used to construct it server-side. - */ - public JobConfiguration setKey(JobKey key) { - this.key = key; - return this; - } - - public void unsetKey() { - this.key = null; - } - - /** Returns true if field key is set (has been assigned a value) and false otherwise */ - public boolean isSetKey() { - return this.key != null; - } - - public void setKeyIsSet(boolean value) { - if (!value) { - this.key = null; - } - } - - /** - * Owner of this job. - */ - public Identity getOwner() { - return this.owner; - } - - /** - * Owner of this job. - */ - public JobConfiguration setOwner(Identity owner) { - this.owner = owner; - return this; - } - - public void unsetOwner() { - this.owner = null; - } - - /** Returns true if field owner is set (has been assigned a value) and false otherwise */ - public boolean isSetOwner() { - return this.owner != null; - } - - public void setOwnerIsSet(boolean value) { - if (!value) { - this.owner = null; - } - } - - /** - * If present, the job will be handled as a cron job with this crontab-syntax schedule. - */ - public String getCronSchedule() { - return this.cronSchedule; - } - - /** - * If present, the job will be handled as a cron job with this crontab-syntax schedule. - */ - public JobConfiguration setCronSchedule(String cronSchedule) { - this.cronSchedule = cronSchedule; - return this; - } - - public void unsetCronSchedule() { - this.cronSchedule = null; - } - - /** Returns true if field cronSchedule is set (has been assigned a value) and false otherwise */ - public boolean isSetCronSchedule() { - return this.cronSchedule != null; - } - - public void setCronScheduleIsSet(boolean value) { - if (!value) { - this.cronSchedule = null; - } - } - - /** - * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. - * - * @see CronCollisionPolicy - */ - public CronCollisionPolicy getCronCollisionPolicy() { - return this.cronCollisionPolicy; - } - - /** - * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. - * - * @see CronCollisionPolicy - */ - public JobConfiguration setCronCollisionPolicy(CronCollisionPolicy cronCollisionPolicy) { - this.cronCollisionPolicy = cronCollisionPolicy; - return this; - } - - public void unsetCronCollisionPolicy() { - this.cronCollisionPolicy = null; - } - - /** Returns true if field cronCollisionPolicy is set (has been assigned a value) and false otherwise */ - public boolean isSetCronCollisionPolicy() { - return this.cronCollisionPolicy != null; - } - - public void setCronCollisionPolicyIsSet(boolean value) { - if (!value) { - this.cronCollisionPolicy = null; - } - } - - /** - * Task configuration for this job. - */ - public TaskConfig getTaskConfig() { - return this.taskConfig; - } - - /** - * Task configuration for this job. - */ - public JobConfiguration setTaskConfig(TaskConfig taskConfig) { - this.taskConfig = taskConfig; - return this; - } - - public void unsetTaskConfig() { - this.taskConfig = null; - } - - /** Returns true if field taskConfig is set (has been assigned a value) and false otherwise */ - public boolean isSetTaskConfig() { - return this.taskConfig != null; - } - - public void setTaskConfigIsSet(boolean value) { - if (!value) { - this.taskConfig = null; - } - } - - /** - * The number of instances in the job. Generated instance IDs for tasks will be in the range - * [0, instances). - */ - public int getInstanceCount() { - return this.instanceCount; - } - - /** - * The number of instances in the job. Generated instance IDs for tasks will be in the range - * [0, instances). - */ - public JobConfiguration setInstanceCount(int instanceCount) { - this.instanceCount = instanceCount; - setInstanceCountIsSet(true); - return this; - } - - public void unsetInstanceCount() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID); - } - - /** Returns true if field instanceCount is set (has been assigned a value) and false otherwise */ - public boolean isSetInstanceCount() { - return EncodingUtils.testBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID); - } - - public void setInstanceCountIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case KEY: - if (value == null) { - unsetKey(); - } else { - setKey((JobKey)value); - } - break; - - case OWNER: - if (value == null) { - unsetOwner(); - } else { - setOwner((Identity)value); - } - break; - - case CRON_SCHEDULE: - if (value == null) { - unsetCronSchedule(); - } else { - setCronSchedule((String)value); - } - break; - - case CRON_COLLISION_POLICY: - if (value == null) { - unsetCronCollisionPolicy(); - } else { - setCronCollisionPolicy((CronCollisionPolicy)value); - } - break; - - case TASK_CONFIG: - if (value == null) { - unsetTaskConfig(); - } else { - setTaskConfig((TaskConfig)value); - } - break; - - case INSTANCE_COUNT: - if (value == null) { - unsetInstanceCount(); - } else { - setInstanceCount((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case KEY: - return getKey(); - - case OWNER: - return getOwner(); - - case CRON_SCHEDULE: - return getCronSchedule(); - - case CRON_COLLISION_POLICY: - return getCronCollisionPolicy(); - - case TASK_CONFIG: - return getTaskConfig(); - - case INSTANCE_COUNT: - return getInstanceCount(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case KEY: - return isSetKey(); - case OWNER: - return isSetOwner(); - case CRON_SCHEDULE: - return isSetCronSchedule(); - case CRON_COLLISION_POLICY: - return isSetCronCollisionPolicy(); - case TASK_CONFIG: - return isSetTaskConfig(); - case INSTANCE_COUNT: - return isSetInstanceCount(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof JobConfiguration) - return this.equals((JobConfiguration)that); - return false; - } - - public boolean equals(JobConfiguration that) { - if (that == null) - return false; - - boolean this_present_key = true && this.isSetKey(); - boolean that_present_key = true && that.isSetKey(); - if (this_present_key || that_present_key) { - if (!(this_present_key && that_present_key)) - return false; - if (!this.key.equals(that.key)) - return false; - } - - boolean this_present_owner = true && this.isSetOwner(); - boolean that_present_owner = true && that.isSetOwner(); - if (this_present_owner || that_present_owner) { - if (!(this_present_owner && that_present_owner)) - return false; - if (!this.owner.equals(that.owner)) - return false; - } - - boolean this_present_cronSchedule = true && this.isSetCronSchedule(); - boolean that_present_cronSchedule = true && that.isSetCronSchedule(); - if (this_present_cronSchedule || that_present_cronSchedule) { - if (!(this_present_cronSchedule && that_present_cronSchedule)) - return false; - if (!this.cronSchedule.equals(that.cronSchedule)) - return false; - } - - boolean this_present_cronCollisionPolicy = true && this.isSetCronCollisionPolicy(); - boolean that_present_cronCollisionPolicy = true && that.isSetCronCollisionPolicy(); - if (this_present_cronCollisionPolicy || that_present_cronCollisionPolicy) { - if (!(this_present_cronCollisionPolicy && that_present_cronCollisionPolicy)) - return false; - if (!this.cronCollisionPolicy.equals(that.cronCollisionPolicy)) - return false; - } - - boolean this_present_taskConfig = true && this.isSetTaskConfig(); - boolean that_present_taskConfig = true && that.isSetTaskConfig(); - if (this_present_taskConfig || that_present_taskConfig) { - if (!(this_present_taskConfig && that_present_taskConfig)) - return false; - if (!this.taskConfig.equals(that.taskConfig)) - return false; - } - - boolean this_present_instanceCount = true; - boolean that_present_instanceCount = true; - if (this_present_instanceCount || that_present_instanceCount) { - if (!(this_present_instanceCount && that_present_instanceCount)) - return false; - if (this.instanceCount != that.instanceCount) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List<Object> list = new ArrayList<Object>(); - - boolean present_key = true && (isSetKey()); - list.add(present_key); - if (present_key) - list.add(key); - - boolean present_owner = true && (isSetOwner()); - list.add(present_owner); - if (present_owner) - list.add(owner); - - boolean present_cronSchedule = true && (isSetCronSchedule()); - list.add(present_cronSchedule); - if (present_cronSchedule) - list.add(cronSchedule); - - boolean present_cronCollisionPolicy = true && (isSetCronCollisionPolicy()); - list.add(present_cronCollisionPolicy); - if (present_cronCollisionPolicy) - list.add(cronCollisionPolicy.getValue()); - - boolean present_taskConfig = true && (isSetTaskConfig()); - list.add(present_taskConfig); - if (present_taskConfig) - list.add(taskConfig); - - boolean present_instanceCount = true; - list.add(present_instanceCount); - if (present_instanceCount) - list.add(instanceCount); - - return list.hashCode(); - } - - @Override - public int compareTo(JobConfiguration other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetKey()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetOwner()).compareTo(other.isSetOwner()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetOwner()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, other.owner); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetCronSchedule()).compareTo(other.isSetCronSchedule()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetCronSchedule()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cronSchedule, other.cronSchedule); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetCronCollisionPolicy()).compareTo(other.isSetCronCollisionPolicy()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetCronCollisionPolicy()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cronCollisionPolicy, other.cronCollisionPolicy); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetTaskConfig()).compareTo(other.isSetTaskConfig()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetTaskConfig()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskConfig, other.taskConfig); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetInstanceCount()).compareTo(other.isSetInstanceCount()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetInstanceCount()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceCount, other.instanceCount); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("JobConfiguration("); - boolean first = true; - - sb.append("key:"); - if (this.key == null) { - sb.append("null"); - } else { - sb.append(this.key); - } - first = false; - if (!first) sb.append(", "); - sb.append("owner:"); - if (this.owner == null) { - sb.append("null"); - } else { - sb.append(this.owner); - } - first = false; - if (isSetCronSchedule()) { - if (!first) sb.append(", "); - sb.append("cronSchedule:"); - if (this.cronSchedule == null) { - sb.append("null"); - } else { - sb.append(this.cronSchedule); - } - first = false; - } - if (!first) sb.append(", "); - sb.append("cronCollisionPolicy:"); - if (this.cronCollisionPolicy == null) { - sb.append("null"); - } else { - sb.append(this.cronCollisionPolicy); - } - first = false; - if (!first) sb.append(", "); - sb.append("taskConfig:"); - if (this.taskConfig == null) { - sb.append("null"); - } else { - sb.append(this.taskConfig); - } - first = false; - if (!first) sb.append(", "); - sb.append("instanceCount:"); - sb.append(this.instanceCount); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (key != null) { - key.validate(); - } - if (owner != null) { - owner.validate(); - } - if (taskConfig != null) { - taskConfig.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class JobConfigurationStandardSchemeFactory implements SchemeFactory { - public JobConfigurationStandardScheme getScheme() { - return new JobConfigurationStandardScheme(); - } - } - - private static class JobConfigurationStandardScheme extends StandardScheme<JobConfiguration> { - - public void read(org.apache.thrift.protocol.TProtocol iprot, JobConfiguration struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 9: // KEY - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.key = new JobKey(); - struct.key.read(iprot); - struct.setKeyIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 7: // OWNER - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.owner = new Identity(); - struct.owner.read(iprot); - struct.setOwnerIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // CRON_SCHEDULE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.cronSchedule = iprot.readString(); - struct.setCronScheduleIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // CRON_COLLISION_POLICY - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.cronCollisionPolicy = org.apache.airavata.cloud.aurora.client.sdk.CronCollisionPolicy.findByValue(iprot.readI32()); - struct.setCronCollisionPolicyIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 6: // TASK_CONFIG - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.taskConfig = new TaskConfig(); - struct.taskConfig.read(iprot); - struct.setTaskConfigIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 8: // INSTANCE_COUNT - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.instanceCount = iprot.readI32(); - struct.setInstanceCountIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, JobConfiguration struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.cronSchedule != null) { - if (struct.isSetCronSchedule()) { - oprot.writeFieldBegin(CRON_SCHEDULE_FIELD_DESC); - oprot.writeString(struct.cronSchedule); - oprot.writeFieldEnd(); - } - } - if (struct.cronCollisionPolicy != null) { - oprot.writeFieldBegin(CRON_COLLISION_POLICY_FIELD_DESC); - oprot.writeI32(struct.cronCollisionPolicy.getValue()); - oprot.writeFieldEnd(); - } - if (struct.taskConfig != null) { - oprot.writeFieldBegin(TASK_CONFIG_FIELD_DESC); - struct.taskConfig.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.owner != null) { - oprot.writeFieldBegin(OWNER_FIELD_DESC); - struct.owner.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(INSTANCE_COUNT_FIELD_DESC); - oprot.writeI32(struct.instanceCount); - oprot.writeFieldEnd(); - if (struct.key != null) { - oprot.writeFieldBegin(KEY_FIELD_DESC); - struct.key.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class JobConfigurationTupleSchemeFactory implements SchemeFactory { - public JobConfigurationTupleScheme getScheme() { - return new JobConfigurationTupleScheme(); - } - } - - private static class JobConfigurationTupleScheme extends TupleScheme<JobConfiguration> { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, JobConfiguration struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetKey()) { - optionals.set(0); - } - if (struct.isSetOwner()) { - optionals.set(1); - } - if (struct.isSetCronSchedule()) { - optionals.set(2); - } - if (struct.isSetCronCollisionPolicy()) { - optionals.set(3); - } - if (struct.isSetTaskConfig()) { - optionals.set(4); - } - if (struct.isSetInstanceCount()) { - optionals.set(5); - } - oprot.writeBitSet(optionals, 6); - if (struct.isSetKey()) { - struct.key.write(oprot); - } - if (struct.isSetOwner()) { - struct.owner.write(oprot); - } - if (struct.isSetCronSchedule()) { - oprot.writeString(struct.cronSchedule); - } - if (struct.isSetCronCollisionPolicy()) { - oprot.writeI32(struct.cronCollisionPolicy.getValue()); - } - if (struct.isSetTaskConfig()) { - struct.taskConfig.write(oprot); - } - if (struct.isSetInstanceCount()) { - oprot.writeI32(struct.instanceCount); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, JobConfiguration struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(6); - if (incoming.get(0)) { - struct.key = new JobKey(); - struct.key.read(iprot); - struct.setKeyIsSet(true); - } - if (incoming.get(1)) { - struct.owner = new Identity(); - struct.owner.read(iprot); - struct.setOwnerIsSet(true); - } - if (incoming.get(2)) { - struct.cronSchedule = iprot.readString(); - struct.setCronScheduleIsSet(true); - } - if (incoming.get(3)) { - struct.cronCollisionPolicy = org.apache.airavata.cloud.aurora.client.sdk.CronCollisionPolicy.findByValue(iprot.readI32()); - struct.setCronCollisionPolicyIsSet(true); - } - if (incoming.get(4)) { - struct.taskConfig = new TaskConfig(); - struct.taskConfig.read(iprot); - struct.setTaskConfigIsSet(true); - } - if (incoming.get(5)) { - struct.instanceCount = iprot.readI32(); - struct.setInstanceCountIsSet(true); - } - } - } - -} -
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java deleted file mode 100644 index 847990f..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java +++ /dev/null @@ -1,666 +0,0 @@ -/** - * - * 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.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.airavata.cloud.aurora.client.sdk; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -/** - * Event marking a state transition in job instance update lifecycle. - */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") -public class JobInstanceUpdateEvent implements org.apache.thrift.TBase<JobInstanceUpdateEvent, JobInstanceUpdateEvent._Fields>, java.io.Serializable, Cloneable, Comparable<JobInstanceUpdateEvent> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobInstanceUpdateEvent"); - - private static final org.apache.thrift.protocol.TField INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceId", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField TIMESTAMP_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("timestampMs", org.apache.thrift.protocol.TType.I64, (short)2); - private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.I32, (short)3); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new JobInstanceUpdateEventStandardSchemeFactory()); - schemes.put(TupleScheme.class, new JobInstanceUpdateEventTupleSchemeFactory()); - } - - /** - * Job instance ID. - */ - public int instanceId; // required - /** - * Epoch timestamp in milliseconds. - */ - public long timestampMs; // required - /** - * Job update action taken on the instance. - * - * @see JobUpdateAction - */ - public JobUpdateAction action; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * Job instance ID. - */ - INSTANCE_ID((short)1, "instanceId"), - /** - * Epoch timestamp in milliseconds. - */ - TIMESTAMP_MS((short)2, "timestampMs"), - /** - * Job update action taken on the instance. - * - * @see JobUpdateAction - */ - ACTION((short)3, "action"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // INSTANCE_ID - return INSTANCE_ID; - case 2: // TIMESTAMP_MS - return TIMESTAMP_MS; - case 3: // ACTION - return ACTION; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __INSTANCEID_ISSET_ID = 0; - private static final int __TIMESTAMPMS_ISSET_ID = 1; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("instanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.TIMESTAMP_MS, new org.apache.thrift.meta_data.FieldMetaData("timestampMs", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, JobUpdateAction.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobInstanceUpdateEvent.class, metaDataMap); - } - - public JobInstanceUpdateEvent() { - } - - public JobInstanceUpdateEvent( - int instanceId, - long timestampMs, - JobUpdateAction action) - { - this(); - this.instanceId = instanceId; - setInstanceIdIsSet(true); - this.timestampMs = timestampMs; - setTimestampMsIsSet(true); - this.action = action; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public JobInstanceUpdateEvent(JobInstanceUpdateEvent other) { - __isset_bitfield = other.__isset_bitfield; - this.instanceId = other.instanceId; - this.timestampMs = other.timestampMs; - if (other.isSetAction()) { - this.action = other.action; - } - } - - public JobInstanceUpdateEvent deepCopy() { - return new JobInstanceUpdateEvent(this); - } - - @Override - public void clear() { - setInstanceIdIsSet(false); - this.instanceId = 0; - setTimestampMsIsSet(false); - this.timestampMs = 0; - this.action = null; - } - - /** - * Job instance ID. - */ - public int getInstanceId() { - return this.instanceId; - } - - /** - * Job instance ID. - */ - public JobInstanceUpdateEvent setInstanceId(int instanceId) { - this.instanceId = instanceId; - setInstanceIdIsSet(true); - return this; - } - - public void unsetInstanceId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INSTANCEID_ISSET_ID); - } - - /** Returns true if field instanceId is set (has been assigned a value) and false otherwise */ - public boolean isSetInstanceId() { - return EncodingUtils.testBit(__isset_bitfield, __INSTANCEID_ISSET_ID); - } - - public void setInstanceIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INSTANCEID_ISSET_ID, value); - } - - /** - * Epoch timestamp in milliseconds. - */ - public long getTimestampMs() { - return this.timestampMs; - } - - /** - * Epoch timestamp in milliseconds. - */ - public JobInstanceUpdateEvent setTimestampMs(long timestampMs) { - this.timestampMs = timestampMs; - setTimestampMsIsSet(true); - return this; - } - - public void unsetTimestampMs() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID); - } - - /** Returns true if field timestampMs is set (has been assigned a value) and false otherwise */ - public boolean isSetTimestampMs() { - return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID); - } - - public void setTimestampMsIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID, value); - } - - /** - * Job update action taken on the instance. - * - * @see JobUpdateAction - */ - public JobUpdateAction getAction() { - return this.action; - } - - /** - * Job update action taken on the instance. - * - * @see JobUpdateAction - */ - public JobInstanceUpdateEvent setAction(JobUpdateAction action) { - this.action = action; - return this; - } - - public void unsetAction() { - this.action = null; - } - - /** Returns true if field action is set (has been assigned a value) and false otherwise */ - public boolean isSetAction() { - return this.action != null; - } - - public void setActionIsSet(boolean value) { - if (!value) { - this.action = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case INSTANCE_ID: - if (value == null) { - unsetInstanceId(); - } else { - setInstanceId((Integer)value); - } - break; - - case TIMESTAMP_MS: - if (value == null) { - unsetTimestampMs(); - } else { - setTimestampMs((Long)value); - } - break; - - case ACTION: - if (value == null) { - unsetAction(); - } else { - setAction((JobUpdateAction)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case INSTANCE_ID: - return getInstanceId(); - - case TIMESTAMP_MS: - return getTimestampMs(); - - case ACTION: - return getAction(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case INSTANCE_ID: - return isSetInstanceId(); - case TIMESTAMP_MS: - return isSetTimestampMs(); - case ACTION: - return isSetAction(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof JobInstanceUpdateEvent) - return this.equals((JobInstanceUpdateEvent)that); - return false; - } - - public boolean equals(JobInstanceUpdateEvent that) { - if (that == null) - return false; - - boolean this_present_instanceId = true; - boolean that_present_instanceId = true; - if (this_present_instanceId || that_present_instanceId) { - if (!(this_present_instanceId && that_present_instanceId)) - return false; - if (this.instanceId != that.instanceId) - return false; - } - - boolean this_present_timestampMs = true; - boolean that_present_timestampMs = true; - if (this_present_timestampMs || that_present_timestampMs) { - if (!(this_present_timestampMs && that_present_timestampMs)) - return false; - if (this.timestampMs != that.timestampMs) - return false; - } - - boolean this_present_action = true && this.isSetAction(); - boolean that_present_action = true && that.isSetAction(); - if (this_present_action || that_present_action) { - if (!(this_present_action && that_present_action)) - return false; - if (!this.action.equals(that.action)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List<Object> list = new ArrayList<Object>(); - - boolean present_instanceId = true; - list.add(present_instanceId); - if (present_instanceId) - list.add(instanceId); - - boolean present_timestampMs = true; - list.add(present_timestampMs); - if (present_timestampMs) - list.add(timestampMs); - - boolean present_action = true && (isSetAction()); - list.add(present_action); - if (present_action) - list.add(action.getValue()); - - return list.hashCode(); - } - - @Override - public int compareTo(JobInstanceUpdateEvent other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetInstanceId()).compareTo(other.isSetInstanceId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetInstanceId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceId, other.instanceId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetTimestampMs()).compareTo(other.isSetTimestampMs()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetTimestampMs()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestampMs, other.timestampMs); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAction()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("JobInstanceUpdateEvent("); - boolean first = true; - - sb.append("instanceId:"); - sb.append(this.instanceId); - first = false; - if (!first) sb.append(", "); - sb.append("timestampMs:"); - sb.append(this.timestampMs); - first = false; - if (!first) sb.append(", "); - sb.append("action:"); - if (this.action == null) { - sb.append("null"); - } else { - sb.append(this.action); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class JobInstanceUpdateEventStandardSchemeFactory implements SchemeFactory { - public JobInstanceUpdateEventStandardScheme getScheme() { - return new JobInstanceUpdateEventStandardScheme(); - } - } - - private static class JobInstanceUpdateEventStandardScheme extends StandardScheme<JobInstanceUpdateEvent> { - - public void read(org.apache.thrift.protocol.TProtocol iprot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // INSTANCE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.instanceId = iprot.readI32(); - struct.setInstanceIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // TIMESTAMP_MS - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.timestampMs = iprot.readI64(); - struct.setTimestampMsIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // ACTION - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.action = org.apache.airavata.cloud.aurora.client.sdk.JobUpdateAction.findByValue(iprot.readI32()); - struct.setActionIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC); - oprot.writeI32(struct.instanceId); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(TIMESTAMP_MS_FIELD_DESC); - oprot.writeI64(struct.timestampMs); - oprot.writeFieldEnd(); - if (struct.action != null) { - oprot.writeFieldBegin(ACTION_FIELD_DESC); - oprot.writeI32(struct.action.getValue()); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class JobInstanceUpdateEventTupleSchemeFactory implements SchemeFactory { - public JobInstanceUpdateEventTupleScheme getScheme() { - return new JobInstanceUpdateEventTupleScheme(); - } - } - - private static class JobInstanceUpdateEventTupleScheme extends TupleScheme<JobInstanceUpdateEvent> { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetInstanceId()) { - optionals.set(0); - } - if (struct.isSetTimestampMs()) { - optionals.set(1); - } - if (struct.isSetAction()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetInstanceId()) { - oprot.writeI32(struct.instanceId); - } - if (struct.isSetTimestampMs()) { - oprot.writeI64(struct.timestampMs); - } - if (struct.isSetAction()) { - oprot.writeI32(struct.action.getValue()); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.instanceId = iprot.readI32(); - struct.setInstanceIdIsSet(true); - } - if (incoming.get(1)) { - struct.timestampMs = iprot.readI64(); - struct.setTimestampMsIsSet(true); - } - if (incoming.get(2)) { - struct.action = org.apache.airavata.cloud.aurora.client.sdk.JobUpdateAction.findByValue(iprot.readI32()); - struct.setActionIsSet(true); - } - } - } - -} - http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java deleted file mode 100644 index 8c1aa16..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java +++ /dev/null @@ -1,666 +0,0 @@ -/** - * - * 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.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.airavata.cloud.aurora.client.sdk; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -/** - * A unique identifier for a Job. - */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") -public class JobKey implements org.apache.thrift.TBase<JobKey, JobKey._Fields>, java.io.Serializable, Cloneable, Comparable<JobKey> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobKey"); - - private static final org.apache.thrift.protocol.TField ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("role", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField ENVIRONMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("environment", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new JobKeyStandardSchemeFactory()); - schemes.put(TupleScheme.class, new JobKeyTupleSchemeFactory()); - } - - /** - * User role (Unix service account), for example "mesos" - */ - public String role; // required - /** - * Environment, for example "devel" - */ - public String environment; // required - /** - * Name, for example "labrat" - */ - public String name; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * User role (Unix service account), for example "mesos" - */ - ROLE((short)1, "role"), - /** - * Environment, for example "devel" - */ - ENVIRONMENT((short)2, "environment"), - /** - * Name, for example "labrat" - */ - NAME((short)3, "name"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // ROLE - return ROLE; - case 2: // ENVIRONMENT - return ENVIRONMENT; - case 3: // NAME - return NAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.ROLE, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.ENVIRONMENT, new org.apache.thrift.meta_data.FieldMetaData("environment", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobKey.class, metaDataMap); - } - - public JobKey() { - } - - public JobKey( - String role, - String environment, - String name) - { - this(); - this.role = role; - this.environment = environment; - this.name = name; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public JobKey(JobKey other) { - if (other.isSetRole()) { - this.role = other.role; - } - if (other.isSetEnvironment()) { - this.environment = other.environment; - } - if (other.isSetName()) { - this.name = other.name; - } - } - - public JobKey deepCopy() { - return new JobKey(this); - } - - @Override - public void clear() { - this.role = null; - this.environment = null; - this.name = null; - } - - /** - * User role (Unix service account), for example "mesos" - */ - public String getRole() { - return this.role; - } - - /** - * User role (Unix service account), for example "mesos" - */ - public JobKey setRole(String role) { - this.role = role; - return this; - } - - public void unsetRole() { - this.role = null; - } - - /** Returns true if field role is set (has been assigned a value) and false otherwise */ - public boolean isSetRole() { - return this.role != null; - } - - public void setRoleIsSet(boolean value) { - if (!value) { - this.role = null; - } - } - - /** - * Environment, for example "devel" - */ - public String getEnvironment() { - return this.environment; - } - - /** - * Environment, for example "devel" - */ - public JobKey setEnvironment(String environment) { - this.environment = environment; - return this; - } - - public void unsetEnvironment() { - this.environment = null; - } - - /** Returns true if field environment is set (has been assigned a value) and false otherwise */ - public boolean isSetEnvironment() { - return this.environment != null; - } - - public void setEnvironmentIsSet(boolean value) { - if (!value) { - this.environment = null; - } - } - - /** - * Name, for example "labrat" - */ - public String getName() { - return this.name; - } - - /** - * Name, for example "labrat" - */ - public JobKey setName(String name) { - this.name = name; - return this; - } - - public void unsetName() { - this.name = null; - } - - /** Returns true if field name is set (has been assigned a value) and false otherwise */ - public boolean isSetName() { - return this.name != null; - } - - public void setNameIsSet(boolean value) { - if (!value) { - this.name = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case ROLE: - if (value == null) { - unsetRole(); - } else { - setRole((String)value); - } - break; - - case ENVIRONMENT: - if (value == null) { - unsetEnvironment(); - } else { - setEnvironment((String)value); - } - break; - - case NAME: - if (value == null) { - unsetName(); - } else { - setName((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case ROLE: - return getRole(); - - case ENVIRONMENT: - return getEnvironment(); - - case NAME: - return getName(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case ROLE: - return isSetRole(); - case ENVIRONMENT: - return isSetEnvironment(); - case NAME: - return isSetName(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof JobKey) - return this.equals((JobKey)that); - return false; - } - - public boolean equals(JobKey that) { - if (that == null) - return false; - - boolean this_present_role = true && this.isSetRole(); - boolean that_present_role = true && that.isSetRole(); - if (this_present_role || that_present_role) { - if (!(this_present_role && that_present_role)) - return false; - if (!this.role.equals(that.role)) - return false; - } - - boolean this_present_environment = true && this.isSetEnvironment(); - boolean that_present_environment = true && that.isSetEnvironment(); - if (this_present_environment || that_present_environment) { - if (!(this_present_environment && that_present_environment)) - return false; - if (!this.environment.equals(that.environment)) - return false; - } - - boolean this_present_name = true && this.isSetName(); - boolean that_present_name = true && that.isSetName(); - if (this_present_name || that_present_name) { - if (!(this_present_name && that_present_name)) - return false; - if (!this.name.equals(that.name)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List<Object> list = new ArrayList<Object>(); - - boolean present_role = true && (isSetRole()); - list.add(present_role); - if (present_role) - list.add(role); - - boolean present_environment = true && (isSetEnvironment()); - list.add(present_environment); - if (present_environment) - list.add(environment); - - boolean present_name = true && (isSetName()); - list.add(present_name); - if (present_name) - list.add(name); - - return list.hashCode(); - } - - @Override - public int compareTo(JobKey other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetRole()).compareTo(other.isSetRole()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRole()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, other.role); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetEnvironment()).compareTo(other.isSetEnvironment()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEnvironment()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.environment, other.environment); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("JobKey("); - boolean first = true; - - sb.append("role:"); - if (this.role == null) { - sb.append("null"); - } else { - sb.append(this.role); - } - first = false; - if (!first) sb.append(", "); - sb.append("environment:"); - if (this.environment == null) { - sb.append("null"); - } else { - sb.append(this.environment); - } - first = false; - if (!first) sb.append(", "); - sb.append("name:"); - if (this.name == null) { - sb.append("null"); - } else { - sb.append(this.name); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class JobKeyStandardSchemeFactory implements SchemeFactory { - public JobKeyStandardScheme getScheme() { - return new JobKeyStandardScheme(); - } - } - - private static class JobKeyStandardScheme extends StandardScheme<JobKey> { - - public void read(org.apache.thrift.protocol.TProtocol iprot, JobKey struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // ROLE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.role = iprot.readString(); - struct.setRoleIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // ENVIRONMENT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.environment = iprot.readString(); - struct.setEnvironmentIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, JobKey struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.role != null) { - oprot.writeFieldBegin(ROLE_FIELD_DESC); - oprot.writeString(struct.role); - oprot.writeFieldEnd(); - } - if (struct.environment != null) { - oprot.writeFieldBegin(ENVIRONMENT_FIELD_DESC); - oprot.writeString(struct.environment); - oprot.writeFieldEnd(); - } - if (struct.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(struct.name); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class JobKeyTupleSchemeFactory implements SchemeFactory { - public JobKeyTupleScheme getScheme() { - return new JobKeyTupleScheme(); - } - } - - private static class JobKeyTupleScheme extends TupleScheme<JobKey> { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, JobKey struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetRole()) { - optionals.set(0); - } - if (struct.isSetEnvironment()) { - optionals.set(1); - } - if (struct.isSetName()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetRole()) { - oprot.writeString(struct.role); - } - if (struct.isSetEnvironment()) { - oprot.writeString(struct.environment); - } - if (struct.isSetName()) { - oprot.writeString(struct.name); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, JobKey struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.role = iprot.readString(); - struct.setRoleIsSet(true); - } - if (incoming.get(1)) { - struct.environment = iprot.readString(); - struct.setEnvironmentIsSet(true); - } - if (incoming.get(2)) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); - } - } - } - -} -
