http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omag-api/src/main/java/org/apache/atlas/omag/ffdc/exception/OMAGNotAuthorizedException.java ---------------------------------------------------------------------- diff --git a/omag-api/src/main/java/org/apache/atlas/omag/ffdc/exception/OMAGNotAuthorizedException.java b/omag-api/src/main/java/org/apache/atlas/omag/ffdc/exception/OMAGNotAuthorizedException.java new file mode 100644 index 0000000..2400f0c --- /dev/null +++ b/omag-api/src/main/java/org/apache/atlas/omag/ffdc/exception/OMAGNotAuthorizedException.java @@ -0,0 +1,57 @@ +/* + * 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.omag.ffdc.exception; + +/** + * OMAGNotAuthorizedException is used when invalid parameters are passed on an OMAG call. + */ +public class OMAGNotAuthorizedException extends OMAGCheckedExceptionBase +{ + /** + * This is the typical constructor used for creating a OMAGNotAuthorizedException. + * + * @param httpCode - http response code to use if this exception flows over a REST call + * @param className - name of class reporting error + * @param actionDescription - description of function it was performing when error detected + * @param errorMessage - description of error + * @param systemAction - actions of the system as a result of the error + * @param userAction - instructions for correcting the error + */ + public OMAGNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) + { + super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); + } + + + /** + * This is the constructor used for creating a OMAGNotAuthorizedException that resulted from a previous error. + * + * @param httpCode - http response code to use if this exception flows over a REST call + * @param className - name of class reporting error + * @param actionDescription - description of function it was performing when error detected + * @param errorMessage - description of error + * @param systemAction - actions of the system as a result of the error + * @param userAction - instructions for correcting the error + * @param caughtError - the error that resulted in this exception. + * */ + public OMAGNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) + { + super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); + } +}
http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omag-server/pom.xml ---------------------------------------------------------------------- diff --git a/omag-server/pom.xml b/omag-server/pom.xml new file mode 100644 index 0000000..7ebfdeb --- /dev/null +++ b/omag-server/pom.xml @@ -0,0 +1,125 @@ +<?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> + <artifactId>apache-atlas</artifactId> + <groupId>org.apache.atlas</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>omag-server</artifactId> + + <name>Open Metadata and Governance (OMAG) Server</name> + <description> + Open Metadata and Governance (OMAG) server for running open metadata function outside of the Apache Atlas server. + </description> + + <packaging>jar</packaging> + + <dependencies> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>1.5.7.RELEASE</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>1.5.7.RELEASE</version> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-base</artifactId> + <version>${jackson.version}</version> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>${jackson.version}</version> + </dependency> + + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>${javax-inject.version}</version> + </dependency> + + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.atlas</groupId> + <artifactId>om-fwk-ocf</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.atlas</groupId> + <artifactId>omrs</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.atlas</groupId> + <artifactId>omag-api</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.4</version> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omag-server/src/main/java/org/apache/atlas/omag/application/OMAGApplication.java ---------------------------------------------------------------------- diff --git a/omag-server/src/main/java/org/apache/atlas/omag/application/OMAGApplication.java b/omag-server/src/main/java/org/apache/atlas/omag/application/OMAGApplication.java new file mode 100644 index 0000000..cb629e9 --- /dev/null +++ b/omag-server/src/main/java/org/apache/atlas/omag/application/OMAGApplication.java @@ -0,0 +1,39 @@ +/* + * 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.omag.application; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@SpringBootApplication +@ComponentScan({"org.apache.atlas.omag.admin.server", "org.apache.atlas.omrs.rest.server"}) +@Configuration + +public class OMAGApplication +{ + public static void main(String[] args) + { + BasicConfigurator.configure(); + + SpringApplication.run(OMAGApplication.class, args); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/pom.xml ---------------------------------------------------------------------- diff --git a/omrs/pom.xml b/omrs/pom.xml index 4861499..50b9898 100644 --- a/omrs/pom.xml +++ b/omrs/pom.xml @@ -39,6 +39,18 @@ <dependencies> <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>1.5.7.RELEASE</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>1.5.7.RELEASE</version> + </dependency> + + <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> </dependency> @@ -71,6 +83,7 @@ <artifactId>testng</artifactId> <scope>test</scope> </dependency> + <dependency> <groupId>org.apache.atlas</groupId> <artifactId>om-fwk-ocf</artifactId> http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/eventmapper/AtlasOMRSRepositoryEventMapper.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/eventmapper/AtlasOMRSRepositoryEventMapper.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/eventmapper/AtlasOMRSRepositoryEventMapper.java index 62b1d2f..ca23a1c 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/eventmapper/AtlasOMRSRepositoryEventMapper.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/eventmapper/AtlasOMRSRepositoryEventMapper.java @@ -17,6 +17,7 @@ */ package org.apache.atlas.omrs.adapters.atlas.eventmapper; +import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase @@ -30,10 +31,23 @@ public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas /** - * Free up any resources held since the connector is no longer needed. + * Indicates that the connector is completely configured and can begin processing. + * + * @throws ConnectorCheckedException - there is a problem within the connector. */ - public void disconnect() + public void start() throws ConnectorCheckedException { + super.start(); + } + + /** + * Free up any resources held since the connector is no longer needed. + * + * @throws ConnectorCheckedException - there is a problem within the connector. + */ + public void disconnect() throws ConnectorCheckedException + { + super.disconnect(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/repositoryconnector/LocalAtlasOMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/repositoryconnector/LocalAtlasOMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/repositoryconnector/LocalAtlasOMRSRepositoryConnector.java index 8f331be..70da690 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/repositoryconnector/LocalAtlasOMRSRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/atlas/repositoryconnector/LocalAtlasOMRSRepositoryConnector.java @@ -17,8 +17,6 @@ */ package org.apache.atlas.omrs.adapters.atlas.repositoryconnector; -import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; -import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; /** @@ -28,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito */ public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector { - private LocalAtlasOMRSMetadataCollection metadataCollection = null; - private String metadataCollectionId = null; - /** * Default constructor used by the OCF Connector Provider. */ @@ -54,32 +49,6 @@ public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector /* * Initialize the metadata collection only once the connector is properly set up. */ - metadataCollection = new LocalAtlasOMRSMetadataCollection(this, metadataCollectionId); - } - - - /** - * Returns the metadata collection object that provides an OMRS abstraction of the metadata within - * a metadata repository. - * - * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. - */ - public OMRSMetadataCollection getMetadataCollection() - { - if (metadataCollection == null) - { - // TODO Throw exception since it means the local metadata collection id is not set up. - } - return metadataCollection; - } - - - /** - * Free up any resources held since the connector is no longer needed. - * - * @throws ConnectorCheckedException - there is a problem disconnecting the connector. - */ - public void disconnect() throws ConnectorCheckedException - { + super.metadataCollection = new LocalAtlasOMRSMetadataCollection(this, metadataCollectionId); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/eventmapper/IGCOMRSRepositoryEventMapper.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/eventmapper/IGCOMRSRepositoryEventMapper.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/eventmapper/IGCOMRSRepositoryEventMapper.java index 3eef8c8..074b7c0 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/eventmapper/IGCOMRSRepositoryEventMapper.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/eventmapper/IGCOMRSRepositoryEventMapper.java @@ -17,6 +17,7 @@ */ package org.apache.atlas.omrs.adapters.igc.v1.eventmapper; +import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; @@ -33,12 +34,24 @@ public class IGCOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase { } + /** + * Indicates that the connector is completely configured and can begin processing. + * + * @throws ConnectorCheckedException - there is a problem within the connector. + */ + public void start() throws ConnectorCheckedException + { + super.start(); + } + /** * Free up any resources held since the connector is no longer needed. + * + * @throws ConnectorCheckedException - there is a problem within the connector. */ - public void disconnect() + public void disconnect() throws ConnectorCheckedException { - + super.disconnect(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/repositoryconnector/IGCOMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/repositoryconnector/IGCOMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/repositoryconnector/IGCOMRSRepositoryConnector.java index 89a2c95..f7438a9 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/repositoryconnector/IGCOMRSRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v1/repositoryconnector/IGCOMRSRepositoryConnector.java @@ -27,9 +27,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito */ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector { - private IGCOMRSMetadataCollection metadataCollection = null; - private String metadataCollectionId = null; - /** * Default constructor used by the OCF Connector Provider. */ @@ -40,7 +37,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector */ } - /** * Set up the unique Id for this metadata collection. * @@ -53,32 +49,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector /* * Initialize the metadata collection only once the connector is properly set up. */ - metadataCollection = new IGCOMRSMetadataCollection(this, metadataCollectionId); - } - - - /** - * Returns the metadata collection object that provides an OMRS abstraction of the metadata within - * a metadata repository. - * - * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. - */ - public OMRSMetadataCollection getMetadataCollection() - { - if (metadataCollection == null) - { - // TODO Throw exception since it means the local metadata collection id is not set up. - } - return metadataCollection; - } - - - /** - * Free up any resources held since the connector is no longer needed. - * - * @throws ConnectorCheckedException - there is a problem disconnecting the connector. - */ - public void disconnect() throws ConnectorCheckedException - { + super.metadataCollection = new IGCOMRSMetadataCollection(this, metadataCollectionId); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/eventmapper/IGCV2OMRSRepositoryEventMapper.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/eventmapper/IGCV2OMRSRepositoryEventMapper.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/eventmapper/IGCV2OMRSRepositoryEventMapper.java index d72aec9..efc3d3c 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/eventmapper/IGCV2OMRSRepositoryEventMapper.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/eventmapper/IGCV2OMRSRepositoryEventMapper.java @@ -17,12 +17,13 @@ */ package org.apache.atlas.omrs.adapters.igc.v2.eventmapper; +import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; /** * IGCOMRSRepositoryEventMapper provides an implementation of a repository event mapper for the - * IBM Governance Catalog (IGC) for relaeave following 11.7. + * IBM Governance Catalog (IGC) for releases following 11.7. */ public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase { @@ -35,10 +36,23 @@ public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas /** - * Free up any resources held since the connector is no longer needed. + * Indicates that the connector is completely configured and can begin processing. + * + * @throws ConnectorCheckedException - there is a problem within the connector. */ - public void disconnect() + public void start() throws ConnectorCheckedException { + super.start(); + } + + /** + * Free up any resources held since the connector is no longer needed. + * + * @throws ConnectorCheckedException - there is a problem within the connector. + */ + public void disconnect() throws ConnectorCheckedException + { + super.disconnect(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/repositoryconnector/IGCV2OMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/repositoryconnector/IGCV2OMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/repositoryconnector/IGCV2OMRSRepositoryConnector.java index 5b68cb4..8fb94a1 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/repositoryconnector/IGCV2OMRSRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/adapters/igc/v2/repositoryconnector/IGCV2OMRSRepositoryConnector.java @@ -17,9 +17,6 @@ */ package org.apache.atlas.omrs.adapters.igc.v2.repositoryconnector; -import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; -import org.apache.atlas.omrs.adapters.igc.v1.repositoryconnector.IGCOMRSMetadataCollection; -import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; @@ -29,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito */ public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector { - private IGCV2OMRSMetadataCollection metadataCollection = null; - private String metadataCollectionId = null; - /** * Default constructor used by the OCF Connector Provider. */ @@ -55,32 +49,6 @@ public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector /* * Initialize the metadata collection only once the connector is properly set up. */ - metadataCollection = new IGCV2OMRSMetadataCollection(this, metadataCollectionId); - } - - - /** - * Returns the metadata collection object that provides an OMRS abstraction of the metadata within - * a metadata repository. - * - * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. - */ - public OMRSMetadataCollection getMetadataCollection() - { - if (metadataCollection == null) - { - // TODO Throw exception since it means the local metadata collection id is not set up. - } - return metadataCollection; - } - - - /** - * Free up any resources held since the connector is no longer needed. - * - * @throws ConnectorCheckedException - there is a problem disconnecting the connector. - */ - public void disconnect() throws ConnectorCheckedException - { + super.metadataCollection = new IGCV2OMRSMetadataCollection(this, metadataCollectionId); } } \ No newline at end of file