ATLAS-2216: Remove Catalog/Taxonomy feature from Atlas Signed-off-by: Madhan Neethiraj <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/96da2306 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/96da2306 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/96da2306 Branch: refs/heads/master Commit: 96da2306df01023ba8bf202368a482ffa59dc4cb Parents: a9928f9 Author: Sarath Subramanian <[email protected]> Authored: Wed Oct 18 11:35:47 2017 -0700 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Oct 18 12:49:33 2017 -0700 ---------------------------------------------------------------------- addons/models/0000-Area0/0010-base_model.json | 18 +- .../atlas/authorize/AtlasResourceTypes.java | 2 +- .../simple/AtlasAuthorizationUtils.java | 10 - .../atlas/authorize/simple/PolicyParser.java | 4 - .../simple/AtlasAuthorizationUtilsTest.java | 13 - catalog/pom.xml | 163 ----- .../apache/atlas/catalog/AtlasTypeSystem.java | 100 ---- .../org/apache/atlas/catalog/BaseRequest.java | 95 --- .../atlas/catalog/BaseResourceProvider.java | 52 -- .../apache/atlas/catalog/CollectionRequest.java | 39 -- .../atlas/catalog/DefaultDateFormatter.java | 39 -- .../atlas/catalog/DefaultPropertyMapper.java | 148 ----- .../apache/atlas/catalog/DefaultTypeSystem.java | 209 ------- .../atlas/catalog/EntityResourceProvider.java | 70 --- .../catalog/EntityTagResourceProvider.java | 137 ----- .../apache/atlas/catalog/InstanceRequest.java | 39 -- .../apache/atlas/catalog/JsonSerializer.java | 90 --- .../apache/atlas/catalog/PropertyMapper.java | 45 -- .../atlas/catalog/PropertyValueFormatter.java | 33 -- .../java/org/apache/atlas/catalog/Request.java | 86 --- .../atlas/catalog/ResourceComparator.java | 62 -- .../apache/atlas/catalog/ResourceProvider.java | 95 --- .../java/org/apache/atlas/catalog/Result.java | 50 -- .../atlas/catalog/TaxonomyResourceProvider.java | 215 ------- .../java/org/apache/atlas/catalog/TermPath.java | 111 ---- .../atlas/catalog/TermResourceProvider.java | 252 -------- .../apache/atlas/catalog/TermVertexWrapper.java | 32 - .../org/apache/atlas/catalog/VertexWrapper.java | 115 ---- .../definition/BaseResourceDefinition.java | 163 ----- .../definition/EntityResourceDefinition.java | 120 ---- .../definition/EntityTagResourceDefinition.java | 105 ---- .../catalog/definition/ResourceDefinition.java | 122 ---- .../definition/TaxonomyResourceDefinition.java | 91 --- .../definition/TermResourceDefinition.java | 158 ----- .../catalog/exception/CatalogException.java | 36 -- .../exception/CatalogRuntimeException.java | 43 -- .../exception/InvalidPayloadException.java | 39 -- .../exception/InvalidQueryException.java | 28 - .../ResourceAlreadyExistsException.java | 28 - .../exception/ResourceNotFoundException.java | 28 - .../atlas/catalog/projection/BaseRelation.java | 33 -- .../catalog/projection/GenericRelation.java | 82 --- .../atlas/catalog/projection/Projection.java | 66 --- .../catalog/projection/ProjectionResult.java | 51 -- .../atlas/catalog/projection/Relation.java | 53 -- .../catalog/projection/RelationProjection.java | 69 --- .../atlas/catalog/projection/RelationSet.java | 45 -- .../atlas/catalog/projection/TagRelation.java | 77 --- .../atlas/catalog/projection/TraitRelation.java | 80 --- .../catalog/query/AlwaysQueryExpression.java | 46 -- .../atlas/catalog/query/AtlasEntityQuery.java | 39 -- .../catalog/query/AtlasEntityTagQuery.java | 86 --- .../apache/atlas/catalog/query/AtlasQuery.java | 47 -- .../atlas/catalog/query/AtlasTaxonomyQuery.java | 38 -- .../atlas/catalog/query/AtlasTermQuery.java | 51 -- .../apache/atlas/catalog/query/BaseQuery.java | 215 ------- .../catalog/query/BaseQueryExpression.java | 105 ---- .../catalog/query/BooleanQueryExpression.java | 141 ----- .../catalog/query/PrefixQueryExpression.java | 39 -- .../query/ProjectionQueryExpression.java | 122 ---- .../atlas/catalog/query/QueryExpression.java | 99 ---- .../atlas/catalog/query/QueryFactory.java | 183 ------ .../catalog/query/RegexQueryExpression.java | 41 -- .../catalog/query/TermQueryExpression.java | 52 -- .../catalog/query/TermRangeQueryExpression.java | 61 -- .../catalog/query/WildcardQueryExpression.java | 43 -- .../atlas/catalog/CollectionRequestTest.java | 74 --- .../atlas/catalog/DefaultDateFormatterTest.java | 41 -- .../catalog/DefaultPropertyMapperTest.java | 177 ------ .../catalog/EntityResourceProviderTest.java | 215 ------- .../catalog/EntityTagResourceProviderTest.java | 463 --------------- .../atlas/catalog/InstanceRequestTest.java | 67 --- .../atlas/catalog/JsonSerializerTest.java | 120 ---- .../atlas/catalog/ResourceComparatorTest.java | 61 -- .../catalog/TaxonomyResourceProviderTest.java | 591 ------------------- .../atlas/catalog/TermResourceProviderTest.java | 558 ----------------- .../apache/atlas/catalog/VertexWrapperTest.java | 332 ----------- .../EntityResourceDefinitionTest.java | 140 ----- .../EntityTagResourceDefinitionTest.java | 177 ------ .../TaxonomyResourceDefinitionTest.java | 174 ------ .../definition/TermResourceDefinitionTest.java | 210 ------- .../catalog/projection/TagRelationTest.java | 55 -- .../query/AlwaysQueryExpressionTest.java | 74 --- .../catalog/query/AtlasEntityQueryTest.java | 277 --------- .../atlas/catalog/query/QueryFactoryTest.java | 209 ------- distro/src/conf/atlas-application.properties | 6 - distro/src/conf/policy-store.txt | 8 +- pom.xml | 7 - typesystem/src/test/resources/policy-store.txt | 8 +- webapp/pom.xml | 44 -- .../atlas/web/resources/AdminResource.java | 7 - .../apache/atlas/web/resources/BaseService.java | 157 ----- .../web/resources/CatalogExceptionMapper.java | 62 -- .../CatalogRuntimeExceptionMapper.java | 78 --- .../atlas/web/resources/EntityService.java | 247 -------- .../atlas/web/resources/TaxonomyService.java | 441 -------------- .../web/resources/TaxonomyServiceTest.java | 569 ------------------ .../atlas/web/security/BaseSecurityTest.java | 2 +- 98 files changed, 11 insertions(+), 10889 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/addons/models/0000-Area0/0010-base_model.json ---------------------------------------------------------------------- diff --git a/addons/models/0000-Area0/0010-base_model.json b/addons/models/0000-Area0/0010-base_model.json index 41cf916..fcc911c 100644 --- a/addons/models/0000-Area0/0010-base_model.json +++ b/addons/models/0000-Area0/0010-base_model.json @@ -1,23 +1,7 @@ { "enumDefs": [], "structDefs": [], - "classificationDefs": [ - { - "name": "TaxonomyTerm", - "superTypes": [], - "typeVersion": "1.0", - "attributeDefs": [ - { - "name": "atlas.taxonomy", - "typeName": "string", - "cardinality": "SINGLE", - "isIndexable": false, - "isOptional": true, - "isUnique": false - } - ] - } - ], + "classificationDefs": [], "entityDefs": [ { "name": "Referenceable", http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java index 9902685..7e2808c 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java @@ -19,5 +19,5 @@ package org.apache.atlas.authorize; public enum AtlasResourceTypes { - UNKNOWN, ENTITY, TYPE, OPERATION, TAXONOMY, TERM, RELATIONSHIP + UNKNOWN, ENTITY, TYPE, OPERATION, RELATIONSHIP } http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java index cc42a73..311894e 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java @@ -111,9 +111,6 @@ public class AtlasAuthorizationUtils { * entities,lineage and discovery apis are mapped with AtlasResourceTypes.ENTITY eg :- /api/atlas/lineage/hive/table/* * /api/atlas/entities/{guid}* /api/atlas/discovery/* * - * taxonomy API are also mapped to AtlasResourceTypes.TAXONOMY & AtlasResourceTypes.ENTITY and its terms APIs have - * added AtlasResourceTypes.TERM associations. - * * unprotected types are mapped with AtlasResourceTypes.UNKNOWN, access to these are allowed. */ public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) { @@ -132,13 +129,6 @@ public class AtlasAuthorizationUtils { } else if (api.startsWith("entities") || api.startsWith("lineage") || api.startsWith("discovery") || api.startsWith("entity") || api.startsWith("search")) { resourceTypes.add(AtlasResourceTypes.ENTITY); - } else if (api.startsWith("taxonomies")) { - resourceTypes.add(AtlasResourceTypes.TAXONOMY); - // taxonomies are modeled as entities - resourceTypes.add(AtlasResourceTypes.ENTITY); - if (contextPath.contains("/terms")) { - resourceTypes.add(AtlasResourceTypes.TERM); - } } else if (api.startsWith("relationship")) { resourceTypes.add(AtlasResourceTypes.RELATIONSHIP); } else { http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java index aabac90..f61bbf7 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java @@ -226,10 +226,6 @@ public class PolicyParser { resourceType = AtlasResourceTypes.OPERATION; } else if (type.equalsIgnoreCase("TYPE")) { resourceType = AtlasResourceTypes.TYPE; - } else if (type.equalsIgnoreCase("TAXONOMY")) { - resourceType = AtlasResourceTypes.TAXONOMY; - } else if (type.equalsIgnoreCase("TERM")) { - resourceType = AtlasResourceTypes.TERM; } else if (type.equalsIgnoreCase("RELATIONSHIP")) { resourceType = AtlasResourceTypes.RELATIONSHIP; } else { http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/authorization/src/test/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtilsTest.java ---------------------------------------------------------------------- diff --git a/authorization/src/test/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtilsTest.java b/authorization/src/test/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtilsTest.java index b76a297..adebb62 100644 --- a/authorization/src/test/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtilsTest.java +++ b/authorization/src/test/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtilsTest.java @@ -92,19 +92,6 @@ public class AtlasAuthorizationUtilsTest { assertEquals(resourceTypes.size(), 1); assertTrue(resourceTypes.contains(AtlasResourceTypes.ENTITY)); - contextPath = "/api/atlas/v1/taxonomies"; - resourceTypes = AtlasAuthorizationUtils.getAtlasResourceType(contextPath); - assertEquals(resourceTypes.size(), 2); - assertTrue(resourceTypes.contains(AtlasResourceTypes.TAXONOMY)); - assertTrue(resourceTypes.contains(AtlasResourceTypes.ENTITY)); - - contextPath = "/api/atlas/v1/taxonomies/taxonomy1/terms"; - resourceTypes = AtlasAuthorizationUtils.getAtlasResourceType(contextPath); - assertEquals(resourceTypes.size(), 3); - assertTrue(resourceTypes.contains(AtlasResourceTypes.TAXONOMY)); - assertTrue(resourceTypes.contains(AtlasResourceTypes.ENTITY)); - assertTrue(resourceTypes.contains(AtlasResourceTypes.TERM)); - contextPath = "/api/atlas/v1/entities/111"; resourceTypes = AtlasAuthorizationUtils.getAtlasResourceType(contextPath); assertEquals(resourceTypes.size(), 1); http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/pom.xml ---------------------------------------------------------------------- diff --git a/catalog/pom.xml b/catalog/pom.xml deleted file mode 100755 index 0d13ae4..0000000 --- a/catalog/pom.xml +++ /dev/null @@ -1,163 +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. - --> - -<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.atlas</groupId> - <artifactId>apache-atlas</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> - <artifactId>atlas-catalog</artifactId> - <description>Apache Atlas Business Catalog Module</description> - <name>Apache Atlas Business Catalog</name> - <packaging>jar</packaging> - <properties> - <tinkerpop.version>2.6.0</tinkerpop.version> - <titan.version>0.5.4</titan.version> - <lucene.version>4.8.1</lucene.version> - </properties> - - <profiles> - <profile> - <id>titan1</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <properties> - <lucene.version>4.10.4</lucene.version> - </properties> - </profile> - </profiles> - - <dependencies> - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-repository</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-typesystem</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-server-api</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-graphdb-api</artifactId> - </dependency> - - <!-- for now, keep the titan 0.5.4 / TP 2 dependencies. This will need to be changed to use a - more generic query framework that supports both TP2/TP3. Maybe the DSL translation could be changed to use - that as well... - --> - <dependency> - <groupId>com.tinkerpop.blueprints</groupId> - <artifactId>blueprints-core</artifactId> - <version>${tinkerpop.version}</version> - </dependency> - <dependency> - <groupId>com.tinkerpop.gremlin</groupId> - <artifactId>gremlin-java</artifactId> - <version>${tinkerpop.version}</version> - </dependency> - - <dependency> - <groupId>com.thinkaurelius.titan</groupId> - <artifactId>titan-core</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - <version>${lucene.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-queryparser</artifactId> - <version>${lucene.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-analyzers-common</artifactId> - <version>${lucene.version}</version> - </dependency> - - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - </dependency> - - <dependency> - <groupId>com.googlecode.json-simple</groupId> - <artifactId>json-simple</artifactId> - </dependency> - - <!-- testing --> - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymock</artifactId> - <version>3.4</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-typesystem</artifactId> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>2.4</version> - <configuration> - <excludes> - <exclude>**/log4j.xml</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/AtlasTypeSystem.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/AtlasTypeSystem.java b/catalog/src/main/java/org/apache/atlas/catalog/AtlasTypeSystem.java deleted file mode 100644 index 8f9cd1d..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/AtlasTypeSystem.java +++ /dev/null @@ -1,100 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.catalog.definition.ResourceDefinition; -import org.apache.atlas.catalog.exception.ResourceAlreadyExistsException; -import org.apache.atlas.catalog.exception.ResourceNotFoundException; - -import java.util.Map; - -/** - * Abstraction for Atlas Type System. - */ -public interface AtlasTypeSystem { - - /** - * Create a Type in the Atlas Type System if it doesn't already exist. - * If the type already exists, this method has no affect. - * - * @param resourceDefinition resource definition for type being created - * @param name type name - * @param description description of the type being created - * - * @throws ResourceAlreadyExistsException if entity already exists - */ - void createClassType(ResourceDefinition resourceDefinition, String name, String description) - throws ResourceAlreadyExistsException; - - /** - * Create an entity in the Atlas Type System for the provided request and resource definition. - * If Type associated with the entity doesn't already exist, it is created. - * - * @param definition the definition of the resource for which we are creating the entity - * @param request the user request - * - * @throws ResourceAlreadyExistsException if type already exists - */ - String createEntity(ResourceDefinition definition, Request request) - throws ResourceAlreadyExistsException; - - /** - * Delete an entity from the Atlas type system. - * - * @param definition definition of the resource being deleted - * @param request user request - * - * @throws ResourceNotFoundException if the resource to delete doesn't exist - */ - void deleteEntity(ResourceDefinition definition, Request request) throws ResourceNotFoundException; - - /** - * Create a trait instance instance in the Atlas Type System. - * - * @param resourceDefinition resource definition for trait type being created - * @param name type name - * @param description description of the type being created - * - * @throws ResourceAlreadyExistsException if type already exists - */ - void createTraitType(ResourceDefinition resourceDefinition, String name, String description) - throws ResourceAlreadyExistsException; - - /** - * Create a trait instance in the Atlas Type System and associate it with the entity identified by the provided guid. - * - * @param guid id of the entity which will be associated with the trait instance - * @param typeName type name of the trait - * @param properties property map used to populate the trait instance - * - * @throws ResourceAlreadyExistsException if trait instance is already associated with the entity - */ - void createTraitInstance(String guid, String typeName, Map<String, Object> properties) - throws ResourceAlreadyExistsException; - - /** - * Delete a tag instance. - * - * @param guid associated entity guid - * @param traitName name of the trait to delete - * - * @throws ResourceNotFoundException if the specified trait doesn't exist for the specified entity - */ - void deleteTag(String guid, String traitName) throws ResourceNotFoundException; -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/BaseRequest.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/BaseRequest.java b/catalog/src/main/java/org/apache/atlas/catalog/BaseRequest.java deleted file mode 100644 index c03d6d0..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/BaseRequest.java +++ /dev/null @@ -1,95 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Objects; - -/** - * Base user API request. - */ -public abstract class BaseRequest implements Request { - private final Map<String, Object> queryProperties = new HashMap<>(); - private final Map<String, Object> updateProperties = new HashMap<>(); - private final String queryString; - private final Collection<String> additionalSelectProperties = new HashSet<>(); - - protected BaseRequest(Map<String, Object> queryProperties, String queryString) { - this(queryProperties, queryString, null); - } - - protected BaseRequest(Map<String, Object> queryProperties, String queryString, Map<String, Object> updateProperties) { - if (queryProperties != null) { - this.queryProperties.putAll(queryProperties); - } - - if (updateProperties != null) { - this.updateProperties.putAll(updateProperties); - } - - this.queryString = queryString; - } - - - public Map<String, Object> getQueryProperties() { - return queryProperties; - } - - public Map<String, Object> getUpdateProperties() { - return updateProperties; - } - - public <T> T getProperty(String name) { - return (T) queryProperties.get(name); - } - - public String getQueryString() { - return queryString; - } - - @Override - public void addAdditionalSelectProperties(Collection<String> resultProperties) { - additionalSelectProperties.addAll(resultProperties); - } - - @Override - public Collection<String> getAdditionalSelectProperties() { - return additionalSelectProperties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BaseRequest that = (BaseRequest) o; - return Objects.equals(queryProperties, that.queryProperties) && - Objects.equals(updateProperties, that.updateProperties) && - Objects.equals(queryString, that.queryString) && - Objects.equals(additionalSelectProperties, that.additionalSelectProperties); - } - - @Override - public int hashCode() { - return Objects.hash(queryProperties, updateProperties, queryString, additionalSelectProperties); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java b/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java deleted file mode 100644 index feb9d72..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java +++ /dev/null @@ -1,52 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.catalog.definition.ResourceDefinition; -import org.apache.atlas.catalog.exception.InvalidPayloadException; -import org.apache.atlas.catalog.exception.ResourceNotFoundException; -import org.apache.atlas.catalog.query.QueryFactory; - -/** - * Base class for resource providers. - */ -public abstract class BaseResourceProvider implements ResourceProvider { - protected final AtlasTypeSystem typeSystem; - protected QueryFactory queryFactory = new QueryFactory(); - protected final ResourceDefinition resourceDefinition; - - protected BaseResourceProvider(AtlasTypeSystem typeSystem, ResourceDefinition resourceDefinition) { - this.typeSystem = typeSystem; - this.resourceDefinition = resourceDefinition; - } - - protected void setQueryFactory(QueryFactory factory) { - queryFactory = factory; - } - - @Override - public void deleteResourceById(Request request) throws ResourceNotFoundException, InvalidPayloadException { - throw new InvalidPayloadException("Delete is not supported for this resource type"); - } - - @Override - public void updateResourceById(Request request) throws ResourceNotFoundException, InvalidPayloadException { - throw new InvalidPayloadException("Update is not supported for this resource type"); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/CollectionRequest.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/CollectionRequest.java b/catalog/src/main/java/org/apache/atlas/catalog/CollectionRequest.java deleted file mode 100644 index 8a6e7fc..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/CollectionRequest.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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.Map; - -/** - * A request for a collection resource. - */ -public class CollectionRequest extends BaseRequest { - public CollectionRequest(Map<String, Object> queryProperties, String queryString) { - super(queryProperties, queryString); - } - - public CollectionRequest(Map<String, Object> queryProperties, String queryString, Map<String, Object> updateProperties) { - super(queryProperties, queryString, updateProperties); - } - - @Override - public Cardinality getCardinality() { - return Cardinality.COLLECTION; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/DefaultDateFormatter.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/DefaultDateFormatter.java b/catalog/src/main/java/org/apache/atlas/catalog/DefaultDateFormatter.java deleted file mode 100644 index df07505..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/DefaultDateFormatter.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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.GregorianCalendar; - -/** - * Format a date field which is represented as a long. - */ -public class DefaultDateFormatter implements PropertyValueFormatter<Long, String> { - - //todo: obtain format from atlas proper - public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss"); - - @Override - public String format(Long l) { - Calendar calendar = new GregorianCalendar(); - calendar.setTimeInMillis(l); - return DATE_FORMAT.format(calendar.getTime()); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/DefaultPropertyMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/DefaultPropertyMapper.java b/catalog/src/main/java/org/apache/atlas/catalog/DefaultPropertyMapper.java deleted file mode 100644 index 6c41881..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/DefaultPropertyMapper.java +++ /dev/null @@ -1,148 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.AtlasException; -import org.apache.atlas.catalog.exception.CatalogRuntimeException; -import org.apache.atlas.repository.Constants; -import org.apache.atlas.typesystem.types.FieldMapping; -import org.apache.atlas.typesystem.types.HierarchicalType; -import org.apache.atlas.typesystem.types.TypeSystem; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * Default property mapper which translates property names to/from name exposed in API to internal fully qualified name. - */ -public class DefaultPropertyMapper implements PropertyMapper { - //todo: abstract HierarchicalType - private Map<String, HierarchicalType> typeInstances = new HashMap<>(); - private final Map<String, String> m_qualifiedToCleanMap = new HashMap<>(); - private final Map<String, String> m_cleanToQualifiedMap = new HashMap<>(); - - - public DefaultPropertyMapper() { - this(Collections.<String, String>emptyMap(), Collections.<String, String>emptyMap()); - } - - public DefaultPropertyMapper(Map<String, String> qualifiedToCleanMap, - Map<String, String> cleanToQualifiedMap) { - setDefaultMappings(); - - m_qualifiedToCleanMap.putAll(qualifiedToCleanMap); - m_cleanToQualifiedMap.putAll(cleanToQualifiedMap); - } - - @Override - public String toCleanName(String propName, String type) { - HierarchicalType dataType = getDataType(type); - String replacement = m_qualifiedToCleanMap.get(propName); - if (replacement == null && dataType != null) { - FieldMapping fieldMap = dataType.fieldMapping(); - if (! fieldMap.fields.containsKey(propName) && propName.contains(".")) { - String cleanName = propName.substring(propName.lastIndexOf('.') + 1); - if (fieldMap.fields.containsKey(cleanName)) { - replacement = cleanName; - } - } - } - - if (replacement == null) { - replacement = propName; - } - return replacement; - } - - @Override - public String toFullyQualifiedName(String propName, String type) { - HierarchicalType dataType = getDataType(type); - String replacement = m_cleanToQualifiedMap.get(propName); - if (replacement == null && dataType != null) { - FieldMapping fieldMap = dataType.fieldMapping(); - if (fieldMap.fields.containsKey(propName)) { - try { - replacement = dataType.getQualifiedName(propName); - } catch (AtlasException e) { - throw new CatalogRuntimeException(String.format( - "Unable to resolve fully qualified property name for type '%s': %s", type, e), e); - } - } - } - - if (replacement == null) { - replacement = propName; - } - return replacement; - } - - //todo: abstract this via AtlasTypeSystem - protected synchronized HierarchicalType getDataType(String type) { - HierarchicalType dataType = typeInstances.get(type); - //todo: are there still cases where type can be null? - if (dataType == null) { - dataType = createDataType(type); - typeInstances.put(type, dataType); - } - return dataType; - } - - protected HierarchicalType createDataType(String type) { - try { - return TypeSystem.getInstance().getDataType(HierarchicalType.class, type); - } catch (AtlasException e) { - throw new CatalogRuntimeException("Unable to get type instance from type system for type: " + type, e); - } - } - - private void setDefaultMappings() { - //todo: these are all internal "__*" properties - //todo: should be able to ask type system for the "clean" name for these - m_qualifiedToCleanMap.put(Constants.GUID_PROPERTY_KEY, "id"); - m_cleanToQualifiedMap.put("id", Constants.GUID_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.TIMESTAMP_PROPERTY_KEY, "creation_time"); - m_cleanToQualifiedMap.put("creation_time", Constants.TIMESTAMP_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, "modified_time"); - m_cleanToQualifiedMap.put("modified_time", Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.ENTITY_TYPE_PROPERTY_KEY, "type"); - m_cleanToQualifiedMap.put("type", Constants.ENTITY_TYPE_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.VERSION_PROPERTY_KEY, "version"); - m_cleanToQualifiedMap.put("version", Constants.VERSION_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.TRAIT_NAMES_PROPERTY_KEY, "trait_names"); - m_cleanToQualifiedMap.put("trait_names", Constants.TRAIT_NAMES_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.SUPER_TYPES_PROPERTY_KEY, "super_types"); - m_cleanToQualifiedMap.put("super_types", Constants.SUPER_TYPES_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.STATE_PROPERTY_KEY, "state"); - m_cleanToQualifiedMap.put("state", Constants.STATE_PROPERTY_KEY); - - m_qualifiedToCleanMap.put(Constants.CREATED_BY_KEY, "created_by"); - m_cleanToQualifiedMap.put("created_by", Constants.CREATED_BY_KEY); - - m_qualifiedToCleanMap.put(Constants.MODIFIED_BY_KEY, "modified_by"); - m_cleanToQualifiedMap.put("modified_by", Constants.MODIFIED_BY_KEY); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java b/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java deleted file mode 100644 index 888818e..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java +++ /dev/null @@ -1,209 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import org.apache.atlas.AtlasErrorCode; -import org.apache.atlas.AtlasException; -import org.apache.atlas.catalog.definition.ResourceDefinition; -import org.apache.atlas.catalog.exception.CatalogRuntimeException; -import org.apache.atlas.catalog.exception.ResourceAlreadyExistsException; -import org.apache.atlas.catalog.exception.ResourceNotFoundException; -import org.apache.atlas.exception.AtlasBaseException; -import org.apache.atlas.model.typedef.AtlasClassificationDef; -import org.apache.atlas.model.typedef.AtlasEntityDef; -import org.apache.atlas.model.typedef.AtlasEnumDef; -import org.apache.atlas.model.typedef.AtlasStructDef; -import org.apache.atlas.model.typedef.AtlasTypesDef; -import org.apache.atlas.repository.converters.TypeConverterUtil; -import org.apache.atlas.services.MetadataService; -import org.apache.atlas.store.AtlasTypeDefStore; -import org.apache.atlas.typesystem.ITypedReferenceableInstance; -import org.apache.atlas.typesystem.Referenceable; -import org.apache.atlas.typesystem.Struct; -import org.apache.atlas.typesystem.exception.EntityExistsException; -import org.apache.atlas.typesystem.exception.EntityNotFoundException; -import org.apache.atlas.typesystem.exception.TraitNotFoundException; -import org.apache.atlas.typesystem.types.AttributeDefinition; -import org.apache.atlas.typesystem.types.ClassType; -import org.apache.atlas.typesystem.types.HierarchicalType; -import org.apache.atlas.typesystem.types.TraitType; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Default implementation. - */ -public class DefaultTypeSystem implements AtlasTypeSystem { - private final MetadataService metadataService; - - private final AtlasTypeDefStore typeDefStore; - - /** - * Constructor. - * - * @param metadataService atlas metadata service - */ - public DefaultTypeSystem(MetadataService metadataService, AtlasTypeDefStore typeDefStore) throws AtlasBaseException { - this.metadataService = metadataService; - this.typeDefStore = typeDefStore; - } - - @Override - public String createEntity(ResourceDefinition definition, Request request) throws ResourceAlreadyExistsException { - String typeName = definition.getTypeName(); - try { - createClassType(definition, typeName, typeName + " Definition"); - } catch (ResourceAlreadyExistsException e) { - // ok if type already exists - } - try { - Referenceable entity = new Referenceable(typeName, request.getQueryProperties()); - //add Taxonomy Namespace - entity.set(TaxonomyResourceProvider.NAMESPACE_ATTRIBUTE_NAME, TaxonomyResourceProvider.TAXONOMY_NS); - - ITypedReferenceableInstance typedInstance = metadataService.getTypedReferenceableInstance(entity); - ITypedReferenceableInstance[] entitiesToCreate = Collections.singletonList(typedInstance).toArray(new ITypedReferenceableInstance[1]); - final List<String> entities = metadataService.createEntities(entitiesToCreate).getCreatedEntities(); - return entities != null && entities.size() > 0 ? entities.get(0) : null; - } catch (EntityExistsException e) { - throw new ResourceAlreadyExistsException( - "Attempted to create an entity which already exists: " + request.getQueryProperties()); - } catch (AtlasException e) { - throw new CatalogRuntimeException("An expected exception occurred creating an entity: " + e, e); - } - } - - @Override - public void deleteEntity(ResourceDefinition definition, Request request) throws ResourceNotFoundException { - String typeName = definition.getTypeName(); - String cleanIdPropName = definition.getIdPropertyName(); - String idValue = request.getProperty(cleanIdPropName); - try { - // transaction handled by atlas repository - metadataService.deleteEntityByUniqueAttribute(typeName, cleanIdPropName, idValue); - } catch (EntityNotFoundException e) { - throw new ResourceNotFoundException(String.format("The specified entity doesn't exist: type=%s, %s=%s", - typeName, cleanIdPropName, idValue)); - } catch (AtlasException e) { - throw new CatalogRuntimeException(String.format( - "An unexpected error occurred while attempting to delete entity: type=%s, %s=%s : %s", - typeName, cleanIdPropName, idValue, e), e); - } - } - - @Override - public void createClassType(ResourceDefinition resourceDefinition, String name, String description) - throws ResourceAlreadyExistsException { - - createType(resourceDefinition.getPropertyDefinitions(), ClassType.class, name, description, false); - } - - @Override - public void createTraitType(ResourceDefinition resourceDefinition, String name, String description) - throws ResourceAlreadyExistsException { - - createType(resourceDefinition.getPropertyDefinitions(), TraitType.class, name, description, true); - } - - @Override - public void createTraitInstance(String guid, String typeName, Map<String, Object> properties) - throws ResourceAlreadyExistsException { - - try { - // not using the constructor with properties argument because it is marked 'InterfaceAudience.Private' - Struct struct = new Struct(typeName); - for (Map.Entry<String, Object> propEntry : properties.entrySet()) { - struct.set(propEntry.getKey(), propEntry.getValue()); - } - - //add Taxonomy Namespace - struct.set(TaxonomyResourceProvider.NAMESPACE_ATTRIBUTE_NAME, TaxonomyResourceProvider.TAXONOMY_NS); - metadataService.addTrait(guid, metadataService.createTraitInstance(struct)); - } catch (IllegalArgumentException e) { - //todo: unfortunately, IllegalArgumentException can be thrown for other reasons - if (e.getMessage().contains("is already defined for entity")) { - throw new ResourceAlreadyExistsException( - String.format("Tag '%s' already associated with the entity", typeName)); - } else { - throw e; - } - } catch (AtlasException e) { - throw new CatalogRuntimeException(String.format( - "Unable to create trait instance '%s' in type system: %s", typeName, e), e); - } - } - - @Override - public void deleteTag(String guid, String traitName) throws ResourceNotFoundException { - try { - metadataService.deleteTrait(guid, traitName); - } catch (TraitNotFoundException e) { - throw new ResourceNotFoundException(String.format( - "The trait '%s' doesn't exist for entity '%s'", traitName, guid)); - } catch (AtlasException e) { - throw new CatalogRuntimeException(String.format( - "Unable to delete tag '%s' from entity '%s'", traitName, guid), e); - } - } - - private <T extends HierarchicalType> void createType(Collection<AttributeDefinition> attributes, - Class<T> type, - String name, - String description, - boolean isTrait) - throws ResourceAlreadyExistsException { - - try { - List<AtlasStructDef.AtlasAttributeDef> attrDefs = new ArrayList<>(); - for (AttributeDefinition attrDefinition : attributes) { - attrDefs.add(TypeConverterUtil.toAtlasAttributeDef(attrDefinition)); - } - if ( isTrait) { - AtlasClassificationDef classificationDef = new AtlasClassificationDef(name, description, "1.0", attrDefs, ImmutableSet.of(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE)); - AtlasTypesDef typesDef = new AtlasTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), - ImmutableList.of(classificationDef), - ImmutableList.<AtlasEntityDef>of()); - - typeDefStore.createTypesDef(typesDef); - - } else { - AtlasEntityDef entityDef = new AtlasEntityDef(name, description, "1.0", attrDefs); - AtlasTypesDef typesDef = new AtlasTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), - ImmutableList.<AtlasClassificationDef>of(), - ImmutableList.of(entityDef)); - - typeDefStore.createTypesDef(typesDef); - } - - } catch (AtlasBaseException e) { - if ( e.getAtlasErrorCode() == AtlasErrorCode.TYPE_ALREADY_EXISTS) { - throw new ResourceAlreadyExistsException(String.format("Type '%s' already exists", name)); - } else { - throw new CatalogRuntimeException(String.format( - "Unable to create type '%s' in type system: %s", name, e), e); - } - } - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/EntityResourceProvider.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/EntityResourceProvider.java b/catalog/src/main/java/org/apache/atlas/catalog/EntityResourceProvider.java deleted file mode 100644 index cee102a..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/EntityResourceProvider.java +++ /dev/null @@ -1,70 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.catalog.definition.EntityResourceDefinition; -import org.apache.atlas.catalog.exception.*; -import org.apache.atlas.catalog.query.AtlasQuery; - -import java.util.*; - -/** - * Provider for entity resources. - */ -public class EntityResourceProvider extends BaseResourceProvider implements ResourceProvider { - - public EntityResourceProvider(AtlasTypeSystem typeSystem) { - super(typeSystem, new EntityResourceDefinition()); - } - - @Override - public Result getResourceById(Request request) throws ResourceNotFoundException { - AtlasQuery atlasQuery; - try { - atlasQuery = queryFactory.createEntityQuery(request); - } catch (InvalidQueryException e) { - throw new CatalogRuntimeException("Unable to compile internal Entity query: " + e, e); - } - Collection<Map<String, Object>> results = atlasQuery.execute(); - if (results.isEmpty()) { - throw new ResourceNotFoundException(String.format("Entity '%s' not found.", - request.getProperty(resourceDefinition.getIdPropertyName()))); - } - return new Result(results); - } - - @Override - public Result getResources(Request request) throws InvalidQueryException, ResourceNotFoundException { - AtlasQuery atlasQuery = queryFactory.createEntityQuery(request); - return new Result(atlasQuery.execute()); - } - - @Override - public void createResource(Request request) - throws InvalidPayloadException, ResourceAlreadyExistsException, ResourceNotFoundException { - - // creation of entities is currently unsupported - throw new UnsupportedOperationException("Creation of entities is not currently supported"); - } - - @Override - public Collection<String> createResources(Request request) throws InvalidQueryException, ResourceNotFoundException { - throw new UnsupportedOperationException("Creation of entities is not currently supported"); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/EntityTagResourceProvider.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/EntityTagResourceProvider.java b/catalog/src/main/java/org/apache/atlas/catalog/EntityTagResourceProvider.java deleted file mode 100644 index c2a843b..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/EntityTagResourceProvider.java +++ /dev/null @@ -1,137 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.catalog.definition.EntityTagResourceDefinition; -import org.apache.atlas.catalog.exception.*; -import org.apache.atlas.catalog.query.AtlasQuery; - -import java.util.*; - -/** - * Provider for entity tag resources. - */ -public class EntityTagResourceProvider extends BaseResourceProvider implements ResourceProvider { - private TermResourceProvider termResourceProvider; - - public EntityTagResourceProvider(AtlasTypeSystem typeSystem) { - super(typeSystem, new EntityTagResourceDefinition()); - } - - @Override - public Result getResourceById(Request request) throws ResourceNotFoundException { - AtlasQuery atlasQuery; - try { - atlasQuery = queryFactory.createEntityTagQuery(request); - } catch (InvalidQueryException e) { - throw new CatalogRuntimeException("Unable to compile internal Entity Tag query: " + e, e); - } - Collection<Map<String, Object>> results = atlasQuery.execute(); - if (results.isEmpty()) { - throw new ResourceNotFoundException(String.format("Tag '%s' not found.", - request.getProperty(resourceDefinition.getIdPropertyName()))); - } - - return new Result(results); - } - - @Override - public Result getResources(Request request) throws InvalidQueryException, ResourceNotFoundException { - AtlasQuery atlasQuery = queryFactory.createEntityTagQuery(request); - return new Result(atlasQuery.execute()); - } - - @Override - public void createResource(Request request) - throws InvalidPayloadException, ResourceAlreadyExistsException, ResourceNotFoundException { - - String entityId = String.valueOf(request.getQueryProperties().remove("id")); - resourceDefinition.validateCreatePayload(request); - Result termResult = getTermQueryResult(request.<String>getProperty("name")); - Map<String, Object> termProperties = termResult.getPropertyMaps().iterator().next(); - //todo: use constant for property name - if (String.valueOf(termProperties.get("available_as_tag")).equals("false")) { - throw new InvalidPayloadException( - "Attempted to tag an entity with a term which is not available to be tagged"); - } - tagEntities(Collections.singleton(entityId), termProperties); - } - - //todo: response for case mixed case where some subset of creations fail - @Override - public Collection<String> createResources(Request request) - throws InvalidQueryException, ResourceNotFoundException, ResourceAlreadyExistsException { - - Collection<String> relativeUrls = new ArrayList<>(); - AtlasQuery atlasQuery = queryFactory.createEntityQuery(request); - Collection<String> guids = new ArrayList<>(); - for (Map<String, Object> entityMap: atlasQuery.execute()) { - guids.add(String.valueOf(entityMap.get("id"))); - } - - Collection<Map<String, String>> tagMaps = request.getProperty("tags"); - for (Map<String, String> tagMap : tagMaps) { - Result termResult = getTermQueryResult(tagMap.get("name")); - relativeUrls.addAll(tagEntities(guids, termResult.getPropertyMaps().iterator().next())); - } - return relativeUrls; - } - - @Override - public void deleteResourceById(Request request) throws ResourceNotFoundException, InvalidPayloadException { - typeSystem.deleteTag(request.<String>getProperty("id"), request.<String>getProperty("name")); - } - - private Result getTermQueryResult(String termName) throws ResourceNotFoundException { - Request tagRequest = new InstanceRequest( - Collections.<String, Object>singletonMap("termPath", new TermPath(termName))); - - tagRequest.addAdditionalSelectProperties(Collections.singleton("type")); - return getTermResourceProvider().getResourceById(tagRequest); - } - - private Collection<String> tagEntities(Collection<String> entityGuids, Map<String, Object> termProperties) - throws ResourceAlreadyExistsException { - - Collection<String> relativeUrls = new ArrayList<>(); - for (String guid : entityGuids) { - //createTermEdge(entity, Collections.singleton(termVertex)); - // copy term properties from trait associated with taxonomy to be set - // on trait associated with new entity (basically clone at time of tag event) - //todo: any changes to 'singleton' trait won't be reflected in new trait - //todo: iterate over properties in term definition instead of hard coding here - Map<String, Object> properties = new HashMap<>(); - String termName = String.valueOf(termProperties.get("name")); - properties.put("name", termName); - properties.put("description", termProperties.get("description")); - - typeSystem.createTraitInstance(guid, termName, properties); - //todo: *** shouldn't know anything about href structure in this class *** - relativeUrls.add(String.format("v1/entities/%s/tags/%s", guid, termName)); - } - return relativeUrls; - } - - protected synchronized ResourceProvider getTermResourceProvider() { - if (termResourceProvider == null) { - termResourceProvider = new TermResourceProvider(typeSystem); - } - return termResourceProvider; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/InstanceRequest.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/InstanceRequest.java b/catalog/src/main/java/org/apache/atlas/catalog/InstanceRequest.java deleted file mode 100644 index 8772229..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/InstanceRequest.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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.Map; - -/** - * A request for an instance resource. - */ -public class InstanceRequest extends BaseRequest { - public InstanceRequest(Map<String, Object> queryProperties) { - super(queryProperties, null); - } - - public InstanceRequest(Map<String, Object> queryProperties, Map<String, Object> updateProperties) { - super(queryProperties, null, updateProperties); - } - - @Override - public Cardinality getCardinality() { - return Cardinality.INSTANCE; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/JsonSerializer.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/JsonSerializer.java b/catalog/src/main/java/org/apache/atlas/catalog/JsonSerializer.java deleted file mode 100644 index a75639f..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/JsonSerializer.java +++ /dev/null @@ -1,90 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import com.google.gson.stream.JsonWriter; -import org.apache.atlas.catalog.exception.CatalogRuntimeException; - -import javax.ws.rs.core.UriInfo; -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * JSON serializer. - */ -public class JsonSerializer { - public String serialize(Result result, UriInfo ui) { - Writer json = new StringWriter(); - JsonWriter writer = new JsonWriter(json); - writer.setIndent(" "); - - try { - writeValue(writer, result.getPropertyMaps(), ui.getBaseUri().toASCIIString()); - } catch (IOException e) { - throw new CatalogRuntimeException("Unable to write JSON response.", e); - } - return json.toString(); - } - - private void writeValue(JsonWriter writer, Object value, String baseUrl) throws IOException { - if (value == null) { - writer.nullValue(); - } else if (value instanceof Map) { - writer.beginObject(); - LinkedHashMap<String, Object> nonScalarMap = new LinkedHashMap<>(); - for (Map.Entry<String, Object> entry : ((Map<String, Object>) value).entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - - if (val == null || ! (val instanceof Collection || val instanceof Map)) { - //todo: use a token in value instead of prop name - if (key.equals("href")) { - val = baseUrl + String.valueOf(val); - } - writer.name(key); - writeValue(writer, val, baseUrl); - } else { - nonScalarMap.put(key, val); - } - } - for (Map.Entry<String, Object> entry : nonScalarMap.entrySet()) { - writer.name(entry.getKey()); - writeValue(writer, entry.getValue(), baseUrl); - } - writer.endObject(); - } else if (value instanceof Collection) { - writer.beginArray(); - for (Object o : (Collection) value) { - writeValue(writer, o, baseUrl); - } - writer.endArray(); - } else if (value instanceof Number) { - writer.value((Number) value); - } else if (value instanceof Boolean) { - writer.value((Boolean) value); - } else { - // everything else is String - writer.value(String.valueOf(value)); - } - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/PropertyMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/PropertyMapper.java b/catalog/src/main/java/org/apache/atlas/catalog/PropertyMapper.java deleted file mode 100644 index 50ee275..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/PropertyMapper.java +++ /dev/null @@ -1,45 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - - -/** - * Translates property names to/from name exposed in API to internal fully qualified name. - */ -public interface PropertyMapper { - /** - * Translate a qualified name to a clean name. - * - * @param propName property name to translate - * @param type resource type - * - * @return clean property name - */ - String toCleanName(String propName, String type); - - /** - * Translate a clean name to a fully qualified name. - * - * @param propName property name to translate - * @param type resource type - * - * @return fully qualified property name - */ - String toFullyQualifiedName(String propName, String type); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/PropertyValueFormatter.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/PropertyValueFormatter.java b/catalog/src/main/java/org/apache/atlas/catalog/PropertyValueFormatter.java deleted file mode 100644 index a42f528..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/PropertyValueFormatter.java +++ /dev/null @@ -1,33 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -/** - * A rule for translating a property value. - */ -public interface PropertyValueFormatter <T,V> { - /** - * Format a property value. - * - * @param value property value to format - * - * @return formatted property value - */ - V format(T value); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/Request.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/Request.java b/catalog/src/main/java/org/apache/atlas/catalog/Request.java deleted file mode 100644 index 86da787..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/Request.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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.Collection; -import java.util.Map; - -/** - * Represents a user request. - */ -public interface Request { - /** - * Request cardinality enum. - */ - enum Cardinality {INSTANCE, COLLECTION} - - /** - * Get query properties of request. - * These are the properties which are used to build the query. - * - * @return query property map - */ - Map<String, Object> getQueryProperties(); - - /** - * Get update properties of request. - * These properties are updated on all resources which are returned from the query. - * - * @return update property map - */ - Map<String, Object> getUpdateProperties(); - - /** - * Get the value of a specified property. - * - * @param name property name - * @param <T> value type - * - * @return value for the requested property or null if property not in map - */ - <T> T getProperty(String name); - - /** - * Get the query string. - * - * @return the user specified query string or null - */ - String getQueryString(); - - /** - * Get the cardinality of the request. - * - * @return the request cardinality - */ - Cardinality getCardinality(); - - /** - * Add additional property names which should be returned in the result. - * - * @param resultProperties collection of property names - */ - void addAdditionalSelectProperties(Collection<String> resultProperties); - - /** - * Get any additional property names which should be included in the result. - * - * @return collection of added property names or an empty collection - */ - Collection<String> getAdditionalSelectProperties(); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/ResourceComparator.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/ResourceComparator.java b/catalog/src/main/java/org/apache/atlas/catalog/ResourceComparator.java deleted file mode 100644 index deb2e4c..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/ResourceComparator.java +++ /dev/null @@ -1,62 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -/** - * Provides key ordering for resource property maps. - * Ordering can be defined explicitly for specific properties, - * otherwise natural ordering is used. - */ -public class ResourceComparator implements Comparator<String> { - private static List<String> ordering = new ArrayList<>(); - - @Override - public int compare(String s1, String s2) { - if (s1.equals(s2)) { - return 0; - } - - int s1Order = ordering.indexOf(s1); - int s2Order = ordering.indexOf(s2); - - if (s1Order == -1 && s2Order == -1) { - return s1.compareTo(s2); - } - - if (s1Order != -1 && s2Order != -1) { - return s1Order - s2Order; - } - - return s1Order == -1 ? 1 : -1; - - } - - //todo: each resource definition can provide its own ordering list - static { - ordering.add("href"); - ordering.add("name"); - ordering.add("id"); - ordering.add("description"); - ordering.add("type"); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/ResourceProvider.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/ResourceProvider.java b/catalog/src/main/java/org/apache/atlas/catalog/ResourceProvider.java deleted file mode 100644 index a63309e..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/ResourceProvider.java +++ /dev/null @@ -1,95 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import org.apache.atlas.catalog.exception.*; - -import java.util.Collection; - -/** - * Provider for a resource type. - */ -public interface ResourceProvider { - /** - * Get a resource by primary key. - * - * @param request request instance which contains the required id properties and no query string - * @return result containing the requested resource; never null - * - * @throws ResourceNotFoundException if the requested resource isn't found - */ - Result getResourceById(Request request) throws ResourceNotFoundException; - - /** - * Get all resources which match the provider query. - * - * @param request request instance which will include a query string and possibly properties - * @return result containing collection of matching resources. If no resources match - * a result is returned with no resources - * - * @throws InvalidQueryException if the user query contains invalid syntax - * @throws ResourceNotFoundException if a parent resource of the requested resource doesn't exist - */ - Result getResources(Request request) throws InvalidQueryException, ResourceNotFoundException; - - /** - * Create a single resource. - * - * @param request request instance containing the contents of the resource to create - * - * @throws InvalidPayloadException if the payload or any other part of the user request is invalid - * @throws ResourceAlreadyExistsException if the resource already exists - * @throws ResourceNotFoundException if a parent of the resource to create doesn't exist - */ - void createResource(Request request) - throws InvalidPayloadException, ResourceAlreadyExistsException, ResourceNotFoundException; - - /** - * Delete a single resource. - * - * @param request request instance containing the id of the resource to delete. - * - * @throws ResourceNotFoundException if the resource doesn't exist - * @throws InvalidPayloadException if the request is invalid - */ - void deleteResourceById(Request request) throws ResourceNotFoundException, InvalidPayloadException; - - //todo: define the behavior for partial success - /** - * Create multiple resources. - * - * @param request request instance containing the contents of 1..n resources - * @return collection of relative urls for the created resources - * - * @throws InvalidPayloadException if the payload or any other part of the user request is invalid - * @throws ResourceAlreadyExistsException if the resource already exists - * @throws ResourceNotFoundException if a parent of the resource to create doesn't exist - */ - Collection<String> createResources(Request request) throws CatalogException; - - /** - * Update a single resource. - * - * @param request request instance containing the contents of the resource to update - * - * @throws ResourceNotFoundException if the resource doesn't exist - * @throws InvalidPayloadException if the request payload is invalid - */ - void updateResourceById(Request request) throws ResourceNotFoundException, InvalidPayloadException; -} http://git-wip-us.apache.org/repos/asf/atlas/blob/96da2306/catalog/src/main/java/org/apache/atlas/catalog/Result.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/Result.java b/catalog/src/main/java/org/apache/atlas/catalog/Result.java deleted file mode 100644 index 34a81ab..0000000 --- a/catalog/src/main/java/org/apache/atlas/catalog/Result.java +++ /dev/null @@ -1,50 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.atlas.catalog; - -import java.util.Collection; -import java.util.Map; - -/** - * Resource provider result. - */ -public class Result { - /** - * collection of property maps - */ - private Collection<Map<String, Object>> propertyMaps; - - /** - * Constructor. - * - * @param propertyMaps collection of property maps - */ - public Result(Collection<Map<String, Object>> propertyMaps) { - this.propertyMaps = propertyMaps; - } - - /** - * Obtain the result property maps. - * - * @return result property maps - */ - public Collection<Map<String, Object>> getPropertyMaps() { - return propertyMaps; - } -}
