FALCON-2187 Refactoring to move entity xsd and jxb bindings to a new nmodule
Author: sandeep <[email protected]> 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 <[email protected]> Authored: Mon Nov 21 20:00:58 2016 +0530 Committer: Pallavi Rao <[email protected]> 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) [email protected]({"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) [email protected]({"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 [email protected]({"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 [email protected]({"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 [email protected]({"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 [email protected]({"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) [email protected]({"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) [email protected]({"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 [email protected]({"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
