You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by pa...@apache.org on 2016/11/21 14:31:15 UTC
[2/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java b/common-types/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
new file mode 100644
index 0000000..a7ca4e4
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
@@ -0,0 +1,96 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Instance list of an extension job used for marshalling / unmarshalling with REST calls.
+ */
+//SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+@XmlRootElement
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class ExtensionInstanceList {
+ @XmlElement
+ public int numEntities;
+
+ @XmlElementWrapper(name = "entitiesSummary")
+ public List<EntitySummary> entitySummary;
+
+ public ExtensionInstanceList() {
+ numEntities = 0;
+ entitySummary = null;
+ }
+
+ public ExtensionInstanceList(int numEntities) {
+ this.numEntities = numEntities;
+ entitySummary = new ArrayList<>();
+ }
+
+ public ExtensionInstanceList(int numEntities, List<EntitySummary> entitySummary) {
+ this.numEntities = numEntities;
+ this.entitySummary = entitySummary;
+ }
+
+ public void addEntitySummary(EntitySummary summary) {
+ entitySummary.add(summary);
+ }
+
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(numEntities + "\n\n");
+ for (EntitySummary summary : entitySummary) {
+ buffer.append(summary.toString());
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Summary of an entity (including entity properties and instances.
+ */
+ public static class EntitySummary {
+ @XmlElement
+ public EntityList.EntityElement entityProfile;
+
+ @XmlElement
+ public InstancesResult.Instance[] instances;
+
+ public EntitySummary() {
+ entityProfile = null;
+ instances = null;
+ }
+
+ public EntitySummary(EntityList.EntityElement entityProfile, InstancesResult.Instance[] instances) {
+ this.entityProfile = entityProfile;
+ this.instances = instances;
+ }
+
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(entityProfile.toString() + "\n");
+ buffer.append(Arrays.toString(instances) + "\n");
+ return buffer.toString();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/ExtensionJobList.java b/common-types/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
new file mode 100644
index 0000000..ca031b5
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
@@ -0,0 +1,98 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Extension job list used for marshalling / unmarshalling with REST calls.
+ */
+//SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+@XmlRootElement
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class ExtensionJobList {
+
+ @XmlElement
+ public int numJobs;
+
+ @XmlElementWrapper(name = "jobs")
+ public List<JobElement> job;
+
+ public ExtensionJobList() {
+ numJobs = 0;
+ job = null;
+ }
+
+ public ExtensionJobList(int numJobs) {
+ this.numJobs = numJobs;
+ job = new ArrayList<JobElement>();
+ }
+
+ public ExtensionJobList(int numJobs, List<JobElement> elements) {
+ this.numJobs = numJobs;
+ this.job = elements;
+ }
+
+ public void addJob(JobElement element) {
+ job.add(element);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(numJobs + "\n\n");
+ for (JobElement element : job) {
+ buffer.append(element.toString());
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Element for a job.
+ */
+ public static class JobElement {
+ @XmlElement
+ public String jobName;
+
+ @XmlElement
+ public EntityList jobEntities;
+
+ public JobElement() {
+ jobName = null;
+ jobEntities = null;
+ }
+
+ public JobElement(String name, EntityList entities) {
+ jobName = name;
+ jobEntities = entities;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Job: " + jobName + ", #. entities: ");
+ buffer.append(jobEntities.toString() + "\n");
+ return buffer.toString();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java b/common-types/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
new file mode 100644
index 0000000..75f0b9a
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
@@ -0,0 +1,155 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import org.apache.commons.io.FileUtils;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Pojo for JAXB marshalling / unmarshalling.
+ */
+//SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+@XmlRootElement
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class FeedInstanceResult extends APIResult {
+
+ @XmlElement
+ private Instance[] instances;
+
+ private FeedInstanceResult() { // for jaxb
+ super();
+ }
+
+ public FeedInstanceResult(String message, Instance[] instances) {
+ this(Status.SUCCEEDED, message, instances);
+ }
+
+ public FeedInstanceResult(Status status, String message,
+ Instance[] inInstances) {
+ super(status, message);
+ this.instances = inInstances;
+ }
+
+ public FeedInstanceResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public Instance[] getInstances() {
+ return instances;
+ }
+
+ public void setInstances(Instance[] instances) {
+ this.instances = instances;
+ }
+
+ @Override
+ public Object[] getCollection() {
+ return getInstances();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setInstances(new Instance[0]);
+ } else {
+ Instance[] newInstances = new Instance[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (Instance)items[index];
+ }
+ setInstances(newInstances);
+ }
+ }
+
+ /**
+ * A single instance object inside instance result.
+ */
+ @XmlRootElement(name = "instance")
+ public static class Instance {
+ @XmlElement
+ public String cluster;
+
+ @XmlElement
+ public String instance;
+
+ @XmlElement
+ public String status;
+
+ @XmlElement
+ public String uri;
+
+ @XmlElement
+ public long creationTime;
+
+ @XmlElement
+ public long size;
+
+ @XmlElement
+ public String sizeH;
+
+ public Instance() {
+ }
+
+ public Instance(String cluster, String instance, String status) {
+ this.cluster = cluster;
+ this.instance = instance;
+ this.status = status;
+ }
+
+ public String getInstance() {
+ return instance;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public long getCreationTime() {
+ return creationTime;
+ }
+
+ public Long getSize() {
+ return size;
+ }
+
+ public String getSizeH(){
+ return FileUtils.byteCountToDisplaySize(size);
+ }
+
+ @Override
+ public String toString() {
+ return "{instance:"
+ + this.instance
+ + ", status:"
+ + this.status
+ + (this.uri == null ? "" : ", uri: " + this.uri)
+ + (this.cluster == null ? "" : ", cluster:" + this.cluster) + "}";
+ }
+ }
+}
+//RESUME CHECKSTYLE CHECK VisibilityModifierCheck
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/FeedLookupResult.java b/common-types/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
new file mode 100644
index 0000000..f8d58ae
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
@@ -0,0 +1,172 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.falcon.entity.v0.feed.LocationType;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Entity list used for marshalling / unmarshalling with REST calls.
+ */
+@XmlRootElement(name = "feeds")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class FeedLookupResult extends APIResult {
+
+ @XmlElement(name = "elements")
+ private FeedProperties[] elements;
+
+ //For JAXB
+ private FeedLookupResult() {
+ super();
+ }
+
+ public FeedLookupResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public FeedProperties[] getElements() {
+ return elements;
+ }
+
+ public void setElements(FeedProperties[] elements) {
+ this.elements = elements;
+ }
+
+
+ @Override
+ public Object[] getCollection() {
+ return getElements();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setElements(new FeedProperties[0]);
+ } else {
+ FeedProperties[] newInstances = new FeedProperties[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (FeedProperties)items[index];
+ }
+ setElements(newInstances);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (elements != null) {
+ for (FeedProperties element : elements) {
+ buffer.append(element.toString());
+ buffer.append("\n");
+ }
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * A single instance in the result.
+ */
+ @XmlRootElement(name = "feed")
+ @XmlAccessorType(XmlAccessType.FIELD)
+ public static class FeedProperties {
+ @XmlElement
+ private String feedName;
+
+ @XmlElement
+ private LocationType locationType;
+
+ @XmlElement
+ private String clusterName;
+
+ public FeedProperties(String feedName, LocationType locationType, String clusterName){
+ this.clusterName = clusterName;
+ this.locationType = locationType;
+ this.feedName = feedName;
+ }
+
+ //for JAXB
+ private FeedProperties(){}
+
+ public void setFeedName(String feedName) {
+ this.feedName = feedName;
+ }
+
+ public void setLocationType(LocationType locationType) {
+ this.locationType = locationType;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public String getFeedName() {
+ return this.feedName;
+ }
+
+ public LocationType getLocationType() {
+ return this.locationType;
+ }
+
+ public String getClusterName() {
+ return this.clusterName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ FeedProperties that = (FeedProperties) o;
+ if (!StringUtils.equals(clusterName, that.clusterName)) {
+ return false;
+ }
+ if (locationType != that.locationType) {
+ return false;
+ }
+ if (!StringUtils.equals(feedName, that.feedName)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = feedName.hashCode();
+ result = 31 * result + (locationType != null ? locationType.hashCode() : 0);
+ result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return feedName + " (CLUSTER:" + clusterName + ") (LocationType:" + locationType.name() + ")";
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java b/common-types/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
new file mode 100644
index 0000000..0751f12
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Entity list used for marshalling / unmarshalling with REST calls.
+ */
+@XmlRootElement(name = "dependents")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class InstanceDependencyResult extends APIResult {
+
+ @XmlElement(name = "dependencies")
+ private SchedulableEntityInstance[] dependencies;
+
+ //For JAXB
+ private InstanceDependencyResult() {
+ super();
+ }
+
+ public InstanceDependencyResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public SchedulableEntityInstance[] getDependencies() {
+ return dependencies;
+ }
+
+ public void setDependencies(SchedulableEntityInstance[] dependencies) {
+ this.dependencies = dependencies;
+ }
+
+
+ @Override
+ public Object[] getCollection() {
+ return getDependencies();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setDependencies(new SchedulableEntityInstance[0]);
+ } else {
+ SchedulableEntityInstance[] newInstances = new SchedulableEntityInstance[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (SchedulableEntityInstance)items[index];
+ }
+ setDependencies(newInstances);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (dependencies != null) {
+ for (SchedulableEntityInstance element : dependencies) {
+ buffer.append(element.toString());
+ buffer.append("\n");
+ }
+ }
+ return buffer.toString();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/InstancesResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/InstancesResult.java b/common-types/src/main/java/org/apache/falcon/resource/InstancesResult.java
new file mode 100644
index 0000000..645050c
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/InstancesResult.java
@@ -0,0 +1,261 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+/**
+ * Pojo for JAXB marshalling / unmarshalling.
+ */
+//SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+@XmlRootElement
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class InstancesResult extends APIResult {
+
+ /**
+ * Workflow status as being set in result object.
+ */
+ public static enum WorkflowStatus {
+ WAITING, RUNNING, SUSPENDED, KILLED, FAILED, SUCCEEDED, ERROR, SKIPPED, UNDEFINED, READY, KILLED_OR_IGNORED,
+ TIMEDOUT
+ }
+
+ /**
+ * RestAPI supports filterBy these fields of instance.
+ */
+ public static enum InstanceFilterFields {
+ STATUS, CLUSTER, SOURCECLUSTER, STARTEDAFTER
+ }
+
+ @XmlElement
+ private Instance[] instances;
+
+ private InstancesResult() { // for jaxb
+ super();
+ }
+
+ public InstancesResult(Status status, String message) {
+ super(status, message);
+ }
+
+
+ public Instance[] getInstances() {
+ return instances;
+ }
+
+ public void setInstances(Instance[] instances) {
+ this.instances = instances;
+ }
+
+ @Override
+ public Object[] getCollection() {
+ return getInstances();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setInstances(new Instance[0]);
+ } else {
+ Instance[] newInstances = new Instance[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (Instance)items[index];
+ }
+ setInstances(newInstances);
+ }
+ }
+
+ /**
+ * A single instance object inside instance result.
+ */
+ @XmlRootElement(name = "instance")
+ public static class Instance {
+ @XmlElement
+ public String instance;
+
+ @XmlElement
+ public WorkflowStatus status;
+
+ @XmlElement
+ public String logFile;
+
+ @XmlElement
+ public String cluster;
+
+ @XmlElement
+ public String sourceCluster;
+
+ @XmlElement
+ public Date startTime;
+
+ @XmlElement
+ public Date endTime;
+
+ @XmlElement
+ public int runId;
+
+ @XmlElement
+ public String details;
+
+ @XmlElement
+ public InstanceAction[] actions;
+
+ @XmlElement(name="wfParams")
+ public KeyValuePair[] wfParams;
+
+ public Instance() {
+ }
+
+ public Instance(String cluster, String instance, WorkflowStatus status) {
+ this.cluster = cluster;
+ this.instance = instance;
+ this.status = status;
+ }
+
+ public String getInstance() {
+ return instance;
+ }
+
+ public WorkflowStatus getStatus() {
+ return status;
+ }
+
+ public String getLogFile() {
+ return logFile;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public String getSourceCluster() {
+ return sourceCluster;
+ }
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public int getRunId() {
+ return runId;
+ }
+
+ public InstanceAction[] getActions() {
+ return actions;
+ }
+
+ public String getDetails() {
+ return details;
+ }
+
+ public KeyValuePair[] getWfParams() { return wfParams; }
+
+ @Override
+ public String toString() {
+ return "{instance:"
+ + this.instance
+ + ", status:"
+ + this.status
+ + (this.logFile == null ? "" : ", log:" + this.logFile)
+ + (this.sourceCluster == null ? "" : ", source-cluster:"
+ + this.sourceCluster)
+ + (this.cluster == null ? "" : ", cluster:"
+ + this.cluster) + "}\n";
+ }
+ }
+
+ /**
+ * Instance action inside an instance object.
+ */
+ @XmlRootElement(name = "actions")
+ public static class InstanceAction {
+ @XmlElement
+ public String action;
+ @XmlElement
+ public String status;
+ @XmlElement
+ public String logFile;
+
+ public InstanceAction() {
+ }
+
+ public InstanceAction(String action, String status, String logFile) {
+ this.action = action;
+ this.status = status;
+ this.logFile = logFile;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public String getLogFile() {
+ return logFile;
+ }
+
+ @Override
+ public String toString() {
+ return "{action:" + this.action + ", status:" + this.status
+ + (this.logFile == null ? "" : ", log:" + this.logFile)
+ + "}";
+ }
+ }
+
+ /**
+ * POJO for key value parameters.
+ */
+ @XmlRootElement(name = "params")
+ public static class KeyValuePair {
+ @XmlElement
+ public String key;
+ @XmlElement
+ public String value;
+
+ public KeyValuePair(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public KeyValuePair() { }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return "{key:" + this.key + ", value:" + this.value + "}";
+ }
+ }
+}
+//RESUME CHECKSTYLE CHECK VisibilityModifierCheck
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java b/common-types/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
new file mode 100644
index 0000000..aa0db99
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
@@ -0,0 +1,114 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Map;
+
+/**
+ * Pojo for JAXB marshalling / unmarshalling.
+ */
+
+//SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+@XmlRootElement
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class InstancesSummaryResult extends APIResult {
+
+ /**
+ * RestAPI supports filterBy these fields of instanceSummary.
+ */
+ public static enum InstanceSummaryFilterFields {
+ STATUS, CLUSTER
+ }
+
+ @XmlElement
+ private InstanceSummary[] instancesSummary;
+
+ private InstancesSummaryResult() { // for jaxb
+ super();
+ }
+
+ public InstancesSummaryResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public InstanceSummary[] getInstancesSummary() {
+ return instancesSummary;
+ }
+
+ public void setInstancesSummary(InstanceSummary[] instancesSummary) {
+ this.instancesSummary = instancesSummary;
+ }
+
+ @Override
+ public Object[] getCollection() {
+ return getInstancesSummary();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setInstancesSummary(new InstanceSummary[0]);
+ } else {
+ InstanceSummary[] newInstances = new InstanceSummary[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (InstanceSummary)items[index];
+ }
+ setInstancesSummary(newInstances);
+ }
+ }
+
+ /**
+ * A single instance object inside instance result.
+ */
+ @XmlRootElement(name = "instance-summary")
+ public static class InstanceSummary {
+
+ @XmlElement
+ public String cluster;
+ @XmlElementWrapper(name="map")
+ public Map<String, Long> summaryMap;
+
+ public InstanceSummary() {
+ }
+
+ public InstanceSummary(String cluster, Map<String, Long> summaryMap) {
+ this.cluster = cluster;
+ this.summaryMap = summaryMap;
+ }
+
+ public Map<String, Long> getSummaryMap() {
+ return summaryMap;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ @Override
+ public String toString() {
+ return "cluster: " + (this.cluster == null ? "" : this.cluster)
+ + "summaryMap: " + summaryMap.toString();
+ }
+ }
+
+}
+//RESUME CHECKSTYLE CHECK VisibilityModifierCheck
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/LineageGraphResult.java b/common-types/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
new file mode 100644
index 0000000..0e10e38
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
@@ -0,0 +1,191 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import org.apache.commons.lang3.StringUtils;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * LineageGraphResult is the output returned by all the apis returning a DAG.
+ */
+@XmlRootElement(name = "result")
+@XmlAccessorType (XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class LineageGraphResult {
+
+ private String[] vertices;
+
+ @XmlElement(name="edges")
+ private Edge[] edges;
+
+ private static final JAXBContext JAXB_CONTEXT;
+
+ static {
+ try {
+ JAXB_CONTEXT = JAXBContext.newInstance(LineageGraphResult.class);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public LineageGraphResult() {
+ // default constructor for JAXB
+ }
+
+ /**
+ * A class to represent an edge in a DAG.
+ */
+ @XmlRootElement(name = "edge")
+ @XmlAccessorType(XmlAccessType.FIELD)
+ public static class Edge {
+ @XmlElement
+ private String from;
+ @XmlElement
+ private String to;
+ @XmlElement
+ private String label;
+
+ public Edge() {
+
+ }
+
+ public Edge(String from, String to, String label) {
+ this.from = from;
+ this.to = to;
+ this.label = label;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDotNotation() {
+ StringBuilder result = new StringBuilder();
+ if (StringUtils.isNotBlank(this.from) && StringUtils.isNotBlank(this.to)
+ && StringUtils.isNotBlank(this.label)) {
+ result.append("\"" + this.from +"\"");
+ result.append(" -> ");
+ result.append("\"" + this.to + "\"");
+ result.append(" [ label = \"" + this.label + "\" ] \n");
+ }
+ return result.toString();
+ }
+
+ @Override
+ public String toString() {
+ return getDotNotation();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Edge that = (Edge) o;
+ if (StringUtils.equals(that.getLabel(), label) && StringUtils.equals(that.getFrom(), from)
+ && StringUtils.equals(that.getTo(), to)) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = from != null ? from.hashCode() : 0;
+ result = 31 * result + (to != null ? to.hashCode() : 0);
+ result = 31 * result + (label != null ? label.hashCode() : 0);
+ return result;
+ }
+
+ }
+
+
+ public String getDotNotation() {
+ StringBuilder result = new StringBuilder();
+ result.append("digraph g{ \n");
+ if (this.vertices != null) {
+ for (String v : this.vertices) {
+ result.append("\"" + v + "\"");
+ result.append("\n");
+ }
+ }
+
+ if (this.edges != null) {
+ for (Edge e : this.edges) {
+ result.append(e.getDotNotation());
+ }
+ }
+ result.append("}\n");
+ return result.toString();
+ }
+
+ public String[] getVertices() {
+ return vertices;
+ }
+
+ public void setVertices(String[] vertices) {
+ this.vertices = vertices;
+ }
+
+ public Edge[] getEdges() {
+ return edges;
+ }
+
+ public void setEdges(Edge[] edges) {
+ this.edges = edges;
+ }
+
+
+ @Override
+ public String toString() {
+ return getDotNotation();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java b/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
new file mode 100644
index 0000000..0968734
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
@@ -0,0 +1,175 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.falcon.entity.v0.EntityType;
+import org.apache.falcon.entity.v0.SchemaHelper;
+
+import java.util.Date;
+
+/**
+ * Instance of a Schedulable Entity (Feed/Process).
+ */
+public class SchedulableEntityInstance implements Comparable<SchedulableEntityInstance> {
+
+ public static final String INPUT = "Input";
+ public static final String OUTPUT = "Output";
+
+ private String entityName;
+
+ private String cluster;
+
+ private Date instanceTime;
+
+ private EntityType entityType;
+
+ private String tags;
+
+ //for JAXB
+ private SchedulableEntityInstance() {
+
+ }
+
+ public SchedulableEntityInstance(String entityName, String cluster, Date instanceTime, EntityType type) {
+ this.entityName = entityName;
+ this.cluster = cluster;
+ this.entityType = type;
+ if (instanceTime != null) {
+ this.instanceTime = new Date(instanceTime.getTime());
+ }
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ public void setEntityName(String entityName) {
+ this.entityName = entityName;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(String cluster) {
+ this.cluster = cluster;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public void setEntityType(EntityType entityType) {
+ this.entityType = entityType;
+ }
+
+ public Date getInstanceTime() {
+ return new Date(instanceTime.getTime());
+ }
+
+ public void setInstanceTime(Date instanceTime) {
+ this.instanceTime = new Date(instanceTime.getTime());
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("name: " + entityName
+ + ", type: " + entityType
+ + ", cluster: " + cluster
+ + ", instanceTime: " + SchemaHelper.formatDateUTC(instanceTime));
+ sb.append(", tags: " + ((tags != null) ? tags : ""));
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ SchedulableEntityInstance that = (SchedulableEntityInstance) o;
+
+ if (instanceTime == null ? that.instanceTime != null : !instanceTime.equals(that.instanceTime)) {
+ return false;
+ }
+
+ if (!entityType.equals(that.entityType)) {
+ return false;
+ }
+
+ if (!StringUtils.equals(entityName, that.entityName)) {
+ return false;
+ }
+
+ if (!StringUtils.equals(cluster, that.cluster)) {
+ return false;
+ }
+
+ if (!StringUtils.equals(tags, that.tags)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = instanceTime.hashCode();
+ result = 31 * result + entityName.hashCode();
+ result = 31 * result + entityType.hashCode();
+ result = 31 * result + cluster.hashCode();
+ if (tags != null) {
+ result = 31 * result + tags.hashCode();
+ }
+ return result;
+ }
+
+ @Override
+ public int compareTo(SchedulableEntityInstance o) {
+ int result = this.cluster.compareTo(o.cluster);
+ if (result != 0) {
+ return result;
+ }
+
+ result = this.entityType.compareTo(o.entityType);
+ if (result != 0) {
+ return result;
+ }
+
+ result = this.entityName.compareToIgnoreCase(o.entityName);
+ if (result != 0) {
+ return result;
+ }
+
+ return this.instanceTime.compareTo(o.instanceTime);
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java b/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
new file mode 100644
index 0000000..752c48d
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Arrays;
+
+/**
+ * Instances list used for marshalling / unmarshalling with REST calls.
+ */
+@XmlRootElement(name = "instances")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class SchedulableEntityInstanceResult extends APIResult {
+
+ @XmlElement(name = "instances")
+ private SchedulableEntityInstance[] instances;
+
+ //For JAXB
+ private SchedulableEntityInstanceResult() {
+ super();
+ }
+
+ public SchedulableEntityInstanceResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public SchedulableEntityInstance[] getInstances() {
+ return instances;
+ }
+
+ public void setInstances(SchedulableEntityInstance[] instances) {
+ this.instances = instances;
+ }
+
+
+ @Override
+ public Object[] getCollection() {
+ return getInstances();
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setInstances(new SchedulableEntityInstance[0]);
+ } else {
+ SchedulableEntityInstance[] newInstances = new SchedulableEntityInstance[items.length];
+ for (int index = 0; index < items.length; index++) {
+ newInstances[index] = (SchedulableEntityInstance)items[index];
+ }
+ setInstances(newInstances);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (instances != null) {
+ Arrays.sort(instances);
+ for (SchedulableEntityInstance element : instances) {
+ buffer.append(element.toString());
+ buffer.append("\n");
+ }
+ }
+ return buffer.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/TriageResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/TriageResult.java b/common-types/src/main/java/org/apache/falcon/resource/TriageResult.java
new file mode 100644
index 0000000..131e2e1
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/TriageResult.java
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.resource;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Resut for instance triage.
+ */
+@XmlRootElement(name = "triage")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class TriageResult extends APIResult {
+
+ @XmlElement(name = "triageGraphs")
+ private LineageGraphResult[] triageGraphs;
+
+ //For JAXB
+ private TriageResult() {
+ super();
+ }
+
+ public TriageResult(Status status, String message) {
+ super(status, message);
+ }
+
+
+
+ public LineageGraphResult[] getTriageGraphs() {
+ return triageGraphs;
+ }
+
+ public void setTriageGraphs(LineageGraphResult[] triageGraphs) {
+ this.triageGraphs = triageGraphs;
+ }
+
+
+ @Override
+ public Object[] getCollection() {
+ return getTriageGraphs();
+ }
+
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setTriageGraphs(new LineageGraphResult[0]);
+ } else {
+ LineageGraphResult[] graphs = new LineageGraphResult[items.length];
+ for (int index = 0; index < items.length; index++) {
+ graphs[index] = (LineageGraphResult)items[index];
+ }
+ setTriageGraphs(graphs);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (triageGraphs != null) {
+ for (LineageGraphResult graph : triageGraphs) {
+ buffer.append(graph.getDotNotation());
+ buffer.append("\n\n");
+ }
+ }
+ return buffer.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/cluster-0.1.xsd
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/cluster-0.1.xsd b/common-types/src/main/resources/cluster-0.1.xsd
new file mode 100644
index 0000000..03e9f84
--- /dev/null
+++ b/common-types/src/main/resources/cluster-0.1.xsd
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"
+ targetNamespace="uri:falcon:cluster:0.1" xmlns="uri:falcon:cluster:0.1"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
+ <xs:annotation>
+ <xs:documentation>
+ 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.
+ </xs:documentation>
+ <xs:appinfo>
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.apache.falcon.entity.v0.cluster"/>
+ </jaxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:element name="cluster" type="cluster">
+ </xs:element>
+ <xs:complexType name="cluster">
+ <xs:annotation>
+ <xs:documentation>The cluster contains the definition of different
+ interfaces which are used by Falcon like readonly, write, workflow and messaging.
+ A cluster is referenced by feeds and processes which are on-boarded
+ to Falcon by its name.
+ name: the name of cluster, which must be unique.
+ colo: the name of the colo to which this cluster belongs to.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="KEY_VALUE_PAIR" name="tags" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ tags: a process specifies an optional list of comma separated tags,
+ Key Value Pairs, separated by comma,
+ which is used for classification of processes.
+ Example: consumer=consumer@xyz.com, owner=producer@xyz.com, department=forecasting
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="interfaces" name="interfaces"/>
+ <xs:element type="locations" name="locations"/>
+ <xs:element type="ACL" name="ACL" minOccurs="0" maxOccurs="1"/>
+ <xs:element type="properties" name="properties" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="description"/>
+ <xs:attribute type="xs:string" name="colo" use="required"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+ <xs:complexType name="locations">
+ <xs:annotation>
+ <xs:documentation>A list of locations on cluster.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="location" name="location" maxOccurs="unbounded" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="property">
+ <xs:annotation>
+ <xs:documentation>
+ A key-value pair, which are propagated to the
+ workflow engine.
+ Ideally the Mapred's job queue name (queueName) and
+ JMS impl class nameof messaging engine (brokerImplClass)
+ should be defined here.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="value" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="interface">
+ <xs:annotation>
+ <xs:documentation>
+ An interface specifies the interface type, Falcon uses it to schedule
+ entities in workflow engine, to save and read data from hadoop and to
+ publish messages to messaging engine.
+ endpoint: is the url for each interface; examples: for write it is the
+ url of hdfs (fs.defaultFS) and
+ for workflow it is url of workflow engine like oozie.
+ version: The current runtime version of each interface.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="interfacetype" name="type" use="required"/>
+ <xs:attribute type="xs:string" name="endpoint" use="required"/>
+ <xs:attribute type="xs:string" name="version" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="properties">
+ <xs:annotation>
+ <xs:documentation>
+ A list of property elements.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="location">
+ <xs:annotation>
+ <xs:documentation>
+ Location has the name and the path.
+ name: is the type of locations which can be
+ staging, temp and working only.
+ staging is a mandatory type.
+ path: the hdfs path for each location.
+ Falcon would use the location to do intermediate
+ processing of entities in hdfs and hence Falcon
+ should have read/write/execute permission on these
+ locations.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="cluster-location-type" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="path" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="interfaces">
+ <xs:annotation>
+ <xs:documentation>
+ A list of interfaces.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="interface" name="interface" maxOccurs="unbounded" minOccurs="3"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="interfacetype">
+ <xs:annotation>
+ <xs:documentation>
+ An interface has 6 different interface types: readonly, write,
+ execute, workflow, messaging, registry.
+ readonly specifies the hadoop's hftp address, it's endpoint is the value of
+ dfs.http.address.ex: hftp://corp.namenode:50070/
+ write specifies the interface to write to hdfs, it's endpoint is the value
+ of fs.defaultFS ex: hdfs://corp.namenode:8020
+ execute specifies the interface for job tracker, it's endpoint is the value
+ of mapreduce.jobtracker.address. ex:corp.jt:8021
+ workflow specifies the interface for workflow engine, example of it's
+ endpoint is value for OOZIE_URL.ex: http://corp.oozie:11000/oozie
+ messaging specifies the interface for sending feed availability messages, it's
+ endpoint is broker url with tcp address.ex: tcp://corp.messaging:61616?daemon=true
+ registry specifies the interface for Hcatalog.
+ spark specifies the interface for spark master.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="readonly"/>
+ <xs:enumeration value="write"/>
+ <xs:enumeration value="execute"/>
+ <xs:enumeration value="workflow"/>
+ <xs:enumeration value="messaging"/>
+ <xs:enumeration value="registry"/>
+ <xs:enumeration value="spark"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="IDENTIFIER">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="(([a-zA-Z]([\-a-zA-Z0-9])*){1,39})"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="KEY_VALUE_PAIR">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="([\w_]+=[^,]+)?([,]?[ ]*[\w_]+=[^,]+)*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="ACL">
+ <xs:annotation>
+ <xs:documentation>
+ Access control list for this cluster.
+ owner is the Owner of this entity.
+ group is the one which has access to read - not used at this time.
+ permission is not enforced at this time
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="owner"/>
+ <xs:attribute type="xs:string" name="group"/>
+ <xs:attribute type="xs:string" name="permission" default="*"/>
+ </xs:complexType>
+ <xs:simpleType name="cluster-location-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="staging"/>
+ <xs:enumeration value="working"/>
+ <xs:enumeration value="temp"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/datasource-0.1.xsd
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/datasource-0.1.xsd b/common-types/src/main/resources/datasource-0.1.xsd
new file mode 100644
index 0000000..d78d967
--- /dev/null
+++ b/common-types/src/main/resources/datasource-0.1.xsd
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"
+ targetNamespace="uri:falcon:datasource:0.1" xmlns="uri:falcon:datasource:0.1"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
+ <xs:annotation>
+ <xs:documentation>
+ 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.
+ </xs:documentation>
+ <xs:appinfo>
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.apache.falcon.entity.v0.datasource"/>
+ </jaxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:element name="datasource" type="datasource">
+ </xs:element>
+ <xs:complexType name="datasource">
+ <xs:annotation>
+ <xs:documentation>The datasource contains various information required
+ to connect to a data source like a MySQL datasource or Kafka cluster.
+ A datasource is referenced by feeds that represent an object like
+ Table (or Topic) in the MySQL database (or Kafka Cluster).
+ name: the name of datasource, which must be unique.
+ colo: the name of the colo to which this datasource belongs to.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="KEY_VALUE_PAIR" name="tags" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ tags: a process specifies an optional list of comma separated tags,
+ Key Value Pairs, separated by comma,
+ which is used for classification of datasource entity.
+ Example: consumer=consumer@xyz.com, owner=producer@xyz.com, department=forecasting
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="interfaces" name="interfaces"/>
+ <xs:element type="driver" name="driver" minOccurs="1" maxOccurs="1" />
+ <xs:element type="properties" name="properties" minOccurs="0"/>
+ <xs:element type="ACL" name="ACL" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="colo" use="required"/>
+ <xs:attribute type="xs:string" name="description"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ <xs:attribute type="datasource-type" name="type" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ datasource type could be Relational Databases (MySQL, Oracle etc.), Messgaing systems like
+ Kafka, etc.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:complexType name="property">
+ <xs:annotation>
+ <xs:documentation>
+ A key-value pair to pass in any datasource specific properties.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="value" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="interface">
+ <xs:annotation>
+ <xs:documentation>
+ An interface specifies the interface type (read or write), and an
+ endpoint url. Falcon uses these endpoints to import or export
+ data from datasources.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="driver" name="driver" minOccurs="0" maxOccurs="1" />
+ <xs:element type="credential" name="credential" minOccurs="0" maxOccurs="1"/>
+ <xs:element type="properties" name="properties" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="interfacetype" name="type" use="required"/>
+ <xs:attribute type="xs:string" name="endpoint" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="properties">
+ <xs:annotation>
+ <xs:documentation>
+ A list of property elements.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="interfaces">
+ <xs:annotation>
+ <xs:documentation>
+ A list of interfaces.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="interface" name="interface" maxOccurs="2" minOccurs="1"/>
+ <xs:element type="credential" name="credential" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="interfacetype">
+ <xs:annotation>
+ <xs:documentation>
+ An interface for datasource has 2 different interface types: readonly, write.
+ The readonly endpoint specifies the url/mechanism to use for data IMPORT operation
+ from a datasource while write endpoint specifies the url/mechanism to use for data
+ EXPORT operatrion.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="readonly"/>
+ <xs:enumeration value="write"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="IDENTIFIER">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="(([a-zA-Z]([\-a-zA-Z0-9])*){1,39})"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="KEY_VALUE_PAIR">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="([\w_]+=[^,]+)?([,]?[ ]*[\w_]+=[^,]+)*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="credential">
+ <xs:sequence minOccurs="1" maxOccurs="1" >
+ <xs:element name="userName" minOccurs="1" maxOccurs="1" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The User for the datasource.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="passwordFile" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The FQ path to a file on HDFS containing the datasource
+ server password with 400 permissions. Only the user
+ submitting the job has read access to this file which
+ will be securely passed to the mappers.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="passwordText" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ Plain text password.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="passwordAlias" type="passwordAliasType">
+ <xs:annotation>
+ <xs:documentation>
+ Password alias using hadoop credential store.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="type" type="credentialtype" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="passwordAliasType">
+ <xs:sequence minOccurs="1" maxOccurs="1">
+ <xs:element name="alias" type="xs:string">
+ <xs:annotation>
+ <xs:documentation> Provide password alias. </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="providerPath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>jceks provider HDFS file path </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="credentialtype">
+ <xs:annotation>
+ <xs:documentation>
+ user-password credentials are supported today which can be extended.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="password-file" />
+ <xs:enumeration value="password-text" />
+ <xs:enumeration value="password-alias" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="datasource-type">
+ <xs:annotation>
+ <xs:documentation>
+ The datasource type can be MySQL, ORACLE, Teradata etc.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="mysql"/>
+ <xs:enumeration value="oracle"/>
+ <xs:enumeration value="hsql"/>
+ <xs:enumeration value="postgres"/>
+ <xs:enumeration value="db2"/>
+ <xs:enumeration value="netezza"/>
+ <xs:enumeration value="teradata"/>
+ <xs:enumeration value="generic"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="driver">
+ <xs:annotation>
+ <xs:documentation>
+ Driver information.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence minOccurs="1" maxOccurs="1">
+ <xs:element type="xs:string" name="clazz" minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ Fully qualified class name for the datasource driver used
+ for validating the datasource connection in Falcon.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="xs:string" name="jar" minOccurs="1" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ Path to the connector jar files on HDFS thats shipped with the workflow.
+ You'd need to put the connector jar files in oozie sharelib and since this
+ is using all the latest features in sqoop 1.x, requires 1.5 snapshot.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ACL">
+ <xs:annotation>
+ <xs:documentation>
+ Access control list for this Entity.
+ owner is the Owner of this entity.
+ group is the one which has access to read - not used at this time.
+ permission is not enforced at this time
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="owner"/>
+ <xs:attribute type="xs:string" name="group"/>
+ <xs:attribute type="xs:string" name="permission" default="*"/>
+ </xs:complexType>
+</xs:schema>