http://git-wip-us.apache.org/repos/asf/airavata/blob/1fe3d1d8/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/JobStatusChangeEvent.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/JobStatusChangeEvent.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/JobStatusChangeEvent.java new file mode 100644 index 0000000..3d26458 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/JobStatusChangeEvent.java @@ -0,0 +1,610 @@ +/** + * 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) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.messaging.event; + +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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings("all") public class JobStatusChangeEvent implements org.apache.thrift.TBase<JobStatusChangeEvent, JobStatusChangeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<JobStatusChangeEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobStatusChangeEvent"); + + private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField JOB_IDENTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("jobIdentity", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField JOB_MONITOR_FIELD_DESC = new org.apache.thrift.protocol.TField("jobMonitor", org.apache.thrift.protocol.TType.STRUCT, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobStatusChangeEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobStatusChangeEventTupleSchemeFactory()); + } + + private org.apache.airavata.model.workspace.experiment.JobState state; // required + private JobIdentity jobIdentity; // required + private JobMonitor jobMonitor; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see org.apache.airavata.model.workspace.experiment.JobState + */ + STATE((short)1, "state"), + JOB_IDENTITY((short)2, "jobIdentity"), + JOB_MONITOR((short)3, "jobMonitor"); + + 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: // STATE + return STATE; + case 2: // JOB_IDENTITY + return JOB_IDENTITY; + case 3: // JOB_MONITOR + return JOB_MONITOR; + 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.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.airavata.model.workspace.experiment.JobState.class))); + tmpMap.put(_Fields.JOB_IDENTITY, new org.apache.thrift.meta_data.FieldMetaData("jobIdentity", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobIdentity.class))); + tmpMap.put(_Fields.JOB_MONITOR, new org.apache.thrift.meta_data.FieldMetaData("jobMonitor", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobMonitor.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobStatusChangeEvent.class, metaDataMap); + } + + public JobStatusChangeEvent() { + } + + public JobStatusChangeEvent( + org.apache.airavata.model.workspace.experiment.JobState state, + JobIdentity jobIdentity, + JobMonitor jobMonitor) + { + this(); + this.state = state; + this.jobIdentity = jobIdentity; + this.jobMonitor = jobMonitor; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobStatusChangeEvent(JobStatusChangeEvent other) { + if (other.isSetState()) { + this.state = other.state; + } + if (other.isSetJobIdentity()) { + this.jobIdentity = new JobIdentity(other.jobIdentity); + } + if (other.isSetJobMonitor()) { + this.jobMonitor = new JobMonitor(other.jobMonitor); + } + } + + public JobStatusChangeEvent deepCopy() { + return new JobStatusChangeEvent(this); + } + + @Override + public void clear() { + this.state = null; + this.jobIdentity = null; + this.jobMonitor = null; + } + + /** + * + * @see org.apache.airavata.model.workspace.experiment.JobState + */ + public org.apache.airavata.model.workspace.experiment.JobState getState() { + return this.state; + } + + /** + * + * @see org.apache.airavata.model.workspace.experiment.JobState + */ + public void setState(org.apache.airavata.model.workspace.experiment.JobState state) { + this.state = state; + } + + public void unsetState() { + this.state = null; + } + + /** Returns true if field state is set (has been assigned a value) and false otherwise */ + public boolean isSetState() { + return this.state != null; + } + + public void setStateIsSet(boolean value) { + if (!value) { + this.state = null; + } + } + + public JobIdentity getJobIdentity() { + return this.jobIdentity; + } + + public void setJobIdentity(JobIdentity jobIdentity) { + this.jobIdentity = jobIdentity; + } + + public void unsetJobIdentity() { + this.jobIdentity = null; + } + + /** Returns true if field jobIdentity is set (has been assigned a value) and false otherwise */ + public boolean isSetJobIdentity() { + return this.jobIdentity != null; + } + + public void setJobIdentityIsSet(boolean value) { + if (!value) { + this.jobIdentity = null; + } + } + + public JobMonitor getJobMonitor() { + return this.jobMonitor; + } + + public void setJobMonitor(JobMonitor jobMonitor) { + this.jobMonitor = jobMonitor; + } + + public void unsetJobMonitor() { + this.jobMonitor = null; + } + + /** Returns true if field jobMonitor is set (has been assigned a value) and false otherwise */ + public boolean isSetJobMonitor() { + return this.jobMonitor != null; + } + + public void setJobMonitorIsSet(boolean value) { + if (!value) { + this.jobMonitor = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATE: + if (value == null) { + unsetState(); + } else { + setState((org.apache.airavata.model.workspace.experiment.JobState)value); + } + break; + + case JOB_IDENTITY: + if (value == null) { + unsetJobIdentity(); + } else { + setJobIdentity((JobIdentity)value); + } + break; + + case JOB_MONITOR: + if (value == null) { + unsetJobMonitor(); + } else { + setJobMonitor((JobMonitor)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATE: + return getState(); + + case JOB_IDENTITY: + return getJobIdentity(); + + case JOB_MONITOR: + return getJobMonitor(); + + } + 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 STATE: + return isSetState(); + case JOB_IDENTITY: + return isSetJobIdentity(); + case JOB_MONITOR: + return isSetJobMonitor(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobStatusChangeEvent) + return this.equals((JobStatusChangeEvent)that); + return false; + } + + public boolean equals(JobStatusChangeEvent that) { + if (that == null) + return false; + + boolean this_present_state = true && this.isSetState(); + boolean that_present_state = true && that.isSetState(); + if (this_present_state || that_present_state) { + if (!(this_present_state && that_present_state)) + return false; + if (!this.state.equals(that.state)) + return false; + } + + boolean this_present_jobIdentity = true && this.isSetJobIdentity(); + boolean that_present_jobIdentity = true && that.isSetJobIdentity(); + if (this_present_jobIdentity || that_present_jobIdentity) { + if (!(this_present_jobIdentity && that_present_jobIdentity)) + return false; + if (!this.jobIdentity.equals(that.jobIdentity)) + return false; + } + + boolean this_present_jobMonitor = true && this.isSetJobMonitor(); + boolean that_present_jobMonitor = true && that.isSetJobMonitor(); + if (this_present_jobMonitor || that_present_jobMonitor) { + if (!(this_present_jobMonitor && that_present_jobMonitor)) + return false; + if (!this.jobMonitor.equals(that.jobMonitor)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(JobStatusChangeEvent other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetState()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetJobIdentity()).compareTo(other.isSetJobIdentity()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJobIdentity()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobIdentity, other.jobIdentity); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetJobMonitor()).compareTo(other.isSetJobMonitor()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJobMonitor()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobMonitor, other.jobMonitor); + 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("JobStatusChangeEvent("); + boolean first = true; + + sb.append("state:"); + if (this.state == null) { + sb.append("null"); + } else { + sb.append(this.state); + } + first = false; + if (!first) sb.append(", "); + sb.append("jobIdentity:"); + if (this.jobIdentity == null) { + sb.append("null"); + } else { + sb.append(this.jobIdentity); + } + first = false; + if (!first) sb.append(", "); + sb.append("jobMonitor:"); + if (this.jobMonitor == null) { + sb.append("null"); + } else { + sb.append(this.jobMonitor); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetState()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'state' is unset! Struct:" + toString()); + } + + if (!isSetJobIdentity()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'jobIdentity' is unset! Struct:" + toString()); + } + + if (!isSetJobMonitor()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'jobMonitor' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (jobIdentity != null) { + jobIdentity.validate(); + } + if (jobMonitor != null) { + jobMonitor.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 { + 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 JobStatusChangeEventStandardSchemeFactory implements SchemeFactory { + public JobStatusChangeEventStandardScheme getScheme() { + return new JobStatusChangeEventStandardScheme(); + } + } + + private static class JobStatusChangeEventStandardScheme extends StandardScheme<JobStatusChangeEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobStatusChangeEvent 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: // STATE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.state = org.apache.airavata.model.workspace.experiment.JobState.findByValue(iprot.readI32()); + struct.setStateIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // JOB_IDENTITY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.jobIdentity = new JobIdentity(); + struct.jobIdentity.read(iprot); + struct.setJobIdentityIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // JOB_MONITOR + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.jobMonitor = new JobMonitor(); + struct.jobMonitor.read(iprot); + struct.setJobMonitorIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, JobStatusChangeEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.state != null) { + oprot.writeFieldBegin(STATE_FIELD_DESC); + oprot.writeI32(struct.state.getValue()); + oprot.writeFieldEnd(); + } + if (struct.jobIdentity != null) { + oprot.writeFieldBegin(JOB_IDENTITY_FIELD_DESC); + struct.jobIdentity.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.jobMonitor != null) { + oprot.writeFieldBegin(JOB_MONITOR_FIELD_DESC); + struct.jobMonitor.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobStatusChangeEventTupleSchemeFactory implements SchemeFactory { + public JobStatusChangeEventTupleScheme getScheme() { + return new JobStatusChangeEventTupleScheme(); + } + } + + private static class JobStatusChangeEventTupleScheme extends TupleScheme<JobStatusChangeEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobStatusChangeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.state.getValue()); + struct.jobIdentity.write(oprot); + struct.jobMonitor.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobStatusChangeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.state = org.apache.airavata.model.workspace.experiment.JobState.findByValue(iprot.readI32()); + struct.setStateIsSet(true); + struct.jobIdentity = new JobIdentity(); + struct.jobIdentity.read(iprot); + struct.setJobIdentityIsSet(true); + struct.jobMonitor = new JobMonitor(); + struct.jobMonitor.read(iprot); + struct.setJobMonitorIsSet(true); + } + } + +} +
http://git-wip-us.apache.org/repos/asf/airavata/blob/1fe3d1d8/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskIdentity.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskIdentity.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskIdentity.java new file mode 100644 index 0000000..91cb600 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskIdentity.java @@ -0,0 +1,588 @@ +/** + * 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) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.messaging.event; + +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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings("all") public class TaskIdentity implements org.apache.thrift.TBase<TaskIdentity, TaskIdentity._Fields>, java.io.Serializable, Cloneable, Comparable<TaskIdentity> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskIdentity"); + + private static final org.apache.thrift.protocol.TField TASK_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("taskId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField WORKFLOW_NODE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("workflowNodeId", org.apache.thrift.protocol.TType.STRING, (short)2); + 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)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TaskIdentityStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TaskIdentityTupleSchemeFactory()); + } + + private String taskId; // required + private String workflowNodeId; // required + private String experimentId; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + TASK_ID((short)1, "taskId"), + WORKFLOW_NODE_ID((short)2, "workflowNodeId"), + EXPERIMENT_ID((short)3, "experimentId"); + + 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: // TASK_ID + return TASK_ID; + case 2: // WORKFLOW_NODE_ID + return WORKFLOW_NODE_ID; + case 3: // EXPERIMENT_ID + return EXPERIMENT_ID; + 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.TASK_ID, new org.apache.thrift.meta_data.FieldMetaData("taskId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.WORKFLOW_NODE_ID, new org.apache.thrift.meta_data.FieldMetaData("workflowNodeId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("experimentId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TaskIdentity.class, metaDataMap); + } + + public TaskIdentity() { + } + + public TaskIdentity( + String taskId, + String workflowNodeId, + String experimentId) + { + this(); + this.taskId = taskId; + this.workflowNodeId = workflowNodeId; + this.experimentId = experimentId; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TaskIdentity(TaskIdentity other) { + if (other.isSetTaskId()) { + this.taskId = other.taskId; + } + if (other.isSetWorkflowNodeId()) { + this.workflowNodeId = other.workflowNodeId; + } + if (other.isSetExperimentId()) { + this.experimentId = other.experimentId; + } + } + + public TaskIdentity deepCopy() { + return new TaskIdentity(this); + } + + @Override + public void clear() { + this.taskId = null; + this.workflowNodeId = null; + this.experimentId = null; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public void unsetTaskId() { + this.taskId = null; + } + + /** Returns true if field taskId is set (has been assigned a value) and false otherwise */ + public boolean isSetTaskId() { + return this.taskId != null; + } + + public void setTaskIdIsSet(boolean value) { + if (!value) { + this.taskId = null; + } + } + + public String getWorkflowNodeId() { + return this.workflowNodeId; + } + + public void setWorkflowNodeId(String workflowNodeId) { + this.workflowNodeId = workflowNodeId; + } + + public void unsetWorkflowNodeId() { + this.workflowNodeId = null; + } + + /** Returns true if field workflowNodeId is set (has been assigned a value) and false otherwise */ + public boolean isSetWorkflowNodeId() { + return this.workflowNodeId != null; + } + + public void setWorkflowNodeIdIsSet(boolean value) { + if (!value) { + this.workflowNodeId = null; + } + } + + public String getExperimentId() { + return this.experimentId; + } + + public void setExperimentId(String experimentId) { + this.experimentId = experimentId; + } + + public void unsetExperimentId() { + this.experimentId = null; + } + + /** Returns true if field experimentId is set (has been assigned a value) and false otherwise */ + public boolean isSetExperimentId() { + return this.experimentId != null; + } + + public void setExperimentIdIsSet(boolean value) { + if (!value) { + this.experimentId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TASK_ID: + if (value == null) { + unsetTaskId(); + } else { + setTaskId((String)value); + } + break; + + case WORKFLOW_NODE_ID: + if (value == null) { + unsetWorkflowNodeId(); + } else { + setWorkflowNodeId((String)value); + } + break; + + case EXPERIMENT_ID: + if (value == null) { + unsetExperimentId(); + } else { + setExperimentId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TASK_ID: + return getTaskId(); + + case WORKFLOW_NODE_ID: + return getWorkflowNodeId(); + + case EXPERIMENT_ID: + return getExperimentId(); + + } + 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 TASK_ID: + return isSetTaskId(); + case WORKFLOW_NODE_ID: + return isSetWorkflowNodeId(); + case EXPERIMENT_ID: + return isSetExperimentId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TaskIdentity) + return this.equals((TaskIdentity)that); + return false; + } + + public boolean equals(TaskIdentity that) { + if (that == null) + return false; + + boolean this_present_taskId = true && this.isSetTaskId(); + boolean that_present_taskId = true && that.isSetTaskId(); + if (this_present_taskId || that_present_taskId) { + if (!(this_present_taskId && that_present_taskId)) + return false; + if (!this.taskId.equals(that.taskId)) + return false; + } + + boolean this_present_workflowNodeId = true && this.isSetWorkflowNodeId(); + boolean that_present_workflowNodeId = true && that.isSetWorkflowNodeId(); + if (this_present_workflowNodeId || that_present_workflowNodeId) { + if (!(this_present_workflowNodeId && that_present_workflowNodeId)) + return false; + if (!this.workflowNodeId.equals(that.workflowNodeId)) + return false; + } + + boolean this_present_experimentId = true && this.isSetExperimentId(); + boolean that_present_experimentId = true && that.isSetExperimentId(); + if (this_present_experimentId || that_present_experimentId) { + if (!(this_present_experimentId && that_present_experimentId)) + return false; + if (!this.experimentId.equals(that.experimentId)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(TaskIdentity other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetTaskId()).compareTo(other.isSetTaskId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTaskId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskId, other.taskId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetWorkflowNodeId()).compareTo(other.isSetWorkflowNodeId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetWorkflowNodeId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workflowNodeId, other.workflowNodeId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExperimentId()).compareTo(other.isSetExperimentId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExperimentId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.experimentId, other.experimentId); + 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("TaskIdentity("); + boolean first = true; + + sb.append("taskId:"); + if (this.taskId == null) { + sb.append("null"); + } else { + sb.append(this.taskId); + } + first = false; + if (!first) sb.append(", "); + sb.append("workflowNodeId:"); + if (this.workflowNodeId == null) { + sb.append("null"); + } else { + sb.append(this.workflowNodeId); + } + first = false; + if (!first) sb.append(", "); + sb.append("experimentId:"); + if (this.experimentId == null) { + sb.append("null"); + } else { + sb.append(this.experimentId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetTaskId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'taskId' is unset! Struct:" + toString()); + } + + if (!isSetWorkflowNodeId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'workflowNodeId' is unset! Struct:" + toString()); + } + + if (!isSetExperimentId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'experimentId' is unset! Struct:" + toString()); + } + + // 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 TaskIdentityStandardSchemeFactory implements SchemeFactory { + public TaskIdentityStandardScheme getScheme() { + return new TaskIdentityStandardScheme(); + } + } + + private static class TaskIdentityStandardScheme extends StandardScheme<TaskIdentity> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TaskIdentity 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: // TASK_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.taskId = iprot.readString(); + struct.setTaskIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // WORKFLOW_NODE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.workflowNodeId = iprot.readString(); + struct.setWorkflowNodeIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // EXPERIMENT_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TaskIdentity struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.taskId != null) { + oprot.writeFieldBegin(TASK_ID_FIELD_DESC); + oprot.writeString(struct.taskId); + oprot.writeFieldEnd(); + } + if (struct.workflowNodeId != null) { + oprot.writeFieldBegin(WORKFLOW_NODE_ID_FIELD_DESC); + oprot.writeString(struct.workflowNodeId); + oprot.writeFieldEnd(); + } + if (struct.experimentId != null) { + oprot.writeFieldBegin(EXPERIMENT_ID_FIELD_DESC); + oprot.writeString(struct.experimentId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TaskIdentityTupleSchemeFactory implements SchemeFactory { + public TaskIdentityTupleScheme getScheme() { + return new TaskIdentityTupleScheme(); + } + } + + private static class TaskIdentityTupleScheme extends TupleScheme<TaskIdentity> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TaskIdentity struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.taskId); + oprot.writeString(struct.workflowNodeId); + oprot.writeString(struct.experimentId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TaskIdentity struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.taskId = iprot.readString(); + struct.setTaskIdIsSet(true); + struct.workflowNodeId = iprot.readString(); + struct.setWorkflowNodeIdIsSet(true); + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/1fe3d1d8/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskStatusChangeEvent.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskStatusChangeEvent.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskStatusChangeEvent.java new file mode 100644 index 0000000..a206f0b --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/TaskStatusChangeEvent.java @@ -0,0 +1,509 @@ +/** + * 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) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.messaging.event; + +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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings("all") public class TaskStatusChangeEvent implements org.apache.thrift.TBase<TaskStatusChangeEvent, TaskStatusChangeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<TaskStatusChangeEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskStatusChangeEvent"); + + private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField TASK_IDENTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("taskIdentity", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TaskStatusChangeEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TaskStatusChangeEventTupleSchemeFactory()); + } + + private org.apache.airavata.model.workspace.experiment.TaskState state; // required + private TaskIdentity taskIdentity; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see org.apache.airavata.model.workspace.experiment.TaskState + */ + STATE((short)1, "state"), + TASK_IDENTITY((short)2, "taskIdentity"); + + 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: // STATE + return STATE; + case 2: // TASK_IDENTITY + return TASK_IDENTITY; + 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.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.airavata.model.workspace.experiment.TaskState.class))); + tmpMap.put(_Fields.TASK_IDENTITY, new org.apache.thrift.meta_data.FieldMetaData("taskIdentity", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskIdentity.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TaskStatusChangeEvent.class, metaDataMap); + } + + public TaskStatusChangeEvent() { + } + + public TaskStatusChangeEvent( + org.apache.airavata.model.workspace.experiment.TaskState state, + TaskIdentity taskIdentity) + { + this(); + this.state = state; + this.taskIdentity = taskIdentity; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TaskStatusChangeEvent(TaskStatusChangeEvent other) { + if (other.isSetState()) { + this.state = other.state; + } + if (other.isSetTaskIdentity()) { + this.taskIdentity = new TaskIdentity(other.taskIdentity); + } + } + + public TaskStatusChangeEvent deepCopy() { + return new TaskStatusChangeEvent(this); + } + + @Override + public void clear() { + this.state = null; + this.taskIdentity = null; + } + + /** + * + * @see org.apache.airavata.model.workspace.experiment.TaskState + */ + public org.apache.airavata.model.workspace.experiment.TaskState getState() { + return this.state; + } + + /** + * + * @see org.apache.airavata.model.workspace.experiment.TaskState + */ + public void setState(org.apache.airavata.model.workspace.experiment.TaskState state) { + this.state = state; + } + + public void unsetState() { + this.state = null; + } + + /** Returns true if field state is set (has been assigned a value) and false otherwise */ + public boolean isSetState() { + return this.state != null; + } + + public void setStateIsSet(boolean value) { + if (!value) { + this.state = null; + } + } + + public TaskIdentity getTaskIdentity() { + return this.taskIdentity; + } + + public void setTaskIdentity(TaskIdentity taskIdentity) { + this.taskIdentity = taskIdentity; + } + + public void unsetTaskIdentity() { + this.taskIdentity = null; + } + + /** Returns true if field taskIdentity is set (has been assigned a value) and false otherwise */ + public boolean isSetTaskIdentity() { + return this.taskIdentity != null; + } + + public void setTaskIdentityIsSet(boolean value) { + if (!value) { + this.taskIdentity = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATE: + if (value == null) { + unsetState(); + } else { + setState((org.apache.airavata.model.workspace.experiment.TaskState)value); + } + break; + + case TASK_IDENTITY: + if (value == null) { + unsetTaskIdentity(); + } else { + setTaskIdentity((TaskIdentity)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATE: + return getState(); + + case TASK_IDENTITY: + return getTaskIdentity(); + + } + 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 STATE: + return isSetState(); + case TASK_IDENTITY: + return isSetTaskIdentity(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TaskStatusChangeEvent) + return this.equals((TaskStatusChangeEvent)that); + return false; + } + + public boolean equals(TaskStatusChangeEvent that) { + if (that == null) + return false; + + boolean this_present_state = true && this.isSetState(); + boolean that_present_state = true && that.isSetState(); + if (this_present_state || that_present_state) { + if (!(this_present_state && that_present_state)) + return false; + if (!this.state.equals(that.state)) + return false; + } + + boolean this_present_taskIdentity = true && this.isSetTaskIdentity(); + boolean that_present_taskIdentity = true && that.isSetTaskIdentity(); + if (this_present_taskIdentity || that_present_taskIdentity) { + if (!(this_present_taskIdentity && that_present_taskIdentity)) + return false; + if (!this.taskIdentity.equals(that.taskIdentity)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(TaskStatusChangeEvent other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetState()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTaskIdentity()).compareTo(other.isSetTaskIdentity()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTaskIdentity()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskIdentity, other.taskIdentity); + 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("TaskStatusChangeEvent("); + boolean first = true; + + sb.append("state:"); + if (this.state == null) { + sb.append("null"); + } else { + sb.append(this.state); + } + first = false; + if (!first) sb.append(", "); + sb.append("taskIdentity:"); + if (this.taskIdentity == null) { + sb.append("null"); + } else { + sb.append(this.taskIdentity); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetState()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'state' is unset! Struct:" + toString()); + } + + if (!isSetTaskIdentity()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'taskIdentity' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (taskIdentity != null) { + taskIdentity.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 { + 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 TaskStatusChangeEventStandardSchemeFactory implements SchemeFactory { + public TaskStatusChangeEventStandardScheme getScheme() { + return new TaskStatusChangeEventStandardScheme(); + } + } + + private static class TaskStatusChangeEventStandardScheme extends StandardScheme<TaskStatusChangeEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TaskStatusChangeEvent 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: // STATE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.state = org.apache.airavata.model.workspace.experiment.TaskState.findByValue(iprot.readI32()); + struct.setStateIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TASK_IDENTITY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.taskIdentity = new TaskIdentity(); + struct.taskIdentity.read(iprot); + struct.setTaskIdentityIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TaskStatusChangeEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.state != null) { + oprot.writeFieldBegin(STATE_FIELD_DESC); + oprot.writeI32(struct.state.getValue()); + oprot.writeFieldEnd(); + } + if (struct.taskIdentity != null) { + oprot.writeFieldBegin(TASK_IDENTITY_FIELD_DESC); + struct.taskIdentity.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TaskStatusChangeEventTupleSchemeFactory implements SchemeFactory { + public TaskStatusChangeEventTupleScheme getScheme() { + return new TaskStatusChangeEventTupleScheme(); + } + } + + private static class TaskStatusChangeEventTupleScheme extends TupleScheme<TaskStatusChangeEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TaskStatusChangeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.state.getValue()); + struct.taskIdentity.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TaskStatusChangeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.state = org.apache.airavata.model.workspace.experiment.TaskState.findByValue(iprot.readI32()); + struct.setStateIsSet(true); + struct.taskIdentity = new TaskIdentity(); + struct.taskIdentity.read(iprot); + struct.setTaskIdentityIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/1fe3d1d8/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/WorkflowIdentity.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/WorkflowIdentity.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/WorkflowIdentity.java new file mode 100644 index 0000000..7c57a56 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/WorkflowIdentity.java @@ -0,0 +1,492 @@ +/** + * 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) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.messaging.event; + +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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings("all") public class WorkflowIdentity implements org.apache.thrift.TBase<WorkflowIdentity, WorkflowIdentity._Fields>, java.io.Serializable, Cloneable, Comparable<WorkflowIdentity> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("WorkflowIdentity"); + + private static final org.apache.thrift.protocol.TField WORKFLOW_NODE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("workflowNodeId", org.apache.thrift.protocol.TType.STRING, (short)1); + 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)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new WorkflowIdentityStandardSchemeFactory()); + schemes.put(TupleScheme.class, new WorkflowIdentityTupleSchemeFactory()); + } + + private String workflowNodeId; // required + private String experimentId; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + WORKFLOW_NODE_ID((short)1, "workflowNodeId"), + EXPERIMENT_ID((short)2, "experimentId"); + + 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: // WORKFLOW_NODE_ID + return WORKFLOW_NODE_ID; + case 2: // EXPERIMENT_ID + return EXPERIMENT_ID; + 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.WORKFLOW_NODE_ID, new org.apache.thrift.meta_data.FieldMetaData("workflowNodeId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("experimentId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(WorkflowIdentity.class, metaDataMap); + } + + public WorkflowIdentity() { + } + + public WorkflowIdentity( + String workflowNodeId, + String experimentId) + { + this(); + this.workflowNodeId = workflowNodeId; + this.experimentId = experimentId; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public WorkflowIdentity(WorkflowIdentity other) { + if (other.isSetWorkflowNodeId()) { + this.workflowNodeId = other.workflowNodeId; + } + if (other.isSetExperimentId()) { + this.experimentId = other.experimentId; + } + } + + public WorkflowIdentity deepCopy() { + return new WorkflowIdentity(this); + } + + @Override + public void clear() { + this.workflowNodeId = null; + this.experimentId = null; + } + + public String getWorkflowNodeId() { + return this.workflowNodeId; + } + + public void setWorkflowNodeId(String workflowNodeId) { + this.workflowNodeId = workflowNodeId; + } + + public void unsetWorkflowNodeId() { + this.workflowNodeId = null; + } + + /** Returns true if field workflowNodeId is set (has been assigned a value) and false otherwise */ + public boolean isSetWorkflowNodeId() { + return this.workflowNodeId != null; + } + + public void setWorkflowNodeIdIsSet(boolean value) { + if (!value) { + this.workflowNodeId = null; + } + } + + public String getExperimentId() { + return this.experimentId; + } + + public void setExperimentId(String experimentId) { + this.experimentId = experimentId; + } + + public void unsetExperimentId() { + this.experimentId = null; + } + + /** Returns true if field experimentId is set (has been assigned a value) and false otherwise */ + public boolean isSetExperimentId() { + return this.experimentId != null; + } + + public void setExperimentIdIsSet(boolean value) { + if (!value) { + this.experimentId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case WORKFLOW_NODE_ID: + if (value == null) { + unsetWorkflowNodeId(); + } else { + setWorkflowNodeId((String)value); + } + break; + + case EXPERIMENT_ID: + if (value == null) { + unsetExperimentId(); + } else { + setExperimentId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case WORKFLOW_NODE_ID: + return getWorkflowNodeId(); + + case EXPERIMENT_ID: + return getExperimentId(); + + } + 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 WORKFLOW_NODE_ID: + return isSetWorkflowNodeId(); + case EXPERIMENT_ID: + return isSetExperimentId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof WorkflowIdentity) + return this.equals((WorkflowIdentity)that); + return false; + } + + public boolean equals(WorkflowIdentity that) { + if (that == null) + return false; + + boolean this_present_workflowNodeId = true && this.isSetWorkflowNodeId(); + boolean that_present_workflowNodeId = true && that.isSetWorkflowNodeId(); + if (this_present_workflowNodeId || that_present_workflowNodeId) { + if (!(this_present_workflowNodeId && that_present_workflowNodeId)) + return false; + if (!this.workflowNodeId.equals(that.workflowNodeId)) + return false; + } + + boolean this_present_experimentId = true && this.isSetExperimentId(); + boolean that_present_experimentId = true && that.isSetExperimentId(); + if (this_present_experimentId || that_present_experimentId) { + if (!(this_present_experimentId && that_present_experimentId)) + return false; + if (!this.experimentId.equals(that.experimentId)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(WorkflowIdentity other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetWorkflowNodeId()).compareTo(other.isSetWorkflowNodeId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetWorkflowNodeId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workflowNodeId, other.workflowNodeId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExperimentId()).compareTo(other.isSetExperimentId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExperimentId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.experimentId, other.experimentId); + 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("WorkflowIdentity("); + boolean first = true; + + sb.append("workflowNodeId:"); + if (this.workflowNodeId == null) { + sb.append("null"); + } else { + sb.append(this.workflowNodeId); + } + first = false; + if (!first) sb.append(", "); + sb.append("experimentId:"); + if (this.experimentId == null) { + sb.append("null"); + } else { + sb.append(this.experimentId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetWorkflowNodeId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'workflowNodeId' is unset! Struct:" + toString()); + } + + if (!isSetExperimentId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'experimentId' is unset! Struct:" + toString()); + } + + // 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 WorkflowIdentityStandardSchemeFactory implements SchemeFactory { + public WorkflowIdentityStandardScheme getScheme() { + return new WorkflowIdentityStandardScheme(); + } + } + + private static class WorkflowIdentityStandardScheme extends StandardScheme<WorkflowIdentity> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, WorkflowIdentity 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: // WORKFLOW_NODE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.workflowNodeId = iprot.readString(); + struct.setWorkflowNodeIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // EXPERIMENT_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, WorkflowIdentity struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.workflowNodeId != null) { + oprot.writeFieldBegin(WORKFLOW_NODE_ID_FIELD_DESC); + oprot.writeString(struct.workflowNodeId); + oprot.writeFieldEnd(); + } + if (struct.experimentId != null) { + oprot.writeFieldBegin(EXPERIMENT_ID_FIELD_DESC); + oprot.writeString(struct.experimentId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class WorkflowIdentityTupleSchemeFactory implements SchemeFactory { + public WorkflowIdentityTupleScheme getScheme() { + return new WorkflowIdentityTupleScheme(); + } + } + + private static class WorkflowIdentityTupleScheme extends TupleScheme<WorkflowIdentity> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, WorkflowIdentity struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.workflowNodeId); + oprot.writeString(struct.experimentId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, WorkflowIdentity struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.workflowNodeId = iprot.readString(); + struct.setWorkflowNodeIdIsSet(true); + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(true); + } + } + +} +
