Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #37 from mandy-chessell/maintenance
Browse files Browse the repository at this point in the history
Update to 3.14 and add gradle files
  • Loading branch information
mandy-chessell authored Jan 9, 2023
2 parents 525e9e8 + 95eab99 commit f21624e
Show file tree
Hide file tree
Showing 30 changed files with 1,005 additions and 68 deletions.
31 changes: 31 additions & 0 deletions asset-deploy/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/

plugins {
id 'application'
id "com.github.johnrengelman.shadow"
}

dependencies {
implementation "org.odpi.egeria:open-connector-framework"
implementation "org.odpi.egeria:it-infrastructure-api"
implementation "org.odpi.egeria:it-infrastructure-client"
implementation "org.odpi.egeria:admin-services-api"
implementation "org.odpi.egeria:platform-services-client"
implementation "org.odpi.egeria:http-helper"
runtimeOnly 'ch.qos.logback:logback-classic'
compileOnly 'com.fasterxml.jackson.core:jackson-annotations'
}

description = 'Creates sample infrastructure asset catalog entries.'

java {
withJavadocJar()
}

shadowJar {
mainClassName = 'org.odpi.openmetadata.devprojects.utilities.assetdeploy.AssetDeploy'
archiveClassifier = 'jar-with-dependencies'
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
*/
public class AssetDeploy
{
private String platformURLRoot;
private String clientUserId;
private String serverName;
private final String platformURLRoot;
private final String clientUserId;
private final String serverName;


/**
Expand Down
30 changes: 30 additions & 0 deletions asset-look-up/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/

plugins {
id 'application'
id "com.github.johnrengelman.shadow"
}

dependencies {
implementation "org.odpi.egeria:open-connector-framework"
implementation "org.odpi.egeria:asset-consumer-api"
implementation "org.odpi.egeria:asset-consumer-client"
implementation "org.odpi.egeria:platform-services-client"
implementation "org.odpi.egeria:http-helper"
runtimeOnly 'ch.qos.logback:logback-classic'
compileOnly 'com.fasterxml.jackson.core:jackson-annotations'
}

description = 'Issues requests to retrieve assets and display all the metadata known about it.'

java {
withJavadocJar()
}

shadowJar {
mainClassName = 'org.odpi.openmetadata.devprojects.reports.assetlookup.AssetLookUp'
archiveClassifier = 'jar-with-dependencies'
}
38 changes: 38 additions & 0 deletions asset-set-up/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/

plugins {
id 'application'
id "com.github.johnrengelman.shadow"
}

dependencies {
implementation "org.odpi.egeria:open-connector-framework"
implementation "org.odpi.egeria:asset-consumer-client"
implementation "org.odpi.egeria:asset-manager-client"
implementation "org.odpi.egeria:asset-owner-client"
implementation "org.odpi.egeria:community-profile-api"
implementation "org.odpi.egeria:community-profile-client"
implementation "org.odpi.egeria:data-manager-client"
implementation "org.odpi.egeria:digital-architecture-client"
implementation "org.odpi.egeria:governance-program-api"
implementation "org.odpi.egeria:governance-program-client"
implementation "org.odpi.egeria:it-infrastructure-client"
implementation "org.odpi.egeria:platform-services-client"
implementation "org.odpi.egeria:http-helper"
runtimeOnly 'ch.qos.logback:logback-classic'
compileOnly 'com.fasterxml.jackson.core:jackson-annotations'
}

description = 'Creates sample data asset catalog entry using different client APIs.'

java {
withJavadocJar()
}

shadowJar {
mainClassName = 'org.odpi.openmetadata.devprojects.utilities.assetsetup.AssetSetUp'
archiveClassifier = 'jar-with-dependencies'
}
4 changes: 4 additions & 0 deletions asset-set-up/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.odpi.egeria</groupId>
<artifactId>platform-services-client</artifactId>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException;
import org.odpi.openmetadata.frameworks.connectors.properties.AssetUniverse;
import org.odpi.openmetadata.http.HttpHelper;
import org.odpi.openmetadata.platformservices.client.PlatformServicesClient;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
* AssetSetUp illustrates the use of the a variety of OMAS APIs to catalog a file in the open metadata ecosystem.
* AssetSetUp illustrates the use of a variety of OMAS APIs to catalog a file in the open metadata ecosystem.
*/
public class AssetSetUp
{
Expand Down Expand Up @@ -58,14 +59,14 @@ public class AssetSetUp
private DatabaseManagerClient databaseManagerClient = null;
private ExternalReferenceManagerClient externalReferenceManagerClient = null;
private ConnectionManager connectionManager = null;
private LocationManager locationManager = null;
private ReferenceDataManager validValuesManager = null;
private CapabilityManagerClient capabilityManagerClient = null;
private LocationManager locationManager = null;
private ReferenceDataManager validValuesManager = null;
private CapabilityManagerClient capabilityManagerClient = null;
private GovernanceZoneManager governanceZoneManager = null;

private Map<String, String> assetGUIDMap = new HashMap<>();
private Map<String, String> assetQNMap = new HashMap<>();
private Map<String, String> orgMap = new HashMap<>();
private final Map<String, String> assetGUIDMap = new HashMap<>();
private final Map<String, String> assetQNMap = new HashMap<>();
private final Map<String, String> orgMap = new HashMap<>();



Expand Down Expand Up @@ -106,6 +107,38 @@ private AssetSetUp(String serverName,
}


/**
* Retrieve the version of the platform. This fails if the platform is not running or the endpoint is populated by a service that is not an
* OMAG Server Platform.
*
* @return platform version or null
*/
private String getPlatformOrigin()
{
try
{
/*
* This client is from the platform services module and queries the runtime state of the platform and the servers that are running on it.
*/
PlatformServicesClient platformServicesClient = new PlatformServicesClient("MyPlatform", platformURLRoot);

/*
* This is the first call to the platform and determines the version of the software.
* If the platform is not running, or the remote service is not an OMAG Server Platform,
* the utility fails at this point.
*/
return platformServicesClient.getPlatformOrigin(clientUserId);
}
catch (Exception error)
{
System.out.println("\n\nThere was an " + error.getClass().getName() + " exception when calling the platform. Error message is: " + error.getMessage());
System.out.println("Ensure the platform URl is correct and the platform is running");
}

return null;
}


/**
* Maintain a list of assets that this utility knows about.
*
Expand Down Expand Up @@ -181,7 +214,7 @@ private void addCSVAsset(String fileName,
{
/*
* This creates the asset for the file - and also assets for the directories above if they do not already exist. The call to
* addAssetsToMaps saves all of the guids for later processing.
* addAssetsToMaps saves all the guids for later processing.
*/
String assetGUID = this.addAssetsToMaps(csvOnboardingClient.addCSVFileToCatalog(clientUserId,
fileName,
Expand Down Expand Up @@ -386,6 +419,18 @@ public static void main(String[] args)
{
AssetSetUp assetSetUp = new AssetSetUp(serverName, platformURLRoot, clientUserId);

String platformOrigin = assetSetUp.getPlatformOrigin();

if (platformOrigin != null)
{
System.out.print(" - " + platformOrigin);
}
else
{
System.out.println();
System.exit(-1);
}

assetSetUp.run();
}
catch (Exception error)
Expand Down
162 changes: 162 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/

// Allow use of maven central to pickup additional plugins
buildscript {
repositories {
mavenCentral()
}
}

plugins {
id 'java-library'
id "com.github.johnrengelman.shadow" version "7.1.2"
id 'idea'
// Checks for unnecessary & problematic dependencies
id 'com.autonomousapps.dependency-analysis' version "1.13.1"
// helps resolve log implementation clashes
id 'dev.jacomet.logging-capabilities' version "0.10.0"
// This plugin helps resolve jakarta/javax clashes
id 'de.jjohannes.java-ecosystem-capabilities' version "0.4"
}

/*
* Configuration for all projects - INCLUDING this one
*/

allprojects {

group = 'org.odpi.egeria'
version = '1.0-SNAPSHOT'

// Mostly java, so default to this for now
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'de.jjohannes.java-ecosystem-capabilities'
apply plugin: 'dev.jacomet.logging-capabilities'

repositories {
mavenCentral()
maven { url("https://oss.sonatype.org/content/repositories/snapshots") }
// Needed for old jackson implementation fixed libraries (used in Egeria)
maven {
url "https://maven.atlassian.com/3rdparty"
}
mavenLocal()
}

/*
* Dependency Management - to fix versions. Pick up maven build settings for now
*/

ext {
egeriaversion = '3.15-SNAPSHOT'
slf4jVersion = '1.7.36'
jacksonVersion = '2.13.3'
jupiterVersion = '5.9.0'
httpclientVersion = '4.5.13'
springwebVersion = '5.3.19'
}

dependencies {
// This applies constraints so that we use same dependency versions as egeria
implementation enforcedPlatform("org.odpi.egeria:egeria:${egeriaversion}")

// These constraints apply to direct and indirect dependencies, in addition
// to the versions specified by enforcedPlatform (in dependency below)
constraints {
// test dependencies
testCompileOnly "org.junit.jupiter:junit-jupiter-api:${jupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}"

compileOnly "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
compileOnly "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"

}

// These are dependencies we include IN ALL PROJECTS (try to be selective)
testCompileOnly 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'

compileOnly "com.fasterxml.jackson.core:jackson-databind"
compileOnly "com.fasterxml.jackson.core:jackson-annotations"
compileOnly "com.fasterxml.jackson.core:jackson-core"
}

// Jacoco version for code coverage
jacoco {
toolVersion = "0.8.8"
}

// Allow for tests to be run in all projects
test {
useJUnitPlatform()
}

// Fixes java compile flags & options for plugin
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = "11"
targetCompatibility = "11"
options.compilerArgs << "-Xlint:all"
options.incremental = true
options.fork = true
options.failOnError = true
}

// Probably duplicate but leave as proven
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}

// Tasks to help in finding dependency chains
task printAllDependencies(type: DependencyReportTask) {}
task printSubDependencies(type: DependencyReportTask) {}
task findDependency(type: DependencyInsightReportTask) {}

// ensures we pick up the very latest snapshots when built
configurations.all {
// Recommended if using snapshots, so that we don't cache (as they may change frequently)
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

// For later java versions this is recommended - keep conditional in case we want to build on 8
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

}
// top level project settings

// Project information
group = 'org.odpi.egeria'
version = '3.10-SNAPSHOT'
ext.name = 'Egeria API Samples'
description = 'Egeria Samples showing various API calls'


// but allow to fail - warning only - configure only in root, applies to subprojects
// For production code we'd want this to be clean
dependencyAnalysis {
issues {
all {
onAny {
severity('warn')
}
}
}
}


// Always run dependency check
build.dependsOn("buildHealth")


Loading

0 comments on commit f21624e

Please sign in to comment.