Commit a1fd4068 by Mandy Chessell Committed by David Radley

ATLAS-2122 OMAG Server Application and OMRS APIs

parent 354162d4
...@@ -38,6 +38,24 @@ ...@@ -38,6 +38,24 @@
<dependencies> <dependencies>
<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> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<scope>test</scope> <scope>test</scope>
......
...@@ -113,9 +113,18 @@ public abstract class Connector ...@@ -113,9 +113,18 @@ public abstract class Connector
/** /**
* Indicates that the connector is completely configured and can begin processing.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public abstract void start() throws ConnectorCheckedException;
/**
* Free up any resources held since the connector is no longer needed. * Free up any resources held since the connector is no longer needed.
* *
* @throws ConnectorCheckedException - there is a problem disconnecting the connector. * @throws ConnectorCheckedException - there is a problem within the connector.
*/ */
public abstract void disconnect() throws ConnectorCheckedException; public abstract void disconnect() throws ConnectorCheckedException;
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
package org.apache.atlas.ocf; package org.apache.atlas.ocf;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.ocf.ffdc.PropertyServerException; import org.apache.atlas.ocf.ffdc.PropertyServerException;
import org.apache.atlas.ocf.properties.AdditionalProperties; import org.apache.atlas.ocf.properties.AdditionalProperties;
import org.apache.atlas.ocf.properties.ConnectedAssetProperties; import org.apache.atlas.ocf.properties.ConnectedAssetProperties;
...@@ -51,6 +52,7 @@ public abstract class ConnectorBase extends Connector ...@@ -51,6 +52,7 @@ public abstract class ConnectorBase extends Connector
protected String connectorInstanceId = null; protected String connectorInstanceId = null;
protected Connection connection = null; protected Connection connection = null;
protected ConnectedAssetProperties connectedAssetProperties = null; protected ConnectedAssetProperties connectedAssetProperties = null;
protected boolean isActive = false;
/* /*
* Secured properties are protected properties from the connection. They are retrieved as a protected * Secured properties are protected properties from the connection. They are retrieved as a protected
...@@ -170,6 +172,40 @@ public abstract class ConnectorBase extends Connector ...@@ -170,6 +172,40 @@ public abstract class ConnectorBase extends Connector
/** /**
* 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
{
isActive = true;
}
/**
* 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
{
isActive = false;
}
/**
* Return a flag indicating whether the connector is active. This means it has been started and not yet
* disconnected.
*
* @return isActive flag
*/
public boolean isActive()
{
return isActive;
}
/**
* Provide a common implementation of hashCode for all OCF Connector objects. The UUID is unique and * Provide a common implementation of hashCode for all OCF Connector objects. The UUID is unique and
* is randomly assigned and so its hashCode is as good as anything to describe the hash code of the connector * is randomly assigned and so its hashCode is as good as anything to describe the hash code of the connector
* object. * object.
......
...@@ -26,7 +26,7 @@ import java.util.*; ...@@ -26,7 +26,7 @@ import java.util.*;
*/ */
public class AdditionalProperties extends AssetPropertyBase public class AdditionalProperties extends AssetPropertyBase
{ {
private Map<String,Object> additionalProperties = new HashMap<>(); protected Map<String,Object> additionalProperties = new HashMap<>();
/** /**
...@@ -59,17 +59,6 @@ public class AdditionalProperties extends AssetPropertyBase ...@@ -59,17 +59,6 @@ public class AdditionalProperties extends AssetPropertyBase
/** /**
* Copy/clone Constructor for additional properties that are not connected to an asset.
*
* @param templateProperties - template object to copy.
*/
public AdditionalProperties(AdditionalProperties templateProperties)
{
this(null, templateProperties);
}
/**
* Copy/clone Constructor for additional properties that are connected to an asset. * Copy/clone Constructor for additional properties that are connected to an asset.
* *
* @param parentAsset - description of the asset that these additional properties are attached to. * @param parentAsset - description of the asset that these additional properties are attached to.
......
...@@ -17,11 +17,21 @@ ...@@ -17,11 +17,21 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* An AnnotationStatus defines the current status for an annotation plus some default descriptive text. * An AnnotationStatus defines the current status for an annotation plus some default descriptive text.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum AnnotationStatus implements Serializable public enum AnnotationStatus implements Serializable
{ {
NEW_ANNOTATION (0, "New", "Annotation has been created but not reviewed"), NEW_ANNOTATION (0, "New", "Annotation has been created but not reviewed"),
......
...@@ -30,7 +30,6 @@ public abstract class AssetPropertyBase extends PropertyBase ...@@ -30,7 +30,6 @@ public abstract class AssetPropertyBase extends PropertyBase
* *
* @param parentAsset - descriptor of asset that his property relates to. * @param parentAsset - descriptor of asset that his property relates to.
*/ */
protected AssetPropertyBase(AssetDescriptor parentAsset) protected AssetPropertyBase(AssetDescriptor parentAsset)
{ {
/* /*
......
...@@ -17,12 +17,22 @@ ...@@ -17,12 +17,22 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* The CommentType allows comments to be used to ask and answer questions as well as make suggestions and * The CommentType allows comments to be used to ask and answer questions as well as make suggestions and
* provide useful information to other users. * provide useful information to other users.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum CommentType implements Serializable public enum CommentType implements Serializable
{ {
STANDARD_COMMENT (0, "Comment", "General comment about the asset."), STANDARD_COMMENT (0, "Comment", "General comment about the asset."),
......
...@@ -125,6 +125,7 @@ public class Connection extends Referenceable ...@@ -125,6 +125,7 @@ public class Connection extends Referenceable
this.securedProperties = securedProperties; this.securedProperties = securedProperties;
} }
/** /**
* Typical Constructor - for constructing a new, populated Connection as part of connected asset properties. * Typical Constructor - for constructing a new, populated Connection as part of connected asset properties.
* *
......
...@@ -63,9 +63,9 @@ public class ConnectorType extends Referenceable ...@@ -63,9 +63,9 @@ public class ConnectorType extends Referenceable
/* /*
* Attributes of a connector type * Attributes of a connector type
*/ */
private String displayName = null; protected String displayName = null;
private String description = null; protected String description = null;
private String connectorProviderClassName = null; protected String connectorProviderClassName = null;
/** /**
* Typical Constructor - used when Connector Type is used inside a connection object which is itself * Typical Constructor - used when Connector Type is used inside a connection object which is itself
......
...@@ -34,7 +34,7 @@ public abstract class ElementHeader extends AssetPropertyBase ...@@ -34,7 +34,7 @@ public abstract class ElementHeader extends AssetPropertyBase
/* /*
* Attached classifications * Attached classifications
*/ */
private Classifications classifications = null; protected Classifications classifications = null;
/** /**
......
...@@ -17,8 +17,15 @@ ...@@ -17,8 +17,15 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* ElementOrigin defines where the metadata comes from and, hence if it can be updated. * ElementOrigin defines where the metadata comes from and, hence if it can be updated.
* <ul> * <ul>
...@@ -43,7 +50,10 @@ import java.io.Serializable; ...@@ -43,7 +50,10 @@ import java.io.Serializable;
* If the repository rejoins the cohort then these elements can be refreshed from the rejoining repository. * If the repository rejoins the cohort then these elements can be refreshed from the rejoining repository.
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum ElementOrigin implements Serializable public enum ElementOrigin implements Serializable
{ {
LOCAL_COHORT(0, "Local to cohort", "The element is being maintained within one of the local cohort members. " + LOCAL_COHORT(0, "Local to cohort", "The element is being maintained within one of the local cohort members. " +
......
...@@ -25,13 +25,13 @@ package org.apache.atlas.ocf.properties; ...@@ -25,13 +25,13 @@ package org.apache.atlas.ocf.properties;
*/ */
public class ElementType extends PropertyBase public class ElementType extends PropertyBase
{ {
private String elementTypeId = null; protected String elementTypeId = null;
private String elementTypeName = null; protected String elementTypeName = null;
private String elementTypeVersion = null; protected long elementTypeVersion = 0;
private String elementTypeDescription = null; protected String elementTypeDescription = null;
private String elementAccessServiceURL = null; protected String elementAccessServiceURL = null;
private ElementOrigin elementOrigin = null; protected ElementOrigin elementOrigin = null;
private String elementHomeMetadataCollectionId = null; protected String elementHomeMetadataCollectionId = null;
/** /**
...@@ -47,7 +47,7 @@ public class ElementType extends PropertyBase ...@@ -47,7 +47,7 @@ public class ElementType extends PropertyBase
*/ */
public ElementType(String elementTypeId, public ElementType(String elementTypeId,
String elementTypeName, String elementTypeName,
String elementTypeVersion, long elementTypeVersion,
String elementTypeDescription, String elementTypeDescription,
String elementAccessServiceURL, String elementAccessServiceURL,
ElementOrigin elementOrigin, ElementOrigin elementOrigin,
...@@ -64,6 +64,7 @@ public class ElementType extends PropertyBase ...@@ -64,6 +64,7 @@ public class ElementType extends PropertyBase
this.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId; this.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId;
} }
/** /**
* Copy/clone constructor * Copy/clone constructor
* *
...@@ -73,6 +74,8 @@ public class ElementType extends PropertyBase ...@@ -73,6 +74,8 @@ public class ElementType extends PropertyBase
{ {
super(templateType); super(templateType);
if (templateType != null)
{
/* /*
* Copy the properties from the supplied template * Copy the properties from the supplied template
*/ */
...@@ -84,6 +87,8 @@ public class ElementType extends PropertyBase ...@@ -84,6 +87,8 @@ public class ElementType extends PropertyBase
this.elementOrigin = templateType.getElementOrigin(); this.elementOrigin = templateType.getElementOrigin();
this.elementHomeMetadataCollectionId = templateType.getElementHomeMetadataCollectionId(); this.elementHomeMetadataCollectionId = templateType.getElementHomeMetadataCollectionId();
} }
}
/** /**
* Return unique identifier for the element's type. * Return unique identifier for the element's type.
...@@ -108,20 +113,20 @@ public class ElementType extends PropertyBase ...@@ -108,20 +113,20 @@ public class ElementType extends PropertyBase
/** /**
* Return the version number for the element type. * Return the version number for this element's type.
* *
* @return elementTypeVersion - version number for the element type. * @return elementTypeVersion - version number for the element type.
*/ */
public String getElementTypeVersion() public long getElementTypeVersion()
{ {
return elementTypeVersion; return elementTypeVersion;
} }
/** /**
* Return the description for the element type. * Return the description for this element's type.
* *
* @return elementTypeDescription - description for the element type * @return elementTypeDescription - String description for the element type
*/ */
public String getElementTypeDescription() public String getElementTypeDescription()
{ {
...@@ -172,7 +177,7 @@ public class ElementType extends PropertyBase ...@@ -172,7 +177,7 @@ public class ElementType extends PropertyBase
return "ElementType{" + return "ElementType{" +
"elementTypeId='" + elementTypeId + '\'' + "elementTypeId='" + elementTypeId + '\'' +
", elementTypeName='" + elementTypeName + '\'' + ", elementTypeName='" + elementTypeName + '\'' +
", elementTypeVersion='" + elementTypeVersion + '\'' + ", elementTypeVersion=" + elementTypeVersion +
", elementTypeDescription='" + elementTypeDescription + '\'' + ", elementTypeDescription='" + elementTypeDescription + '\'' +
", elementAccessServiceURL='" + elementAccessServiceURL + '\'' + ", elementAccessServiceURL='" + elementAccessServiceURL + '\'' +
", elementOrigin=" + elementOrigin + ", elementOrigin=" + elementOrigin +
......
...@@ -72,11 +72,11 @@ public class Endpoint extends Referenceable ...@@ -72,11 +72,11 @@ public class Endpoint extends Referenceable
/* /*
* Properties of an Endpoint * Properties of an Endpoint
*/ */
private String displayName = null; protected String displayName = null;
private String description = null; protected String description = null;
private String address = null; protected String address = null;
private String protocol = null; protected String protocol = null;
private String encryptionMethod = null; protected String encryptionMethod = null;
/** /**
* Admin Constructor - used when Endpoint is inside a Connection that is not part of the connected asset * Admin Constructor - used when Endpoint is inside a Connection that is not part of the connected asset
...@@ -164,6 +164,7 @@ public class Endpoint extends Referenceable ...@@ -164,6 +164,7 @@ public class Endpoint extends Referenceable
this.encryptionMethod = encryptionMethod; this.encryptionMethod = encryptionMethod;
} }
/** /**
* Copy/clone constructor for an Endpoint not connected to an asset. * Copy/clone constructor for an Endpoint not connected to an asset.
* *
...@@ -174,6 +175,7 @@ public class Endpoint extends Referenceable ...@@ -174,6 +175,7 @@ public class Endpoint extends Referenceable
this(null, templateEndpoint); this(null, templateEndpoint);
} }
/** /**
* Copy/clone constructor for an Endpoint that is connected to an Asset (either directly or indirectly). * Copy/clone constructor for an Endpoint that is connected to an Asset (either directly or indirectly).
* *
......
...@@ -17,12 +17,22 @@ ...@@ -17,12 +17,22 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* A KeyPattern defines the type of External Identifier in use for an asset, or the type of Primary Key used within an * A KeyPattern defines the type of External Identifier in use for an asset, or the type of Primary Key used within an
* asset. * asset.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum KeyPattern implements Serializable public enum KeyPattern implements Serializable
{ {
LOCAL_KEY (0, "Local Key", "Unique key allocated and used within the scope of a single system."), LOCAL_KEY (0, "Local Key", "Unique key allocated and used within the scope of a single system."),
......
...@@ -22,13 +22,13 @@ package org.apache.atlas.ocf.properties; ...@@ -22,13 +22,13 @@ package org.apache.atlas.ocf.properties;
* Meaning is a cut-down summary of a glossary term to aid the asset consumer in understanding the content * Meaning is a cut-down summary of a glossary term to aid the asset consumer in understanding the content
* of an asset. * of an asset.
*/ */
public class Meaning extends Referenceable public class Meaning extends ElementHeader
{ {
/* /*
* Attributes of a meaning object definition * Attributes of a meaning object definition
*/ */
private String name = null; protected String name = null;
private String description = null; protected String description = null;
/** /**
...@@ -39,9 +39,6 @@ public class Meaning extends Referenceable ...@@ -39,9 +39,6 @@ public class Meaning extends Referenceable
* @param guid - String - unique id * @param guid - String - unique id
* @param url - String - URL * @param url - String - URL
* @param classifications - enumeration of classifications * @param classifications - enumeration of classifications
* @param qualifiedName - unique name
* @param additionalProperties - additional properties for the referenceable object
* @param meanings - list of glossary terms (summary) attached to this glossary term - often additional context
* @param name - name of the glossary term * @param name - name of the glossary term
* @param description - description of the glossary term. * @param description - description of the glossary term.
*/ */
...@@ -50,13 +47,10 @@ public class Meaning extends Referenceable ...@@ -50,13 +47,10 @@ public class Meaning extends Referenceable
String guid, String guid,
String url, String url,
Classifications classifications, Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String name, String name,
String description) String description)
{ {
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); super(parentAsset, type, guid, url, classifications);
this.name = name; this.name = name;
this.description = description; this.description = description;
...@@ -120,12 +114,10 @@ public class Meaning extends Referenceable ...@@ -120,12 +114,10 @@ public class Meaning extends Referenceable
return "Meaning{" + return "Meaning{" +
"name='" + name + '\'' + "name='" + name + '\'' +
", description='" + description + '\'' + ", description='" + description + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type + ", type=" + type +
", guid='" + guid + '\'' + ", guid='" + guid + '\'' +
", url='" + url + '\'' + ", url='" + url + '\'' +
", classifications=" + classifications +
'}'; '}';
} }
} }
\ No newline at end of file
...@@ -17,8 +17,15 @@ ...@@ -17,8 +17,15 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* The RelatedMediaType defines the type of resource referenced in a related media reference. * The RelatedMediaType defines the type of resource referenced in a related media reference.
* <ul> * <ul>
...@@ -29,6 +36,9 @@ import java.io.Serializable; ...@@ -29,6 +36,9 @@ import java.io.Serializable;
* <li>Other - The media type is not supported.</li> * <li>Other - The media type is not supported.</li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum RelatedMediaType implements Serializable public enum RelatedMediaType implements Serializable
{ {
IMAGE(0, "Image", "The media is an image."), IMAGE(0, "Image", "The media is an image."),
......
...@@ -17,12 +17,22 @@ ...@@ -17,12 +17,22 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties. * The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties.
* These usage options are not mutually exclusive. * These usage options are not mutually exclusive.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum RelatedMediaUsage implements Serializable public enum RelatedMediaUsage implements Serializable
{ {
ICON (0, "Icon", "Provides a small image to represent the asset in tree views and graphs."), ICON (0, "Icon", "Provides a small image to represent the asset in tree views and graphs."),
......
...@@ -17,10 +17,22 @@ ...@@ -17,10 +17,22 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* SchemaType describes the type of schema element. * SchemaType describes the type of schema element.
*/ */
public enum SchemaType @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum SchemaType implements Serializable
{ {
UNKNOWN (0, "<Unknown>", "The schema type is unknown."), UNKNOWN (0, "<Unknown>", "The schema type is unknown."),
STRUCT (1, "Struct" , "The schema type is a structure containing a list of properties of potentially different types."), STRUCT (1, "Struct" , "The schema type is a structure containing a list of properties of potentially different types."),
...@@ -31,6 +43,7 @@ public enum SchemaType ...@@ -31,6 +43,7 @@ public enum SchemaType
private String schemaTypeName; private String schemaTypeName;
private String schemaTypeDescription; private String schemaTypeDescription;
private static final long serialVersionUID = 1L;
/** /**
* Constructor to set up the instance of this enum. * Constructor to set up the instance of this enum.
......
...@@ -17,12 +17,22 @@ ...@@ -17,12 +17,22 @@
*/ */
package org.apache.atlas.ocf.properties; package org.apache.atlas.ocf.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* A StarRating defines the rating that a user has placed against an asset. This ranges from not recommended * A StarRating defines the rating that a user has placed against an asset. This ranges from not recommended
* through to five stars (excellent). * through to five stars (excellent).
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum StarRating implements Serializable public enum StarRating implements Serializable
{ {
NOT_RECOMMENDED (0, "X", "Not recommended"), NOT_RECOMMENDED (0, "X", "Not recommended"),
......
/*
* 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.ocf.properties.beans;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.Map;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* The AdditionalProperties bean extends the AdditionalProperties from the properties package with a default constructor and
* setter methods. This means it can be used for REST calls and other JSON based functions.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class AdditionalProperties extends org.apache.atlas.ocf.properties.AdditionalProperties
{
/**
* Default constructor
*/
public AdditionalProperties()
{
super(null);
}
/**
* Set up the additional properties.
*
* @param additionalProperties
*/
public void setAdditionalProperties(Map<String, Object> additionalProperties)
{
super.additionalProperties = additionalProperties;
}
/**
* Copy/clone Constructor for additional properties that are connected to an asset.
*
* @param templateProperties - template object to copy.
*/
public AdditionalProperties(AdditionalProperties templateProperties)
{
super(null, templateProperties);
}
}
/*
* 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.ocf.properties.beans;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* The Connection bean extends the Connection from the properties package with a default constructor and
* setter methods. This means it can be used for REST calls and other JSON based functions.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class Connection extends org.apache.atlas.ocf.properties.Connection
{
/**
* Default constructor sets the Connection properties to null.
*/
public Connection()
{
super(null);
}
/**
* Copy/clone Constructor to return a copy of a connection object that is not connected to an asset.
*
* @param templateConnection - Connection to copy
*/
public Connection(Connection templateConnection)
{
/*
* Set parentAsset to null
*/
super(templateConnection);
}
/**
* Copy/clone Constructor to return a copy of a connection object that is not connected to an asset.
*
* @param templateConnection - Connection to copy
*/
public Connection(org.apache.atlas.ocf.properties.Connection templateConnection)
{
/*
* Set parentAsset to null
*/
super(templateConnection);
}
/**
* Set up the type of this element.
*
* @param type - element type proprerties
*/
public void setType(ElementType type)
{
super.type = type;
}
/**
* Set up the guid for the element.
*
* @param guid - String unique identifier
*/
public void setGUID(String guid)
{
super.guid = guid;
}
/**
* Set up the URL of this element.
*
* @param url - String
*/
public void setURL(String url)
{
super.url = url;
}
/**
* Set up the fully qualified name.
*
* @param qualifiedName - String name
*/
public void setQualifiedName(String qualifiedName)
{
super.qualifiedName = qualifiedName;
}
/**
* Set up additional properties.
*
* @param additionalProperties - Additional properties object
*/
public void setAdditionalProperties(AdditionalProperties additionalProperties)
{
super.additionalProperties = additionalProperties;
}
/**
* Set up the display name for UIs and reports.
*
* @param displayName - String name
*/
public void setDisplayName(String displayName)
{
super.displayName = displayName;
}
/**
* Set up description of the element.
*
* @param description - String
*/
public void setDescription(String description)
{
super.description = description;
}
/**
* Set up the connector type properties for this Connection.
*
* @param connectorType - ConnectorType properties object
*/
public void setConnectorType(ConnectorType connectorType)
{
super.connectorType = connectorType;
}
/**
* Set up the endpoint properties for this Connection.
*
* @param endpoint - Endpoint properties object
*/
public void setEndpoint(Endpoint endpoint)
{
super.endpoint = endpoint;
}
/**
* Set up the secured properties for this Connection.
*
* @param securedProperties
*/
public void setSecuredProperties(AdditionalProperties securedProperties)
{
super.securedProperties = securedProperties;
}
}
/*
* 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.ocf.properties.beans;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* The Connection bean extends the Connection from the properties package with a default constructor and
* setter methods. This means it can be used for REST calls and other JSON based functions.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class ConnectorType extends org.apache.atlas.ocf.properties.ConnectorType
{
/**
* Default constructor
*/
public ConnectorType()
{
super(null);
}
/**
* Copy/clone constructor for a connectorType that is not connected to an asset (either directly or indirectly).
*
* @param templateConnectorType - template object to copy.
*/
public ConnectorType(ConnectorType templateConnectorType)
{
super(templateConnectorType);
}
/**
* Set up the type of this element.
*
* @param type - element type proprerties
*/
public void setType(ElementType type)
{
super.type = type;
}
/**
* Set up the guid for the element.
*
* @param guid - String unique identifier
*/
public void setGUID(String guid)
{
super.guid = guid;
}
/**
* Set up the URL of this element.
*
* @param url - String
*/
public void setURL(String url)
{
super.url = url;
}
/**
* Set up the fully qualified name.
*
* @param qualifiedName - String name
*/
public void setQualifiedName(String qualifiedName)
{
super.qualifiedName = qualifiedName;
}
/**
* Set up additional properties.
*
* @param additionalProperties - Additional properties object
*/
public void setAdditionalProperties(AdditionalProperties additionalProperties)
{
super.additionalProperties = additionalProperties;
}
/**
* Set up the display name for UIs and reports.
*
* @param displayName - String name
*/
public void setDisplayName(String displayName)
{
super.displayName = displayName;
}
/**
* Set up description of the element.
*
* @param description - String
*/
public void setDescription(String description)
{
super.description = description;
}
/**
* The name of the connector provider class name.
*
* @param connectorProviderClassName - String class name
*/
public void setConnectorProviderClassName(String connectorProviderClassName)
{
super.connectorProviderClassName = connectorProviderClassName;
}
}
/*
* 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.ocf.properties.beans;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.atlas.ocf.properties.ElementOrigin;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* The ElementType bean extends the ElementType from the properties package with a default constructor and
* setter methods. This means it can be used for REST calls and other JSON based functions.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class ElementType extends org.apache.atlas.ocf.properties.ElementType
{
/**
* Default constructor
*/
public ElementType()
{
super(null);
}
/**
* Copy/clone constructor
*
* @param templateType - type to clone
*/
public ElementType(ElementType templateType)
{
super(templateType);
}
/**
* Set up the unique identifier for the element's type.
*
* @param elementTypeId - String identifier
*/
public void setElementTypeId(String elementTypeId)
{
super.elementTypeId = elementTypeId;
}
/**
* Set up the name of this element's type
*
* @param elementTypeName - String name
*/
public void setElementTypeName(String elementTypeName)
{
super.elementTypeName = elementTypeName;
}
/**
* Set up the version number for this element's type
*
* @param elementTypeVersion - version number for the element type.
*/
public void setElementTypeVersion(long elementTypeVersion)
{
super.elementTypeVersion = elementTypeVersion;
}
/**
*
* @param elementTypeDescription - set up the description for this element's type
*/
public void setElementTypeDescription(String elementTypeDescription)
{
super.elementTypeDescription = elementTypeDescription;
}
/**
* the URL of the server where the element was retrieved from. Typically this is
* a server where the OMAS interfaces are activated. If no URL is known for the server then null is returned.
*
* @param elementAccessServiceURL - URL of the server
*/
public void setElementAccessServiceURL(String elementAccessServiceURL)
{
super.elementAccessServiceURL = elementAccessServiceURL;
}
/**
* Set up the details of this element's origin.
*
* @param elementOrigin - see ElementOrigin enum
*/
public void setElementOrigin(ElementOrigin elementOrigin)
{
super.elementOrigin = elementOrigin;
}
/**
* Set up the OMRS identifier for the metadata collection that is managed by the repository
* where the element originates (its home repository).
*
* @param elementHomeMetadataCollectionId - String unique identifier for the home metadata repository
*/
public void setElementHomeMetadataCollectionId(String elementHomeMetadataCollectionId)
{
super.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId;
}
}
/*
* 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.ocf.properties.beans;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* The Endpoint bean extends the Endpoint from the properties package with a default constructor and
* setter methods. This means it can be used for REST calls and other JSON based functions.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class Endpoint extends org.apache.atlas.ocf.properties.Endpoint
{
/**
* Default constructor
*/
public Endpoint()
{
super(null);
}
/**
* Copy/clone constructor for an Endpoint not connected to an asset.
*
* @param templateEndpoint - template object to copy.
*/
public Endpoint(Endpoint templateEndpoint)
{
super(templateEndpoint);
}
/**
* Set up the type of this element.
*
* @param type - element type proprerties
*/
public void setType(ElementType type)
{
super.type = type;
}
/**
* Set up the guid for the element.
*
* @param guid - String unique identifier
*/
public void setGUID(String guid)
{
super.guid = guid;
}
/**
* Set up the URL of this element.
*
* @param url - String
*/
public void setURL(String url)
{
super.url = url;
}
/**
* Set up the fully qualified name.
*
* @param qualifiedName - String name
*/
public void setQualifiedName(String qualifiedName)
{
super.qualifiedName = qualifiedName;
}
/**
* Set up additional properties.
*
* @param additionalProperties - Additional properties object
*/
public void setAdditionalProperties(AdditionalProperties additionalProperties)
{
super.additionalProperties = additionalProperties;
}
/**
* Set up the display name for UIs and reports.
*
* @param displayName - String name
*/
public void setDisplayName(String displayName)
{
super.displayName = displayName;
}
/**
* Set up description of the element.
*
* @param description - String
*/
public void setDescription(String description)
{
super.description = description;
}
/**
* Set up the network address of the Endpoint.
*
* @param address - String resource name
*/
public void setAddress(String address)
{
super.address = address;
}
/**
* Set up the protocol to use for this Endpoint
*
* @param protocol - String protocol name
*/
public void setProtocol(String protocol)
{
super.protocol = protocol;
}
/**
* Set up the encryption method used on this Endpoint.
*
* @param encryptionMethod - String name
*/
public void setEncryptionMethod(String encryptionMethod)
{
super.encryptionMethod = encryptionMethod;
}
}
<?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-api</artifactId>
<name>Open Metadata and Governance (OMAG) Server APIs</name>
<description>Open Metadata and Governance (OMAG) server interfaces for managing the open metadata and governance
functions running inside a 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>
</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
/*
* 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.admin;
import java.io.Serializable;
/**
* LocalRepositoryMode defines the mode that the local repository will operate in.
*/
public enum LocalRepositoryMode implements Serializable
{
NO_LOCAL_REPOSITORY (0, "No Local repository", "There is no local repository so all of the metadata " +
"passed through the enterprise access " +
"layer to the open metadata access services comes from " +
"peer repositories from the cohort(s) that this repository " +
"is registered with."),
IN_MEMORY_REPOSITORY (1, "In memory repository", "The local repository is an in memory repository that does" +
"not save metadata between each run of the server."),
LOCAL_GRAPH_REPOSITORY (2, "Local graph repository", "The built-in graph database is in use. Metadata can be stored " +
"and retrieved from this graph database. " +
"This metadata can be combined with metadata from " +
"peer repositories from the cohort(s) that this repository " +
"is registered with."),
REPOSITORY_PROXY (3, "Repository proxy", "The local repository is implemented by a service that is " +
"external to the local server. Metadata can be stored " +
"and retrieved from this repository. This metadata can be " +
"combined with metadata from peer repositories from the " +
"cohort(s) that this repository is registered with.");
private static final long serialVersionUID = 1L;
private int typeCode;
private String typeName;
private String typeDescription;
/**
* Default Constructor
*
* @param typeCode - ordinal for this enum
* @param typeName - symbolic name for this enum
* @param typeDescription - short description for this enum
*/
LocalRepositoryMode(int typeCode, String typeName, String typeDescription)
{
/*
* Save the values supplied
*/
this.typeCode = typeCode;
this.typeName = typeName;
this.typeDescription = typeDescription;
}
/**
* Return the code for this enum instance
*
* @return int - type code
*/
public int getTypeCode()
{
return typeCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getTypeName()
{
return typeName;
}
/**
* Return the default description for the type for this enum instance.
*
* @return String - default description
*/
public String getTypeDescription()
{
return typeDescription;
}
}
/*
* 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.admin;
import java.io.Serializable;
/**
* OMAGServiceMode sets up whether an open metadata and governance service (OMAS) is enabled or not.
*/
public enum OMAGServiceMode implements Serializable
{
ENABLED (1, "Enabled", "The open metadata and governance service is available and running."),
DISABLED (0, "Disabled", "The open metadata and governance service is disabled.");
private static final long serialVersionUID = 1L;
private int typeCode;
private String typeName;
private String typeDescription;
/**
* Default Constructor
*
* @param typeCode - ordinal for this enum
* @param typeName - symbolic name for this enum
* @param typeDescription - short description for this enum
*/
OMAGServiceMode(int typeCode, String typeName, String typeDescription)
{
/*
* Save the values supplied
*/
this.typeCode = typeCode;
this.typeName = typeName;
this.typeDescription = typeDescription;
}
/**
* Return the code for this enum instance
*
* @return int - type code
*/
public int getTypeCode()
{
return typeCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getTypeName()
{
return typeName;
}
/**
* Return the default description for the type for this enum instance.
*
* @return String - default description
*/
public String getTypeDescription()
{
return typeDescription;
}
}
/*
* 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.configuration.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.atlas.omrs.admin.properties.RepositoryServicesConfig;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* OMAGServerConfig provides the properties used to initialize an open metadata and governance (OMAG) server.
*
* The OMAG server configuration has the following properties:
* <ul>
* <li>
* localServerName - meaningful name for the server for use in messages and UIs.
* Ideally this value is unique to aid administrators in understanding the behavior of the local
* server/repository in the open metadata cluster.
*
* The default value is "Default Server".
* </li>
* <li>
* localServerType - descriptive type name for the local server. Again this is useful information for the
* administrator to understand which vendor implementation, or versionName of the vendor implementation, is
* in operation.
*
* The default value is "Open Metadata and Governance Server".
* </li>
* <li>
* organizationName - descriptive name for the organization that owns the local server/repository.
* This is useful when the open metadata repository cluster consists of metadata servers from different
* organizations, or different departments of an enterprise.
*
* The default value is null.
* </li>
* <li>
* localServerURL - network address of the server (typically URL and port number).
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OMAGServerConfig implements Serializable
{
/*
* Default values used when the server configuration does not provide a value.
*/
private static final String defaultLocalServerType = "Open Metadata and Governance Server";
private static final String defaultLocalOrganizationName = null;
private static final String defaultLocalServerURL = "http://localhost:8080";
private static final int defaultMaxPageSize = 1000;
/*
* Values in use by this server.
*/
private String localServerName = null;
private String localServerType = defaultLocalServerType;
private String organizationName = defaultLocalOrganizationName;
private String localServerURL = defaultLocalServerURL;
private int maxPageSize = defaultMaxPageSize;
private List<AccessServiceConfig> accessServicesConfig = new ArrayList<>();
private RepositoryServicesConfig repositoryServicesConfig = null;
private static final long serialVersionUID = 1L;
/**
* Default constructor used to set all properties to their default value. This means the server can connect to the
* cluster (assuming the default topic name is used by the cluster) and replicate metadata, but it will not be
* remotely callable through an OMRS connector.
*/
public OMAGServerConfig()
{
}
/**
* Return the name of the local server.
*
* @return String server name
*/
public String getLocalServerName()
{
return localServerName;
}
/**
* Set up the name of the local server.
*
* @param localServerName - String local server name
*/
public void setLocalServerName(String localServerName)
{
this.localServerName = localServerName;
}
/**
* Return the descriptive name for the server type.
*
* @return String server type
*/
public String getLocalServerType()
{
return localServerType;
}
/**
* Set up the descriptive name for the server type.
*
* @param localServerType - String server type
*/
public void setLocalServerType(String localServerType)
{
this.localServerType = localServerType;
}
/**
* Return the name of the organization that is running the server.
*
* @return String organization name
*/
public String getOrganizationName()
{
return organizationName;
}
/**
* Set up the name of the organization that is running the server.
*
* @param organizationName - String organization name
*/
public void setOrganizationName(String organizationName)
{
this.organizationName = organizationName;
}
/**
* Return the base URL for calling the local server.
*
* @return String URL
*/
public String getLocalServerURL()
{
return localServerURL;
}
/**
* Set up the base URL for calling the local server.
*
* @param localServerURL - String URL
*/
public void setLocalServerURL(String localServerURL)
{
this.localServerURL = localServerURL;
}
/**
* Return the maximum page size supported by this server.
*
* @return int number of elements
*/
public int getMaxPageSize()
{
return maxPageSize;
}
/**
* Set up the maximum page size supported by this server.
*
* @param maxPageSize - int number of elements
*/
public void setMaxPageSize(int maxPageSize)
{
this.maxPageSize = maxPageSize;
}
/**
* Return the configuration for the registered Open Metadata Access Services (OMAS).
*
* @return array of configuration properties - one for each OMAS
*/
public List<AccessServiceConfig> getAccessServicesConfig()
{
return accessServicesConfig;
}
/**
* Set up the configuration for the registered Open Metadata Access Services (OMAS).
*
* @param accessServicesConfig - array of configuration properties - one for each OMAS
*/
public void setAccessServicesConfig(List<AccessServiceConfig> accessServicesConfig)
{
this.accessServicesConfig = accessServicesConfig;
}
/**
* Return the Open Metadata Repository Services (OMRS) config.
*
* @return configuration properties that control OMRS
*/
public RepositoryServicesConfig getRepositoryServicesConfig()
{
return repositoryServicesConfig;
}
/**
* Set up the Open Metadata Repository Services (OMRS) config.
*
* @param repositoryServicesConfig - configuration properties that control OMRS
*/
public void setRepositoryServicesConfig(RepositoryServicesConfig repositoryServicesConfig)
{
this.repositoryServicesConfig = repositoryServicesConfig;
}
}
/*
* 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.configuration.registration;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.omag.configuration.properties.AccessServiceConfig;
import org.apache.atlas.omag.ffdc.exception.OMAGConfigurationErrorException;
/**
* AccessServiceAdmin is the interface that an access service implements to receive its configuration.
* The java class that implements this interface is created with a default constructor and then
* the initialize method is called. It is configured in the AccessServiceDescription enumeration.
*/
public interface AccessServiceAdmin
{
/**
* Initialize the access service.
*
* @param configurationProperties - specific configuration properties for this access service.
* @throws OMAGConfigurationErrorException - invalid parameters in the configuration properties.
*/
void initialize(AccessServiceConfig configurationProperties,
Connection enterpriseOMRSTopicConnector) throws OMAGConfigurationErrorException;
/**
* Refresh the configuration in the access service.
*
* @param configurationProperties - specific configuration properties for this access service.
* @throws OMAGConfigurationErrorException - invalid parameters in the configuration properties.
*/
void refreshConfiguration(AccessServiceConfig configurationProperties,
Connection enterpriseOMRSTopicConnector) throws OMAGConfigurationErrorException;
/**
* Shutdown the access service.
*/
void shutdown();
}
/*
* 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.configuration.registration;
import java.io.Serializable;
/**
* AccessServiceOperationalStatus sets up whether an open metadata access service (OMAS) is enabled or not.
*/
public enum AccessServiceOperationalStatus implements Serializable
{
NOT_IMPLEMENTED (0, "Not Implemented", "Code for this access server is not available."),
ENABLED (1, "Enabled", "The access service is available and running."),
DISABLED (2, "Disabled", "The access service has been disabled.");
private static final long serialVersionUID = 1L;
private int typeCode;
private String typeName;
private String typeDescription;
/**
* Default Constructor
*
* @param typeCode - ordinal for this enum
* @param typeName - symbolic name for this enum
* @param typeDescription - short description for this enum
*/
AccessServiceOperationalStatus(int typeCode, String typeName, String typeDescription)
{
/*
* Save the values supplied
*/
this.typeCode = typeCode;
this.typeName = typeName;
this.typeDescription = typeDescription;
}
/**
* Return the code for this enum instance
*
* @return int - type code
*/
public int getTypeCode()
{
return typeCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getTypeName()
{
return typeName;
}
/**
* Return the default description for the type for this enum instance.
*
* @return String - default description
*/
public String getTypeDescription()
{
return typeDescription;
}
}
/*
* 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.configuration.store;
import org.apache.atlas.omag.configuration.properties.OMAGServerConfig;
/**
* OMAGServerConfigStore provides the interface to the configuration for an OMAG Server. This is accessed
* through a connector.
*/
public interface OMAGServerConfigStore
{
/**
* Save the server configuration.
*
* @param configuration - configuration properties to save
*/
void saveServerConfig(OMAGServerConfig configuration);
/**
* Retrieve the configuration saved from a previous run of the server.
*
* @return server configuration
*/
OMAGServerConfig retrieveServerConfig();
/**
* Remove the server configuration.
*/
void removeServerConfig();
}
/*
* 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.configuration.store;
import org.apache.atlas.ocf.ConnectorBase;
/**
* OMAGServerConfigStoreConnectorBase provides the base class for an OMAG Server's configuration store. It defines the
* specific interface for this type of connector.
*/
public abstract class OMAGServerConfigStoreConnectorBase extends ConnectorBase implements OMAGServerConfigStore
{
}
/*
* 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.configuration.store;
import org.apache.atlas.ocf.ConnectorProviderBase;
/**
* The OMAGServerConfigStoreProviderBase provides a base class for the connector provider supporting the OMAG
* server configuration stores. It extends ConnectorProviderBase which does the creation of connector instances.
* The subclasses of OMAGServerConfigStoreProviderBase must initialize ConnectorProviderBase with the Java class
* name of the registry store connector implementation (by calling super.setConnectorClassName(className)).
* Then the connector provider will work.
*/
public class OMAGServerConfigStoreProviderBase extends ConnectorProviderBase
{
/**
* Default Constructor
*/
public OMAGServerConfigStoreProviderBase()
{
/*
* Nothing to do
*/
}
}
/*
* 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.configuration.store.file;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.ocf.properties.Endpoint;
import org.apache.atlas.omag.configuration.properties.OMAGServerConfig;
import org.apache.atlas.omag.configuration.store.OMAGServerConfigStoreConnectorBase;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class FileBasedServerConfigStoreConnector extends OMAGServerConfigStoreConnectorBase
{
/*
* This is the name of the configuration file that is used if there is no file name in the connection.
*/
private static final String defaultFilename = "omag.server.config";
/*
* Variables used in writing to the file.
*/
private String configStoreName = null;
/*
* Variables used for logging and debug.
*/
private static final Logger log = LoggerFactory.getLogger(FileBasedServerConfigStoreConnector.class);
/**
* Default constructor
*/
public FileBasedServerConfigStoreConnector()
{
}
@Override
public void initialize(String connectorInstanceId, Connection connection)
{
super.initialize(connectorInstanceId, connection);
Endpoint endpoint = connection.getEndpoint();
if (endpoint != null)
{
configStoreName = endpoint.getAddress();
}
if (configStoreName == null)
{
configStoreName = defaultFilename;
}
}
/**
* Save the server configuration.
*
* @param omagServerConfig - configuration properties to save
*/
public void saveServerConfig(OMAGServerConfig omagServerConfig)
{
File configStoreFile = new File(configStoreName);
try
{
if (log.isDebugEnabled())
{
log.debug("Writing server config store properties", omagServerConfig);
}
if (omagServerConfig == null)
{
configStoreFile.delete();
}
else
{
ObjectMapper objectMapper = new ObjectMapper();
String configStoreFileContents = objectMapper.writeValueAsString(omagServerConfig);
FileUtils.writeStringToFile(configStoreFile, configStoreFileContents, false);
}
}
catch (IOException ioException)
{
if (log.isDebugEnabled())
{
log.debug("Unusable Server config Store :(", ioException);
}
}
}
/**
* Retrieve the configuration saved from a previous run of the server.
*
* @return server configuration
*/
public OMAGServerConfig retrieveServerConfig()
{
File configStoreFile = new File(configStoreName);
OMAGServerConfig newConfigProperties;
try
{
if (log.isDebugEnabled())
{
log.debug("Retrieving server configuration properties");
}
String configStoreFileContents = FileUtils.readFileToString(configStoreFile, "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
newConfigProperties = objectMapper.readValue(configStoreFileContents, OMAGServerConfig.class);
}
catch (IOException ioException)
{
/*
* The config file is not found, create a new one ...
*/
if (log.isDebugEnabled())
{
log.debug("New server config Store", ioException);
}
newConfigProperties = new OMAGServerConfig();
}
return newConfigProperties;
}
/**
* Remove the server configuration.
*/
public void removeServerConfig()
{
File configStoreFile = new File(configStoreName);
configStoreFile.delete();
}
/**
* Close the config file
*/
public void disconnect()
{
if (log.isDebugEnabled())
{
log.debug("Closing Config Store.");
}
}
}
/*
* 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.configuration.store.file;
import org.apache.atlas.omag.configuration.store.OMAGServerConfigStoreProviderBase;
/**
* FileBasedServerConfigStoreProvider is the OCF connector provider for the file based server configuration store.
*/
public class FileBasedServerConfigStoreProvider extends OMAGServerConfigStoreProviderBase
{
/**
* Constructor used to initialize the ConnectorProviderBase with the Java class name of the specific
* configuration store implementation.
*/
public FileBasedServerConfigStoreProvider()
{
Class connectorClass = FileBasedServerConfigStoreConnector.class;
super.setConnectorClassName(connectorClass.getName());
}
}
/*
* 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;
/**
* OMAGCheckedExceptionBase provides a checked exception for reporting errors found when using the OMAG Server.
* Typically these errors are either configuration or operational errors that can be fixed by an administrator
* or power user. However, there may be the odd bug that surfaces here. The OMAGErrorCode can be used with
* this exception to populate it with standard messages.
*/
public class OMAGCheckedExceptionBase extends Exception
{
/*
* These default values are only seen if this exception is initialized using one of its superclass constructors.
*/
private int reportedHTTPCode;
private String reportingClassName;
private String reportingActionDescription;
private String reportedErrorMessage;
private String reportedSystemAction;
private String reportedUserAction;
private Throwable reportedCaughtException = null;
/**
* This is the typical constructor used for creating a OMRSCheckedExceptionBase.
*
* @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 OMAGCheckedExceptionBase(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction)
{
super(errorMessage);
this.reportedHTTPCode = httpCode;
this.reportingClassName = className;
this.reportingActionDescription = actionDescription;
this.reportedErrorMessage = errorMessage;
this.reportedSystemAction = systemAction;
this.reportedUserAction = userAction;
}
/**
* This is the constructor used for creating a OMRSCheckedExceptionBase when an unexpected error has been caught.
*
* @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 - previous error causing this exception
*/
public OMAGCheckedExceptionBase(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(errorMessage, caughtError);
this.reportedHTTPCode = httpCode;
this.reportingClassName = className;
this.reportingActionDescription = actionDescription;
this.reportedErrorMessage = errorMessage;
this.reportedSystemAction = systemAction;
this.reportedUserAction = userAction;
this.reportedCaughtException = caughtError;
}
/**
* Return the HTTP response code to use with this exception.
*
* @return reportedHTTPCode
*/
public int getReportedHTTPCode()
{
return reportedHTTPCode;
}
/**
* The class that created this exception.
*
* @return reportingClassName
*/
public String getReportingClassName()
{
return reportingClassName;
}
/**
* The type of request that the class was performing when the condition occurred that resulted in this
* exception.
*
* @return reportingActionDescription
*/
public String getReportingActionDescription()
{
return reportingActionDescription;
}
/**
* A formatted short description of the cause of the condition that resulted in this exception.
*
* @return reportedErrorMessage
*/
public String getErrorMessage()
{
return reportedErrorMessage;
}
/**
* A description of the action that the system took as a result of the error condition.
*
* @return reportedSystemAction
*/
public String getReportedSystemAction()
{
return reportedSystemAction;
}
/**
* A description of the action necessary to correct the error.
*
* @return reportedUserAction
*/
public String getReportedUserAction()
{
return reportedUserAction;
}
/**
* An exception that was caught and wrapped by this exception. If a null is returned, then this exception is
* newly created and not the result of a previous exception.
*
* @return reportedCaughtException
*/
public Throwable getReportedCaughtException() { return reportedCaughtException; }
}
/*
* 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;
/**
* OMAGConfigurationErrorException is used when configuration parameters passed on earlier calls turn out to
* be invalid.
*/
public class OMAGConfigurationErrorException extends OMAGCheckedExceptionBase
{
/**
* This is the typical constructor used for creating a OMAGConfigurationErrorException.
*
* @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 OMAGConfigurationErrorException(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 OMAGConfigurationErrorException 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 OMAGConfigurationErrorException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
}
}
/*
* 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;
/**
* OMAGInvalidParameterException is used when invalid parameters are passed on an OMAG call.
*/
public class OMAGInvalidParameterException extends OMAGCheckedExceptionBase
{
/**
* This is the typical constructor used for creating a OMAGInvalidParameterException.
*
* @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 OMAGInvalidParameterException(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 OMAGInvalidParameterException 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 OMAGInvalidParameterException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
}
}
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.atlas.omrs.ffdc.exception;
package org.apache.atlas.omag.ffdc.exception;
/** /**
* The RelationshipKnownException is thrown by an OMRS Connector when a specific relationship instance is added but this * OMAGNotAuthorizedException is used when invalid parameters are passed on an OMAG call.
* relationship is already stored in the metadata collection.
*/ */
public class RelationshipKnownException extends OMRSCheckedExceptionBase public class OMAGNotAuthorizedException extends OMAGCheckedExceptionBase
{ {
/** /**
* This is the typical constructor used for creating a RelationshipKnownException. * 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 httpCode - http response code to use if this exception flows over a REST call
* @param className - name of class reporting error * @param className - name of class reporting error
...@@ -33,14 +33,14 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase ...@@ -33,14 +33,14 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase
* @param systemAction - actions of the system as a result of the error * @param systemAction - actions of the system as a result of the error
* @param userAction - instructions for correcting the error * @param userAction - instructions for correcting the error
*/ */
public RelationshipKnownException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) public OMAGNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction)
{ {
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); super(httpCode, className, actionDescription, errorMessage, systemAction, userAction);
} }
/** /**
* This is the constructor used for creating a RelationshipKnownException that resulted from a previous error. * 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 httpCode - http response code to use if this exception flows over a REST call
* @param className - name of class reporting error * @param className - name of class reporting error
...@@ -50,7 +50,7 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase ...@@ -50,7 +50,7 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase
* @param userAction - instructions for correcting the error * @param userAction - instructions for correcting the error
* @param caughtError - the error that resulted in this exception. * @param caughtError - the error that resulted in this exception.
* */ * */
public RelationshipKnownException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) public OMAGNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{ {
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
} }
......
<?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
/*
* 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);
}
}
...@@ -39,6 +39,18 @@ ...@@ -39,6 +39,18 @@
<dependencies> <dependencies>
<dependency> <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> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
</dependency> </dependency>
...@@ -71,6 +83,7 @@ ...@@ -71,6 +83,7 @@
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.atlas</groupId> <groupId>org.apache.atlas</groupId>
<artifactId>om-fwk-ocf</artifactId> <artifactId>om-fwk-ocf</artifactId>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
package org.apache.atlas.omrs.adapters.atlas.eventmapper; package org.apache.atlas.omrs.adapters.atlas.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase
...@@ -30,10 +31,23 @@ public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas ...@@ -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();
} }
} }
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
*/ */
package org.apache.atlas.omrs.adapters.atlas.repositoryconnector; 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; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
/** /**
...@@ -28,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito ...@@ -28,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/ */
public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector
{ {
private LocalAtlasOMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/** /**
* Default constructor used by the OCF Connector Provider. * Default constructor used by the OCF Connector Provider.
*/ */
...@@ -54,32 +49,6 @@ public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector ...@@ -54,32 +49,6 @@ public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector
/* /*
* Initialize the metadata collection only once the connector is properly set up. * Initialize the metadata collection only once the connector is properly set up.
*/ */
metadataCollection = new LocalAtlasOMRSMetadataCollection(this, metadataCollectionId); super.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
{
} }
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
package org.apache.atlas.omrs.adapters.igc.v1.eventmapper; package org.apache.atlas.omrs.adapters.igc.v1.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
...@@ -33,12 +34,24 @@ public class IGCOMRSRepositoryEventMapper extends 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. * 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();
} }
} }
...@@ -27,9 +27,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito ...@@ -27,9 +27,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/ */
public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
{ {
private IGCOMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/** /**
* Default constructor used by the OCF Connector Provider. * Default constructor used by the OCF Connector Provider.
*/ */
...@@ -40,7 +37,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector ...@@ -40,7 +37,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
*/ */
} }
/** /**
* Set up the unique Id for this metadata collection. * Set up the unique Id for this metadata collection.
* *
...@@ -53,32 +49,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector ...@@ -53,32 +49,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
/* /*
* Initialize the metadata collection only once the connector is properly set up. * Initialize the metadata collection only once the connector is properly set up.
*/ */
metadataCollection = new IGCOMRSMetadataCollection(this, metadataCollectionId); super.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
{
} }
} }
\ No newline at end of file
...@@ -17,12 +17,13 @@ ...@@ -17,12 +17,13 @@
*/ */
package org.apache.atlas.omrs.adapters.igc.v2.eventmapper; package org.apache.atlas.omrs.adapters.igc.v2.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase; import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
/** /**
* IGCOMRSRepositoryEventMapper provides an implementation of a repository event mapper for the * 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 public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase
{ {
...@@ -35,10 +36,23 @@ public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas ...@@ -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();
} }
} }
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
*/ */
package org.apache.atlas.omrs.adapters.igc.v2.repositoryconnector; 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; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
...@@ -29,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito ...@@ -29,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/ */
public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector
{ {
private IGCV2OMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/** /**
* Default constructor used by the OCF Connector Provider. * Default constructor used by the OCF Connector Provider.
*/ */
...@@ -55,32 +49,6 @@ public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector ...@@ -55,32 +49,6 @@ public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector
/* /*
* Initialize the metadata collection only once the connector is properly set up. * Initialize the metadata collection only once the connector is properly set up.
*/ */
metadataCollection = new IGCV2OMRSMetadataCollection(this, metadataCollectionId); super.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
{
} }
} }
\ No newline at end of file
/*
* 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.omrs.adapters.inmemory.repositoryconnector;
import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
/**
* The InMemoryOMRSRepositoryConnector is a connector to a local in memory repository. It is used for test,
* small scale fixed or temporary repositories where the initial content comes from open metadata archives and
* other members of connected open metadata repository cohorts.
*/
public class InMemoryOMRSRepositoryConnector extends OMRSRepositoryConnector
{
/**
* Default constructor used by the OCF Connector Provider.
*/
public InMemoryOMRSRepositoryConnector()
{
/*
* Nothing to do.
*/
}
/**
* Set up the unique Id for this metadata collection.
*
* @param metadataCollectionId - String unique Id
*/
public void setMetadataCollectionId(String metadataCollectionId)
{
super.metadataCollectionId = metadataCollectionId;
/*
* Initialize the metadata collection only once the connector is properly set up.
*/
super.metadataCollection = new InMemoryOMRSMetadataCollection(this,
super.serverName,
repositoryHelper,
repositoryValidator,
metadataCollectionId);
}
}
\ No newline at end of file
/*
* 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.omrs.adapters.inmemory.repositoryconnector;
import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnectorProviderBase;
/**
* In the Open Connector Framework (OCF), a ConnectorProvider is a factory for a specific type of connector.
* The InMemoryOMRSRepositoryConnectorProvider is the connector provider for the InMemoryOMRSRepositoryConnector.
* It extends OMRSRepositoryConnectorProviderBase which in turn extends the OCF ConnectorProviderBase.
* ConnectorProviderBase supports the creation of connector instances.
*
* The InMemoryOMRSRepositoryConnectorProvider must initialize ConnectorProviderBase with the Java class
* name of the OMRS Connector implementation (by calling super.setConnectorClassName(className)).
* Then the connector provider will work.
*/
public class InMemoryOMRSRepositoryConnectorProvider
extends OMRSRepositoryConnectorProviderBase
{
/**
* Constructor used to initialize the ConnectorProviderBase with the Java class name of the specific
* OMRS Connector implementation.
*/
public InMemoryOMRSRepositoryConnectorProvider()
{
Class connectorClass = InMemoryOMRSRepositoryConnector.class;
super.setConnectorClassName(connectorClass.getName());
}
}
\ No newline at end of file
...@@ -18,10 +18,18 @@ ...@@ -18,10 +18,18 @@
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import org.apache.atlas.ocf.properties.Connection; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.atlas.ocf.properties.beans.Connection;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* CohortConfig provides the configuration properties used to connect to an open metadata repository cohort. * CohortConfig provides the configuration properties used to connect to an open metadata repository cohort.
...@@ -56,6 +64,9 @@ import java.util.ArrayList; ...@@ -56,6 +64,9 @@ import java.util.ArrayList;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class CohortConfig public class CohortConfig
{ {
private String cohortName = null; private String cohortName = null;
...@@ -214,10 +225,17 @@ public class CohortConfig ...@@ -214,10 +225,17 @@ public class CohortConfig
* *
* @return list of TypeDefs that determine which metadata instances to process * @return list of TypeDefs that determine which metadata instances to process
*/ */
public ArrayList<TypeDefSummary> getSelectedTypesToProcess() public List<TypeDefSummary> getSelectedTypesToProcess()
{
if (selectedTypesToProcess == null)
{
return null;
}
else
{ {
return selectedTypesToProcess; return selectedTypesToProcess;
} }
}
/** /**
...@@ -226,8 +244,15 @@ public class CohortConfig ...@@ -226,8 +244,15 @@ public class CohortConfig
* *
* @param selectedTypesToProcess - list of TypeDefs that determine which metadata instances to process * @param selectedTypesToProcess - list of TypeDefs that determine which metadata instances to process
*/ */
public void setSelectedTypesToProcess(ArrayList<TypeDefSummary> selectedTypesToProcess) public void setSelectedTypesToProcess(List<TypeDefSummary> selectedTypesToProcess)
{ {
this.selectedTypesToProcess = selectedTypesToProcess; if (selectedTypesToProcess == null)
{
this.selectedTypesToProcess = null;
}
else
{
this.selectedTypesToProcess = new ArrayList<>(selectedTypesToProcess);
}
} }
} }
...@@ -17,7 +17,14 @@ ...@@ -17,7 +17,14 @@
*/ */
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import org.apache.atlas.ocf.properties.Connection; import org.apache.atlas.ocf.properties.beans.Connection;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* EnterpriseAccessConfig describes the properties that control the enterprise access services that the * EnterpriseAccessConfig describes the properties that control the enterprise access services that the
...@@ -36,6 +43,9 @@ import org.apache.atlas.ocf.properties.Connection; ...@@ -36,6 +43,9 @@ import org.apache.atlas.ocf.properties.Connection;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class EnterpriseAccessConfig public class EnterpriseAccessConfig
{ {
private String enterpriseMetadataCollectionName = null; private String enterpriseMetadataCollectionName = null;
......
...@@ -17,11 +17,18 @@ ...@@ -17,11 +17,18 @@
*/ */
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import org.apache.atlas.ocf.properties.Connection; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import org.apache.atlas.ocf.properties.beans.Connection;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* LocalRepositoryConfig provides the properties to control the behavior of the metadata repository associated with * LocalRepositoryConfig provides the properties to control the behavior of the metadata repository associated with
...@@ -62,6 +69,9 @@ import java.util.ArrayList; ...@@ -62,6 +69,9 @@ import java.util.ArrayList;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class LocalRepositoryConfig public class LocalRepositoryConfig
{ {
private String metadataCollectionId = null; private String metadataCollectionId = null;
...@@ -94,18 +104,18 @@ public class LocalRepositoryConfig ...@@ -94,18 +104,18 @@ public class LocalRepositoryConfig
Connection localRepositoryLocalConnection, Connection localRepositoryLocalConnection,
Connection localRepositoryRemoteConnection, Connection localRepositoryRemoteConnection,
OpenMetadataExchangeRule eventsToSaveRule, OpenMetadataExchangeRule eventsToSaveRule,
ArrayList<TypeDefSummary> selectedTypesToSave, List<TypeDefSummary> selectedTypesToSave,
OpenMetadataExchangeRule eventsToSendRule, OpenMetadataExchangeRule eventsToSendRule,
ArrayList<TypeDefSummary> selectedTypesToSend, List<TypeDefSummary> selectedTypesToSend,
Connection eventMapperConnection) Connection eventMapperConnection)
{ {
this.metadataCollectionId = metadataCollectionId; this.metadataCollectionId = metadataCollectionId;
this.localRepositoryLocalConnection = localRepositoryLocalConnection; this.localRepositoryLocalConnection = localRepositoryLocalConnection;
this.localRepositoryRemoteConnection = localRepositoryRemoteConnection; this.localRepositoryRemoteConnection = localRepositoryRemoteConnection;
this.eventsToSaveRule = eventsToSaveRule; this.eventsToSaveRule = eventsToSaveRule;
this.selectedTypesToSave = selectedTypesToSave; this.setSelectedTypesToSave(selectedTypesToSave);
this.eventsToSendRule = eventsToSendRule; this.eventsToSendRule = eventsToSendRule;
this.selectedTypesToSend = selectedTypesToSend; this.setSelectedTypesToSend(selectedTypesToSend);
this.eventMapperConnection = eventMapperConnection; this.eventMapperConnection = eventMapperConnection;
} }
...@@ -218,10 +228,17 @@ public class LocalRepositoryConfig ...@@ -218,10 +228,17 @@ public class LocalRepositoryConfig
* *
* @return list of types * @return list of types
*/ */
public ArrayList<TypeDefSummary> getSelectedTypesToSave() public List<TypeDefSummary> getSelectedTypesToSave()
{
if (selectedTypesToSave == null)
{
return null;
}
else
{ {
return selectedTypesToSave; return selectedTypesToSave;
} }
}
/** /**
...@@ -229,9 +246,16 @@ public class LocalRepositoryConfig ...@@ -229,9 +246,16 @@ public class LocalRepositoryConfig
* *
* @param selectedTypesToSave - list of types * @param selectedTypesToSave - list of types
*/ */
public void setSelectedTypesToSave(ArrayList<TypeDefSummary> selectedTypesToSave) public void setSelectedTypesToSave(List<TypeDefSummary> selectedTypesToSave)
{
if (selectedTypesToSave == null)
{
this.selectedTypesToSave = null;
}
else
{ {
this.selectedTypesToSave = selectedTypesToSave; this.selectedTypesToSave = new ArrayList<>(selectedTypesToSave);
}
} }
...@@ -264,10 +288,17 @@ public class LocalRepositoryConfig ...@@ -264,10 +288,17 @@ public class LocalRepositoryConfig
* *
* @return list of types * @return list of types
*/ */
public ArrayList<TypeDefSummary> getSelectedTypesToSend() public List<TypeDefSummary> getSelectedTypesToSend()
{
if (selectedTypesToSend == null)
{
return null;
}
else
{ {
return selectedTypesToSend; return selectedTypesToSend;
} }
}
/** /**
...@@ -275,9 +306,16 @@ public class LocalRepositoryConfig ...@@ -275,9 +306,16 @@ public class LocalRepositoryConfig
* *
* @param selectedTypesToSend - list of types * @param selectedTypesToSend - list of types
*/ */
public void setSelectedTypesToSend(ArrayList<TypeDefSummary> selectedTypesToSend) public void setSelectedTypesToSend(List<TypeDefSummary> selectedTypesToSend)
{ {
this.selectedTypesToSend = selectedTypesToSend; if (selectedTypesToSend == null)
{
this.selectedTypesToSend = null;
}
else
{
this.selectedTypesToSend = new ArrayList<>(selectedTypesToSend);
}
} }
......
...@@ -17,11 +17,20 @@ ...@@ -17,11 +17,20 @@
*/ */
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* OpenMetadataEventProtocolVersion provides the identifier for the version number of the event payload. There is * OpenMetadataEventProtocolVersion provides the identifier for the version number of the event payload. There is
* only one version at the moment which is why it looks a little sad. * only one version at the moment which is why it looks a little sad.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum OpenMetadataEventProtocolVersion public enum OpenMetadataEventProtocolVersion
{ {
V1 V1
......
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* OpenMetadataExchangeRule controls the sending/receiving of metadata instances on the metadata highway. * OpenMetadataExchangeRule controls the sending/receiving of metadata instances on the metadata highway.
* <ul> * <ul>
...@@ -41,6 +48,9 @@ package org.apache.atlas.omrs.admin.properties; ...@@ -41,6 +48,9 @@ package org.apache.atlas.omrs.admin.properties;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum OpenMetadataExchangeRule public enum OpenMetadataExchangeRule
{ {
REGISTRATION_ONLY (0, "Registration Only", "Only registration exchange; no TypeDefs or metadata instances."), REGISTRATION_ONLY (0, "Registration Only", "Only registration exchange; no TypeDefs or metadata instances."),
......
...@@ -17,9 +17,18 @@ ...@@ -17,9 +17,18 @@
*/ */
package org.apache.atlas.omrs.admin.properties; package org.apache.atlas.omrs.admin.properties;
import org.apache.atlas.ocf.properties.Connection; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import org.apache.atlas.ocf.properties.beans.Connection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* RepositoryServicesConfig provides the configuration properties that are needed by the OMRS components * RepositoryServicesConfig provides the configuration properties that are needed by the OMRS components
...@@ -31,7 +40,7 @@ import java.util.ArrayList; ...@@ -31,7 +40,7 @@ import java.util.ArrayList;
* component should use. * component should use.
* </li> * </li>
* <li> * <li>
* openMetadataArchiveConnectionList is a list of Open Metadata Archive Connections. * openMetadataArchiveConnections is a list of Open Metadata Archive Connections.
* An open metadata archive connection provides properties needed to create a connector to manage * An open metadata archive connection provides properties needed to create a connector to manage
* an open metadata archive. This contains pre-built TypeDefs and metadata instance. * an open metadata archive. This contains pre-built TypeDefs and metadata instance.
* The archives are managed by the OMRSArchiveManager. * The archives are managed by the OMRSArchiveManager.
...@@ -49,10 +58,13 @@ import java.util.ArrayList; ...@@ -49,10 +58,13 @@ import java.util.ArrayList;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class RepositoryServicesConfig public class RepositoryServicesConfig
{ {
private Connection auditLogConnection = null; private ArrayList<Connection> auditLogConnections = new ArrayList<>();
private ArrayList<Connection> openMetadataArchiveConnectionList = new ArrayList<>(); private ArrayList<Connection> openMetadataArchiveConnections = new ArrayList<>();
private LocalRepositoryConfig localRepositoryConfig = null; private LocalRepositoryConfig localRepositoryConfig = null;
private EnterpriseAccessConfig enterpriseAccessConfig = null; private EnterpriseAccessConfig enterpriseAccessConfig = null;
private ArrayList<CohortConfig> cohortConfigList = new ArrayList<>(); private ArrayList<CohortConfig> cohortConfigList = new ArrayList<>();
...@@ -69,24 +81,24 @@ public class RepositoryServicesConfig ...@@ -69,24 +81,24 @@ public class RepositoryServicesConfig
/** /**
* Constructor to set all properties. * Constructor to set all properties.
* *
* @param auditLogConnection - connection to the audit log. * @param auditLogConnections - connections to copies of the audit log.
* @param openMetadataArchiveConnectionList - list of open metadata archive files to load. * @param openMetadataArchiveConnections - list of open metadata archive files to load.
* @param localRepositoryConfig - properties to configure the behavior of the local repository. * @param localRepositoryConfig - properties to configure the behavior of the local repository.
* @param enterpriseAccessConfig - properties to configure the behavior of the federation services provided * @param enterpriseAccessConfig - properties to configure the behavior of the federation services provided
* to the Open Metadata Access Services (OMASs). * to the Open Metadata Access Services (OMASs).
* @param cohortConfigList - properties about the open metadata repository clusters that this server connects to. * @param cohortConfigList - properties about the open metadata repository clusters that this server connects to.
*/ */
public RepositoryServicesConfig(Connection auditLogConnection, public RepositoryServicesConfig(List<Connection> auditLogConnections,
ArrayList<Connection> openMetadataArchiveConnectionList, List<Connection> openMetadataArchiveConnections,
LocalRepositoryConfig localRepositoryConfig, LocalRepositoryConfig localRepositoryConfig,
EnterpriseAccessConfig enterpriseAccessConfig, EnterpriseAccessConfig enterpriseAccessConfig,
ArrayList<CohortConfig> cohortConfigList) List<CohortConfig> cohortConfigList)
{ {
this.auditLogConnection = auditLogConnection; this.setAuditLogConnections(auditLogConnections);
this.openMetadataArchiveConnectionList = openMetadataArchiveConnectionList; this.setOpenMetadataArchiveConnections(openMetadataArchiveConnections);
this.localRepositoryConfig = localRepositoryConfig; this.setLocalRepositoryConfig(localRepositoryConfig);
this.enterpriseAccessConfig = enterpriseAccessConfig; this.setEnterpriseAccessConfig(enterpriseAccessConfig);
this.cohortConfigList = cohortConfigList; this.setCohortConfigList(cohortConfigList);
} }
...@@ -95,20 +107,34 @@ public class RepositoryServicesConfig ...@@ -95,20 +107,34 @@ public class RepositoryServicesConfig
* *
* @return Connection object * @return Connection object
*/ */
public Connection getAuditLogConnection() public List<Connection> getAuditLogConnections()
{
if (auditLogConnections == null)
{
return null;
}
else
{ {
return auditLogConnection; return auditLogConnections;
}
} }
/** /**
* Set up the Connection properties used to create an OCF Connector to the AuditLog. * Set up the Connection properties used to create an OCF Connector to the AuditLog.
* *
* @param auditLogConnection - Connection object * @param auditLogConnections - list of Connection objects
*/ */
public void setAuditLogConnection(Connection auditLogConnection) public void setAuditLogConnections(List<Connection> auditLogConnections)
{
if (auditLogConnections == null)
{
this.auditLogConnections = null;
}
else
{ {
this.auditLogConnection = auditLogConnection; this.auditLogConnections = new ArrayList<>(auditLogConnections);
}
} }
...@@ -118,9 +144,16 @@ public class RepositoryServicesConfig ...@@ -118,9 +144,16 @@ public class RepositoryServicesConfig
* *
* @return list of Connection objects * @return list of Connection objects
*/ */
public ArrayList<Connection> getOpenMetadataArchiveConnectionList() public List<Connection> getOpenMetadataArchiveConnections()
{
if (openMetadataArchiveConnections == null)
{ {
return openMetadataArchiveConnectionList; return null;
}
else
{
return openMetadataArchiveConnections;
}
} }
...@@ -128,11 +161,18 @@ public class RepositoryServicesConfig ...@@ -128,11 +161,18 @@ public class RepositoryServicesConfig
* Set up the list of Connection object, each of which is used to create the Connector to an Open Metadata * Set up the list of Connection object, each of which is used to create the Connector to an Open Metadata
* Archive. Open Metadata Archive contains pre-built metadata types and instances. * Archive. Open Metadata Archive contains pre-built metadata types and instances.
* *
* @param openMetadataArchiveConnectionList - list of Connection objects * @param openMetadataArchiveConnections - list of Connection objects
*/ */
public void setOpenMetadataArchiveConnectionList(ArrayList<Connection> openMetadataArchiveConnectionList) public void setOpenMetadataArchiveConnections(List<Connection> openMetadataArchiveConnections)
{ {
this.openMetadataArchiveConnectionList = openMetadataArchiveConnectionList; if (openMetadataArchiveConnections == null)
{
this.openMetadataArchiveConnections = null;
}
else
{
this.openMetadataArchiveConnections = new ArrayList<>(openMetadataArchiveConnections);
}
} }
...@@ -188,10 +228,17 @@ public class RepositoryServicesConfig ...@@ -188,10 +228,17 @@ public class RepositoryServicesConfig
* *
* @return list of cluster configuration properties * @return list of cluster configuration properties
*/ */
public ArrayList<CohortConfig> getCohortConfigList() public List<CohortConfig> getCohortConfigList()
{
if (cohortConfigList == null)
{
return null;
}
else
{ {
return cohortConfigList; return cohortConfigList;
} }
}
/** /**
...@@ -200,8 +247,15 @@ public class RepositoryServicesConfig ...@@ -200,8 +247,15 @@ public class RepositoryServicesConfig
* *
* @param cohortConfigList - list of cluster configuration properties * @param cohortConfigList - list of cluster configuration properties
*/ */
public void setCohortConfigList(ArrayList<CohortConfig> cohortConfigList) public void setCohortConfigList(List<CohortConfig> cohortConfigList)
{
if (cohortConfigList == null)
{ {
this.cohortConfigList = cohortConfigList; this.cohortConfigList = null;
}
else
{
this.cohortConfigList = new ArrayList<>(cohortConfigList);
}
} }
} }
/*
* 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.omrs.archivemanager;
import org.apache.atlas.ocf.Connector;
import org.apache.atlas.ocf.ConnectorBroker;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.omrs.admin.OMRSConfigurationFactory;
import org.apache.atlas.omrs.archivemanager.opentypes.OpenMetadataTypesArchive;
import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive;
import org.apache.atlas.omrs.archivemanager.store.OpenMetadataArchiveStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* OMRSArchiveWriter creates physical open metadata archive files for the supplied open metadata archives
* encoded in OMRS.
*/
public class OMRSArchiveWriter
{
private static final Logger log = LoggerFactory.getLogger(OMRSArchiveWriter.class);
/**
* Default constructor
*/
public OMRSArchiveWriter()
{
}
/**
* Opens up an open metadata archive store connector.
*
* @param connection - connection information for the open metadata archive.
* @return open metadata archive store connector
*/
private OpenMetadataArchiveStore getOpenMetadataArchive(Connection connection)
{
OpenMetadataArchiveStore openMetadataArchiveStore = null;
try
{
ConnectorBroker connectorBroker = new ConnectorBroker();
Connector connector = connectorBroker.getConnector(connection);
openMetadataArchiveStore = (OpenMetadataArchiveStore)connector;
log.debug("Created connector to open metadata archive store");
}
catch (Throwable error)
{
log.error("Unexpected exception occurred: " + error.getMessage());
log.error("Exception: " + error.toString());
}
return openMetadataArchiveStore;
}
/**
* Generates and writes out an open metadata archive containing all of the open metadata types.
*/
private void writeOpenMetadataArchiveTypes()
{
OMRSConfigurationFactory configurationFactory = new OMRSConfigurationFactory();
Connection connection = configurationFactory.getOpenMetadataTypesConnection();
OpenMetadataArchiveStore openMetadataArchiveStore = this.getOpenMetadataArchive(connection);
OpenMetadataTypesArchive openMetadataTypesArchive = new OpenMetadataTypesArchive();
OpenMetadataArchive openMetadataArchive = openMetadataTypesArchive.getOpenMetadataArchive();
openMetadataArchiveStore.setArchiveContents(openMetadataArchive);
}
/**
* Main program to control the archive writer.
*
* @param args - ignored arguments
*/
public static void main(String[] args)
{
OMRSArchiveWriter archiveWriter = new OMRSArchiveWriter();
archiveWriter.writeOpenMetadataArchiveTypes();
/*
* Calls to create other standard archives will go here.
*/
}
}
...@@ -17,6 +17,13 @@ ...@@ -17,6 +17,13 @@
*/ */
package org.apache.atlas.omrs.archivemanager.properties; package org.apache.atlas.omrs.archivemanager.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* OpenMetadataArchive defines the structure of the properties inside of an open metadata archive. * OpenMetadataArchive defines the structure of the properties inside of an open metadata archive.
* There are 3 sections: * There are 3 sections:
...@@ -32,6 +39,9 @@ package org.apache.atlas.omrs.archivemanager.properties; ...@@ -32,6 +39,9 @@ package org.apache.atlas.omrs.archivemanager.properties;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchive public class OpenMetadataArchive
{ {
private OpenMetadataArchiveProperties archiveProperties = null; private OpenMetadataArchiveProperties archiveProperties = null;
......
...@@ -18,15 +18,25 @@ ...@@ -18,15 +18,25 @@
package org.apache.atlas.omrs.archivemanager.properties; package org.apache.atlas.omrs.archivemanager.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail; import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail;
import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship; import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* OpenMetadataArchiveInstanceStore defines the contents of the InstanceStore in an open metadata archive. It * OpenMetadataArchiveInstanceStore defines the contents of the InstanceStore in an open metadata archive. It
* consists of a list of entities and a list of relationships. * consists of a list of entities and a list of relationships.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchiveInstanceStore public class OpenMetadataArchiveInstanceStore
{ {
private ArrayList<EntityDetail> entities = null; private ArrayList<EntityDetail> entities = null;
...@@ -46,9 +56,16 @@ public class OpenMetadataArchiveInstanceStore ...@@ -46,9 +56,16 @@ public class OpenMetadataArchiveInstanceStore
* *
* @return list of entities * @return list of entities
*/ */
public ArrayList<EntityDetail> getEntities() public List<EntityDetail> getEntities()
{
if (entities == null)
{ {
return entities; return null;
}
else
{
return new ArrayList<>(entities);
}
} }
...@@ -57,9 +74,16 @@ public class OpenMetadataArchiveInstanceStore ...@@ -57,9 +74,16 @@ public class OpenMetadataArchiveInstanceStore
* *
* @param entities - list of entities * @param entities - list of entities
*/ */
public void setEntities(ArrayList<EntityDetail> entities) public void setEntities(List<EntityDetail> entities)
{ {
this.entities = entities; if (entities == null)
{
this.entities = null;
}
else
{
this.entities = new ArrayList<>(entities);
}
} }
...@@ -68,9 +92,16 @@ public class OpenMetadataArchiveInstanceStore ...@@ -68,9 +92,16 @@ public class OpenMetadataArchiveInstanceStore
* *
* @return list of relationships * @return list of relationships
*/ */
public ArrayList<Relationship> getRelationships() public List<Relationship> getRelationships()
{ {
return relationships; if (relationships == null)
{
return null;
}
else
{
return new ArrayList<>(relationships);
}
} }
...@@ -79,8 +110,15 @@ public class OpenMetadataArchiveInstanceStore ...@@ -79,8 +110,15 @@ public class OpenMetadataArchiveInstanceStore
* *
* @param relationships - list of relationship objects * @param relationships - list of relationship objects
*/ */
public void setRelationships(ArrayList<Relationship> relationships) public void setRelationships(List<Relationship> relationships)
{ {
this.relationships = relationships; if (relationships == null)
{
this.relationships = null;
}
else
{
this.relationships = new ArrayList<>(relationships);
}
} }
} }
...@@ -18,8 +18,16 @@ ...@@ -18,8 +18,16 @@
package org.apache.atlas.omrs.archivemanager.properties; package org.apache.atlas.omrs.archivemanager.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
* OpenMetadataArchiveProperties defines the properties of an open metadata archive. This includes the following * OpenMetadataArchiveProperties defines the properties of an open metadata archive. This includes the following
...@@ -48,6 +56,9 @@ import java.util.Date; ...@@ -48,6 +56,9 @@ import java.util.Date;
* </li> * </li>
* </ul> * </ul>
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchiveProperties public class OpenMetadataArchiveProperties
{ {
private String archiveGUID = null; private String archiveGUID = null;
...@@ -55,6 +66,7 @@ public class OpenMetadataArchiveProperties ...@@ -55,6 +66,7 @@ public class OpenMetadataArchiveProperties
private String archiveDescription = null; private String archiveDescription = null;
private OpenMetadataArchiveType archiveType = null; private OpenMetadataArchiveType archiveType = null;
private String originatorName = null; private String originatorName = null;
private String originatorOrganization = null;
private Date creationDate = null; private Date creationDate = null;
private ArrayList<String> dependsOnArchives = null; private ArrayList<String> dependsOnArchives = null;
...@@ -156,7 +168,8 @@ public class OpenMetadataArchiveProperties ...@@ -156,7 +168,8 @@ public class OpenMetadataArchiveProperties
/** /**
* Return the name of the originator of this open metadata archive (persona or organization). * Return the name of the originator of this open metadata archive This will be used as the name of the
* creator for each element in the archive.
* *
* @return String name * @return String name
*/ */
...@@ -167,7 +180,8 @@ public class OpenMetadataArchiveProperties ...@@ -167,7 +180,8 @@ public class OpenMetadataArchiveProperties
/** /**
* Set up the name of the originator of this open metadata archive (persona or organization). * Set up the name of the originator of this open metadata archive. This will be used as the name of the
* creator for each element in the archive.
* *
* @param originatorName - String name * @param originatorName - String name
*/ */
...@@ -178,6 +192,27 @@ public class OpenMetadataArchiveProperties ...@@ -178,6 +192,27 @@ public class OpenMetadataArchiveProperties
/** /**
* Return the name of the organization that provided this archive.
*
* @return String organization name
*/
public String getOriginatorOrganization()
{
return originatorOrganization;
}
/**
* Set up the name of the organization that provided this archive.
*
* @param originatorOrganization - String name
*/
public void setOriginatorOrganization(String originatorOrganization)
{
this.originatorOrganization = originatorOrganization;
}
/**
* Return the date that this open metadata archive was created. * Return the date that this open metadata archive was created.
* *
* @return Date object * @return Date object
...@@ -204,9 +239,16 @@ public class OpenMetadataArchiveProperties ...@@ -204,9 +239,16 @@ public class OpenMetadataArchiveProperties
* *
* @return list of guids * @return list of guids
*/ */
public ArrayList<String> getDependsOnArchives() public List<String> getDependsOnArchives()
{
if (dependsOnArchives == null)
{
return null;
}
else
{ {
return dependsOnArchives; return new ArrayList<>(dependsOnArchives);
}
} }
...@@ -215,8 +257,15 @@ public class OpenMetadataArchiveProperties ...@@ -215,8 +257,15 @@ public class OpenMetadataArchiveProperties
* *
* @param dependsOnArchives - list of guids * @param dependsOnArchives - list of guids
*/ */
public void setDependsOnArchives(ArrayList<String> dependsOnArchives) public void setDependsOnArchives(List<String> dependsOnArchives)
{
if (dependsOnArchives == null)
{ {
this.dependsOnArchives = dependsOnArchives; this.dependsOnArchives = null;
}
else
{
this.dependsOnArchives = new ArrayList<>(dependsOnArchives);
}
} }
} }
...@@ -17,6 +17,21 @@ ...@@ -17,6 +17,21 @@
*/ */
package org.apache.atlas.omrs.archivemanager.properties; package org.apache.atlas.omrs.archivemanager.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* OpenMetadataArchiveType defines the origin of the open metadata archive. Content pack means tha the archive contains
* pre-defined types and instances for a particular use case. Metadata export is a collection of types and instances
* from a particular metadata server.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum OpenMetadataArchiveType public enum OpenMetadataArchiveType
{ {
CONTENT_PACK (1, "ContentPack", CONTENT_PACK (1, "ContentPack",
......
...@@ -17,11 +17,18 @@ ...@@ -17,11 +17,18 @@
*/ */
package org.apache.atlas.omrs.archivemanager.properties; package org.apache.atlas.omrs.archivemanager.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.AttributeTypeDef; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.AttributeTypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/** /**
...@@ -29,6 +36,9 @@ import java.util.ArrayList; ...@@ -29,6 +36,9 @@ import java.util.ArrayList;
* contains a list of types used for attributes, a list of type definition (TypeDef) patches to update existing types * contains a list of types used for attributes, a list of type definition (TypeDef) patches to update existing types
* and a list of TypeDefs for new types of classifications, entities and relationships. * and a list of TypeDefs for new types of classifications, entities and relationships.
*/ */
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchiveTypeStore public class OpenMetadataArchiveTypeStore
{ {
private ArrayList<AttributeTypeDef> attributeTypeDefs = null; private ArrayList<AttributeTypeDef> attributeTypeDefs = null;
...@@ -49,9 +59,16 @@ public class OpenMetadataArchiveTypeStore ...@@ -49,9 +59,16 @@ public class OpenMetadataArchiveTypeStore
* *
* @return list of AttributeTypeDef objects * @return list of AttributeTypeDef objects
*/ */
public ArrayList<AttributeTypeDef> getAttributeTypeDefs() public List<AttributeTypeDef> getAttributeTypeDefs()
{
if (attributeTypeDefs == null)
{
return null;
}
else
{ {
return attributeTypeDefs; return new ArrayList<>(attributeTypeDefs);
}
} }
...@@ -60,9 +77,16 @@ public class OpenMetadataArchiveTypeStore ...@@ -60,9 +77,16 @@ public class OpenMetadataArchiveTypeStore
* *
* @param attributeTypeDefs - list of AttributeTypeDef objects * @param attributeTypeDefs - list of AttributeTypeDef objects
*/ */
public void setAttributeTypeDefs(ArrayList<AttributeTypeDef> attributeTypeDefs) public void setAttributeTypeDefs(List<AttributeTypeDef> attributeTypeDefs)
{
if (attributeTypeDefs == null)
{ {
this.attributeTypeDefs = attributeTypeDefs; this.attributeTypeDefs = null;
}
else
{
this.attributeTypeDefs = new ArrayList<>(attributeTypeDefs);
}
} }
...@@ -71,9 +95,16 @@ public class OpenMetadataArchiveTypeStore ...@@ -71,9 +95,16 @@ public class OpenMetadataArchiveTypeStore
* *
* @return list of TypeDef objects * @return list of TypeDef objects
*/ */
public ArrayList<TypeDefPatch> getTypeDefPatches() public List<TypeDefPatch> getTypeDefPatches()
{
if (typeDefPatches == null)
{ {
return typeDefPatches; return null;
}
else
{
return new ArrayList<>(typeDefPatches);
}
} }
...@@ -82,9 +113,16 @@ public class OpenMetadataArchiveTypeStore ...@@ -82,9 +113,16 @@ public class OpenMetadataArchiveTypeStore
* *
* @param typeDefPatches - list of TypeDef objects * @param typeDefPatches - list of TypeDef objects
*/ */
public void setTypeDefPatches(ArrayList<TypeDefPatch> typeDefPatches) public void setTypeDefPatches(List<TypeDefPatch> typeDefPatches)
{ {
this.typeDefPatches = typeDefPatches; if (typeDefPatches == null)
{
this.typeDefPatches = null;
}
else
{
this.typeDefPatches = new ArrayList<>(typeDefPatches);
}
} }
...@@ -93,9 +131,16 @@ public class OpenMetadataArchiveTypeStore ...@@ -93,9 +131,16 @@ public class OpenMetadataArchiveTypeStore
* *
* @return list of TypeDef objects * @return list of TypeDef objects
*/ */
public ArrayList<TypeDef> getNewTypeDefs() public List<TypeDef> getNewTypeDefs()
{
if (newTypeDefs == null)
{
return null;
}
else
{ {
return newTypeDefs; return new ArrayList<>(newTypeDefs);
}
} }
...@@ -104,8 +149,15 @@ public class OpenMetadataArchiveTypeStore ...@@ -104,8 +149,15 @@ public class OpenMetadataArchiveTypeStore
* *
* @param newTypeDefs - list of TypeDef objects * @param newTypeDefs - list of TypeDef objects
*/ */
public void setNewTypeDefs(ArrayList<TypeDef> newTypeDefs) public void setNewTypeDefs(List<TypeDef> newTypeDefs)
{
if (newTypeDefs == null)
{ {
this.newTypeDefs = newTypeDefs; this.newTypeDefs = null;
}
else
{
this.newTypeDefs = new ArrayList<>(newTypeDefs);
}
} }
} }
...@@ -44,12 +44,6 @@ import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive; ...@@ -44,12 +44,6 @@ import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive;
public interface OpenMetadataArchiveStore public interface OpenMetadataArchiveStore
{ {
/** /**
* Open the archive and retrieve archive contents (if any)
*/
void openArchive();
/**
* Return the contents of the archive. * Return the contents of the archive.
* *
* @return OpenMetadataArchive object * @return OpenMetadataArchive object
...@@ -63,10 +57,4 @@ public interface OpenMetadataArchiveStore ...@@ -63,10 +57,4 @@ public interface OpenMetadataArchiveStore
* @param archiveContents - OpenMetadataArchive object * @param archiveContents - OpenMetadataArchive object
*/ */
void setArchiveContents(OpenMetadataArchive archiveContents); void setArchiveContents(OpenMetadataArchive archiveContents);
/**
* Close the archive - this releases the connection and any resources held.
*/
void closeArchive();
} }
...@@ -20,8 +20,8 @@ package org.apache.atlas.omrs.archivemanager.store; ...@@ -20,8 +20,8 @@ package org.apache.atlas.omrs.archivemanager.store;
import org.apache.atlas.ocf.ConnectorBase; import org.apache.atlas.ocf.ConnectorBase;
/** /**
* OpenMetadataArchiveStoreConnectorBase is the base class for connectors that support the OpenMetadataArchiveStore * OpenMetadataArchiveStoreConnector is the base class for connectors that support the OpenMetadataArchiveStore
*/ */
public abstract class OpenMetadataArchiveStoreConnectorBase extends ConnectorBase implements OpenMetadataArchiveStore public abstract class OpenMetadataArchiveStoreConnector extends ConnectorBase implements OpenMetadataArchiveStore
{ {
} }
/*
* 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.omrs.archivemanager.store.file;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.ocf.properties.Endpoint;
import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive;
import org.apache.atlas.omrs.archivemanager.store.OpenMetadataArchiveStoreConnector;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class FileBasedOpenMetadataArchiveStoreConnector extends OpenMetadataArchiveStoreConnector
{
/*
* This is the default name of the open metadata archive file that is used if there is no file name in the connection.
*/
private static final String defaultFilename = "open.metadata.archive";
/*
* Variables used in writing to the file.
*/
private String archiveStoreName = null;
/*
* Variables used for logging and debug.
*/
private static final Logger log = LoggerFactory.getLogger(FileBasedOpenMetadataArchiveStoreConnector.class);
/**
* Default constructor
*/
public FileBasedOpenMetadataArchiveStoreConnector()
{
}
@Override
public void initialize(String connectorInstanceId, Connection connection)
{
super.initialize(connectorInstanceId, connection);
Endpoint endpoint = connection.getEndpoint();
if (endpoint != null)
{
archiveStoreName = endpoint.getAddress();
}
if (archiveStoreName == null)
{
archiveStoreName = defaultFilename;
}
}
/**
* Return the contents of the archive.
*
* @return OpenMetadataArchive object
*/
public OpenMetadataArchive getArchiveContents()
{
File archiveStoreFile = new File(archiveStoreName);
OpenMetadataArchive newOpenMetadataArchive;
try
{
if (log.isDebugEnabled())
{
log.debug("Retrieving server configuration properties");
}
String configStoreFileContents = FileUtils.readFileToString(archiveStoreFile, "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
newOpenMetadataArchive = objectMapper.readValue(configStoreFileContents, OpenMetadataArchive.class);
}
catch (IOException ioException)
{
/*
* The config file is not found, create a new one ...
*/
if (log.isDebugEnabled())
{
log.debug("New server config Store", ioException);
}
newOpenMetadataArchive = new OpenMetadataArchive();
}
return newOpenMetadataArchive;
}
/**
* Set new contents into the archive. This overrides any content previously stored.
*
* @param archiveContents - OpenMetadataArchive object
*/
public void setArchiveContents(OpenMetadataArchive archiveContents)
{
File archiveStoreFile = new File(archiveStoreName);
try
{
if (log.isDebugEnabled())
{
log.debug("Writing open metadata archive store properties: " + archiveContents);
}
if (archiveContents == null)
{
archiveStoreFile.delete();
}
else
{
ObjectMapper objectMapper = new ObjectMapper();
String archiveStoreFileContents = objectMapper.writeValueAsString(archiveContents);
FileUtils.writeStringToFile(archiveStoreFile, archiveStoreFileContents, false);
}
}
catch (IOException ioException)
{
if (log.isDebugEnabled())
{
log.debug("Unusable Server config Store :(", ioException);
}
}
}
/**
* 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() throws ConnectorCheckedException
{
super.disconnect();
if (log.isDebugEnabled())
{
log.debug("Closing Config Store.");
}
}
}
/*
* 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.omrs.archivemanager.store.file;
import org.apache.atlas.omrs.archivemanager.store.OpenMetadataArchiveStoreProviderBase;
/**
* FileBasedOpenMetadataArchiveStoreProvider is the OCF connector provider for the file based server configuration store.
*/
public class FileBasedOpenMetadataArchiveStoreProvider extends OpenMetadataArchiveStoreProviderBase
{
/**
* Constructor used to initialize the ConnectorProviderBase with the Java class name of the specific
* configuration store implementation.
*/
public FileBasedOpenMetadataArchiveStoreProvider()
{
Class connectorClass = FileBasedOpenMetadataArchiveStoreConnector.class;
super.setConnectorClassName(connectorClass.getName());
}
}
...@@ -120,7 +120,21 @@ public enum OMRSAuditCode ...@@ -120,7 +120,21 @@ public enum OMRSAuditCode
"correct and look for errors that have occurred during server start up." + "correct and look for errors that have occurred during server start up." +
"If necessary, correct the configuration and restart the server."), "If necessary, correct the configuration and restart the server."),
NULL_TOPIC_CONNECTOR("OMRS-AUDIT-0013", LOCAL_REPOSITORY_FAILED_TO_START("OMRS-AUDIT-0013",
OMRSAuditLogRecordSeverity.EXCEPTION,
"Unable to start processing in the local repository due to error {0}",
"The local server will not process events.",
"Review previous error messages to determine the precise error in the " +
"start up configuration. " +
"Correct the configuration and restart the server. "),
LOCAL_REPOSITORY_FAILED_TO_DISCONNECT("OMRS-AUDIT-0014",
OMRSAuditLogRecordSeverity.EXCEPTION,
"Unable to disconnect processing in the local repository due to error {0}",
"The local server may not shutdown cleanly.",
"Review previous error messages to determine the precise error. Correct the cause and restart the server. "),
NULL_TOPIC_CONNECTOR("OMRS-AUDIT-0015",
OMRSAuditLogRecordSeverity.EXCEPTION, OMRSAuditLogRecordSeverity.EXCEPTION,
"Unable to send or receive events for cohort {0} because the connector to the OMRS Topic failed to initialize", "Unable to send or receive events for cohort {0} because the connector to the OMRS Topic failed to initialize",
"The local server will not connect to the cohort.", "The local server will not connect to the cohort.",
...@@ -129,6 +143,38 @@ public enum OMRSAuditCode ...@@ -129,6 +143,38 @@ public enum OMRSAuditCode
"start up configuration. " + "start up configuration. " +
"Correct the configuration and reconnect the server to the cohort. "), "Correct the configuration and reconnect the server to the cohort. "),
PROCESSING_ARCHIVE("OMRS-AUDIT-0050",
OMRSAuditLogRecordSeverity.INFO,
"The Open Metadata Repository Services (OMRS) is about to process open metadata archive {0}.",
"The local server is about to local types and instances from an open metadata archive.",
"No action is required. This is part of the normal operation of the server."),
EMPTY_ARCHIVE("OMRS-AUDIT-0051",
OMRSAuditLogRecordSeverity.ERROR,
"The Open Metadata Repository Services (OMRS) is unable to process an open metadata archive because it is empty.",
"The local server is skipping an open metadata archive because it is empty.",
"Review the list of archives for the server and determine which archive is in error. " +
"Request a new version of the archive or remove it from the server's archive list."),
NULL_PROPERTIES_IN_ARCHIVE("OMRS-AUDIT-0052",
OMRSAuditLogRecordSeverity.ERROR,
"The Open Metadata Repository Services (OMRS) is unable to process an open metadata archive because it is empty.",
"The local server is skipping an open metadata archive because it is empty.",
"Review the list of archives for the server and determine which archive is in error. " +
"Request a new version of the archive or remove it from the server's archive list."),
COMPLETED_ARCHIVE("OMRS-AUDIT-0053",
OMRSAuditLogRecordSeverity.INFO,
"The Open Metadata Repository Services (OMRS) has loaded {0} types and {1} instances from open metadata archive {2}.",
"The local server has completed the processing of the open metadata archive.",
"No action is required. This is part of the normal operation of the server."),
EVENT_PROCESSING_ERROR("OMRS-AUDIT-0100",
OMRSAuditLogRecordSeverity.EXCEPTION,
"Unable process an incoming event {0} due to exception {1}",
"The information in the event is not available to the server.",
"Review the exception to determine the source of the error and correct it. "),
REGISTERED_WITH_COHORT("OMRS-AUDIT-0101", REGISTERED_WITH_COHORT("OMRS-AUDIT-0101",
OMRSAuditLogRecordSeverity.INFO, OMRSAuditLogRecordSeverity.INFO,
"Registering with open metadata repository cohort {0} using metadata collection id {1}", "Registering with open metadata repository cohort {0} using metadata collection id {1}",
...@@ -323,6 +369,38 @@ public enum OMRSAuditCode ...@@ -323,6 +369,38 @@ public enum OMRSAuditCode
"It is necessary to update the TypeDef to remove the conflict before the local server will " + "It is necessary to update the TypeDef to remove the conflict before the local server will " +
"exchange metadata with the remote server."), "exchange metadata with the remote server."),
NEW_TYPE_ADDED("OMRS-AUDIT-0301",
OMRSAuditLogRecordSeverity.INFO,
"The local server has added a new type called {0} with a unique identifier of {1} and a version number of {2} from {3}",
"The local server will be able to manage metadata instances of this type.",
"No action required. This message is for information only."),
NEW_TYPE_NOT_SUPPORTED("OMRS-AUDIT-0302",
OMRSAuditLogRecordSeverity.INFO,
"The local server is unable to add a new type called {0} with a unique identifier of {1} and a version number of {2} because the server does not support this feature",
"The local server will be able to manage metadata instances of this type.",
"No action required. This message is for information only."),
TYPE_UPDATED("OMRS-AUDIT-0303",
OMRSAuditLogRecordSeverity.INFO,
"The local server has updated an existing type called {0} with a unique identifier of {1} to version number of {2} from {3}",
"The local server will be able to manage metadata instances of this latest version of the type.",
"No action required. This message is for information only."),
TYPE_REMOVED("OMRS-AUDIT-0304",
OMRSAuditLogRecordSeverity.INFO,
"The local server has removed an existing type called {0} with a unique identifier of {1} to version number of {2}",
"The local server will be no longer be able to manage metadata instances of this type.",
"No action required. This message is for information only."),
TYPE_IDENTIFIER_MISMATCH("OMRS-AUDIT-0305",
OMRSAuditLogRecordSeverity.ERROR,
"The local server has detected a conflict with an existing type called {0} with a unique identifier of {1}. This does not match the type name {2} and unique identifier {3} passed to it on a request",
"The local server will be no longer be able to manage metadata instances of this type.",
"This is a serious error since it may cause metadata to be corrupted. " +
"First check the caller to ensure it is operating properly. " +
"Then investigate the source of the type and any other errors."),
PROCESS_UNKNOWN_EVENT("OMRS-AUDIT-8001", PROCESS_UNKNOWN_EVENT("OMRS-AUDIT-8001",
OMRSAuditLogRecordSeverity.EVENT, OMRSAuditLogRecordSeverity.EVENT,
"Received unknown event: {0}", "Received unknown event: {0}",
...@@ -388,7 +466,17 @@ public enum OMRSAuditCode ...@@ -388,7 +466,17 @@ public enum OMRSAuditCode
"Unable to send an event because the event is of an unknown type", "Unable to send an event because the event is of an unknown type",
"The local server may not be communicating properly with other servers in " + "The local server may not be communicating properly with other servers in " +
"the metadata repository cohort.", "the metadata repository cohort.",
"This is an internal logic error. Raise a JIRA, including the audit log, to get this fixed.") "This is an internal logic error. Raise a JIRA, including the audit log, to get this fixed."),
UNEXPECTED_EXCEPTION_FROM_EVENT("OMRS-AUDIT-9011",
OMRSAuditLogRecordSeverity.EXCEPTION,
"An incoming event of type {0} from {1} ({2}) generated an exception with message {3}",
"The contents of the event were not accepted by the local repository.",
"Review the exception and resolve the issue it documents."),
ENTERPRISE_TOPIC_DISCONNECT_ERROR("OMRS-AUDIT-9012",
OMRSAuditLogRecordSeverity.EXCEPTION,
"Disconnecting from the enterprise topic connector generated an exception with message {0}",
"The server may not have disconnected from the topic cleanly.",
"Review the exception and resolve the issue it documents.")
; ;
......
...@@ -26,6 +26,7 @@ import org.slf4j.Logger; ...@@ -26,6 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* OMRSAuditLog is a class for managing the audit logging of activity for the OMRS components. Each auditing component * OMRSAuditLog is a class for managing the audit logging of activity for the OMRS components. Each auditing component
...@@ -40,11 +41,11 @@ import java.util.ArrayList; ...@@ -40,11 +41,11 @@ import java.util.ArrayList;
public class OMRSAuditLog public class OMRSAuditLog
{ {
static private final OMRSAuditLogRecordOriginator originator = new OMRSAuditLogRecordOriginator(); static private final OMRSAuditLogRecordOriginator originator = new OMRSAuditLogRecordOriginator();
static private OMRSAuditLogStore auditLogStore = null; static private ArrayList<OMRSAuditLogStore> auditLogStores = null;
private static final Logger log = LoggerFactory.getLogger(OMRSAuditLog.class); private static final Logger log = LoggerFactory.getLogger(OMRSAuditLog.class);
private OMRSAuditLogReportingComponent reportingComponent = null; private OMRSAuditLogReportingComponent reportingComponent; /* Initialized in the constructor */
/** /**
...@@ -54,18 +55,21 @@ public class OMRSAuditLog ...@@ -54,18 +55,21 @@ public class OMRSAuditLog
* @param localServerName - name of the local server * @param localServerName - name of the local server
* @param localServerType - type of the local server * @param localServerType - type of the local server
* @param localOrganizationName - name of the organization that owns the local server * @param localOrganizationName - name of the organization that owns the local server
* @param auditLogStore - destination for the audit log records * @param auditLogStores - list of destinations for the audit log records
*/ */
public static void initialize(String localServerName, public static void initialize(String localServerName,
String localServerType, String localServerType,
String localOrganizationName, String localOrganizationName,
OMRSAuditLogStore auditLogStore) List<OMRSAuditLogStore> auditLogStores)
{ {
OMRSAuditLog.originator.setServerName(localServerName); OMRSAuditLog.originator.setServerName(localServerName);
OMRSAuditLog.originator.setServerType(localServerType); OMRSAuditLog.originator.setServerType(localServerType);
OMRSAuditLog.originator.setOrganizationName(localOrganizationName); OMRSAuditLog.originator.setOrganizationName(localOrganizationName);
OMRSAuditLog.auditLogStore = auditLogStore; if (auditLogStores != null)
{
OMRSAuditLog.auditLogStores = new ArrayList<>(auditLogStores);
}
} }
...@@ -118,11 +122,11 @@ public class OMRSAuditLog ...@@ -118,11 +122,11 @@ public class OMRSAuditLog
{ {
if ((severity == OMRSAuditLogRecordSeverity.ERROR) || (severity == OMRSAuditLogRecordSeverity.EXCEPTION)) if ((severity == OMRSAuditLogRecordSeverity.ERROR) || (severity == OMRSAuditLogRecordSeverity.EXCEPTION))
{ {
log.error("New Audit Log Record", actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction); log.error(logMessageId + " " + logMessage, actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction);
} }
else else
{ {
log.info("New Audit Log Record", actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction); log.info(logMessageId + " " + logMessage, actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction);
} }
} }
else else
...@@ -130,6 +134,10 @@ public class OMRSAuditLog ...@@ -130,6 +134,10 @@ public class OMRSAuditLog
severity = OMRSAuditLogRecordSeverity.UNKNOWN; severity = OMRSAuditLogRecordSeverity.UNKNOWN;
} }
if (auditLogStores != null)
{
for (OMRSAuditLogStore auditLogStore : auditLogStores)
{
if (auditLogStore != null) if (auditLogStore != null)
{ {
ArrayList<String> additionalInformationArray = null; ArrayList<String> additionalInformationArray = null;
...@@ -158,6 +166,9 @@ public class OMRSAuditLog ...@@ -158,6 +166,9 @@ public class OMRSAuditLog
} }
} }
} }
}
}
/** /**
* Log details of an unexpected exception detected by the OMRS. These exceptions typically mean that the local * Log details of an unexpected exception detected by the OMRS. These exceptions typically mean that the local
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment