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:14 UTC
[1/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
Repository: falcon
Updated Branches:
refs/heads/master 3d61e96fa -> 9e25ede1f
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/feed-0.1.xsd
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/feed-0.1.xsd b/common-types/src/main/resources/feed-0.1.xsd
new file mode 100644
index 0000000..cbc97b9
--- /dev/null
+++ b/common-types/src/main/resources/feed-0.1.xsd
@@ -0,0 +1,578 @@
+<?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:feed:0.1" xmlns="uri:falcon:feed: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.feed"/>
+ </jaxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:element name="feed" type="feed">
+ </xs:element>
+ <xs:complexType name="feed">
+ <xs:annotation>
+ <xs:documentation>
+ name: A feed should have a unique name and this name is referenced
+ by processes as input or output feed.
+ tags: a feed specifies an optional list of comma separated tags
+ which is used for classification of data sets.
+ groups: a feed specifies a list of comma separated groups,
+ a group is a logical grouping of feeds and a group is said to be
+ available if all the feeds belonging to a group are available.
+ The frequency of all
+ the feed which belong to the same group
+ must be same.
+ availabilityFlag: specifies the name of a file which when
+ present/created
+ in a feeds data directory, the feed is
+ termed as available. ex: _SUCCESS, if
+ this element is ignored then Falcon would consider the presence of feed's
+ data directory as feed availability.
+ A feed has a
+ frequency and a periodicity which specifies the frequency by which
+ this feed is generated. ex: it can be generated every hour, every 5 minutes, daily, weekly etc.
+ valid frequency type for a feed are minutes, hours, days, months.
+ sla: A feed can have SLA and each SLA has two properties - slaLow and slaHigh. Both slaLow and slaHigh
+ are written using expressions like frequency. slaLow is intended to serve for alerting for feeds which
+ are in danger of missing their availability SLAs. slaHigh is intended to serve for reporting the feeds
+ which missed their SLAs. SLAs are relative to feed instance time.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="KEY_VALUE_PAIR" name="tags" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ tags: a feed 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="partitions" name="partitions" minOccurs="0"/>
+ <xs:element type="group-type" name="groups" minOccurs="0"/>
+ <xs:element type="xs:string" name="availabilityFlag" minOccurs="0"/>
+ <xs:element type="frequency-type" name="frequency"/>
+ <xs:element type="sla" name="sla" minOccurs="0"/>
+ <xs:element name="timezone" minOccurs="0" default="UTC">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="java.util.TimeZone" parseMethod="java.util.TimeZone.getTimeZone"
+ printMethod="org.apache.falcon.entity.v0.SchemaHelper.getTimeZoneId"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element type="late-arrival" name="late-arrival" minOccurs="0"/>
+ <xs:element type="clusters" name="clusters"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element type="locations" name="locations"/>
+ <xs:element type="catalog-table" name="table"/>
+ </xs:choice>
+ <xs:element type="notification" name="notification" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Notification will help to notify the users about the finished status of Falcon
+ Instance. Currently Email type notification is supported and users must specify the receiver's
+ email address.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="ACL" name="ACL"/>
+ <xs:element type="schema" name="schema"/>
+ <xs:element type="properties" name="properties" minOccurs="0"/>
+ <xs:element type="lifecycle" name="lifecycle" minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="description"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+ <xs:complexType name="cluster">
+ <xs:annotation>
+ <xs:documentation>
+ Feed references a cluster by it's name, before submitting a feed all the
+ referenced cluster should be submitted to Falcon.
+ type: specifies whether the
+ referenced cluster should be treated as a
+ source or target for a feed.
+ Validity of a feed on cluster specifies duration for which this feed is
+ valid on this cluster.
+ Retention specifies how long the feed is retained on this cluster and the
+ action to be taken on the feed after the expiry of retention period.
+ The retention limit is
+ specified by expression frequency(times), ex: if
+ feed should be retained for at least 6 hours then retention's limit="hours(6)".
+ The field partitionExp contains
+ partition tags. Number of partition tags has to be equal to number of partitions specified in feed
+ schema.
+ A partition tag can be a wildcard(*), a static string or
+ an expression. Atleast one of the strings has to be an expression.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="validity" name="validity"/>
+ <xs:element type="retention" name="retention"/>
+ <xs:element type="sla" name="sla" minOccurs="0" maxOccurs="1"/>
+ <xs:element type="import" name="import" minOccurs="0" maxOccurs="1"/>
+ <xs:element type="export" name="export" minOccurs="0" maxOccurs="1"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element type="locations" name="locations" minOccurs="0"/>
+ <xs:element type="catalog-table" name="table"/>
+ </xs:choice>
+ <xs:element type="lifecycle" name="lifecycle" minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="cluster-type" name="type" use="optional"/>
+ <xs:attribute type="xs:string" name="partition" use="optional"/>
+ <xs:attribute type="frequency-type" name="delay" use="optional" />
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+ <xs:complexType name="partitions">
+ <xs:annotation>
+ <xs:documentation>
+ A list of partition, which is the logical partition of a feed and this
+ is maintained in Hcatalog registry.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="partition" name="partition" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="schema">
+ <xs:annotation>
+ <xs:documentation>A schema specifies the location of a schema file
+ for a feed and the provider of schema like protobuf, thrift etc.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="location" use="required"/>
+ <xs:attribute type="xs:string" name="provider" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="properties">
+ <xs:annotation>
+ <xs:documentation>
+ A list of name-value pair of property.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="validity">
+ <xs:annotation>
+ <xs:documentation>
+ A validity has a start, which is the validity start date and end the
+ validity
+ end date. ex: start="2011-11-01T00:00Z" in TZ format.
+ timezone can be UTC,
+ GMT.
+ Processes referring this feed would consider the validity period for
+ validation.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="date-time-type" name="start" use="required"/>
+ <xs:attribute type="date-time-type" name="end" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="sla">
+ <xs:annotation>
+ <xs:documentation>
+ sla has two properties - slaLow and slaHigh. Both slaLow and slaHigh
+ are written using expressions like frequency. slaLow is intended to serve for alerting for feeds which
+ are in danger of missing their availability SLAs. slaHigh is intended to serve for reporting the feeds
+ which missed their SLAs. SLAs are relative to feed instance time.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="frequency-type" name="slaLow" use="required"/>
+ <xs:attribute type="frequency-type" name="slaHigh" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="locations">
+ <xs:annotation>
+ <xs:documentation>
+ A list of locations on the file system.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="location" name="location"/>
+ </xs:choice>
+ </xs:complexType>
+ <xs:complexType name="late-arrival">
+ <xs:annotation>
+ <xs:documentation>
+ late-arrival specifies the cut-off period till which the feed is
+ expected to arrive late and should be honored be processes referring
+ to it as input
+ feed by rerunning the instances in case
+ the data arrives late with in a cut-off period.
+ The cut-off period is specified by expression
+ frequency(times), ex: if the feed
+ can arrive late
+ upto 8 hours then late-arrival's cut-off="hours(8)"
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="frequency-type" name="cut-off" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="property">
+ <xs:annotation>
+ <xs:documentation>
+ A key-value pair, which are propagated to the
+ workflow engine.
+ </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="clusters">
+ <xs:annotation>
+ <xs:documentation>
+ A list of clusters.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="cluster" name="cluster" maxOccurs="unbounded" minOccurs="1">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="retention">
+ <xs:attribute type="retention-type" name="type" default="instance"/>
+ <xs:attribute type="frequency-type" name="limit" use="required"/>
+ <xs:attribute type="action-type" name="action" use="required"/>
+ </xs:complexType>
+ <xs:simpleType name="retention-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="instance"/>
+ <!-- <xs:enumeration value="age" /> -->
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="location">
+ <xs:annotation>
+ <xs:documentation>
+ location specifies the type of location like data, meta, stats
+ and the corresponding paths for them.
+ A feed should at least define the location for type
+ data, which
+ specifies the HDFS path pattern where the feed is generated
+ periodically. ex: type="data" path="/projects/TrafficHourly/${YEAR}-${MONTH}-${DAY}/traffic"
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="location-type" name="type" use="required"/>
+ <xs:attribute type="non-empty-string" name="path" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="partition">
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="notification">
+ <xs:annotation>
+ <xs:documentation>
+ Notification specifies the "type" of notification to be used to send notification.
+ Currently email based notification type is supported and user can specify the comma
+ separated email address with "to" property.
+ e.g: type="email" to="falcon@localhost,hive@localhost"
+ "limit" property in notification will help to set the frequency of email notification
+ in case of Falcon instance failure. Incase of feed entity limit="attempt" is only supported
+ as there is no retry element.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="email"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="level" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="attempt"/>
+ <xs:enumeration value="instance"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute type="xs:string" name="to" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="ACL">
+ <xs:annotation>
+ <xs:documentation>
+ Access control list for this feed.
+ </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="action-type">
+ <xs:restriction base="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ action type specifies the action that should be taken on a feed
+ when the retention period of a feed expires on a cluster,
+ the only valid action is delete.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:enumeration value="delete"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="lifecycle">
+ <xs:annotation>
+ <xs:documentation>
+ Lifecycle of the feed consists of various stages. For example typical stages of a feed are import,
+ replication, archival, retention and export. All these stages together are called lifecycle of a feed.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:all>
+ <xs:element type="retention-stage" name="retention-stage" minOccurs="0"></xs:element>
+ </xs:all>
+
+ </xs:complexType>
+
+ <xs:simpleType name="cluster-type">
+ <xs:annotation>
+ <xs:documentation>
+ The clusters on feed can be either defined as source or target,
+ a feed
+ should at least have one source cluster defined.
+ the target clusters
+ are used for
+ replication of feed.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="source"/>
+ <xs:enumeration value="target"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="location-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="data"/>
+ <xs:enumeration value="stats"/>
+ <xs:enumeration value="meta"/>
+ <xs:enumeration value="tmp"/>
+ </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="frequency-type">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="org.apache.falcon.entity.v0.Frequency"
+ parseMethod="org.apache.falcon.entity.v0.Frequency.fromString"
+ printMethod="org.apache.falcon.entity.v0.Frequency.toString"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="(minutes|hours|days|months)\([1-9]\d*\)"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="date-time-type">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="java.util.Date" parseMethod="org.apache.falcon.entity.v0.SchemaHelper.parseDateUTC"
+ printMethod="org.apache.falcon.entity.v0.SchemaHelper.formatDateUTC"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="((19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9]))Z"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="group-type">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="(\w+(,\w+)*)"/>
+ </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="catalog-table">
+ <xs:annotation>
+ <xs:documentation>
+ catalog specifies the uri of a Hive table along with the partition spec.
+ uri="catalog:$database:$table#(partition-key=partition-value);+"
+ Example: catalog:logs-db:clicks#ds=${YEAR}-${MONTH}-${DAY}
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="xs:string" name="uri" use="required"/>
+ </xs:complexType>
+ <xs:simpleType name="non-empty-string">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="import">
+ <xs:sequence>
+ <xs:element type="datasource" name="source"/>
+ <xs:element type="arguments" name="arguments" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="export">
+ <xs:sequence>
+ <xs:element type="datasource" name="target"/>
+ <xs:element type="arguments" name="arguments" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="datasource">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies the source entity name from which data can be imported or exported.
+ This can be Database or other data source types in the future. The connection
+ and authentication details of the data source are defined in the Datasource
+ entity.
+ Table name specifies the table to import or export depending on the action type.
+ Extract type specifies a extraction method (full or incremental).
+ DeltaColumn specifies the column name on source databbase table
+ to identify the new data since the last extraction.
+ Merge type specifies how the data will be organized on Hadoop.
+ The supported types are snapshot (as in a particular time) or append
+ (as in timeseries partitions).
+ Load type specifies if new rows are inserted (load type=insertallowed) into
+ the database table or updated (load type=updateonly). If updateonly load type
+ is specified, then update columns need to be passed via the arguments.
+ Fields can be specified as includes or excludes of fields. If exlusion list
+ is specified, all column except the ones specified will not be imported or exported.
+ If inclusion list is specified, only the specified columns are exported or imported.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element type="extract" name="extract"/>
+ <xs:element type="load" name="load"/>
+ </xs:choice>
+ <xs:element type="fields-type" name="fields" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="non-empty-string" name="name" use="required"/>
+ <xs:attribute type="non-empty-string" name="tableName" use="required"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+ <xs:complexType name="extract">
+ <xs:sequence>
+ <xs:element type="xs:string" name="deltacolumn" minOccurs="0" maxOccurs="1"/>
+ <xs:element type="merge-type" name="mergepolicy" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="extract-method" name="type" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="load">
+ <xs:attribute type="load-method" name="type" use="required"/>
+ </xs:complexType>
+ <xs:simpleType name="extract-method">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="full"/>
+ <xs:enumeration value="incremental"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="load-method">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="updateonly"/>
+ <xs:enumeration value="allowinsert"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="merge-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="snapshot"/>
+ <xs:enumeration value="append"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="fields-type">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies either an include or exclude fields list. If include field list is specified, only
+ the specified fields will be imported. If exclude field list is specified, all fields except
+ the ones specified will be imported from datasource to HDFS.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element type="field-include-exclude" name="includes"/>
+ <xs:element type="field-include-exclude" name="excludes"/>
+ </xs:choice>
+ </xs:complexType>
+ <xs:complexType name="field-include-exclude">
+ <xs:sequence>
+ <xs:element type="xs:string" name="field" maxOccurs="unbounded" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="arguments">
+ <xs:annotation>
+ <xs:documentation>
+ A list of name-value pair of extra arguments to be passed to the concrete implementation.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="argument" name="argument" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="argument">
+ <xs:annotation>
+ <xs:documentation>
+ A key-value pair, which are used while invoking
+ ingestion engines.
+ </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="retention-stage">
+ <xs:annotation>
+ <xs:documentation>
+ Retention stage is the new way to define retention for a feed using feed lifecycle feature. Retention
+ has a configurable policy which does the validation and the real execution through workflow engine.
+ This method of specifying retention gives you more control like using different queue name, priority
+ and execution-order for retention than other lifecycle stages of feed like replication.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:all>
+ <xs:element type="non-empty-string" name="policy" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element type="frequency-type" name="frequency" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element type="xs:string" name="queue" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element type="xs:string" name="priority" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element type="properties" name="properties" minOccurs="0" maxOccurs="1"></xs:element>
+ </xs:all>
+ </xs:complexType>
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/jaxb-binding.xjb
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/jaxb-binding.xjb b/common-types/src/main/resources/jaxb-binding.xjb
new file mode 100644
index 0000000..978145f
--- /dev/null
+++ b/common-types/src/main/resources/jaxb-binding.xjb
@@ -0,0 +1,72 @@
+<?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.
+ -->
+<jaxb:bindings
+ version="2.1"
+ jaxb:extensionBindingPrefixes="xjc jaxb xs inheritance annox"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <jaxb:bindings schemaLocation="cluster-0.1.xsd" node="//xs:complexType[@name='cluster']">
+ <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="cluster-0.1.xsd" node="//xs:complexType[@name='ACL']">
+ <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='feed']">
+ <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='ACL']">
+ <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='notification']">
+ <inheritance:extends>org.apache.falcon.entity.v0.EntityNotification</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='process']">
+ <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='ACL']">
+ <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='notification']">
+ <inheritance:extends>org.apache.falcon.entity.v0.EntityNotification</inheritance:extends>
+ </jaxb:bindings>
+
+
+ <jaxb:bindings schemaLocation="datasource-0.1.xsd" node="//xs:complexType[@name='datasource']">
+ <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="datasource-0.1.xsd" node="//xs:complexType[@name='ACL']">
+ <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
+ </jaxb:bindings>
+
+ <jaxb:globalBindings>
+ <xjc:simple/>
+ </jaxb:globalBindings>
+
+</jaxb:bindings>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/mysql_database.xml
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/mysql_database.xml b/common-types/src/main/resources/mysql_database.xml
new file mode 100644
index 0000000..5f88ba4
--- /dev/null
+++ b/common-types/src/main/resources/mysql_database.xml
@@ -0,0 +1,46 @@
+<?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.
+ -->
+<database colo="west-coast" description="MySQL database on west coast" type="mysql" name="mysql-db" xmlns="uri:falcon:database:0.1">
+ <tags>owner=foobar@ambari.apache.org, consumer=phoe@ambari.apache.org</tags>
+ <interfaces>
+
+ <!-- ***** read interface ***** -->
+ <interface type="readonly" endpoint="jdbc:mysql://c6402/test">
+ <credential type="password-file">
+ <userName>sqoop_user</userName>
+ <passwordFile>/user/ambari-qa/password-store/password_read_user</passwordFile>
+ </credential>
+ </interface>
+
+ <!-- ***** write interface ***** -->
+ <interface type="write" endpoint="jdbc:mysql://c6402/test">
+ <credential type="password-file">
+ <userName>sqoop2_user</userName>
+ <passwordFile>/user/ambari-qa/password-store/password_write_user</passwordFile>
+ </credential>
+ </interface>
+
+ <!-- ***** default credential ***** -->
+ <credential type="password-file">
+ <userName>sqoop2_user</userName>
+ <passwordFile>/user/ambari-qa/password-store/password_write_user</passwordFile>
+ </credential>
+
+ </interfaces>
+</database>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/resources/process-0.1.xsd
----------------------------------------------------------------------
diff --git a/common-types/src/main/resources/process-0.1.xsd b/common-types/src/main/resources/process-0.1.xsd
new file mode 100644
index 0000000..7ed8474
--- /dev/null
+++ b/common-types/src/main/resources/process-0.1.xsd
@@ -0,0 +1,477 @@
+<?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 attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="uri:falcon:process:0.1" xmlns="uri:falcon:process: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.process"/>
+ </jaxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:element name="process" type="process">
+ <xs:annotation>
+ <xs:documentation>
+ A process defines configuration for the workflow job like
+ frequency of the workflow, inputs and outputs for the workflow, how to
+ handle workflow failures, how to handle data that comes late and so on.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="process">
+ <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="PIPELINE_LIST" name="pipelines" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ pipelines: a process specifies an optional list of comma separated pipelines,
+ separated by comma, which is used for classification of processes.
+ Example: dataReplicationPipeline, clickStreamPipeline
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="clusters" name="clusters">
+ <xs:annotation>
+ <xs:documentation>Defines the clusters where the workflow should run
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="parallel">
+ <xs:annotation>
+ <xs:documentation>Defines how many workflow instances can run concurrently
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="12"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element type="execution-type" name="order">
+ <xs:annotation>
+ <xs:documentation>Defines the order in which ready workflow instances should run
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="frequency-type" name="timeout" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Defines time after which instances will no longer be executed
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="frequency-type" name="frequency">
+ <xs:annotation>
+ <xs:documentation>Defines workflow frequency
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="sla" name="sla" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ Defines SLA(Service Level Agreement) for process.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="timezone" minOccurs="0" default="UTC">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="java.util.TimeZone" parseMethod="java.util.TimeZone.getTimeZone"
+ printMethod="org.apache.falcon.entity.v0.SchemaHelper.getTimeZoneId"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element type="inputs" name="inputs" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Defines inputs for the workflow. The workflow will run only when the scheduled
+ time is up and all the inputs are available
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="outputs" name="outputs" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Defines outputs of the workflow
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="properties" name="properties" minOccurs="0">
+ </xs:element>
+ <xs:element type="workflow" name="workflow">
+ <xs:annotation>
+ <xs:documentation>Defines the workflow that should run. The workflow should be defined with respect
+ to the workflow specification of the workflow engine.
+ Only
+ oozie workflow engine is supported as of now. The workflow path is the path on hdfs which
+ contains the workflow xml
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="spark-attributes" name="spark-attributes" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Defines the spark related attributes to run the Spark application. Attributes
+ must be defined when workflow engine "spark" is selected.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="retry" name="retry" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Retry defines how to handle workflow failures. Policy type - periodic, exponential
+ backoff, final along with the delay define how frequently the workflow should be re-tried. Number of
+ attempts define how many times to re-try the failures.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="late-process" name="late-process" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Late process defines how the late data should be handled. Late policy - backoff,
+ exponential backoff, final along with delay
+ define how
+ frequently Falcon should check for late data. The late data handling can be customized for each
+ input separatly.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="notification" name="notification" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Notification will help to notify the users about the finished status of Falcon
+ Instance. Currently Email type notification is supported and users must specify the receiver's
+ email address.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="ACL" name="ACL" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+
+ <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:complexType name="clusters">
+ <xs:annotation>
+ <xs:documentation>
+ A list of clusters.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="cluster" name="cluster" maxOccurs="unbounded" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="cluster">
+ <xs:annotation>
+ <xs:documentation>
+ Defines the cluster where the workflow should run. In addition, it also defines the validity of the
+ workflow on this cluster
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element type="validity" name="validity"/>
+ <xs:element type="sla" name="sla" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
+ </xs:complexType>
+
+ <xs:complexType name="validity">
+ <xs:annotation>
+ <xs:documentation>
+ Defines the vailidity of the workflow as start and end time
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="date-time-type" name="start" use="required"/>
+ <xs:attribute type="date-time-type" name="end" use="required"/>
+ </xs:complexType>
+
+ <xs:simpleType name="date-time-type">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="java.util.Date" parseMethod="org.apache.falcon.entity.v0.SchemaHelper.parseDateUTC"
+ printMethod="org.apache.falcon.entity.v0.SchemaHelper.formatDateUTC"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="((1|2)\d\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9]))Z"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="execution-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="FIFO"/>
+ <xs:enumeration value="LIFO"/>
+ <xs:enumeration value="LAST_ONLY"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="frequency-type">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:javaType name="org.apache.falcon.entity.v0.Frequency"
+ parseMethod="org.apache.falcon.entity.v0.Frequency.fromString"
+ printMethod="org.apache.falcon.entity.v0.Frequency.toString"/>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="(minutes|hours|days|months)\([1-9]\d*\)"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="sla">
+ <xs:annotation>
+ <xs:documentation>
+ sla has 2 optional attributes - shouldStartIn and shouldEndIn. All the attributes
+ are written using expressions like frequency. shouldStartIn is the time in which the process should have
+ started. shouldEndIn is the time in which the process should have finished.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute type="frequency-type" name="shouldStartIn"/>
+ <xs:attribute type="frequency-type" name="shouldEndIn" />
+ </xs:complexType>
+
+ <xs:complexType name="inputs">
+ <xs:sequence>
+ <xs:element type="input" name="input" maxOccurs="unbounded" minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Defines input for the workflow. Each input maps to a feed. Input path and
+ frequency are picked from feed definition.
+ The input specifies the
+ start and end instance for the workflow. Falcon creates a property with input name which
+ contains paths of all input
+ instances between start and end. This
+ property will be available for the workflow to read inputs.
+ Input can also optionally specify the specific partition of feed that the workflow needs.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="input">
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="IDENTIFIER" name="feed" use="required"/>
+ <xs:attribute type="xs:string" name="start" use="required"/>
+ <xs:attribute type="xs:string" name="end" use="required"/>
+ <xs:attribute type="xs:string" name="partition" use="optional"/>
+ <xs:attribute type="xs:boolean" name="optional" use="optional" default="false"/>
+ </xs:complexType>
+
+ <xs:complexType name="outputs">
+ <xs:sequence>
+ <xs:element type="output" name="output" maxOccurs="unbounded" minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Each output maps to a feed. The Output path and frequency are picked from the
+ corresponding feed definition.
+ The output also specifies the
+ instance that is created in terms of EL expression.
+ For each output, Falcon creates a property with the output name which can be used in workflows
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="output">
+ <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+ <xs:attribute type="IDENTIFIER" name="feed" use="required"/>
+ <xs:attribute type="xs:string" name="instance" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="workflow">
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="version" use="optional" default="1.0"/>
+ <xs:attribute type="engine-type" name="engine" use="optional" default="oozie"/>
+ <xs:attribute type="xs:string" name="path" use="required"/>
+ <xs:attribute type="xs:string" name="lib" use="optional"/>
+ </xs:complexType>
+
+ <xs:simpleType name="engine-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="oozie"/>
+ <xs:enumeration value="pig"/>
+ <xs:enumeration value="hive"/>
+ <xs:enumeration value="spark"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="spark-attributes">
+ <xs:annotation>
+ <xs:documentation>
+ List of Spark attributes to run Spark application:
+ master element is optional and indicates the url of the Spark Master. Ex: yarn-client, yarn-master, or local. This will override the Spark interface, if define in cluster entity.
+ mode element if present indicates the mode of spark, where to run spark driver program. Ex: client,cluster.
+ name element indicates the name of the spark application.
+ class element if present, indicates the spark's application main class.
+ jar element indicates a comma separated list of jars or python files. Also provide the jar or file directory path to workflow attribute path
+ spark-opts element if present, contains a list of spark options that can be passed to spark driver.
+ arg element if present, contains arguments that can be passed to spark application.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="master" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="mode" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="class" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="jar" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="spark-opts" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="arg" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="retry">
+ <xs:attribute type="policy-type" name="policy" use="required"/>
+ <xs:attribute type="frequency-type" name="delay" use="required"/>
+ <xs:attribute name="attempts" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:minInclusive value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute type="xs:boolean" name="onTimeout" use="optional" default="false"/>
+ </xs:complexType>
+
+ <xs:simpleType name="policy-type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="periodic"/>
+ <xs:enumeration value="exp-backoff"/>
+ <xs:enumeration value="final"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="late-process">
+ <xs:sequence>
+ <xs:element type="late-input" name="late-input" maxOccurs="unbounded" minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ For each input, defines the workflow that should be run when late data is detected
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute type="policy-type" name="policy" use="required"/>
+ <xs:attribute type="frequency-type" name="delay" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="late-input">
+ <xs:attribute type="IDENTIFIER" name="input" use="required"/>
+ <xs:attribute type="xs:string" name="workflow-path" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="properties">
+ <xs:sequence>
+ <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="property">
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:string" name="value" use="required"/>
+ </xs:complexType>
+
+ <xs:simpleType name="KEY_VALUE_PAIR">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="([\w_]+=[^,]+)?([,]?[ ]*[\w_]+=[^,]+)*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="PIPELINE_LIST">
+ <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 process.
+ 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:complexType name="notification">
+ <xs:annotation>
+ <xs:documentation>
+ Notification specifies the "type" of notification to be used to send notification.
+ Currently email based notification type is supported and user can specify the comma
+ separated email address with "to" property.
+ e.g: type="email" to="falcon@localhost,hive@localhost"
+ "limit" property in notification will help to set the frequency of email notification
+ in case of Falcon instance failure.
+ If limit="attempt" is set, for every instance failure email will be sent.
+ If limit="final" is set, failure email will be sent only when all the attempts has been
+ tried defined with retry element.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="email"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="level" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="attempt"/>
+ <xs:enumeration value="instance"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute type="xs:string" name="to" use="required"/>
+ </xs:complexType>
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
----------------------------------------------------------------------
diff --git a/common-types/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java b/common-types/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
new file mode 100644
index 0000000..a1adb24
--- /dev/null
+++ b/common-types/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
@@ -0,0 +1,83 @@
+/**
+ * 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.entity.v0;
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Date format yyyy/mm/dd validator Testing.
+ */
+public class DateValidatorTest {
+
+ @DataProvider
+ public Object[][] validDateProvider() {
+ return new Object[][]{
+ new Object[]{"2011-11-01T00:00Z", }, new Object[]{"2020-01-01T00:00Z", },
+ new Object[]{"2010-01-31T00:59Z", }, new Object[]{"2020-01-31T00:00Z", },
+ new Object[]{"2008-02-29T01:00Z", }, new Object[]{"2008-02-29T00:00Z", },
+ new Object[]{"2009-02-28T01:01Z", }, new Object[]{"2009-02-28T00:00Z", },
+ new Object[]{"2010-03-31T23:00Z", }, new Object[]{"2010-03-31T00:00Z", },
+ new Object[]{"2010-04-30T23:59Z", }, new Object[]{"2010-04-30T00:00Z", },
+ new Object[]{"2010-05-31T23:23Z", }, new Object[]{"2010-05-31T00:00Z", },
+ new Object[]{"2010-06-30T00:00Z", }, new Object[]{"2010-06-30T00:00Z", },
+ new Object[]{"2010-07-31T00:00Z", }, new Object[]{"2010-07-31T00:00Z", },
+ new Object[]{"2010-08-31T00:00Z", }, new Object[]{"2010-08-31T00:00Z", },
+ new Object[]{"2010-09-30T00:00Z", }, new Object[]{"2010-09-30T00:00Z", },
+ new Object[]{"2010-10-31T00:00Z", }, new Object[]{"2010-10-31T00:00Z", },
+ new Object[]{"2010-11-30T00:00Z", }, new Object[]{"2010-11-30T00:00Z", },
+ new Object[]{"2010-12-31T00:00Z", }, new Object[]{"2010-12-31T00:00Z", },
+ new Object[]{"1999-01-30T01:00Z", }, new Object[]{"2999-12-31T00:00Z", },
+ };
+ }
+
+ @DataProvider
+ public Object[][] invalidDateProvider() {
+ return new Object[][]{
+ new Object[]{"2010-12-31T00:60Z", }, new Object[]{"2010-12-31T24:00Z", },
+ new Object[]{"2010-01-32T00:00Z", }, new Object[]{"2020-01-32T00:00Z", },
+ new Object[]{"2010-13-1T00:00Z", }, new Object[]{"1820-01-01T00:00Z", },
+ new Object[]{"2007-2-29T00:00Z", }, new Object[]{"2007-02-29T00:00Z", },
+ new Object[]{"2008-2-30T00:00Z", }, new Object[]{"2008-02-31T00:00Z", },
+ new Object[]{"2008-a-29T00:00Z", }, new Object[]{"2008-02aT00:00Z", },
+ new Object[]{"2008-2-333T00:00Z", }, new Object[]{"200a-02-29T00:00Z", },
+ new Object[]{"2010-4-31T00:00Z", }, new Object[]{"2010-04-31T00:00Z", },
+ new Object[]{"2010-6-31T00:00Z", }, new Object[]{"2010-06-31T00:00Z", },
+ new Object[]{"2010-9-31T00:00Z", }, new Object[]{"2010-09-31T00:00Z", },
+ new Object[]{"2010-11-31T00:00Z", }, new Object[]{"1999-04-31T01:00Z", },
+ new Object[]{null, }, new Object[]{"", }, new Object[]{" ", },
+ };
+ }
+
+ @Test(dataProvider = "validDateProvider")
+ public void validDateTest(String date) {
+ boolean valid = DateValidator.validate(date);
+ System.out.println("Date is valid : " + date + " , " + valid);
+ Assert.assertEquals(valid, true);
+ }
+
+ @Test(dataProvider = "invalidDateProvider",
+ dependsOnMethods = "validDateTest")
+ public void invalidDateTest(String date) {
+ boolean valid = DateValidator.validate(date);
+ System.out.println("Date is valid : " + date + " , " + valid);
+ Assert.assertEquals(valid, false);
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
----------------------------------------------------------------------
diff --git a/common-types/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java b/common-types/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
new file mode 100644
index 0000000..56e442f
--- /dev/null
+++ b/common-types/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
@@ -0,0 +1,37 @@
+/**
+ * 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.entity.v0;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Test frequency.
+ */
+@Test
+public class TestFrequency {
+
+ public void testValidFrequency() {
+ String freqStr = "minutes(10)";
+ Frequency freq = Frequency.fromString(freqStr);
+ Assert.assertEquals(freq.getTimeUnit().name(), "minutes");
+ Assert.assertEquals(freq.getFrequency(), "10");
+ Assert.assertEquals(freq.getFrequencyAsInt(), 10);
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index 96cb7f5..34822aa 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -92,7 +92,8 @@
<dependency>
<groupId>org.apache.falcon</groupId>
- <artifactId>falcon-client</artifactId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/extensions/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 77821ca..df8f35f 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -71,7 +71,8 @@
<dependency>
<groupId>org.apache.falcon</groupId>
- <artifactId>falcon-client</artifactId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/extensions/src/main/java/org/apache/falcon/extensions/ExtensionType.java
----------------------------------------------------------------------
diff --git a/extensions/src/main/java/org/apache/falcon/extensions/ExtensionType.java b/extensions/src/main/java/org/apache/falcon/extensions/ExtensionType.java
deleted file mode 100644
index c4621cc..0000000
--- a/extensions/src/main/java/org/apache/falcon/extensions/ExtensionType.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.extensions;
-
-/**
- * Enum to store ExtensionType.
- */
-public enum ExtensionType {
- TRUSTED("Trusted extension") ,
- CUSTOM("Custom extension");
-
- private final String text;
-
- private ExtensionType(final String text) {
- this.text = text;
- }
- @Override
- public String toString(){
- return text;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/metrics/pom.xml
----------------------------------------------------------------------
diff --git a/metrics/pom.xml b/metrics/pom.xml
index 8188e74..30aff8d 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -52,7 +52,8 @@
</dependency>
<dependency>
<groupId>org.apache.falcon</groupId>
- <artifactId>falcon-client</artifactId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9e4d196..6a15987 100644
--- a/pom.xml
+++ b/pom.xml
@@ -370,6 +370,7 @@
<modules>
<module>falcon-ui</module>
<module>build-tools</module>
+ <module>common-types</module>
<module>client</module>
<module>shell</module>
<module>cli</module>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/prism/pom.xml
----------------------------------------------------------------------
diff --git a/prism/pom.xml b/prism/pom.xml
index 038a3ba..11f3944 100644
--- a/prism/pom.xml
+++ b/prism/pom.xml
@@ -82,7 +82,14 @@
<dependency>
<groupId>org.apache.falcon</groupId>
- <artifactId>falcon-client</artifactId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.falcon</groupId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/test-util/pom.xml
----------------------------------------------------------------------
diff --git a/test-util/pom.xml b/test-util/pom.xml
index 2a0fd6f..6e2303a 100644
--- a/test-util/pom.xml
+++ b/test-util/pom.xml
@@ -68,7 +68,8 @@
<dependency>
<groupId>org.apache.falcon</groupId>
- <artifactId>falcon-client</artifactId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
[5/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
Posted by pa...@apache.org.
FALCON-2187 Refactoring to move entity xsd and jxb bindings to a new nmodule
Author: sandeep <sa...@gmail.com>
Reviewers: @pallavi-rao
Closes #303 from sandeepSamudrala/FALCON-2187 and squashes the following commits:
eed6ff1 [sandeep] FALCON-2187 dummy commit
579d39a [sandeep] FALCON-2187 moving resource folder too from client to common-types as its creating a cyclic dependency from client to extensions to common to client
c4815b7 [sandeep] FALCON-2187 litlle formatting in Tag class
fb8aed9 [sandeep] Merge branch 'master' of https://github.com/apache/falcon into FALCON-2187
846f566 [sandeep] Merge branch 'master' of https://github.com/apache/falcon into FALCON-2187
0b3aff8 [sandeep] FALCON-2187 Moving ExtensionType to common-types
7534497 [sandeep] FALCON-2187 Refactoring to move entity xsd and jxb bindings to a new nmodule
3a7be21 [sandeep] Merge branch 'master' of https://github.com/apache/falcon into FALCON-2187
2baea85 [sandeep] Merge branch 'master' of https://github.com/apache/falcon into FALCON-2187
8aacd75 [sandeep] FALCON-2183 Incorporated review comments
f3d7268 [sandeep] FALCON-2183 Incorporated review comments
11e7b3f [sandeep] FALCON-2183 Extension Builder changes to support new user extensions
250cc46 [sandeep] Merge branch 'master' of https://github.com/apache/falcon
d0393e9 [sandeep] Merge branch 'master' of https://github.com/apache/falcon
a178805 [sandeep] Merge branch 'master' of https://github.com/apache/falcon
d6dc8bf [sandeep] Merge branch 'master' of https://github.com/apache/falcon
1bb8d3c [sandeep] Merge branch 'master' of https://github.com/apache/falcon
c065566 [sandeep] reverting last line changes made
1a4dcd2 [sandeep] rebased and resolved the conflicts from master
271318b [sandeep] FALCON-2097. Adding UT to the new method for getting next instance time with Delay.
a94d4fe [sandeep] rebasing from master
9e68a57 [sandeep] FALCON-298. Feed update with replication delay creates holes
Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/9e25ede1
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/9e25ede1
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/9e25ede1
Branch: refs/heads/master
Commit: 9e25ede1f871ab86db50d4ff4833b0f85901f03d
Parents: 3d61e96
Author: sandeep <sa...@gmail.com>
Authored: Mon Nov 21 20:00:58 2016 +0530
Committer: Pallavi Rao <pa...@inmobi.com>
Committed: Mon Nov 21 20:00:58 2016 +0530
----------------------------------------------------------------------
client/pom.xml | 33 +-
.../main/java/org/apache/falcon/LifeCycle.java | 41 --
.../src/main/java/org/apache/falcon/Pair.java | 78 ---
client/src/main/java/org/apache/falcon/Tag.java | 39 --
.../java/org/apache/falcon/ValidationUtil.java | 2 +-
.../falcon/entity/v0/AccessControlList.java | 40 --
.../apache/falcon/entity/v0/DateValidator.java | 81 ---
.../org/apache/falcon/entity/v0/Entity.java | 98 ----
.../falcon/entity/v0/EntityNotification.java | 35 --
.../org/apache/falcon/entity/v0/EntityType.java | 127 ----
.../org/apache/falcon/entity/v0/Frequency.java | 113 ----
.../apache/falcon/entity/v0/SchemaHelper.java | 71 ---
.../falcon/metadata/RelationshipType.java | 81 ---
.../org/apache/falcon/resource/APIResult.java | 106 ----
.../org/apache/falcon/resource/EntityList.java | 213 -------
.../falcon/resource/EntitySummaryResult.java | 235 --------
.../falcon/resource/ExtensionInstanceList.java | 96 ---
.../falcon/resource/ExtensionJobList.java | 98 ----
.../falcon/resource/FeedInstanceResult.java | 155 -----
.../falcon/resource/FeedLookupResult.java | 172 ------
.../resource/InstanceDependencyResult.java | 86 ---
.../apache/falcon/resource/InstancesResult.java | 261 ---------
.../falcon/resource/InstancesSummaryResult.java | 114 ----
.../falcon/resource/LineageGraphResult.java | 191 ------
.../resource/SchedulableEntityInstance.java | 175 ------
.../SchedulableEntityInstanceResult.java | 86 ---
.../apache/falcon/resource/TriageResult.java | 87 ---
client/src/main/resources/cluster-0.1.xsd | 214 -------
client/src/main/resources/datasource-0.1.xsd | 282 ---------
client/src/main/resources/feed-0.1.xsd | 578 -------------------
client/src/main/resources/jaxb-binding.xjb | 72 ---
client/src/main/resources/mysql_database.xml | 46 --
client/src/main/resources/process-0.1.xsd | 477 ---------------
.../falcon/entity/v0/DateValidatorTest.java | 83 ---
.../apache/falcon/entity/v0/TestFrequency.java | 37 --
common-types/pom.xml | 164 ++++++
.../main/java/org/apache/falcon/LifeCycle.java | 41 ++
.../src/main/java/org/apache/falcon/Pair.java | 78 +++
.../src/main/java/org/apache/falcon/Tag.java | 42 ++
.../falcon/entity/v0/AccessControlList.java | 40 ++
.../apache/falcon/entity/v0/DateValidator.java | 81 +++
.../org/apache/falcon/entity/v0/Entity.java | 98 ++++
.../falcon/entity/v0/EntityNotification.java | 35 ++
.../org/apache/falcon/entity/v0/EntityType.java | 127 ++++
.../org/apache/falcon/entity/v0/Frequency.java | 113 ++++
.../apache/falcon/entity/v0/SchemaHelper.java | 71 +++
.../apache/falcon/extensions/ExtensionType.java | 37 ++
.../falcon/metadata/RelationshipType.java | 81 +++
.../org/apache/falcon/resource/APIResult.java | 106 ++++
.../org/apache/falcon/resource/EntityList.java | 213 +++++++
.../falcon/resource/EntitySummaryResult.java | 235 ++++++++
.../falcon/resource/ExtensionInstanceList.java | 96 +++
.../falcon/resource/ExtensionJobList.java | 98 ++++
.../falcon/resource/FeedInstanceResult.java | 155 +++++
.../falcon/resource/FeedLookupResult.java | 172 ++++++
.../resource/InstanceDependencyResult.java | 86 +++
.../apache/falcon/resource/InstancesResult.java | 261 +++++++++
.../falcon/resource/InstancesSummaryResult.java | 114 ++++
.../falcon/resource/LineageGraphResult.java | 191 ++++++
.../resource/SchedulableEntityInstance.java | 175 ++++++
.../SchedulableEntityInstanceResult.java | 86 +++
.../apache/falcon/resource/TriageResult.java | 87 +++
common-types/src/main/resources/cluster-0.1.xsd | 214 +++++++
.../src/main/resources/datasource-0.1.xsd | 282 +++++++++
common-types/src/main/resources/feed-0.1.xsd | 578 +++++++++++++++++++
.../src/main/resources/jaxb-binding.xjb | 72 +++
.../src/main/resources/mysql_database.xml | 46 ++
common-types/src/main/resources/process-0.1.xsd | 477 +++++++++++++++
.../falcon/entity/v0/DateValidatorTest.java | 83 +++
.../apache/falcon/entity/v0/TestFrequency.java | 37 ++
common/pom.xml | 3 +-
extensions/pom.xml | 3 +-
.../apache/falcon/extensions/ExtensionType.java | 37 --
metrics/pom.xml | 3 +-
pom.xml | 1 +
prism/pom.xml | 9 +-
test-util/pom.xml | 3 +-
77 files changed, 4896 insertions(+), 4738 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 6df9d6d..9daa998 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -41,6 +41,12 @@
</dependency>
<dependency>
+ <groupId>org.apache.falcon</groupId>
+ <artifactId>falcon-common-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
</dependency>
@@ -125,33 +131,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.0</version>
- <executions>
- <execution>
- <id>1</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <args>
- <arg>-extension</arg>
- <arg>-Xinheritance</arg>
- </args>
- <plugins>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-basics</artifactId>
- <version>0.6.3</version>
- </plugin>
- </plugins>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/LifeCycle.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/LifeCycle.java b/client/src/main/java/org/apache/falcon/LifeCycle.java
deleted file mode 100644
index 0ecddd1..0000000
--- a/client/src/main/java/org/apache/falcon/LifeCycle.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon;
-
-/**
- * Represents life cycle of an entity.
- */
-
-public enum LifeCycle {
- EXECUTION(Tag.DEFAULT),
- EVICTION(Tag.RETENTION),
- REPLICATION(Tag.REPLICATION),
- IMPORT(Tag.IMPORT),
- EXPORT(Tag.EXPORT);
-
- private final Tag tag;
-
- LifeCycle(Tag tag) {
- this.tag = tag;
- }
-
- public Tag getTag() {
- return this.tag;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/Pair.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/Pair.java b/client/src/main/java/org/apache/falcon/Pair.java
deleted file mode 100644
index d4cea90..0000000
--- a/client/src/main/java/org/apache/falcon/Pair.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon;
-
-import java.io.Serializable;
-
-/**
- * Simple pair class to hold a pair of object of specific class.
- * @param <A> - First element in pair.
- * @param <B> - Second element in pair
- */
-public class Pair<A, B> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- //SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
- public final A first;
- public final B second;
- //RESUME CHECKSTYLE CHECK VisibilityModifierCheck
-
- public Pair(A fst, B snd) {
- this.first = fst;
- this.second = snd;
- }
-
- public static <A, B> Pair<A, B> of(A a, B b) {
- return new Pair<A, B>(a, b);
- }
-
- @Override
- public String toString() {
- return "(" + first + "," + second + ")";
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- Pair pair = (Pair) o;
-
- if (first != null ? !first.equals(pair.first) : pair.first != null) {
- return false;
- }
- if (second != null ? !second.equals(pair.second) : pair.second != null) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = first != null ? first.hashCode() : 0;
- result = 31 * result + (second != null ? second.hashCode() : 0);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/Tag.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/Tag.java b/client/src/main/java/org/apache/falcon/Tag.java
deleted file mode 100644
index a8d60b6..0000000
--- a/client/src/main/java/org/apache/falcon/Tag.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon;
-
-import org.apache.falcon.entity.v0.EntityType;
-
-/**
- * Tag to include in the entity type.
- */
-public enum Tag {
- DEFAULT(EntityType.PROCESS), RETENTION(EntityType.FEED), REPLICATION(EntityType.FEED),
- IMPORT(EntityType.FEED), EXPORT(EntityType.FEED);
-
- private final EntityType entityType;
-
- private Tag(EntityType entityType) {
- this.entityType = entityType;
- }
-
- public EntityType getType() {
- return entityType;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/ValidationUtil.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/ValidationUtil.java b/client/src/main/java/org/apache/falcon/ValidationUtil.java
index cdf1f05..3db521f 100644
--- a/client/src/main/java/org/apache/falcon/ValidationUtil.java
+++ b/client/src/main/java/org/apache/falcon/ValidationUtil.java
@@ -108,7 +108,7 @@ public final class ValidationUtil {
public static List<LifeCycle> getLifeCycle(String lifeCycleValue) {
if (lifeCycleValue != null) {
String[] lifeCycleValues = lifeCycleValue.split(",");
- List<LifeCycle> lifeCycles = new ArrayList<LifeCycle>();
+ List<LifeCycle> lifeCycles = new ArrayList<>();
try {
for (String lifeCycle : lifeCycleValues) {
lifeCycles.add(LifeCycle.valueOf(lifeCycle.toUpperCase().trim()));
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java b/client/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
deleted file mode 100644
index 89ce6f9..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-/**
- * Access control list for an Entity.
- */
-public abstract class AccessControlList {
-
- public abstract String getOwner();
-
- public abstract String getGroup();
-
- public abstract String getPermission();
-
- @Override
- public String toString() {
- return "AccessControlList{"
- + "owner='" + getOwner() + '\''
- + ", group='" + getGroup() + '\''
- + ", permission='" + getPermission() + '\''
- + '}';
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java b/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
deleted file mode 100644
index e211f57..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.falcon.entity.v0;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Date utility class.
- */
-public final class DateValidator {
-
- private static final String DATE_PATTERN =
- "(2\\d\\d\\d|19\\d\\d)-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9])Z";
- private static final Pattern PATTERN = Pattern.compile(DATE_PATTERN);
-
- private DateValidator() {
- }
-
- /**
- * Validate date format with regular expression.
- *
- * @param date date address for validation
- * @return true valid date fromat, false invalid date format
- */
- public static boolean validate(final String date) {
- if (StringUtils.isBlank(date)) {
- return false;
- }
- Matcher matcher = PATTERN.matcher(date);
-
- if (matcher.matches()) {
-
- matcher.reset();
-
- if (matcher.find()) {
-
- int year = Integer.parseInt(matcher.group(1));
- String month = matcher.group(2);
- String day = matcher.group(3);
-
- if (day.equals("31")
- && (month.equals("4") || month.equals("6")
- || month.equals("9") || month.equals("11")
- || month.equals("04") || month.equals("06") || month.equals("09"))) {
- return false; // only 1,3,5,7,8,10,12 has 31 days
- } else if (month.equals("2") || month.equals("02")) {
- // leap year
- if (year % 4 == 0) {
- return !(day.equals("30") || day.equals("31"));
- } else {
- return !(day.equals("29") || day.equals("30") || day.equals("31"));
- }
- } else {
- return true;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/Entity.java b/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
deleted file mode 100644
index ba6f2e5..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-/**
- * Base class that all entity jaxb object will extend.
- */
-public abstract class Entity {
- public abstract String getName();
-
- public abstract String getTags();
-
- public abstract AccessControlList getACL();
-
- public EntityType getEntityType() {
- for (EntityType type : EntityType.values()) {
- if (type.getEntityClass().equals(getClass())) {
- return type;
- }
- }
- return null;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || !o.getClass().equals(this.getClass())) {
- return false;
- }
-
- Entity entity = (Entity) o;
-
- String name = getName();
- return !(name != null ? !name.equals(entity.getName()) : entity.getName() != null);
- }
-
- @Override
- public int hashCode() {
- String clazz = this.getClass().getName();
-
- String name = getName();
- int result = name != null ? name.hashCode() : 0;
- result = 31 * result + clazz.hashCode();
- return result;
- }
-
- @Override
- public String toString() {
- try {
- StringWriter stringWriter = new StringWriter();
- Marshaller marshaller = getEntityType().getMarshaller();
- marshaller.marshal(this, stringWriter);
- return stringWriter.toString();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public static Entity fromString(EntityType type, String str) {
- try {
- Unmarshaller unmarshaler = type.getUnmarshaller();
- return (Entity) unmarshaler.unmarshal(new StringReader(str));
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public String toShortString() {
- return "(" + getEntityType().name().toLowerCase() + ") " + getName();
- }
-
- public Entity copy() {
- return fromString(getEntityType(), toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java b/client/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
deleted file mode 100644
index bab70d4..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-/**
- * EntityNotification class to be extended by Feed/Process notification class.
- */
-public abstract class EntityNotification {
- public abstract String getType();
- public abstract String getLevel();
- public abstract String getTo();
-
- public String toString() {
- return "Notification{"
- + "type=" + getType()
- + ", to=" + getTo()
- + "}";
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java b/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
deleted file mode 100644
index 29dbc7a..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import org.apache.falcon.entity.v0.cluster.Cluster;
-import org.apache.falcon.entity.v0.feed.Feed;
-import org.apache.falcon.entity.v0.process.Process;
-import org.apache.falcon.entity.v0.datasource.Datasource;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.ValidationEvent;
-import javax.xml.bind.ValidationEventHandler;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import java.util.Arrays;
-
-/**
- * Enum for types of entities in Falcon Process, Feed and Cluster.
- */
-public enum EntityType {
- FEED(Feed.class, "/feed-0.1.xsd", "name"),
- PROCESS(Process.class, "/process-0.1.xsd", "name"),
- CLUSTER(Cluster.class, "/cluster-0.1.xsd", "name"),
- DATASOURCE(Datasource.class, "/datasource-0.1.xsd", "name");
-
- //Fail unmarshalling of whole xml if unmarshalling of any element fails
- private static class EventHandler implements ValidationEventHandler {
- @Override
- public boolean handleEvent(ValidationEvent event) {
- return false;
- }
- }
-
- private static final String NS = "http://www.w3.org/2001/XMLSchema";
-
- private final Class<? extends Entity> clazz;
- private JAXBContext jaxbContext;
- private Schema schema;
- private String[] immutableProperties;
-
- private String schemaFile;
-
- private EntityType(Class<? extends Entity> typeClass, String schemaFile, String... immutableProperties) {
- clazz = typeClass;
- this.immutableProperties = immutableProperties;
- this.schemaFile = schemaFile;
- try {
- jaxbContext = JAXBContext.newInstance(typeClass);
- synchronized (this) {
- SchemaFactory schemaFactory = SchemaFactory.newInstance(NS);
- schema = schemaFactory.newSchema(getClass().getResource(schemaFile));
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Class<? extends Entity> getEntityClass() {
- return clazz;
- }
-
- public String getSchemaFile() {
- return schemaFile;
- }
-
- public Marshaller getMarshaller() throws JAXBException {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- return marshaller;
- }
-
- public Unmarshaller getUnmarshaller() throws JAXBException {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- unmarshaller.setSchema(schema);
- unmarshaller.setEventHandler(new EventHandler());
- return unmarshaller;
- }
-
-
- public boolean isSchedulable() {
- // Cluster and Datasource are not schedulable like Feed and Process
- return ((this != EntityType.CLUSTER) && (this != EntityType.DATASOURCE));
- }
-
- public static void assertSchedulable(String entityType){
- EntityType type = EntityType.getEnum(entityType);
- if (type.isSchedulable()){
- return;
- } else {
- throw new IllegalArgumentException("EntityType "+ entityType
- + " is not valid,Feed and Process are the valid input type.");
- }
- }
-
- @edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP"})
- public String[] getImmutableProperties() {
- return immutableProperties;
- }
-
- public static EntityType getEnum(String type) {
- try {
- return EntityType.valueOf(type.toUpperCase().trim());
- } catch (IllegalArgumentException iae) {
- throw new IllegalArgumentException("Invalid entity type: " + type + ". Expected "
- + Arrays.toString(values()).toLowerCase() + ".");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java b/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
deleted file mode 100644
index f423df6..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import java.util.Calendar;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Frequency as supported in the xsd definitions.
- */
-public class Frequency {
- private static final Pattern PATTERN = Pattern.compile("(minutes|hours|days|months)\\((\\d+)\\)");
-
- /**
- * TimeUnit corresponding to the frequency.
- */
- public static enum TimeUnit {
- minutes(Calendar.MINUTE), hours(Calendar.HOUR), days(Calendar.DATE), months(Calendar.MONTH);
-
- private int calendarUnit;
-
- private TimeUnit(int calendarUnit) {
- this.calendarUnit = calendarUnit;
- }
-
- public int getCalendarUnit() {
- return calendarUnit;
- }
- }
-
- private TimeUnit timeUnit;
- private String frequency;
-
- public Frequency(String freq, TimeUnit timeUnit) {
- this.frequency = freq;
- this.timeUnit = timeUnit;
- }
-
- public Frequency(String strValue) {
- Matcher matcher = PATTERN.matcher(strValue);
- if (!matcher.matches()) {
- throw new IllegalArgumentException("Invalid frequency: " + strValue);
- }
-
- timeUnit = TimeUnit.valueOf(matcher.group(1));
- frequency = matcher.group(2);
- }
-
- public static Frequency fromString(String strValue) {
- return new Frequency(strValue);
- }
-
- public static String toString(Frequency freq) {
- return freq==null? null:freq.toString();
- }
-
- @Override
- public String toString() {
- return timeUnit.name() + "(" + frequency + ")";
- }
-
- public TimeUnit getTimeUnit() {
- return timeUnit;
- }
-
- public String getFrequency() {
- return frequency;
- }
-
- public int getFrequencyAsInt() {
- return Integer.parseInt(frequency);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
-
- if (!(obj instanceof Frequency)) {
- return false;
- }
-
- Frequency freq = (Frequency) obj;
- return this == freq || this.getFrequency().equals(freq.getFrequency())
- && this.getTimeUnit() == freq.getTimeUnit();
-
- }
-
- @Override
- public int hashCode() {
- int result = timeUnit.hashCode();
- result = 31 * result + frequency.hashCode();
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java b/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
deleted file mode 100644
index 1c02f37..0000000
--- a/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * Support function to parse and format date in xsd string.
- */
-public final class SchemaHelper {
-
- public static final String ISO8601_FORMAT = "yyyy-MM-dd'T'HH:mm'Z'";
-
- private SchemaHelper() {}
-
- public static String getTimeZoneId(TimeZone tz) {
- return tz.getID();
- }
-
- public static DateFormat getDateFormat() {
- DateFormat dateFormat = new SimpleDateFormat(ISO8601_FORMAT);
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- return dateFormat;
- }
-
- public static String formatDateUTC(Date date) {
- return (date != null) ? getDateFormat().format(date) : null;
- }
-
- public static Date parseDateUTC(String dateStr) {
- if (!DateValidator.validate(dateStr)) {
- throw new IllegalArgumentException(dateStr + " is not a valid UTC string");
- }
- try {
- return getDateFormat().parse(dateStr);
- } catch (ParseException e) {
- throw new RuntimeException("Unable to parse date: " + dateStr, e);
- }
- }
-
- public static String formatDateUTCToISO8601(final String dateString, final String dateStringFormat) {
-
- try {
- DateFormat dateFormat = new SimpleDateFormat(dateStringFormat.substring(0, dateString.length()));
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- return SchemaHelper.formatDateUTC(dateFormat.parse(dateString));
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/metadata/RelationshipType.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/metadata/RelationshipType.java b/client/src/main/java/org/apache/falcon/metadata/RelationshipType.java
deleted file mode 100644
index 47bc377..0000000
--- a/client/src/main/java/org/apache/falcon/metadata/RelationshipType.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.metadata;
-
-import org.apache.falcon.entity.v0.EntityType;
-
-/**
- * Enumerates Relationship types.
- */
-public enum RelationshipType {
-
- // entity vertex types
- CLUSTER_ENTITY("cluster-entity"),
- FEED_ENTITY("feed-entity"),
- PROCESS_ENTITY("process-entity"),
- DATASOURCE_ENTITY("datasource-entity"),
-
- // instance vertex types
- FEED_INSTANCE("feed-instance"),
- PROCESS_INSTANCE("process-instance"),
- IMPORT_INSTANCE("import-instance"),
-
- // Misc vertex types
- USER("user"),
- COLO("data-center"),
- TAGS("classification"),
- GROUPS("group"),
- PIPELINES("pipelines"),
- REPLICATION_METRICS("replication-metrics");
-
-
- private final String name;
-
- RelationshipType(java.lang.String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public static RelationshipType fromString(String value) {
- if (value != null) {
- for (RelationshipType type : RelationshipType.values()) {
- if (value.equals(type.getName())) {
- return type;
- }
- }
- }
-
- throw new IllegalArgumentException("No constant with value " + value + " found");
- }
-
- public static RelationshipType fromSchedulableEntityType(String type) {
- EntityType entityType = EntityType.getEnum(type);
- switch (entityType) {
- case FEED:
- return RelationshipType.FEED_ENTITY;
- case PROCESS:
- return RelationshipType.PROCESS_ENTITY;
- default:
- throw new IllegalArgumentException("Invalid schedulable entity type: " + entityType.name());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/resource/APIResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/APIResult.java b/client/src/main/java/org/apache/falcon/resource/APIResult.java
deleted file mode 100644
index e67eb3a..0000000
--- a/client/src/main/java/org/apache/falcon/resource/APIResult.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.resource;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.StringWriter;
-
-/**
- * APIResult is the output returned by all the APIs; status-SUCCEEDED or FAILED
- * message- detailed message.
- */
-@XmlRootElement(name = "result")
-@XmlAccessorType(XmlAccessType.FIELD)
-@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
-public class APIResult {
-
- private Status status;
-
- private String message;
-
- private String requestId;
-
- private static final JAXBContext JAXB_CONTEXT;
-
- static {
- try {
- JAXB_CONTEXT = JAXBContext.newInstance(APIResult.class);
- } catch (JAXBException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * API Result status.
- */
- public static enum Status {
- SUCCEEDED, PARTIAL, FAILED
- }
-
- public APIResult(Status status, String message) {
- super();
- this.status = status;
- this.message = message;
- requestId = Thread.currentThread().getName();
- }
-
- protected APIResult() {
- // private default constructor for JAXB
- }
-
- public Status getStatus() {
- return status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String reqId) {
- this.requestId = reqId;
- }
-
- @Override
- public String toString() {
- try {
- StringWriter stringWriter = new StringWriter();
- Marshaller marshaller = JAXB_CONTEXT.createMarshaller();
- marshaller.marshal(this, stringWriter);
- return stringWriter.toString();
- } catch (JAXBException e) {
- return e.getMessage();
- }
- }
-
- public Object[] getCollection() {
- return null;
- }
-
- public void setCollection(Object[] items) {
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/resource/EntityList.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/EntityList.java b/client/src/main/java/org/apache/falcon/resource/EntityList.java
deleted file mode 100644
index 1a208fa..0000000
--- a/client/src/main/java/org/apache/falcon/resource/EntityList.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.entity.v0.Entity;
-import org.apache.falcon.entity.v0.EntityType;
-import org.apache.falcon.entity.v0.process.Input;
-import org.apache.falcon.entity.v0.process.Output;
-import org.apache.falcon.entity.v0.process.Process;
-
-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 javax.xml.bind.annotation.XmlElementWrapper;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Entity list used for marshalling / unmarshalling with REST calls.
- */
-@XmlRootElement(name = "entities")
-@XmlAccessorType(XmlAccessType.FIELD)
-@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
-public class EntityList {
- public static final String INPUT_TAG = "Input";
- public static final String OUTPUT_TAG = "Output";
-
- public int getTotalResults() {
- return totalResults;
- }
-
- @XmlElement
- private int totalResults;
-
- @XmlElement(name = "entity")
- private final EntityElement[] elements;
-
- /**
- * List of fields returned by RestAPI.
- */
- public enum EntityFieldList {
- TYPE, NAME, STATUS, TAGS, PIPELINES, CLUSTERS
- }
-
- /**
- * Filter by these Fields is supported by RestAPI.
- */
- public enum EntityFilterByFields {
- TYPE, NAME, STATUS, PIPELINES, CLUSTER, TAGS
- }
-
- /**
- * Element within an entity.
- */
- public static class EntityElement {
- //SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
- @XmlElement
- public String type;
- @XmlElement
- public String name;
- @XmlElement
- public String status;
- @XmlElementWrapper(name = "tags")
- public List<String> tag;
- @XmlElementWrapper(name = "pipelines")
- public List<String> pipeline;
- @XmlElementWrapper(name = "clusters")
- public List<String> cluster;
-
- //RESUME CHECKSTYLE CHECK VisibilityModifierCheck
-
- @Override
- public String toString() {
- String outString = "(" + type + ") " + name;
- if (StringUtils.isNotEmpty(status)) {
- outString += "(" + status + ")";
- }
-
- if (tag != null && !tag.isEmpty()) {
- outString += " - " + tag.toString();
- }
-
- if (pipeline != null && !pipeline.isEmpty()) {
- outString += " - " + pipeline.toString();
- }
-
- if (cluster != null && !cluster.isEmpty()) {
- outString += " - " + cluster.toString();
- }
-
- outString += "\n";
- return outString;
- }
- }
-
- //For JAXB
- public EntityList() {
- this.elements = null;
- this.totalResults = 0;
- }
-
- public EntityList(EntityElement[] elements, int totalResults) {
- this.totalResults = totalResults;
- this.elements = elements;
- }
-
- public EntityList(Entity[] elements, int totalResults) {
- this.totalResults = totalResults;
- int len = elements.length;
- EntityElement[] items = new EntityElement[len];
- for (int i = 0; i < len; i++) {
- items[i] = createEntityElement(elements[i]);
- }
- this.elements = items;
- }
-
- private EntityElement createEntityElement(Entity e) {
- EntityElement element = new EntityElement();
- element.type = e.getEntityType().name().toLowerCase();
- element.name = e.getName();
- element.status = null;
- element.tag = new ArrayList<String>();
- element.pipeline = new ArrayList<String>();
- element.cluster = new ArrayList<String>();
- return element;
- }
-
- public EntityList(Entity[] dependentEntities, Entity entity) {
- int len = dependentEntities.length;
- this.totalResults = len;
- EntityElement[] items = new EntityElement[len];
- for (int i = 0; i < len; i++) {
- Entity e = dependentEntities[i];
- EntityElement o = new EntityElement();
- o.type = e.getEntityType().name().toLowerCase();
- o.name = e.getName();
- o.status = null;
- o.tag = getEntityTag(e, entity);
- items[i] = o;
- }
- this.elements = items;
- }
-
- public EntityElement[] getElements() {
- return elements;
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append(totalResults + "\n");
- for (EntityElement element : elements) {
- buffer.append(element.toString());
- }
- return buffer.toString();
- }
-
- private List<String> getEntityTag(Entity dependentEntity, Entity entity) {
- List<String> tagList = new ArrayList<String>();
-
- if (entity.getEntityType().equals(EntityType.CLUSTER)) {
- return tagList;
- }
-
- Process process = null;
- String entityNameToMatch = null;
- if (dependentEntity.getEntityType().equals(EntityType.PROCESS)) {
- process = (Process) dependentEntity;
- entityNameToMatch = entity.getName();
- } else if (dependentEntity.getEntityType().equals(EntityType.FEED)
- && entity.getEntityType().equals(EntityType.PROCESS)) {
- process = (Process) entity;
- entityNameToMatch = dependentEntity.getName();
- }
-
- if (process != null) {
- if (process.getInputs() != null) {
- for (Input i : process.getInputs().getInputs()) {
- if (i.getFeed().equals(entityNameToMatch)) {
- tagList.add(INPUT_TAG);
- }
- }
- }
- if (process.getOutputs() != null) {
- for (Output o : process.getOutputs().getOutputs()) {
- if (o.getFeed().equals(entityNameToMatch)) {
- tagList.add(OUTPUT_TAG);
- }
- }
- }
- }
-
- return tagList;
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java b/client/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
deleted file mode 100644
index 4d42b42..0000000
--- a/client/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.resource;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Arrays;
-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 EntitySummaryResult extends APIResult {
-
- /**
- * Workflow status as being set in result object.
- */
- public static enum WorkflowStatus {
- WAITING, RUNNING, SUSPENDED, KILLED, FAILED, SUCCEEDED, ERROR, READY
- }
-
- @XmlElement
- private EntitySummary[] entitySummaries;
-
- //For JAXB
- public EntitySummaryResult() {
- super();
- }
-
- public EntitySummaryResult(String message, EntitySummary[] entitySummaries) {
- this(Status.SUCCEEDED, message, entitySummaries);
- }
-
- public EntitySummaryResult(Status status, String message, EntitySummary[] entitySummaries) {
- super(status, message);
- this.entitySummaries = entitySummaries;
- }
-
- public EntitySummaryResult(Status status, String message) {
- super(status, message);
- }
-
- public EntitySummary[] getEntitySummaries() {
- return this.entitySummaries;
- }
-
- public void setEntitySummaries(EntitySummary[] entitySummaries) {
- this.entitySummaries = entitySummaries;
- }
-
- @Override
- public Object[] getCollection() {
- return entitySummaries;
- }
-
- @Override
- public void setCollection(Object[] items) {
- if (items == null) {
- setEntitySummaries(new EntitySummary[0]);
- } else {
- EntitySummary[] summaries = Arrays.copyOf(items, items.length, EntitySummary[].class);
- setEntitySummaries(summaries);
- }
- }
-
- /**
- * A single entity object inside entity summary result.
- */
- @XmlRootElement(name = "entitySummary")
- public static class EntitySummary {
-
- @XmlElement
- public String type;
- @XmlElement
- public String name;
- @XmlElement
- public String status;
- @XmlElement
- public String[] tags;
- @XmlElement
- public String[] pipelines;
- @XmlElement
- public Instance[] instances;
-
- public EntitySummary() {
- }
-
- public EntitySummary(String entityName, String entityType) {
- this.name = entityName;
- this.type = entityType;
- }
-
- public EntitySummary(String name, String type, String status,
- String[] tags, String[] pipelines,
- Instance[] instances) {
- this.name = name;
- this.type = type;
- this.status = status;
- this.pipelines = pipelines;
- this.tags = tags;
- this.instances = instances;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getType() {
- return this.type;
- }
-
- public String getStatus() {
- return this.status;
- }
-
- public String[] getTags() {
- return this.tags;
- }
-
- public String[] getPipelines() {
- return this.pipelines;
- }
-
- public Instance[] getInstances() {
- return this.instances;
- }
-
- @Override
- public String toString() {
- return "{Entity: " + (this.name == null ? "" : this.name)
- + ", Type: " + (this.type == null ? "" : this.type)
- + ", Status: " + (this.status == null ? "" : this.status)
- + ", Tags: " + (this.tags == null ? "[]" : Arrays.toString(this.tags))
- + ", Pipelines: " + (this.pipelines == null ? "[]" : Arrays.toString(this.pipelines))
- + ", InstanceSummary: " + (this.instances == null ? "[]" : Arrays.toString(this.instances))
- +"}";
- }
- }
-
- /**
- * A single instance object inside instance result.
- */
- @XmlRootElement(name = "instances")
- 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;
-
- 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;
- }
-
- @Override
- public String toString() {
- return "{instance: " + (this.instance == null ? "" : this.instance)
- + ", status: " + (this.status == null ? "" : this.status)
- + (this.logFile == null ? "" : ", log: " + this.logFile)
- + (this.sourceCluster == null ? "" : ", source-cluster: " + this.sourceCluster)
- + (this.cluster == null ? "" : ", cluster: " + this.cluster)
- + (this.startTime == null ? "" : ", startTime: " + this.startTime)
- + (this.endTime == null ? "" : ", endTime: " + this.endTime)
- + "}";
- }
- }
-}
-//RESUME CHECKSTYLE CHECK VisibilityModifierCheck
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java b/client/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
deleted file mode 100644
index a7ca4e4..0000000
--- a/client/src/main/java/org/apache/falcon/resource/ExtensionInstanceList.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/ExtensionJobList.java b/client/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
deleted file mode 100644
index ca031b5..0000000
--- a/client/src/main/java/org/apache/falcon/resource/ExtensionJobList.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java b/client/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
deleted file mode 100644
index 75f0b9a..0000000
--- a/client/src/main/java/org/apache/falcon/resource/FeedInstanceResult.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java b/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
deleted file mode 100644
index f8d58ae..0000000
--- a/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java b/client/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
deleted file mode 100644
index 0751f12..0000000
--- a/client/src/main/java/org/apache/falcon/resource/InstanceDependencyResult.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/InstancesResult.java b/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
deleted file mode 100644
index 645050c..0000000
--- a/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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
[4/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
Posted by pa...@apache.org.
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java b/client/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
deleted file mode 100644
index aa0db99..0000000
--- a/client/src/main/java/org/apache/falcon/resource/InstancesSummaryResult.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java b/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
deleted file mode 100644
index 0e10e38..0000000
--- a/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java b/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
deleted file mode 100644
index 0968734..0000000
--- a/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstance.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java b/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
deleted file mode 100644
index 752c48d..0000000
--- a/client/src/main/java/org/apache/falcon/resource/SchedulableEntityInstanceResult.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/java/org/apache/falcon/resource/TriageResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/TriageResult.java b/client/src/main/java/org/apache/falcon/resource/TriageResult.java
deleted file mode 100644
index 131e2e1..0000000
--- a/client/src/main/java/org/apache/falcon/resource/TriageResult.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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/client/src/main/resources/cluster-0.1.xsd
----------------------------------------------------------------------
diff --git a/client/src/main/resources/cluster-0.1.xsd b/client/src/main/resources/cluster-0.1.xsd
deleted file mode 100644
index 03e9f84..0000000
--- a/client/src/main/resources/cluster-0.1.xsd
+++ /dev/null
@@ -1,214 +0,0 @@
-<?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/client/src/main/resources/datasource-0.1.xsd
----------------------------------------------------------------------
diff --git a/client/src/main/resources/datasource-0.1.xsd b/client/src/main/resources/datasource-0.1.xsd
deleted file mode 100644
index d78d967..0000000
--- a/client/src/main/resources/datasource-0.1.xsd
+++ /dev/null
@@ -1,282 +0,0 @@
-<?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>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/resources/feed-0.1.xsd
----------------------------------------------------------------------
diff --git a/client/src/main/resources/feed-0.1.xsd b/client/src/main/resources/feed-0.1.xsd
deleted file mode 100644
index cbc97b9..0000000
--- a/client/src/main/resources/feed-0.1.xsd
+++ /dev/null
@@ -1,578 +0,0 @@
-<?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:feed:0.1" xmlns="uri:falcon:feed: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.feed"/>
- </jaxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:element name="feed" type="feed">
- </xs:element>
- <xs:complexType name="feed">
- <xs:annotation>
- <xs:documentation>
- name: A feed should have a unique name and this name is referenced
- by processes as input or output feed.
- tags: a feed specifies an optional list of comma separated tags
- which is used for classification of data sets.
- groups: a feed specifies a list of comma separated groups,
- a group is a logical grouping of feeds and a group is said to be
- available if all the feeds belonging to a group are available.
- The frequency of all
- the feed which belong to the same group
- must be same.
- availabilityFlag: specifies the name of a file which when
- present/created
- in a feeds data directory, the feed is
- termed as available. ex: _SUCCESS, if
- this element is ignored then Falcon would consider the presence of feed's
- data directory as feed availability.
- A feed has a
- frequency and a periodicity which specifies the frequency by which
- this feed is generated. ex: it can be generated every hour, every 5 minutes, daily, weekly etc.
- valid frequency type for a feed are minutes, hours, days, months.
- sla: A feed can have SLA and each SLA has two properties - slaLow and slaHigh. Both slaLow and slaHigh
- are written using expressions like frequency. slaLow is intended to serve for alerting for feeds which
- are in danger of missing their availability SLAs. slaHigh is intended to serve for reporting the feeds
- which missed their SLAs. SLAs are relative to feed instance time.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="KEY_VALUE_PAIR" name="tags" minOccurs="0">
- <xs:annotation>
- <xs:documentation>
- tags: a feed 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="partitions" name="partitions" minOccurs="0"/>
- <xs:element type="group-type" name="groups" minOccurs="0"/>
- <xs:element type="xs:string" name="availabilityFlag" minOccurs="0"/>
- <xs:element type="frequency-type" name="frequency"/>
- <xs:element type="sla" name="sla" minOccurs="0"/>
- <xs:element name="timezone" minOccurs="0" default="UTC">
- <xs:simpleType>
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="java.util.TimeZone" parseMethod="java.util.TimeZone.getTimeZone"
- printMethod="org.apache.falcon.entity.v0.SchemaHelper.getTimeZoneId"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string"/>
- </xs:simpleType>
- </xs:element>
- <xs:element type="late-arrival" name="late-arrival" minOccurs="0"/>
- <xs:element type="clusters" name="clusters"/>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element type="locations" name="locations"/>
- <xs:element type="catalog-table" name="table"/>
- </xs:choice>
- <xs:element type="notification" name="notification" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Notification will help to notify the users about the finished status of Falcon
- Instance. Currently Email type notification is supported and users must specify the receiver's
- email address.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="ACL" name="ACL"/>
- <xs:element type="schema" name="schema"/>
- <xs:element type="properties" name="properties" minOccurs="0"/>
- <xs:element type="lifecycle" name="lifecycle" minOccurs="0" />
- </xs:sequence>
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="xs:string" name="description"/>
- <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
- </xs:complexType>
- <xs:complexType name="cluster">
- <xs:annotation>
- <xs:documentation>
- Feed references a cluster by it's name, before submitting a feed all the
- referenced cluster should be submitted to Falcon.
- type: specifies whether the
- referenced cluster should be treated as a
- source or target for a feed.
- Validity of a feed on cluster specifies duration for which this feed is
- valid on this cluster.
- Retention specifies how long the feed is retained on this cluster and the
- action to be taken on the feed after the expiry of retention period.
- The retention limit is
- specified by expression frequency(times), ex: if
- feed should be retained for at least 6 hours then retention's limit="hours(6)".
- The field partitionExp contains
- partition tags. Number of partition tags has to be equal to number of partitions specified in feed
- schema.
- A partition tag can be a wildcard(*), a static string or
- an expression. Atleast one of the strings has to be an expression.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="validity" name="validity"/>
- <xs:element type="retention" name="retention"/>
- <xs:element type="sla" name="sla" minOccurs="0" maxOccurs="1"/>
- <xs:element type="import" name="import" minOccurs="0" maxOccurs="1"/>
- <xs:element type="export" name="export" minOccurs="0" maxOccurs="1"/>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:element type="locations" name="locations" minOccurs="0"/>
- <xs:element type="catalog-table" name="table"/>
- </xs:choice>
- <xs:element type="lifecycle" name="lifecycle" minOccurs="0" />
- </xs:sequence>
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="cluster-type" name="type" use="optional"/>
- <xs:attribute type="xs:string" name="partition" use="optional"/>
- <xs:attribute type="frequency-type" name="delay" use="optional" />
- <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
- </xs:complexType>
- <xs:complexType name="partitions">
- <xs:annotation>
- <xs:documentation>
- A list of partition, which is the logical partition of a feed and this
- is maintained in Hcatalog registry.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="partition" name="partition" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="schema">
- <xs:annotation>
- <xs:documentation>A schema specifies the location of a schema file
- for a feed and the provider of schema like protobuf, thrift etc.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="xs:string" name="location" use="required"/>
- <xs:attribute type="xs:string" name="provider" use="required"/>
- </xs:complexType>
- <xs:complexType name="properties">
- <xs:annotation>
- <xs:documentation>
- A list of name-value pair of property.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="validity">
- <xs:annotation>
- <xs:documentation>
- A validity has a start, which is the validity start date and end the
- validity
- end date. ex: start="2011-11-01T00:00Z" in TZ format.
- timezone can be UTC,
- GMT.
- Processes referring this feed would consider the validity period for
- validation.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="date-time-type" name="start" use="required"/>
- <xs:attribute type="date-time-type" name="end" use="required"/>
- </xs:complexType>
- <xs:complexType name="sla">
- <xs:annotation>
- <xs:documentation>
- sla has two properties - slaLow and slaHigh. Both slaLow and slaHigh
- are written using expressions like frequency. slaLow is intended to serve for alerting for feeds which
- are in danger of missing their availability SLAs. slaHigh is intended to serve for reporting the feeds
- which missed their SLAs. SLAs are relative to feed instance time.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="frequency-type" name="slaLow" use="required"/>
- <xs:attribute type="frequency-type" name="slaHigh" use="required"/>
- </xs:complexType>
- <xs:complexType name="locations">
- <xs:annotation>
- <xs:documentation>
- A list of locations on the file system.
- </xs:documentation>
- </xs:annotation>
- <xs:choice maxOccurs="unbounded" minOccurs="0">
- <xs:element type="location" name="location"/>
- </xs:choice>
- </xs:complexType>
- <xs:complexType name="late-arrival">
- <xs:annotation>
- <xs:documentation>
- late-arrival specifies the cut-off period till which the feed is
- expected to arrive late and should be honored be processes referring
- to it as input
- feed by rerunning the instances in case
- the data arrives late with in a cut-off period.
- The cut-off period is specified by expression
- frequency(times), ex: if the feed
- can arrive late
- upto 8 hours then late-arrival's cut-off="hours(8)"
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="frequency-type" name="cut-off" use="required"/>
- </xs:complexType>
- <xs:complexType name="property">
- <xs:annotation>
- <xs:documentation>
- A key-value pair, which are propagated to the
- workflow engine.
- </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="clusters">
- <xs:annotation>
- <xs:documentation>
- A list of clusters.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="cluster" name="cluster" maxOccurs="unbounded" minOccurs="1">
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="retention">
- <xs:attribute type="retention-type" name="type" default="instance"/>
- <xs:attribute type="frequency-type" name="limit" use="required"/>
- <xs:attribute type="action-type" name="action" use="required"/>
- </xs:complexType>
- <xs:simpleType name="retention-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="instance"/>
- <!-- <xs:enumeration value="age" /> -->
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="location">
- <xs:annotation>
- <xs:documentation>
- location specifies the type of location like data, meta, stats
- and the corresponding paths for them.
- A feed should at least define the location for type
- data, which
- specifies the HDFS path pattern where the feed is generated
- periodically. ex: type="data" path="/projects/TrafficHourly/${YEAR}-${MONTH}-${DAY}/traffic"
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="location-type" name="type" use="required"/>
- <xs:attribute type="non-empty-string" name="path" use="required"/>
- </xs:complexType>
- <xs:complexType name="partition">
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- </xs:complexType>
- <xs:complexType name="notification">
- <xs:annotation>
- <xs:documentation>
- Notification specifies the "type" of notification to be used to send notification.
- Currently email based notification type is supported and user can specify the comma
- separated email address with "to" property.
- e.g: type="email" to="falcon@localhost,hive@localhost"
- "limit" property in notification will help to set the frequency of email notification
- in case of Falcon instance failure. Incase of feed entity limit="attempt" is only supported
- as there is no retry element.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute name="type" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="email"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="level" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="attempt"/>
- <xs:enumeration value="instance"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute type="xs:string" name="to" use="required"/>
- </xs:complexType>
- <xs:complexType name="ACL">
- <xs:annotation>
- <xs:documentation>
- Access control list for this feed.
- </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="action-type">
- <xs:restriction base="xs:string">
- <xs:annotation>
- <xs:documentation>
- action type specifies the action that should be taken on a feed
- when the retention period of a feed expires on a cluster,
- the only valid action is delete.
- </xs:documentation>
- </xs:annotation>
- <xs:enumeration value="delete"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="lifecycle">
- <xs:annotation>
- <xs:documentation>
- Lifecycle of the feed consists of various stages. For example typical stages of a feed are import,
- replication, archival, retention and export. All these stages together are called lifecycle of a feed.
- </xs:documentation>
- </xs:annotation>
-
- <xs:all>
- <xs:element type="retention-stage" name="retention-stage" minOccurs="0"></xs:element>
- </xs:all>
-
- </xs:complexType>
-
- <xs:simpleType name="cluster-type">
- <xs:annotation>
- <xs:documentation>
- The clusters on feed can be either defined as source or target,
- a feed
- should at least have one source cluster defined.
- the target clusters
- are used for
- replication of feed.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:enumeration value="source"/>
- <xs:enumeration value="target"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="location-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="data"/>
- <xs:enumeration value="stats"/>
- <xs:enumeration value="meta"/>
- <xs:enumeration value="tmp"/>
- </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="frequency-type">
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="org.apache.falcon.entity.v0.Frequency"
- parseMethod="org.apache.falcon.entity.v0.Frequency.fromString"
- printMethod="org.apache.falcon.entity.v0.Frequency.toString"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="(minutes|hours|days|months)\([1-9]\d*\)"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="date-time-type">
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="java.util.Date" parseMethod="org.apache.falcon.entity.v0.SchemaHelper.parseDateUTC"
- printMethod="org.apache.falcon.entity.v0.SchemaHelper.formatDateUTC"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern
- value="((19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9]))Z"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="group-type">
- <xs:restriction base="xs:string">
- <xs:pattern value="(\w+(,\w+)*)"/>
- </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="catalog-table">
- <xs:annotation>
- <xs:documentation>
- catalog specifies the uri of a Hive table along with the partition spec.
- uri="catalog:$database:$table#(partition-key=partition-value);+"
- Example: catalog:logs-db:clicks#ds=${YEAR}-${MONTH}-${DAY}
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="xs:string" name="uri" use="required"/>
- </xs:complexType>
- <xs:simpleType name="non-empty-string">
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="import">
- <xs:sequence>
- <xs:element type="datasource" name="source"/>
- <xs:element type="arguments" name="arguments" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="export">
- <xs:sequence>
- <xs:element type="datasource" name="target"/>
- <xs:element type="arguments" name="arguments" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="datasource">
- <xs:annotation>
- <xs:documentation>
- Specifies the source entity name from which data can be imported or exported.
- This can be Database or other data source types in the future. The connection
- and authentication details of the data source are defined in the Datasource
- entity.
- Table name specifies the table to import or export depending on the action type.
- Extract type specifies a extraction method (full or incremental).
- DeltaColumn specifies the column name on source databbase table
- to identify the new data since the last extraction.
- Merge type specifies how the data will be organized on Hadoop.
- The supported types are snapshot (as in a particular time) or append
- (as in timeseries partitions).
- Load type specifies if new rows are inserted (load type=insertallowed) into
- the database table or updated (load type=updateonly). If updateonly load type
- is specified, then update columns need to be passed via the arguments.
- Fields can be specified as includes or excludes of fields. If exlusion list
- is specified, all column except the ones specified will not be imported or exported.
- If inclusion list is specified, only the specified columns are exported or imported.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element type="extract" name="extract"/>
- <xs:element type="load" name="load"/>
- </xs:choice>
- <xs:element type="fields-type" name="fields" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute type="non-empty-string" name="name" use="required"/>
- <xs:attribute type="non-empty-string" name="tableName" use="required"/>
- <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
- </xs:complexType>
- <xs:complexType name="extract">
- <xs:sequence>
- <xs:element type="xs:string" name="deltacolumn" minOccurs="0" maxOccurs="1"/>
- <xs:element type="merge-type" name="mergepolicy" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute type="extract-method" name="type" use="required"/>
- </xs:complexType>
- <xs:complexType name="load">
- <xs:attribute type="load-method" name="type" use="required"/>
- </xs:complexType>
- <xs:simpleType name="extract-method">
- <xs:restriction base="xs:string">
- <xs:enumeration value="full"/>
- <xs:enumeration value="incremental"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="load-method">
- <xs:restriction base="xs:string">
- <xs:enumeration value="updateonly"/>
- <xs:enumeration value="allowinsert"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="merge-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="snapshot"/>
- <xs:enumeration value="append"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="fields-type">
- <xs:annotation>
- <xs:documentation>
- Specifies either an include or exclude fields list. If include field list is specified, only
- the specified fields will be imported. If exclude field list is specified, all fields except
- the ones specified will be imported from datasource to HDFS.
- </xs:documentation>
- </xs:annotation>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element type="field-include-exclude" name="includes"/>
- <xs:element type="field-include-exclude" name="excludes"/>
- </xs:choice>
- </xs:complexType>
- <xs:complexType name="field-include-exclude">
- <xs:sequence>
- <xs:element type="xs:string" name="field" maxOccurs="unbounded" minOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="arguments">
- <xs:annotation>
- <xs:documentation>
- A list of name-value pair of extra arguments to be passed to the concrete implementation.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="argument" name="argument" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="argument">
- <xs:annotation>
- <xs:documentation>
- A key-value pair, which are used while invoking
- ingestion engines.
- </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="retention-stage">
- <xs:annotation>
- <xs:documentation>
- Retention stage is the new way to define retention for a feed using feed lifecycle feature. Retention
- has a configurable policy which does the validation and the real execution through workflow engine.
- This method of specifying retention gives you more control like using different queue name, priority
- and execution-order for retention than other lifecycle stages of feed like replication.
- </xs:documentation>
- </xs:annotation>
- <xs:all>
- <xs:element type="non-empty-string" name="policy" minOccurs="0" maxOccurs="1"></xs:element>
- <xs:element type="frequency-type" name="frequency" minOccurs="0" maxOccurs="1"></xs:element>
- <xs:element type="xs:string" name="queue" minOccurs="0" maxOccurs="1"></xs:element>
- <xs:element type="xs:string" name="priority" minOccurs="0" maxOccurs="1"></xs:element>
- <xs:element type="properties" name="properties" minOccurs="0" maxOccurs="1"></xs:element>
- </xs:all>
- </xs:complexType>
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/resources/jaxb-binding.xjb
----------------------------------------------------------------------
diff --git a/client/src/main/resources/jaxb-binding.xjb b/client/src/main/resources/jaxb-binding.xjb
deleted file mode 100644
index 978145f..0000000
--- a/client/src/main/resources/jaxb-binding.xjb
+++ /dev/null
@@ -1,72 +0,0 @@
-<?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.
- -->
-<jaxb:bindings
- version="2.1"
- jaxb:extensionBindingPrefixes="xjc jaxb xs inheritance annox"
- xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
- xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <jaxb:bindings schemaLocation="cluster-0.1.xsd" node="//xs:complexType[@name='cluster']">
- <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="cluster-0.1.xsd" node="//xs:complexType[@name='ACL']">
- <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='feed']">
- <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='ACL']">
- <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="feed-0.1.xsd" node="//xs:complexType[@name='notification']">
- <inheritance:extends>org.apache.falcon.entity.v0.EntityNotification</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='process']">
- <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='ACL']">
- <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="process-0.1.xsd" node="//xs:complexType[@name='notification']">
- <inheritance:extends>org.apache.falcon.entity.v0.EntityNotification</inheritance:extends>
- </jaxb:bindings>
-
-
- <jaxb:bindings schemaLocation="datasource-0.1.xsd" node="//xs:complexType[@name='datasource']">
- <inheritance:extends>org.apache.falcon.entity.v0.Entity</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:bindings schemaLocation="datasource-0.1.xsd" node="//xs:complexType[@name='ACL']">
- <inheritance:extends>org.apache.falcon.entity.v0.AccessControlList</inheritance:extends>
- </jaxb:bindings>
-
- <jaxb:globalBindings>
- <xjc:simple/>
- </jaxb:globalBindings>
-
-</jaxb:bindings>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/resources/mysql_database.xml
----------------------------------------------------------------------
diff --git a/client/src/main/resources/mysql_database.xml b/client/src/main/resources/mysql_database.xml
deleted file mode 100644
index 5f88ba4..0000000
--- a/client/src/main/resources/mysql_database.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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.
- -->
-<database colo="west-coast" description="MySQL database on west coast" type="mysql" name="mysql-db" xmlns="uri:falcon:database:0.1">
- <tags>owner=foobar@ambari.apache.org, consumer=phoe@ambari.apache.org</tags>
- <interfaces>
-
- <!-- ***** read interface ***** -->
- <interface type="readonly" endpoint="jdbc:mysql://c6402/test">
- <credential type="password-file">
- <userName>sqoop_user</userName>
- <passwordFile>/user/ambari-qa/password-store/password_read_user</passwordFile>
- </credential>
- </interface>
-
- <!-- ***** write interface ***** -->
- <interface type="write" endpoint="jdbc:mysql://c6402/test">
- <credential type="password-file">
- <userName>sqoop2_user</userName>
- <passwordFile>/user/ambari-qa/password-store/password_write_user</passwordFile>
- </credential>
- </interface>
-
- <!-- ***** default credential ***** -->
- <credential type="password-file">
- <userName>sqoop2_user</userName>
- <passwordFile>/user/ambari-qa/password-store/password_write_user</passwordFile>
- </credential>
-
- </interfaces>
-</database>
[2/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
Posted by pa...@apache.org.
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>
[3/5] falcon git commit: FALCON-2187 Refactoring to move entity xsd
and jxb bindings to a new nmodule
Posted by pa...@apache.org.
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/main/resources/process-0.1.xsd
----------------------------------------------------------------------
diff --git a/client/src/main/resources/process-0.1.xsd b/client/src/main/resources/process-0.1.xsd
deleted file mode 100644
index 7ed8474..0000000
--- a/client/src/main/resources/process-0.1.xsd
+++ /dev/null
@@ -1,477 +0,0 @@
-<?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 attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
- targetNamespace="uri:falcon:process:0.1" xmlns="uri:falcon:process: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.process"/>
- </jaxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:element name="process" type="process">
- <xs:annotation>
- <xs:documentation>
- A process defines configuration for the workflow job like
- frequency of the workflow, inputs and outputs for the workflow, how to
- handle workflow failures, how to handle data that comes late and so on.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:complexType name="process">
- <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="PIPELINE_LIST" name="pipelines" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>
- pipelines: a process specifies an optional list of comma separated pipelines,
- separated by comma, which is used for classification of processes.
- Example: dataReplicationPipeline, clickStreamPipeline
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="clusters" name="clusters">
- <xs:annotation>
- <xs:documentation>Defines the clusters where the workflow should run
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="parallel">
- <xs:annotation>
- <xs:documentation>Defines how many workflow instances can run concurrently
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:unsignedShort">
- <xs:minInclusive value="1"/>
- <xs:maxInclusive value="12"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element type="execution-type" name="order">
- <xs:annotation>
- <xs:documentation>Defines the order in which ready workflow instances should run
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="frequency-type" name="timeout" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Defines time after which instances will no longer be executed
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="frequency-type" name="frequency">
- <xs:annotation>
- <xs:documentation>Defines workflow frequency
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="sla" name="sla" minOccurs="0">
- <xs:annotation>
- <xs:documentation>
- Defines SLA(Service Level Agreement) for process.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="timezone" minOccurs="0" default="UTC">
- <xs:simpleType>
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="java.util.TimeZone" parseMethod="java.util.TimeZone.getTimeZone"
- printMethod="org.apache.falcon.entity.v0.SchemaHelper.getTimeZoneId"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string"/>
- </xs:simpleType>
- </xs:element>
- <xs:element type="inputs" name="inputs" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Defines inputs for the workflow. The workflow will run only when the scheduled
- time is up and all the inputs are available
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="outputs" name="outputs" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Defines outputs of the workflow
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="properties" name="properties" minOccurs="0">
- </xs:element>
- <xs:element type="workflow" name="workflow">
- <xs:annotation>
- <xs:documentation>Defines the workflow that should run. The workflow should be defined with respect
- to the workflow specification of the workflow engine.
- Only
- oozie workflow engine is supported as of now. The workflow path is the path on hdfs which
- contains the workflow xml
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="spark-attributes" name="spark-attributes" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Defines the spark related attributes to run the Spark application. Attributes
- must be defined when workflow engine "spark" is selected.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="retry" name="retry" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Retry defines how to handle workflow failures. Policy type - periodic, exponential
- backoff, final along with the delay define how frequently the workflow should be re-tried. Number of
- attempts define how many times to re-try the failures.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="late-process" name="late-process" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Late process defines how the late data should be handled. Late policy - backoff,
- exponential backoff, final along with delay
- define how
- frequently Falcon should check for late data. The late data handling can be customized for each
- input separatly.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="notification" name="notification" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Notification will help to notify the users about the finished status of Falcon
- Instance. Currently Email type notification is supported and users must specify the receiver's
- email address.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element type="ACL" name="ACL" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
- </xs:complexType>
-
- <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:complexType name="clusters">
- <xs:annotation>
- <xs:documentation>
- A list of clusters.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="cluster" name="cluster" maxOccurs="unbounded" minOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="cluster">
- <xs:annotation>
- <xs:documentation>
- Defines the cluster where the workflow should run. In addition, it also defines the validity of the
- workflow on this cluster
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element type="validity" name="validity"/>
- <xs:element type="sla" name="sla" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="xs:int" name="version" use="optional" default="0"/>
- </xs:complexType>
-
- <xs:complexType name="validity">
- <xs:annotation>
- <xs:documentation>
- Defines the vailidity of the workflow as start and end time
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="date-time-type" name="start" use="required"/>
- <xs:attribute type="date-time-type" name="end" use="required"/>
- </xs:complexType>
-
- <xs:simpleType name="date-time-type">
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="java.util.Date" parseMethod="org.apache.falcon.entity.v0.SchemaHelper.parseDateUTC"
- printMethod="org.apache.falcon.entity.v0.SchemaHelper.formatDateUTC"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern
- value="((1|2)\d\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9]))Z"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="execution-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="FIFO"/>
- <xs:enumeration value="LIFO"/>
- <xs:enumeration value="LAST_ONLY"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="frequency-type">
- <xs:annotation>
- <xs:appinfo>
- <jaxb:javaType name="org.apache.falcon.entity.v0.Frequency"
- parseMethod="org.apache.falcon.entity.v0.Frequency.fromString"
- printMethod="org.apache.falcon.entity.v0.Frequency.toString"/>
- </xs:appinfo>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="(minutes|hours|days|months)\([1-9]\d*\)"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="sla">
- <xs:annotation>
- <xs:documentation>
- sla has 2 optional attributes - shouldStartIn and shouldEndIn. All the attributes
- are written using expressions like frequency. shouldStartIn is the time in which the process should have
- started. shouldEndIn is the time in which the process should have finished.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute type="frequency-type" name="shouldStartIn"/>
- <xs:attribute type="frequency-type" name="shouldEndIn" />
- </xs:complexType>
-
- <xs:complexType name="inputs">
- <xs:sequence>
- <xs:element type="input" name="input" maxOccurs="unbounded" minOccurs="1">
- <xs:annotation>
- <xs:documentation>Defines input for the workflow. Each input maps to a feed. Input path and
- frequency are picked from feed definition.
- The input specifies the
- start and end instance for the workflow. Falcon creates a property with input name which
- contains paths of all input
- instances between start and end. This
- property will be available for the workflow to read inputs.
- Input can also optionally specify the specific partition of feed that the workflow needs.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="input">
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="IDENTIFIER" name="feed" use="required"/>
- <xs:attribute type="xs:string" name="start" use="required"/>
- <xs:attribute type="xs:string" name="end" use="required"/>
- <xs:attribute type="xs:string" name="partition" use="optional"/>
- <xs:attribute type="xs:boolean" name="optional" use="optional" default="false"/>
- </xs:complexType>
-
- <xs:complexType name="outputs">
- <xs:sequence>
- <xs:element type="output" name="output" maxOccurs="unbounded" minOccurs="1">
- <xs:annotation>
- <xs:documentation>Each output maps to a feed. The Output path and frequency are picked from the
- corresponding feed definition.
- The output also specifies the
- instance that is created in terms of EL expression.
- For each output, Falcon creates a property with the output name which can be used in workflows
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="output">
- <xs:attribute type="IDENTIFIER" name="name" use="required"/>
- <xs:attribute type="IDENTIFIER" name="feed" use="required"/>
- <xs:attribute type="xs:string" name="instance" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="workflow">
- <xs:attribute type="xs:string" name="name" use="optional"/>
- <xs:attribute type="xs:string" name="version" use="optional" default="1.0"/>
- <xs:attribute type="engine-type" name="engine" use="optional" default="oozie"/>
- <xs:attribute type="xs:string" name="path" use="required"/>
- <xs:attribute type="xs:string" name="lib" use="optional"/>
- </xs:complexType>
-
- <xs:simpleType name="engine-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="oozie"/>
- <xs:enumeration value="pig"/>
- <xs:enumeration value="hive"/>
- <xs:enumeration value="spark"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="spark-attributes">
- <xs:annotation>
- <xs:documentation>
- List of Spark attributes to run Spark application:
- master element is optional and indicates the url of the Spark Master. Ex: yarn-client, yarn-master, or local. This will override the Spark interface, if define in cluster entity.
- mode element if present indicates the mode of spark, where to run spark driver program. Ex: client,cluster.
- name element indicates the name of the spark application.
- class element if present, indicates the spark's application main class.
- jar element indicates a comma separated list of jars or python files. Also provide the jar or file directory path to workflow attribute path
- spark-opts element if present, contains a list of spark options that can be passed to spark driver.
- arg element if present, contains arguments that can be passed to spark application.
- </xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element name="master" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="mode" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="class" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="jar" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="spark-opts" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="arg" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="retry">
- <xs:attribute type="policy-type" name="policy" use="required"/>
- <xs:attribute type="frequency-type" name="delay" use="required"/>
- <xs:attribute name="attempts" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:unsignedShort">
- <xs:minInclusive value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute type="xs:boolean" name="onTimeout" use="optional" default="false"/>
- </xs:complexType>
-
- <xs:simpleType name="policy-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="periodic"/>
- <xs:enumeration value="exp-backoff"/>
- <xs:enumeration value="final"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="late-process">
- <xs:sequence>
- <xs:element type="late-input" name="late-input" maxOccurs="unbounded" minOccurs="1">
- <xs:annotation>
- <xs:documentation>
- For each input, defines the workflow that should be run when late data is detected
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- <xs:attribute type="policy-type" name="policy" use="required"/>
- <xs:attribute type="frequency-type" name="delay" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="late-input">
- <xs:attribute type="IDENTIFIER" name="input" use="required"/>
- <xs:attribute type="xs:string" name="workflow-path" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="properties">
- <xs:sequence>
- <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="property">
- <xs:attribute type="xs:string" name="name" use="required"/>
- <xs:attribute type="xs:string" name="value" use="required"/>
- </xs:complexType>
-
- <xs:simpleType name="KEY_VALUE_PAIR">
- <xs:restriction base="xs:string">
- <xs:pattern value="([\w_]+=[^,]+)?([,]?[ ]*[\w_]+=[^,]+)*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PIPELINE_LIST">
- <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 process.
- 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:complexType name="notification">
- <xs:annotation>
- <xs:documentation>
- Notification specifies the "type" of notification to be used to send notification.
- Currently email based notification type is supported and user can specify the comma
- separated email address with "to" property.
- e.g: type="email" to="falcon@localhost,hive@localhost"
- "limit" property in notification will help to set the frequency of email notification
- in case of Falcon instance failure.
- If limit="attempt" is set, for every instance failure email will be sent.
- If limit="final" is set, failure email will be sent only when all the attempts has been
- tried defined with retry element.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute name="type" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="email"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="level" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="attempt"/>
- <xs:enumeration value="instance"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute type="xs:string" name="to" use="required"/>
- </xs:complexType>
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java b/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
deleted file mode 100644
index a1adb24..0000000
--- a/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Date format yyyy/mm/dd validator Testing.
- */
-public class DateValidatorTest {
-
- @DataProvider
- public Object[][] validDateProvider() {
- return new Object[][]{
- new Object[]{"2011-11-01T00:00Z", }, new Object[]{"2020-01-01T00:00Z", },
- new Object[]{"2010-01-31T00:59Z", }, new Object[]{"2020-01-31T00:00Z", },
- new Object[]{"2008-02-29T01:00Z", }, new Object[]{"2008-02-29T00:00Z", },
- new Object[]{"2009-02-28T01:01Z", }, new Object[]{"2009-02-28T00:00Z", },
- new Object[]{"2010-03-31T23:00Z", }, new Object[]{"2010-03-31T00:00Z", },
- new Object[]{"2010-04-30T23:59Z", }, new Object[]{"2010-04-30T00:00Z", },
- new Object[]{"2010-05-31T23:23Z", }, new Object[]{"2010-05-31T00:00Z", },
- new Object[]{"2010-06-30T00:00Z", }, new Object[]{"2010-06-30T00:00Z", },
- new Object[]{"2010-07-31T00:00Z", }, new Object[]{"2010-07-31T00:00Z", },
- new Object[]{"2010-08-31T00:00Z", }, new Object[]{"2010-08-31T00:00Z", },
- new Object[]{"2010-09-30T00:00Z", }, new Object[]{"2010-09-30T00:00Z", },
- new Object[]{"2010-10-31T00:00Z", }, new Object[]{"2010-10-31T00:00Z", },
- new Object[]{"2010-11-30T00:00Z", }, new Object[]{"2010-11-30T00:00Z", },
- new Object[]{"2010-12-31T00:00Z", }, new Object[]{"2010-12-31T00:00Z", },
- new Object[]{"1999-01-30T01:00Z", }, new Object[]{"2999-12-31T00:00Z", },
- };
- }
-
- @DataProvider
- public Object[][] invalidDateProvider() {
- return new Object[][]{
- new Object[]{"2010-12-31T00:60Z", }, new Object[]{"2010-12-31T24:00Z", },
- new Object[]{"2010-01-32T00:00Z", }, new Object[]{"2020-01-32T00:00Z", },
- new Object[]{"2010-13-1T00:00Z", }, new Object[]{"1820-01-01T00:00Z", },
- new Object[]{"2007-2-29T00:00Z", }, new Object[]{"2007-02-29T00:00Z", },
- new Object[]{"2008-2-30T00:00Z", }, new Object[]{"2008-02-31T00:00Z", },
- new Object[]{"2008-a-29T00:00Z", }, new Object[]{"2008-02aT00:00Z", },
- new Object[]{"2008-2-333T00:00Z", }, new Object[]{"200a-02-29T00:00Z", },
- new Object[]{"2010-4-31T00:00Z", }, new Object[]{"2010-04-31T00:00Z", },
- new Object[]{"2010-6-31T00:00Z", }, new Object[]{"2010-06-31T00:00Z", },
- new Object[]{"2010-9-31T00:00Z", }, new Object[]{"2010-09-31T00:00Z", },
- new Object[]{"2010-11-31T00:00Z", }, new Object[]{"1999-04-31T01:00Z", },
- new Object[]{null, }, new Object[]{"", }, new Object[]{" ", },
- };
- }
-
- @Test(dataProvider = "validDateProvider")
- public void validDateTest(String date) {
- boolean valid = DateValidator.validate(date);
- System.out.println("Date is valid : " + date + " , " + valid);
- Assert.assertEquals(valid, true);
- }
-
- @Test(dataProvider = "invalidDateProvider",
- dependsOnMethods = "validDateTest")
- public void invalidDateTest(String date) {
- boolean valid = DateValidator.validate(date);
- System.out.println("Date is valid : " + date + " , " + valid);
- Assert.assertEquals(valid, false);
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/client/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java b/client/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
deleted file mode 100644
index 56e442f..0000000
--- a/client/src/test/java/org/apache/falcon/entity/v0/TestFrequency.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.falcon.entity.v0;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Test frequency.
- */
-@Test
-public class TestFrequency {
-
- public void testValidFrequency() {
- String freqStr = "minutes(10)";
- Frequency freq = Frequency.fromString(freqStr);
- Assert.assertEquals(freq.getTimeUnit().name(), "minutes");
- Assert.assertEquals(freq.getFrequency(), "10");
- Assert.assertEquals(freq.getFrequencyAsInt(), 10);
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/pom.xml
----------------------------------------------------------------------
diff --git a/common-types/pom.xml b/common-types/pom.xml
new file mode 100644
index 0000000..714b166
--- /dev/null
+++ b/common-types/pom.xml
@@ -0,0 +1,164 @@
+<?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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.falcon</groupId>
+ <artifactId>falcon-main</artifactId>
+ <version>0.11-SNAPSHOT</version>
+ </parent>
+ <artifactId>falcon-common-types</artifactId>
+ <description>Apache Falcon Java common types</description>
+ <name>Apache Falcon Java common types</name>
+ <packaging>jar</packaging>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-auth</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-json</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.github.stephenc.findbugs</groupId>
+ <artifactId>findbugs-annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.hive.hcatalog</groupId>
+ <artifactId>hive-webhcat-java-client</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/dependency</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.8.0</version>
+ <executions>
+ <execution>
+ <id>1</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <args>
+ <arg>-extension</arg>
+ <arg>-Xinheritance</arg>
+ </args>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics</artifactId>
+ <version>0.6.3</version>
+ </plugin>
+ </plugins>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/LifeCycle.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/LifeCycle.java b/common-types/src/main/java/org/apache/falcon/LifeCycle.java
new file mode 100644
index 0000000..0ecddd1
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/LifeCycle.java
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+/**
+ * Represents life cycle of an entity.
+ */
+
+public enum LifeCycle {
+ EXECUTION(Tag.DEFAULT),
+ EVICTION(Tag.RETENTION),
+ REPLICATION(Tag.REPLICATION),
+ IMPORT(Tag.IMPORT),
+ EXPORT(Tag.EXPORT);
+
+ private final Tag tag;
+
+ LifeCycle(Tag tag) {
+ this.tag = tag;
+ }
+
+ public Tag getTag() {
+ return this.tag;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/Pair.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/Pair.java b/common-types/src/main/java/org/apache/falcon/Pair.java
new file mode 100644
index 0000000..d4cea90
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/Pair.java
@@ -0,0 +1,78 @@
+/**
+ * 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;
+
+import java.io.Serializable;
+
+/**
+ * Simple pair class to hold a pair of object of specific class.
+ * @param <A> - First element in pair.
+ * @param <B> - Second element in pair
+ */
+public class Pair<A, B> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ //SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+ public final A first;
+ public final B second;
+ //RESUME CHECKSTYLE CHECK VisibilityModifierCheck
+
+ public Pair(A fst, B snd) {
+ this.first = fst;
+ this.second = snd;
+ }
+
+ public static <A, B> Pair<A, B> of(A a, B b) {
+ return new Pair<A, B>(a, b);
+ }
+
+ @Override
+ public String toString() {
+ return "(" + first + "," + second + ")";
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Pair pair = (Pair) o;
+
+ if (first != null ? !first.equals(pair.first) : pair.first != null) {
+ return false;
+ }
+ if (second != null ? !second.equals(pair.second) : pair.second != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = first != null ? first.hashCode() : 0;
+ result = 31 * result + (second != null ? second.hashCode() : 0);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/Tag.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/Tag.java b/common-types/src/main/java/org/apache/falcon/Tag.java
new file mode 100644
index 0000000..3c2f25e
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/Tag.java
@@ -0,0 +1,42 @@
+/**
+ * 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;
+
+import org.apache.falcon.entity.v0.EntityType;
+
+/**
+ * Tag to include in the entity type.
+ */
+public enum Tag {
+ DEFAULT(EntityType.PROCESS),
+ RETENTION(EntityType.FEED),
+ REPLICATION(EntityType.FEED),
+ IMPORT(EntityType.FEED),
+ EXPORT(EntityType.FEED);
+
+ private final EntityType entityType;
+
+ Tag(EntityType entityType) {
+ this.entityType = entityType;
+ }
+
+ public EntityType getType() {
+ return entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java b/common-types/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
new file mode 100644
index 0000000..89ce6f9
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/AccessControlList.java
@@ -0,0 +1,40 @@
+/**
+ * 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.entity.v0;
+
+/**
+ * Access control list for an Entity.
+ */
+public abstract class AccessControlList {
+
+ public abstract String getOwner();
+
+ public abstract String getGroup();
+
+ public abstract String getPermission();
+
+ @Override
+ public String toString() {
+ return "AccessControlList{"
+ + "owner='" + getOwner() + '\''
+ + ", group='" + getGroup() + '\''
+ + ", permission='" + getPermission() + '\''
+ + '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/DateValidator.java b/common-types/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
new file mode 100644
index 0000000..e211f57
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
@@ -0,0 +1,81 @@
+/**
+ * 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.entity.v0;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Date utility class.
+ */
+public final class DateValidator {
+
+ private static final String DATE_PATTERN =
+ "(2\\d\\d\\d|19\\d\\d)-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9])Z";
+ private static final Pattern PATTERN = Pattern.compile(DATE_PATTERN);
+
+ private DateValidator() {
+ }
+
+ /**
+ * Validate date format with regular expression.
+ *
+ * @param date date address for validation
+ * @return true valid date fromat, false invalid date format
+ */
+ public static boolean validate(final String date) {
+ if (StringUtils.isBlank(date)) {
+ return false;
+ }
+ Matcher matcher = PATTERN.matcher(date);
+
+ if (matcher.matches()) {
+
+ matcher.reset();
+
+ if (matcher.find()) {
+
+ int year = Integer.parseInt(matcher.group(1));
+ String month = matcher.group(2);
+ String day = matcher.group(3);
+
+ if (day.equals("31")
+ && (month.equals("4") || month.equals("6")
+ || month.equals("9") || month.equals("11")
+ || month.equals("04") || month.equals("06") || month.equals("09"))) {
+ return false; // only 1,3,5,7,8,10,12 has 31 days
+ } else if (month.equals("2") || month.equals("02")) {
+ // leap year
+ if (year % 4 == 0) {
+ return !(day.equals("30") || day.equals("31"));
+ } else {
+ return !(day.equals("29") || day.equals("30") || day.equals("31"));
+ }
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/Entity.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/Entity.java b/common-types/src/main/java/org/apache/falcon/entity/v0/Entity.java
new file mode 100644
index 0000000..ba6f2e5
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/Entity.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.entity.v0;
+
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+/**
+ * Base class that all entity jaxb object will extend.
+ */
+public abstract class Entity {
+ public abstract String getName();
+
+ public abstract String getTags();
+
+ public abstract AccessControlList getACL();
+
+ public EntityType getEntityType() {
+ for (EntityType type : EntityType.values()) {
+ if (type.getEntityClass().equals(getClass())) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || !o.getClass().equals(this.getClass())) {
+ return false;
+ }
+
+ Entity entity = (Entity) o;
+
+ String name = getName();
+ return !(name != null ? !name.equals(entity.getName()) : entity.getName() != null);
+ }
+
+ @Override
+ public int hashCode() {
+ String clazz = this.getClass().getName();
+
+ String name = getName();
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + clazz.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ Marshaller marshaller = getEntityType().getMarshaller();
+ marshaller.marshal(this, stringWriter);
+ return stringWriter.toString();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Entity fromString(EntityType type, String str) {
+ try {
+ Unmarshaller unmarshaler = type.getUnmarshaller();
+ return (Entity) unmarshaler.unmarshal(new StringReader(str));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String toShortString() {
+ return "(" + getEntityType().name().toLowerCase() + ") " + getName();
+ }
+
+ public Entity copy() {
+ return fromString(getEntityType(), toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java b/common-types/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
new file mode 100644
index 0000000..bab70d4
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/EntityNotification.java
@@ -0,0 +1,35 @@
+/**
+ * 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.entity.v0;
+
+/**
+ * EntityNotification class to be extended by Feed/Process notification class.
+ */
+public abstract class EntityNotification {
+ public abstract String getType();
+ public abstract String getLevel();
+ public abstract String getTo();
+
+ public String toString() {
+ return "Notification{"
+ + "type=" + getType()
+ + ", to=" + getTo()
+ + "}";
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/EntityType.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/EntityType.java b/common-types/src/main/java/org/apache/falcon/entity/v0/EntityType.java
new file mode 100644
index 0000000..29dbc7a
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/EntityType.java
@@ -0,0 +1,127 @@
+/**
+ * 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.entity.v0;
+
+import org.apache.falcon.entity.v0.cluster.Cluster;
+import org.apache.falcon.entity.v0.feed.Feed;
+import org.apache.falcon.entity.v0.process.Process;
+import org.apache.falcon.entity.v0.datasource.Datasource;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.util.Arrays;
+
+/**
+ * Enum for types of entities in Falcon Process, Feed and Cluster.
+ */
+public enum EntityType {
+ FEED(Feed.class, "/feed-0.1.xsd", "name"),
+ PROCESS(Process.class, "/process-0.1.xsd", "name"),
+ CLUSTER(Cluster.class, "/cluster-0.1.xsd", "name"),
+ DATASOURCE(Datasource.class, "/datasource-0.1.xsd", "name");
+
+ //Fail unmarshalling of whole xml if unmarshalling of any element fails
+ private static class EventHandler implements ValidationEventHandler {
+ @Override
+ public boolean handleEvent(ValidationEvent event) {
+ return false;
+ }
+ }
+
+ private static final String NS = "http://www.w3.org/2001/XMLSchema";
+
+ private final Class<? extends Entity> clazz;
+ private JAXBContext jaxbContext;
+ private Schema schema;
+ private String[] immutableProperties;
+
+ private String schemaFile;
+
+ private EntityType(Class<? extends Entity> typeClass, String schemaFile, String... immutableProperties) {
+ clazz = typeClass;
+ this.immutableProperties = immutableProperties;
+ this.schemaFile = schemaFile;
+ try {
+ jaxbContext = JAXBContext.newInstance(typeClass);
+ synchronized (this) {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(NS);
+ schema = schemaFactory.newSchema(getClass().getResource(schemaFile));
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Class<? extends Entity> getEntityClass() {
+ return clazz;
+ }
+
+ public String getSchemaFile() {
+ return schemaFile;
+ }
+
+ public Marshaller getMarshaller() throws JAXBException {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ return marshaller;
+ }
+
+ public Unmarshaller getUnmarshaller() throws JAXBException {
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ unmarshaller.setSchema(schema);
+ unmarshaller.setEventHandler(new EventHandler());
+ return unmarshaller;
+ }
+
+
+ public boolean isSchedulable() {
+ // Cluster and Datasource are not schedulable like Feed and Process
+ return ((this != EntityType.CLUSTER) && (this != EntityType.DATASOURCE));
+ }
+
+ public static void assertSchedulable(String entityType){
+ EntityType type = EntityType.getEnum(entityType);
+ if (type.isSchedulable()){
+ return;
+ } else {
+ throw new IllegalArgumentException("EntityType "+ entityType
+ + " is not valid,Feed and Process are the valid input type.");
+ }
+ }
+
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP"})
+ public String[] getImmutableProperties() {
+ return immutableProperties;
+ }
+
+ public static EntityType getEnum(String type) {
+ try {
+ return EntityType.valueOf(type.toUpperCase().trim());
+ } catch (IllegalArgumentException iae) {
+ throw new IllegalArgumentException("Invalid entity type: " + type + ". Expected "
+ + Arrays.toString(values()).toLowerCase() + ".");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/Frequency.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/Frequency.java b/common-types/src/main/java/org/apache/falcon/entity/v0/Frequency.java
new file mode 100644
index 0000000..f423df6
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/Frequency.java
@@ -0,0 +1,113 @@
+/**
+ * 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.entity.v0;
+
+import java.util.Calendar;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Frequency as supported in the xsd definitions.
+ */
+public class Frequency {
+ private static final Pattern PATTERN = Pattern.compile("(minutes|hours|days|months)\\((\\d+)\\)");
+
+ /**
+ * TimeUnit corresponding to the frequency.
+ */
+ public static enum TimeUnit {
+ minutes(Calendar.MINUTE), hours(Calendar.HOUR), days(Calendar.DATE), months(Calendar.MONTH);
+
+ private int calendarUnit;
+
+ private TimeUnit(int calendarUnit) {
+ this.calendarUnit = calendarUnit;
+ }
+
+ public int getCalendarUnit() {
+ return calendarUnit;
+ }
+ }
+
+ private TimeUnit timeUnit;
+ private String frequency;
+
+ public Frequency(String freq, TimeUnit timeUnit) {
+ this.frequency = freq;
+ this.timeUnit = timeUnit;
+ }
+
+ public Frequency(String strValue) {
+ Matcher matcher = PATTERN.matcher(strValue);
+ if (!matcher.matches()) {
+ throw new IllegalArgumentException("Invalid frequency: " + strValue);
+ }
+
+ timeUnit = TimeUnit.valueOf(matcher.group(1));
+ frequency = matcher.group(2);
+ }
+
+ public static Frequency fromString(String strValue) {
+ return new Frequency(strValue);
+ }
+
+ public static String toString(Frequency freq) {
+ return freq==null? null:freq.toString();
+ }
+
+ @Override
+ public String toString() {
+ return timeUnit.name() + "(" + frequency + ")";
+ }
+
+ public TimeUnit getTimeUnit() {
+ return timeUnit;
+ }
+
+ public String getFrequency() {
+ return frequency;
+ }
+
+ public int getFrequencyAsInt() {
+ return Integer.parseInt(frequency);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj instanceof Frequency)) {
+ return false;
+ }
+
+ Frequency freq = (Frequency) obj;
+ return this == freq || this.getFrequency().equals(freq.getFrequency())
+ && this.getTimeUnit() == freq.getTimeUnit();
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = timeUnit.hashCode();
+ result = 31 * result + frequency.hashCode();
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java b/common-types/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
new file mode 100644
index 0000000..1c02f37
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
@@ -0,0 +1,71 @@
+/**
+ * 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.entity.v0;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * Support function to parse and format date in xsd string.
+ */
+public final class SchemaHelper {
+
+ public static final String ISO8601_FORMAT = "yyyy-MM-dd'T'HH:mm'Z'";
+
+ private SchemaHelper() {}
+
+ public static String getTimeZoneId(TimeZone tz) {
+ return tz.getID();
+ }
+
+ public static DateFormat getDateFormat() {
+ DateFormat dateFormat = new SimpleDateFormat(ISO8601_FORMAT);
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return dateFormat;
+ }
+
+ public static String formatDateUTC(Date date) {
+ return (date != null) ? getDateFormat().format(date) : null;
+ }
+
+ public static Date parseDateUTC(String dateStr) {
+ if (!DateValidator.validate(dateStr)) {
+ throw new IllegalArgumentException(dateStr + " is not a valid UTC string");
+ }
+ try {
+ return getDateFormat().parse(dateStr);
+ } catch (ParseException e) {
+ throw new RuntimeException("Unable to parse date: " + dateStr, e);
+ }
+ }
+
+ public static String formatDateUTCToISO8601(final String dateString, final String dateStringFormat) {
+
+ try {
+ DateFormat dateFormat = new SimpleDateFormat(dateStringFormat.substring(0, dateString.length()));
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return SchemaHelper.formatDateUTC(dateFormat.parse(dateString));
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/extensions/ExtensionType.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/extensions/ExtensionType.java b/common-types/src/main/java/org/apache/falcon/extensions/ExtensionType.java
new file mode 100644
index 0000000..c4621cc
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/extensions/ExtensionType.java
@@ -0,0 +1,37 @@
+/**
+ * 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.extensions;
+
+/**
+ * Enum to store ExtensionType.
+ */
+public enum ExtensionType {
+ TRUSTED("Trusted extension") ,
+ CUSTOM("Custom extension");
+
+ private final String text;
+
+ private ExtensionType(final String text) {
+ this.text = text;
+ }
+ @Override
+ public String toString(){
+ return text;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/metadata/RelationshipType.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/metadata/RelationshipType.java b/common-types/src/main/java/org/apache/falcon/metadata/RelationshipType.java
new file mode 100644
index 0000000..47bc377
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/metadata/RelationshipType.java
@@ -0,0 +1,81 @@
+/**
+ * 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.metadata;
+
+import org.apache.falcon.entity.v0.EntityType;
+
+/**
+ * Enumerates Relationship types.
+ */
+public enum RelationshipType {
+
+ // entity vertex types
+ CLUSTER_ENTITY("cluster-entity"),
+ FEED_ENTITY("feed-entity"),
+ PROCESS_ENTITY("process-entity"),
+ DATASOURCE_ENTITY("datasource-entity"),
+
+ // instance vertex types
+ FEED_INSTANCE("feed-instance"),
+ PROCESS_INSTANCE("process-instance"),
+ IMPORT_INSTANCE("import-instance"),
+
+ // Misc vertex types
+ USER("user"),
+ COLO("data-center"),
+ TAGS("classification"),
+ GROUPS("group"),
+ PIPELINES("pipelines"),
+ REPLICATION_METRICS("replication-metrics");
+
+
+ private final String name;
+
+ RelationshipType(java.lang.String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public static RelationshipType fromString(String value) {
+ if (value != null) {
+ for (RelationshipType type : RelationshipType.values()) {
+ if (value.equals(type.getName())) {
+ return type;
+ }
+ }
+ }
+
+ throw new IllegalArgumentException("No constant with value " + value + " found");
+ }
+
+ public static RelationshipType fromSchedulableEntityType(String type) {
+ EntityType entityType = EntityType.getEnum(type);
+ switch (entityType) {
+ case FEED:
+ return RelationshipType.FEED_ENTITY;
+ case PROCESS:
+ return RelationshipType.PROCESS_ENTITY;
+ default:
+ throw new IllegalArgumentException("Invalid schedulable entity type: " + entityType.name());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/APIResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/APIResult.java b/common-types/src/main/java/org/apache/falcon/resource/APIResult.java
new file mode 100644
index 0000000..e67eb3a
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/APIResult.java
@@ -0,0 +1,106 @@
+/**
+ * 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.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.StringWriter;
+
+/**
+ * APIResult is the output returned by all the APIs; status-SUCCEEDED or FAILED
+ * message- detailed message.
+ */
+@XmlRootElement(name = "result")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class APIResult {
+
+ private Status status;
+
+ private String message;
+
+ private String requestId;
+
+ private static final JAXBContext JAXB_CONTEXT;
+
+ static {
+ try {
+ JAXB_CONTEXT = JAXBContext.newInstance(APIResult.class);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * API Result status.
+ */
+ public static enum Status {
+ SUCCEEDED, PARTIAL, FAILED
+ }
+
+ public APIResult(Status status, String message) {
+ super();
+ this.status = status;
+ this.message = message;
+ requestId = Thread.currentThread().getName();
+ }
+
+ protected APIResult() {
+ // private default constructor for JAXB
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String reqId) {
+ this.requestId = reqId;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ Marshaller marshaller = JAXB_CONTEXT.createMarshaller();
+ marshaller.marshal(this, stringWriter);
+ return stringWriter.toString();
+ } catch (JAXBException e) {
+ return e.getMessage();
+ }
+ }
+
+ public Object[] getCollection() {
+ return null;
+ }
+
+ public void setCollection(Object[] items) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/EntityList.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/EntityList.java b/common-types/src/main/java/org/apache/falcon/resource/EntityList.java
new file mode 100644
index 0000000..1a208fa
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/EntityList.java
@@ -0,0 +1,213 @@
+/**
+ * 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.Entity;
+import org.apache.falcon.entity.v0.EntityType;
+import org.apache.falcon.entity.v0.process.Input;
+import org.apache.falcon.entity.v0.process.Output;
+import org.apache.falcon.entity.v0.process.Process;
+
+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 javax.xml.bind.annotation.XmlElementWrapper;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Entity list used for marshalling / unmarshalling with REST calls.
+ */
+@XmlRootElement(name = "entities")
+@XmlAccessorType(XmlAccessType.FIELD)
+@edu.umd.cs.findbugs.annotations.SuppressWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
+public class EntityList {
+ public static final String INPUT_TAG = "Input";
+ public static final String OUTPUT_TAG = "Output";
+
+ public int getTotalResults() {
+ return totalResults;
+ }
+
+ @XmlElement
+ private int totalResults;
+
+ @XmlElement(name = "entity")
+ private final EntityElement[] elements;
+
+ /**
+ * List of fields returned by RestAPI.
+ */
+ public enum EntityFieldList {
+ TYPE, NAME, STATUS, TAGS, PIPELINES, CLUSTERS
+ }
+
+ /**
+ * Filter by these Fields is supported by RestAPI.
+ */
+ public enum EntityFilterByFields {
+ TYPE, NAME, STATUS, PIPELINES, CLUSTER, TAGS
+ }
+
+ /**
+ * Element within an entity.
+ */
+ public static class EntityElement {
+ //SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
+ @XmlElement
+ public String type;
+ @XmlElement
+ public String name;
+ @XmlElement
+ public String status;
+ @XmlElementWrapper(name = "tags")
+ public List<String> tag;
+ @XmlElementWrapper(name = "pipelines")
+ public List<String> pipeline;
+ @XmlElementWrapper(name = "clusters")
+ public List<String> cluster;
+
+ //RESUME CHECKSTYLE CHECK VisibilityModifierCheck
+
+ @Override
+ public String toString() {
+ String outString = "(" + type + ") " + name;
+ if (StringUtils.isNotEmpty(status)) {
+ outString += "(" + status + ")";
+ }
+
+ if (tag != null && !tag.isEmpty()) {
+ outString += " - " + tag.toString();
+ }
+
+ if (pipeline != null && !pipeline.isEmpty()) {
+ outString += " - " + pipeline.toString();
+ }
+
+ if (cluster != null && !cluster.isEmpty()) {
+ outString += " - " + cluster.toString();
+ }
+
+ outString += "\n";
+ return outString;
+ }
+ }
+
+ //For JAXB
+ public EntityList() {
+ this.elements = null;
+ this.totalResults = 0;
+ }
+
+ public EntityList(EntityElement[] elements, int totalResults) {
+ this.totalResults = totalResults;
+ this.elements = elements;
+ }
+
+ public EntityList(Entity[] elements, int totalResults) {
+ this.totalResults = totalResults;
+ int len = elements.length;
+ EntityElement[] items = new EntityElement[len];
+ for (int i = 0; i < len; i++) {
+ items[i] = createEntityElement(elements[i]);
+ }
+ this.elements = items;
+ }
+
+ private EntityElement createEntityElement(Entity e) {
+ EntityElement element = new EntityElement();
+ element.type = e.getEntityType().name().toLowerCase();
+ element.name = e.getName();
+ element.status = null;
+ element.tag = new ArrayList<String>();
+ element.pipeline = new ArrayList<String>();
+ element.cluster = new ArrayList<String>();
+ return element;
+ }
+
+ public EntityList(Entity[] dependentEntities, Entity entity) {
+ int len = dependentEntities.length;
+ this.totalResults = len;
+ EntityElement[] items = new EntityElement[len];
+ for (int i = 0; i < len; i++) {
+ Entity e = dependentEntities[i];
+ EntityElement o = new EntityElement();
+ o.type = e.getEntityType().name().toLowerCase();
+ o.name = e.getName();
+ o.status = null;
+ o.tag = getEntityTag(e, entity);
+ items[i] = o;
+ }
+ this.elements = items;
+ }
+
+ public EntityElement[] getElements() {
+ return elements;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(totalResults + "\n");
+ for (EntityElement element : elements) {
+ buffer.append(element.toString());
+ }
+ return buffer.toString();
+ }
+
+ private List<String> getEntityTag(Entity dependentEntity, Entity entity) {
+ List<String> tagList = new ArrayList<String>();
+
+ if (entity.getEntityType().equals(EntityType.CLUSTER)) {
+ return tagList;
+ }
+
+ Process process = null;
+ String entityNameToMatch = null;
+ if (dependentEntity.getEntityType().equals(EntityType.PROCESS)) {
+ process = (Process) dependentEntity;
+ entityNameToMatch = entity.getName();
+ } else if (dependentEntity.getEntityType().equals(EntityType.FEED)
+ && entity.getEntityType().equals(EntityType.PROCESS)) {
+ process = (Process) entity;
+ entityNameToMatch = dependentEntity.getName();
+ }
+
+ if (process != null) {
+ if (process.getInputs() != null) {
+ for (Input i : process.getInputs().getInputs()) {
+ if (i.getFeed().equals(entityNameToMatch)) {
+ tagList.add(INPUT_TAG);
+ }
+ }
+ }
+ if (process.getOutputs() != null) {
+ for (Output o : process.getOutputs().getOutputs()) {
+ if (o.getFeed().equals(entityNameToMatch)) {
+ tagList.add(OUTPUT_TAG);
+ }
+ }
+ }
+ }
+
+ return tagList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/9e25ede1/common-types/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
----------------------------------------------------------------------
diff --git a/common-types/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java b/common-types/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
new file mode 100644
index 0000000..4d42b42
--- /dev/null
+++ b/common-types/src/main/java/org/apache/falcon/resource/EntitySummaryResult.java
@@ -0,0 +1,235 @@
+/**
+ * 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.Arrays;
+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 EntitySummaryResult extends APIResult {
+
+ /**
+ * Workflow status as being set in result object.
+ */
+ public static enum WorkflowStatus {
+ WAITING, RUNNING, SUSPENDED, KILLED, FAILED, SUCCEEDED, ERROR, READY
+ }
+
+ @XmlElement
+ private EntitySummary[] entitySummaries;
+
+ //For JAXB
+ public EntitySummaryResult() {
+ super();
+ }
+
+ public EntitySummaryResult(String message, EntitySummary[] entitySummaries) {
+ this(Status.SUCCEEDED, message, entitySummaries);
+ }
+
+ public EntitySummaryResult(Status status, String message, EntitySummary[] entitySummaries) {
+ super(status, message);
+ this.entitySummaries = entitySummaries;
+ }
+
+ public EntitySummaryResult(Status status, String message) {
+ super(status, message);
+ }
+
+ public EntitySummary[] getEntitySummaries() {
+ return this.entitySummaries;
+ }
+
+ public void setEntitySummaries(EntitySummary[] entitySummaries) {
+ this.entitySummaries = entitySummaries;
+ }
+
+ @Override
+ public Object[] getCollection() {
+ return entitySummaries;
+ }
+
+ @Override
+ public void setCollection(Object[] items) {
+ if (items == null) {
+ setEntitySummaries(new EntitySummary[0]);
+ } else {
+ EntitySummary[] summaries = Arrays.copyOf(items, items.length, EntitySummary[].class);
+ setEntitySummaries(summaries);
+ }
+ }
+
+ /**
+ * A single entity object inside entity summary result.
+ */
+ @XmlRootElement(name = "entitySummary")
+ public static class EntitySummary {
+
+ @XmlElement
+ public String type;
+ @XmlElement
+ public String name;
+ @XmlElement
+ public String status;
+ @XmlElement
+ public String[] tags;
+ @XmlElement
+ public String[] pipelines;
+ @XmlElement
+ public Instance[] instances;
+
+ public EntitySummary() {
+ }
+
+ public EntitySummary(String entityName, String entityType) {
+ this.name = entityName;
+ this.type = entityType;
+ }
+
+ public EntitySummary(String name, String type, String status,
+ String[] tags, String[] pipelines,
+ Instance[] instances) {
+ this.name = name;
+ this.type = type;
+ this.status = status;
+ this.pipelines = pipelines;
+ this.tags = tags;
+ this.instances = instances;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public String getStatus() {
+ return this.status;
+ }
+
+ public String[] getTags() {
+ return this.tags;
+ }
+
+ public String[] getPipelines() {
+ return this.pipelines;
+ }
+
+ public Instance[] getInstances() {
+ return this.instances;
+ }
+
+ @Override
+ public String toString() {
+ return "{Entity: " + (this.name == null ? "" : this.name)
+ + ", Type: " + (this.type == null ? "" : this.type)
+ + ", Status: " + (this.status == null ? "" : this.status)
+ + ", Tags: " + (this.tags == null ? "[]" : Arrays.toString(this.tags))
+ + ", Pipelines: " + (this.pipelines == null ? "[]" : Arrays.toString(this.pipelines))
+ + ", InstanceSummary: " + (this.instances == null ? "[]" : Arrays.toString(this.instances))
+ +"}";
+ }
+ }
+
+ /**
+ * A single instance object inside instance result.
+ */
+ @XmlRootElement(name = "instances")
+ 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;
+
+ 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;
+ }
+
+ @Override
+ public String toString() {
+ return "{instance: " + (this.instance == null ? "" : this.instance)
+ + ", status: " + (this.status == null ? "" : this.status)
+ + (this.logFile == null ? "" : ", log: " + this.logFile)
+ + (this.sourceCluster == null ? "" : ", source-cluster: " + this.sourceCluster)
+ + (this.cluster == null ? "" : ", cluster: " + this.cluster)
+ + (this.startTime == null ? "" : ", startTime: " + this.startTime)
+ + (this.endTime == null ? "" : ", endTime: " + this.endTime)
+ + "}";
+ }
+ }
+}
+//RESUME CHECKSTYLE CHECK VisibilityModifierCheck