Commit a1fd4068 by Mandy Chessell Committed by David Radley

ATLAS-2122 OMAG Server Application and OMRS APIs

parent 354162d4
......@@ -38,6 +38,24 @@
<dependencies>
<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>
......
......@@ -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.
*
* @throws ConnectorCheckedException - there is a problem disconnecting the connector.
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public abstract void disconnect() throws ConnectorCheckedException;
}
\ No newline at end of file
......@@ -17,6 +17,7 @@
*/
package org.apache.atlas.ocf;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
import org.apache.atlas.ocf.properties.AdditionalProperties;
import org.apache.atlas.ocf.properties.ConnectedAssetProperties;
......@@ -48,9 +49,10 @@ import java.util.UUID;
*/
public abstract class ConnectorBase extends Connector
{
protected String connectorInstanceId = null;
protected Connection connection = null;
protected ConnectedAssetProperties connectedAssetProperties = null;
protected String connectorInstanceId = null;
protected Connection connection = null;
protected ConnectedAssetProperties connectedAssetProperties = null;
protected boolean isActive = false;
/*
* Secured properties are protected properties from the connection. They are retrieved as a protected
......@@ -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
* is randomly assigned and so its hashCode is as good as anything to describe the hash code of the connector
* object.
......
......@@ -26,7 +26,7 @@ import java.util.*;
*/
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
/**
* 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.
*
* @param parentAsset - description of the asset that these additional properties are attached to.
......
......@@ -17,11 +17,21 @@
*/
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;
/**
* 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
{
NEW_ANNOTATION (0, "New", "Annotation has been created but not reviewed"),
......
......@@ -30,7 +30,6 @@ public abstract class AssetPropertyBase extends PropertyBase
*
* @param parentAsset - descriptor of asset that his property relates to.
*/
protected AssetPropertyBase(AssetDescriptor parentAsset)
{
/*
......
......@@ -17,12 +17,22 @@
*/
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;
/**
* The CommentType allows comments to be used to ask and answer questions as well as make suggestions and
* 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
{
STANDARD_COMMENT (0, "Comment", "General comment about the asset."),
......
......@@ -125,6 +125,7 @@ public class Connection extends Referenceable
this.securedProperties = securedProperties;
}
/**
* Typical Constructor - for constructing a new, populated Connection as part of connected asset properties.
*
......
......@@ -63,9 +63,9 @@ public class ConnectorType extends Referenceable
/*
* Attributes of a connector type
*/
private String displayName = null;
private String description = null;
private String connectorProviderClassName = null;
protected String displayName = null;
protected String description = null;
protected String connectorProviderClassName = null;
/**
* 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
/*
* Attached classifications
*/
private Classifications classifications = null;
protected Classifications classifications = null;
/**
......
......@@ -17,8 +17,15 @@
*/
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;
/**
* ElementOrigin defines where the metadata comes from and, hence if it can be updated.
* <ul>
......@@ -43,7 +50,10 @@ import java.io.Serializable;
* If the repository rejoins the cohort then these elements can be refreshed from the rejoining repository.
* </li>
* </ul>
*/
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum ElementOrigin implements Serializable
{
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;
*/
public class ElementType extends PropertyBase
{
private String elementTypeId = null;
private String elementTypeName = null;
private String elementTypeVersion = null;
private String elementTypeDescription = null;
private String elementAccessServiceURL = null;
private ElementOrigin elementOrigin = null;
private String elementHomeMetadataCollectionId = null;
protected String elementTypeId = null;
protected String elementTypeName = null;
protected long elementTypeVersion = 0;
protected String elementTypeDescription = null;
protected String elementAccessServiceURL = null;
protected ElementOrigin elementOrigin = null;
protected String elementHomeMetadataCollectionId = null;
/**
......@@ -47,7 +47,7 @@ public class ElementType extends PropertyBase
*/
public ElementType(String elementTypeId,
String elementTypeName,
String elementTypeVersion,
long elementTypeVersion,
String elementTypeDescription,
String elementAccessServiceURL,
ElementOrigin elementOrigin,
......@@ -64,6 +64,7 @@ public class ElementType extends PropertyBase
this.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId;
}
/**
* Copy/clone constructor
*
......@@ -73,18 +74,22 @@ public class ElementType extends PropertyBase
{
super(templateType);
/*
* Copy the properties from the supplied template
*/
this.elementTypeId = templateType.getElementTypeId();
this.elementTypeName = templateType.getElementTypeName();
this.elementTypeVersion = templateType.getElementTypeVersion();
this.elementTypeDescription = templateType.getElementTypeDescription();
this.elementAccessServiceURL = templateType.getElementAccessServiceURL();
this.elementOrigin = templateType.getElementOrigin();
this.elementHomeMetadataCollectionId = templateType.getElementHomeMetadataCollectionId();
if (templateType != null)
{
/*
* Copy the properties from the supplied template
*/
this.elementTypeId = templateType.getElementTypeId();
this.elementTypeName = templateType.getElementTypeName();
this.elementTypeVersion = templateType.getElementTypeVersion();
this.elementTypeDescription = templateType.getElementTypeDescription();
this.elementAccessServiceURL = templateType.getElementAccessServiceURL();
this.elementOrigin = templateType.getElementOrigin();
this.elementHomeMetadataCollectionId = templateType.getElementHomeMetadataCollectionId();
}
}
/**
* Return unique identifier for the element's type.
*
......@@ -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.
*/
public String getElementTypeVersion()
public long getElementTypeVersion()
{
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()
{
......@@ -172,7 +177,7 @@ public class ElementType extends PropertyBase
return "ElementType{" +
"elementTypeId='" + elementTypeId + '\'' +
", elementTypeName='" + elementTypeName + '\'' +
", elementTypeVersion='" + elementTypeVersion + '\'' +
", elementTypeVersion=" + elementTypeVersion +
", elementTypeDescription='" + elementTypeDescription + '\'' +
", elementAccessServiceURL='" + elementAccessServiceURL + '\'' +
", elementOrigin=" + elementOrigin +
......
......@@ -72,11 +72,11 @@ public class Endpoint extends Referenceable
/*
* Properties of an Endpoint
*/
private String displayName = null;
private String description = null;
private String address = null;
private String protocol = null;
private String encryptionMethod = null;
protected String displayName = null;
protected String description = null;
protected String address = null;
protected String protocol = null;
protected String encryptionMethod = null;
/**
* 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
this.encryptionMethod = encryptionMethod;
}
/**
* Copy/clone constructor for an Endpoint not connected to an asset.
*
......@@ -174,6 +175,7 @@ public class Endpoint extends Referenceable
this(null, templateEndpoint);
}
/**
* Copy/clone constructor for an Endpoint that is connected to an Asset (either directly or indirectly).
*
......
......@@ -17,12 +17,22 @@
*/
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;
/**
* A KeyPattern defines the type of External Identifier in use for an asset, or the type of Primary Key used within an
* asset.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum KeyPattern implements Serializable
{
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;
* Meaning is a cut-down summary of a glossary term to aid the asset consumer in understanding the content
* of an asset.
*/
public class Meaning extends Referenceable
public class Meaning extends ElementHeader
{
/*
* Attributes of a meaning object definition
*/
private String name = null;
private String description = null;
protected String name = null;
protected String description = null;
/**
......@@ -39,9 +39,6 @@ public class Meaning extends Referenceable
* @param guid - String - unique id
* @param url - String - URL
* @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 description - description of the glossary term.
*/
......@@ -50,13 +47,10 @@ public class Meaning extends Referenceable
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String name,
String description)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
super(parentAsset, type, guid, url, classifications);
this.name = name;
this.description = description;
......@@ -120,12 +114,10 @@ public class Meaning extends Referenceable
return "Meaning{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
", classifications=" + classifications +
'}';
}
}
\ No newline at end of file
......@@ -17,8 +17,15 @@
*/
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;
/**
* The RelatedMediaType defines the type of resource referenced in a related media reference.
* <ul>
......@@ -29,6 +36,9 @@ import java.io.Serializable;
* <li>Other - The media type is not supported.</li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum RelatedMediaType implements Serializable
{
IMAGE(0, "Image", "The media is an image."),
......
......@@ -17,12 +17,22 @@
*/
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;
/**
* The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties.
* 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
{
ICON (0, "Icon", "Provides a small image to represent the asset in tree views and graphs."),
......
......@@ -17,10 +17,22 @@
*/
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.
*/
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."),
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
private String schemaTypeName;
private String schemaTypeDescription;
private static final long serialVersionUID = 1L;
/**
* Constructor to set up the instance of this enum.
......
......@@ -17,12 +17,22 @@
*/
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;
/**
* A StarRating defines the rating that a user has placed against an asset. This ranges from not recommended
* 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
{
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 @@
* See the License for the specific language governing permissions and
* 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
* relationship is already stored in the metadata collection.
* OMAGNotAuthorizedException is used when invalid parameters are passed on an OMAG call.
*/
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 className - name of class reporting error
......@@ -33,14 +33,14 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase
* @param systemAction - actions of the system as a result of 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);
}
/**
* 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 className - name of class reporting error
......@@ -50,7 +50,7 @@ public class RelationshipKnownException extends OMRSCheckedExceptionBase
* @param userAction - instructions for correcting the error
* @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);
}
......
<?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 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
......@@ -71,6 +83,7 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>om-fwk-ocf</artifactId>
......
......@@ -17,6 +17,7 @@
*/
package org.apache.atlas.omrs.adapters.atlas.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase
......@@ -30,10 +31,23 @@ public class AtlasOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas
/**
* Free up any resources held since the connector is no longer needed.
* Indicates that the connector is completely configured and can begin processing.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void disconnect()
public void start() throws ConnectorCheckedException
{
super.start();
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void disconnect() throws ConnectorCheckedException
{
super.disconnect();
}
}
......@@ -17,8 +17,6 @@
*/
package org.apache.atlas.omrs.adapters.atlas.repositoryconnector;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
/**
......@@ -28,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/
public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector
{
private LocalAtlasOMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/**
* Default constructor used by the OCF Connector Provider.
*/
......@@ -54,32 +49,6 @@ public class LocalAtlasOMRSRepositoryConnector extends OMRSRepositoryConnector
/*
* Initialize the metadata collection only once the connector is properly set up.
*/
metadataCollection = new LocalAtlasOMRSMetadataCollection(this, metadataCollectionId);
}
/**
* Returns the metadata collection object that provides an OMRS abstraction of the metadata within
* a metadata repository.
*
* @return OMRSMetadataCollection - metadata information retrieved from the metadata repository.
*/
public OMRSMetadataCollection getMetadataCollection()
{
if (metadataCollection == null)
{
// TODO Throw exception since it means the local metadata collection id is not set up.
}
return metadataCollection;
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem disconnecting the connector.
*/
public void disconnect() throws ConnectorCheckedException
{
super.metadataCollection = new LocalAtlasOMRSMetadataCollection(this, metadataCollectionId);
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@
*/
package org.apache.atlas.omrs.adapters.igc.v1.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
......@@ -33,12 +34,24 @@ public class IGCOMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase
{
}
/**
* Indicates that the connector is completely configured and can begin processing.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void start() throws ConnectorCheckedException
{
super.start();
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void disconnect()
public void disconnect() throws ConnectorCheckedException
{
super.disconnect();
}
}
......@@ -27,9 +27,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/
public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
{
private IGCOMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/**
* Default constructor used by the OCF Connector Provider.
*/
......@@ -40,7 +37,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
*/
}
/**
* Set up the unique Id for this metadata collection.
*
......@@ -53,32 +49,6 @@ public class IGCOMRSRepositoryConnector extends OMRSRepositoryConnector
/*
* Initialize the metadata collection only once the connector is properly set up.
*/
metadataCollection = new IGCOMRSMetadataCollection(this, metadataCollectionId);
}
/**
* Returns the metadata collection object that provides an OMRS abstraction of the metadata within
* a metadata repository.
*
* @return OMRSMetadataCollection - metadata information retrieved from the metadata repository.
*/
public OMRSMetadataCollection getMetadataCollection()
{
if (metadataCollection == null)
{
// TODO Throw exception since it means the local metadata collection id is not set up.
}
return metadataCollection;
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem disconnecting the connector.
*/
public void disconnect() throws ConnectorCheckedException
{
super.metadataCollection = new IGCOMRSMetadataCollection(this, metadataCollectionId);
}
}
\ No newline at end of file
......@@ -17,12 +17,13 @@
*/
package org.apache.atlas.omrs.adapters.igc.v2.eventmapper;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperBase;
/**
* IGCOMRSRepositoryEventMapper provides an implementation of a repository event mapper for the
* IBM Governance Catalog (IGC) for relaeave following 11.7.
* IBM Governance Catalog (IGC) for releases following 11.7.
*/
public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBase
{
......@@ -35,10 +36,23 @@ public class IGCV2OMRSRepositoryEventMapper extends OMRSRepositoryEventMapperBas
/**
* Free up any resources held since the connector is no longer needed.
* Indicates that the connector is completely configured and can begin processing.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void disconnect()
public void start() throws ConnectorCheckedException
{
super.start();
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem within the connector.
*/
public void disconnect() throws ConnectorCheckedException
{
super.disconnect();
}
}
......@@ -17,9 +17,6 @@
*/
package org.apache.atlas.omrs.adapters.igc.v2.repositoryconnector;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.omrs.adapters.igc.v1.repositoryconnector.IGCOMRSMetadataCollection;
import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
......@@ -29,9 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSReposito
*/
public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector
{
private IGCV2OMRSMetadataCollection metadataCollection = null;
private String metadataCollectionId = null;
/**
* Default constructor used by the OCF Connector Provider.
*/
......@@ -55,32 +49,6 @@ public class IGCV2OMRSRepositoryConnector extends OMRSRepositoryConnector
/*
* Initialize the metadata collection only once the connector is properly set up.
*/
metadataCollection = new IGCV2OMRSMetadataCollection(this, metadataCollectionId);
}
/**
* Returns the metadata collection object that provides an OMRS abstraction of the metadata within
* a metadata repository.
*
* @return OMRSMetadataCollection - metadata information retrieved from the metadata repository.
*/
public OMRSMetadataCollection getMetadataCollection()
{
if (metadataCollection == null)
{
// TODO Throw exception since it means the local metadata collection id is not set up.
}
return metadataCollection;
}
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem disconnecting the connector.
*/
public void disconnect() throws ConnectorCheckedException
{
super.metadataCollection = new IGCV2OMRSMetadataCollection(this, metadataCollectionId);
}
}
\ No newline at end of file
/*
* 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 @@
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 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.
......@@ -56,6 +64,9 @@ import java.util.ArrayList;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class CohortConfig
{
private String cohortName = null;
......@@ -214,9 +225,16 @@ public class CohortConfig
*
* @return list of TypeDefs that determine which metadata instances to process
*/
public ArrayList<TypeDefSummary> getSelectedTypesToProcess()
public List<TypeDefSummary> getSelectedTypesToProcess()
{
return selectedTypesToProcess;
if (selectedTypesToProcess == null)
{
return null;
}
else
{
return selectedTypesToProcess;
}
}
......@@ -226,8 +244,15 @@ public class CohortConfig
*
* @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 @@
*/
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
......@@ -36,6 +43,9 @@ import org.apache.atlas.ocf.properties.Connection;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class EnterpriseAccessConfig
{
private String enterpriseMetadataCollectionName = null;
......
......@@ -17,11 +17,18 @@
*/
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 java.util.ArrayList;
import java.util.List;
/**
* LocalRepositoryConfig provides the properties to control the behavior of the metadata repository associated with
......@@ -62,6 +69,9 @@ import java.util.ArrayList;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class LocalRepositoryConfig
{
private String metadataCollectionId = null;
......@@ -94,18 +104,18 @@ public class LocalRepositoryConfig
Connection localRepositoryLocalConnection,
Connection localRepositoryRemoteConnection,
OpenMetadataExchangeRule eventsToSaveRule,
ArrayList<TypeDefSummary> selectedTypesToSave,
List<TypeDefSummary> selectedTypesToSave,
OpenMetadataExchangeRule eventsToSendRule,
ArrayList<TypeDefSummary> selectedTypesToSend,
List<TypeDefSummary> selectedTypesToSend,
Connection eventMapperConnection)
{
this.metadataCollectionId = metadataCollectionId;
this.localRepositoryLocalConnection = localRepositoryLocalConnection;
this.localRepositoryRemoteConnection = localRepositoryRemoteConnection;
this.eventsToSaveRule = eventsToSaveRule;
this.selectedTypesToSave = selectedTypesToSave;
this.setSelectedTypesToSave(selectedTypesToSave);
this.eventsToSendRule = eventsToSendRule;
this.selectedTypesToSend = selectedTypesToSend;
this.setSelectedTypesToSend(selectedTypesToSend);
this.eventMapperConnection = eventMapperConnection;
}
......@@ -218,9 +228,16 @@ public class LocalRepositoryConfig
*
* @return list of types
*/
public ArrayList<TypeDefSummary> getSelectedTypesToSave()
public List<TypeDefSummary> getSelectedTypesToSave()
{
return selectedTypesToSave;
if (selectedTypesToSave == null)
{
return null;
}
else
{
return selectedTypesToSave;
}
}
......@@ -229,9 +246,16 @@ public class LocalRepositoryConfig
*
* @param selectedTypesToSave - list of types
*/
public void setSelectedTypesToSave(ArrayList<TypeDefSummary> selectedTypesToSave)
public void setSelectedTypesToSave(List<TypeDefSummary> selectedTypesToSave)
{
this.selectedTypesToSave = selectedTypesToSave;
if (selectedTypesToSave == null)
{
this.selectedTypesToSave = null;
}
else
{
this.selectedTypesToSave = new ArrayList<>(selectedTypesToSave);
}
}
......@@ -264,9 +288,16 @@ public class LocalRepositoryConfig
*
* @return list of types
*/
public ArrayList<TypeDefSummary> getSelectedTypesToSend()
public List<TypeDefSummary> getSelectedTypesToSend()
{
return selectedTypesToSend;
if (selectedTypesToSend == null)
{
return null;
}
else
{
return selectedTypesToSend;
}
}
......@@ -275,9 +306,16 @@ public class LocalRepositoryConfig
*
* @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 @@
*/
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
* 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
{
V1
......
......@@ -18,6 +18,13 @@
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.
* <ul>
......@@ -41,6 +48,9 @@ package org.apache.atlas.omrs.admin.properties;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public enum OpenMetadataExchangeRule
{
REGISTRATION_ONLY (0, "Registration Only", "Only registration exchange; no TypeDefs or metadata instances."),
......
......@@ -17,9 +17,18 @@
*/
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.List;
/**
* RepositoryServicesConfig provides the configuration properties that are needed by the OMRS components
......@@ -31,7 +40,7 @@ import java.util.ArrayList;
* component should use.
* </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. This contains pre-built TypeDefs and metadata instance.
* The archives are managed by the OMRSArchiveManager.
......@@ -49,13 +58,16 @@ import java.util.ArrayList;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class RepositoryServicesConfig
{
private Connection auditLogConnection = null;
private ArrayList<Connection> openMetadataArchiveConnectionList = new ArrayList<>();
private LocalRepositoryConfig localRepositoryConfig = null;
private EnterpriseAccessConfig enterpriseAccessConfig = null;
private ArrayList<CohortConfig> cohortConfigList = new ArrayList<>();
private ArrayList<Connection> auditLogConnections = new ArrayList<>();
private ArrayList<Connection> openMetadataArchiveConnections = new ArrayList<>();
private LocalRepositoryConfig localRepositoryConfig = null;
private EnterpriseAccessConfig enterpriseAccessConfig = null;
private ArrayList<CohortConfig> cohortConfigList = new ArrayList<>();
/**
......@@ -69,24 +81,24 @@ public class RepositoryServicesConfig
/**
* Constructor to set all properties.
*
* @param auditLogConnection - connection to the audit log.
* @param openMetadataArchiveConnectionList - list of open metadata archive files to load.
* @param auditLogConnections - connections to copies of the audit log.
* @param openMetadataArchiveConnections - list of open metadata archive files to load.
* @param localRepositoryConfig - properties to configure the behavior of the local repository.
* @param enterpriseAccessConfig - properties to configure the behavior of the federation services provided
* to the Open Metadata Access Services (OMASs).
* @param cohortConfigList - properties about the open metadata repository clusters that this server connects to.
*/
public RepositoryServicesConfig(Connection auditLogConnection,
ArrayList<Connection> openMetadataArchiveConnectionList,
public RepositoryServicesConfig(List<Connection> auditLogConnections,
List<Connection> openMetadataArchiveConnections,
LocalRepositoryConfig localRepositoryConfig,
EnterpriseAccessConfig enterpriseAccessConfig,
ArrayList<CohortConfig> cohortConfigList)
List<CohortConfig> cohortConfigList)
{
this.auditLogConnection = auditLogConnection;
this.openMetadataArchiveConnectionList = openMetadataArchiveConnectionList;
this.localRepositoryConfig = localRepositoryConfig;
this.enterpriseAccessConfig = enterpriseAccessConfig;
this.cohortConfigList = cohortConfigList;
this.setAuditLogConnections(auditLogConnections);
this.setOpenMetadataArchiveConnections(openMetadataArchiveConnections);
this.setLocalRepositoryConfig(localRepositoryConfig);
this.setEnterpriseAccessConfig(enterpriseAccessConfig);
this.setCohortConfigList(cohortConfigList);
}
......@@ -95,20 +107,34 @@ public class RepositoryServicesConfig
*
* @return Connection object
*/
public Connection getAuditLogConnection()
public List<Connection> getAuditLogConnections()
{
return auditLogConnection;
if (auditLogConnections == null)
{
return null;
}
else
{
return auditLogConnections;
}
}
/**
* 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)
{
this.auditLogConnection = auditLogConnection;
if (auditLogConnections == null)
{
this.auditLogConnections = null;
}
else
{
this.auditLogConnections = new ArrayList<>(auditLogConnections);
}
}
......@@ -118,9 +144,16 @@ public class RepositoryServicesConfig
*
* @return list of Connection objects
*/
public ArrayList<Connection> getOpenMetadataArchiveConnectionList()
public List<Connection> getOpenMetadataArchiveConnections()
{
return openMetadataArchiveConnectionList;
if (openMetadataArchiveConnections == null)
{
return null;
}
else
{
return openMetadataArchiveConnections;
}
}
......@@ -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
* 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,9 +228,16 @@ public class RepositoryServicesConfig
*
* @return list of cluster configuration properties
*/
public ArrayList<CohortConfig> getCohortConfigList()
public List<CohortConfig> getCohortConfigList()
{
return cohortConfigList;
if (cohortConfigList == null)
{
return null;
}
else
{
return cohortConfigList;
}
}
......@@ -200,8 +247,15 @@ public class RepositoryServicesConfig
*
* @param cohortConfigList - list of cluster configuration properties
*/
public void setCohortConfigList(ArrayList<CohortConfig> cohortConfigList)
public void setCohortConfigList(List<CohortConfig> cohortConfigList)
{
this.cohortConfigList = cohortConfigList;
if (cohortConfigList == null)
{
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 @@
*/
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.
* There are 3 sections:
......@@ -32,6 +39,9 @@ package org.apache.atlas.omrs.archivemanager.properties;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchive
{
private OpenMetadataArchiveProperties archiveProperties = null;
......
......@@ -18,15 +18,25 @@
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.Relationship;
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
* 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
{
private ArrayList<EntityDetail> entities = null;
......@@ -46,9 +56,16 @@ public class OpenMetadataArchiveInstanceStore
*
* @return list of entities
*/
public ArrayList<EntityDetail> getEntities()
public List<EntityDetail> getEntities()
{
return entities;
if (entities == null)
{
return null;
}
else
{
return new ArrayList<>(entities);
}
}
......@@ -57,9 +74,16 @@ public class OpenMetadataArchiveInstanceStore
*
* @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
*
* @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
*
* @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 @@
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.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
......@@ -48,15 +56,19 @@ import java.util.Date;
* </li>
* </ul>
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchiveProperties
{
private String archiveGUID = null;
private String archiveName = null;
private String archiveDescription = null;
private OpenMetadataArchiveType archiveType = null;
private String originatorName = null;
private Date creationDate = null;
private ArrayList<String> dependsOnArchives = null;
private String archiveGUID = null;
private String archiveName = null;
private String archiveDescription = null;
private OpenMetadataArchiveType archiveType = null;
private String originatorName = null;
private String originatorOrganization = null;
private Date creationDate = null;
private ArrayList<String> dependsOnArchives = null;
/**
......@@ -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
*/
......@@ -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
*/
......@@ -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 Date object
......@@ -204,9 +239,16 @@ public class OpenMetadataArchiveProperties
*
* @return list of guids
*/
public ArrayList<String> getDependsOnArchives()
public List<String> getDependsOnArchives()
{
return dependsOnArchives;
if (dependsOnArchives == null)
{
return null;
}
else
{
return new ArrayList<>(dependsOnArchives);
}
}
......@@ -215,8 +257,15 @@ public class OpenMetadataArchiveProperties
*
* @param dependsOnArchives - list of guids
*/
public void setDependsOnArchives(ArrayList<String> dependsOnArchives)
public void setDependsOnArchives(List<String> dependsOnArchives)
{
this.dependsOnArchives = dependsOnArchives;
if (dependsOnArchives == null)
{
this.dependsOnArchives = null;
}
else
{
this.dependsOnArchives = new ArrayList<>(dependsOnArchives);
}
}
}
......@@ -17,6 +17,21 @@
*/
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
{
CONTENT_PACK (1, "ContentPack",
......
......@@ -17,11 +17,18 @@
*/
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.TypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch;
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;
* 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.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OpenMetadataArchiveTypeStore
{
private ArrayList<AttributeTypeDef> attributeTypeDefs = null;
......@@ -49,9 +59,16 @@ public class OpenMetadataArchiveTypeStore
*
* @return list of AttributeTypeDef objects
*/
public ArrayList<AttributeTypeDef> getAttributeTypeDefs()
public List<AttributeTypeDef> getAttributeTypeDefs()
{
return attributeTypeDefs;
if (attributeTypeDefs == null)
{
return null;
}
else
{
return new ArrayList<>(attributeTypeDefs);
}
}
......@@ -60,9 +77,16 @@ public class OpenMetadataArchiveTypeStore
*
* @param attributeTypeDefs - list of AttributeTypeDef objects
*/
public void setAttributeTypeDefs(ArrayList<AttributeTypeDef> attributeTypeDefs)
public void setAttributeTypeDefs(List<AttributeTypeDef> attributeTypeDefs)
{
this.attributeTypeDefs = attributeTypeDefs;
if (attributeTypeDefs == null)
{
this.attributeTypeDefs = null;
}
else
{
this.attributeTypeDefs = new ArrayList<>(attributeTypeDefs);
}
}
......@@ -71,9 +95,16 @@ public class OpenMetadataArchiveTypeStore
*
* @return list of TypeDef objects
*/
public ArrayList<TypeDefPatch> getTypeDefPatches()
public List<TypeDefPatch> getTypeDefPatches()
{
return typeDefPatches;
if (typeDefPatches == null)
{
return null;
}
else
{
return new ArrayList<>(typeDefPatches);
}
}
......@@ -82,9 +113,16 @@ public class OpenMetadataArchiveTypeStore
*
* @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
*
* @return list of TypeDef objects
*/
public ArrayList<TypeDef> getNewTypeDefs()
public List<TypeDef> getNewTypeDefs()
{
return newTypeDefs;
if (newTypeDefs == null)
{
return null;
}
else
{
return new ArrayList<>(newTypeDefs);
}
}
......@@ -104,8 +149,15 @@ public class OpenMetadataArchiveTypeStore
*
* @param newTypeDefs - list of TypeDef objects
*/
public void setNewTypeDefs(ArrayList<TypeDef> newTypeDefs)
public void setNewTypeDefs(List<TypeDef> newTypeDefs)
{
this.newTypeDefs = newTypeDefs;
if (newTypeDefs == null)
{
this.newTypeDefs = null;
}
else
{
this.newTypeDefs = new ArrayList<>(newTypeDefs);
}
}
}
......@@ -44,12 +44,6 @@ import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive;
public interface OpenMetadataArchiveStore
{
/**
* Open the archive and retrieve archive contents (if any)
*/
void openArchive();
/**
* Return the contents of the archive.
*
* @return OpenMetadataArchive object
......@@ -63,10 +57,4 @@ public interface OpenMetadataArchiveStore
* @param archiveContents - OpenMetadataArchive object
*/
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;
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());
}
}
......@@ -26,6 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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
......@@ -40,11 +41,11 @@ import java.util.ArrayList;
public class OMRSAuditLog
{
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 OMRSAuditLogReportingComponent reportingComponent = null;
private OMRSAuditLogReportingComponent reportingComponent; /* Initialized in the constructor */
/**
......@@ -54,18 +55,21 @@ public class OMRSAuditLog
* @param localServerName - name of the local server
* @param localServerType - type of 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,
String localServerType,
String localOrganizationName,
OMRSAuditLogStore auditLogStore)
public static void initialize(String localServerName,
String localServerType,
String localOrganizationName,
List<OMRSAuditLogStore> auditLogStores)
{
OMRSAuditLog.originator.setServerName(localServerName);
OMRSAuditLog.originator.setServerType(localServerType);
OMRSAuditLog.originator.setOrganizationName(localOrganizationName);
OMRSAuditLog.auditLogStore = auditLogStore;
if (auditLogStores != null)
{
OMRSAuditLog.auditLogStores = new ArrayList<>(auditLogStores);
}
}
......@@ -118,11 +122,11 @@ public class OMRSAuditLog
{
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
{
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
......@@ -130,35 +134,42 @@ public class OMRSAuditLog
severity = OMRSAuditLogRecordSeverity.UNKNOWN;
}
if (auditLogStore != null)
if (auditLogStores != null)
{
ArrayList<String> additionalInformationArray = null;
if (additionalInformation != null)
for (OMRSAuditLogStore auditLogStore : auditLogStores)
{
additionalInformationArray = new ArrayList<>();
additionalInformationArray.add(additionalInformation);
}
OMRSAuditLogRecord logRecord = new OMRSAuditLogRecord(originator,
reportingComponent,
severity.getSeverityName(),
logMessageId,
logMessage,
additionalInformationArray,
systemAction,
userAction);
try
{
auditLogStore.storeLogRecord(logRecord);
}
catch (Throwable error)
{
log.error("Error writing audit log: ", logRecord, error);
if (auditLogStore != null)
{
ArrayList<String> additionalInformationArray = null;
if (additionalInformation != null)
{
additionalInformationArray = new ArrayList<>();
additionalInformationArray.add(additionalInformation);
}
OMRSAuditLogRecord logRecord = new OMRSAuditLogRecord(originator,
reportingComponent,
severity.getSeverityName(),
logMessageId,
logMessage,
additionalInformationArray,
systemAction,
userAction);
try
{
auditLogStore.storeLogRecord(logRecord);
}
catch (Throwable error)
{
log.error("Error writing audit log: ", logRecord, error);
}
}
}
}
}
/**
* Log details of an unexpected exception detected by the OMRS. These exceptions typically mean that the local
* server is not configured correctly, or there is a logic error in the code. When exceptions are logged, it is
......
......@@ -17,13 +17,24 @@
*/
package org.apache.atlas.omrs.auditlog.store;
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.Date;
import java.util.List;
import java.util.UUID;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* OMRSAuditLogRecord provides a carrier for details about a single log record in the OMRS audit log.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class OMRSAuditLogRecord
{
private String guid = null;
......@@ -39,6 +50,14 @@ public class OMRSAuditLogRecord
/**
* Default constructor
*/
public OMRSAuditLogRecord()
{
}
/**
* Audit log records are immutable so the only way to update the values is through the constructor.
*
* @param originator - details of the originating server
......@@ -72,7 +91,7 @@ public class OMRSAuditLogRecord
}
/**
* Return the unique Id of the audit log record
* Return the unique Id of the audit log record.
*
* @return String guid
*/
......@@ -83,6 +102,17 @@ public class OMRSAuditLogRecord
/**
* Set up the unique Id of the audit log record.
*
* @param guid - String guid
*/
public void setGUID(String guid)
{
this.guid = guid;
}
/**
* Return the time stamp for when the audit log record was created.
*
* @return Date object
......@@ -153,22 +183,91 @@ public class OMRSAuditLogRecord
*
* @return String additional information
*/
public ArrayList<String> getAdditionalInformation()
public List<String> getAdditionalInformation()
{
return additionalInformation;
}
public void setTimeStamp(Date timeStamp)
{
this.timeStamp = timeStamp;
}
public void setOriginator(OMRSAuditLogRecordOriginator originator)
{
this.originator = originator;
}
public void setSeverity(String severity)
{
this.severity = severity;
}
public void setReportingComponent(OMRSAuditLogReportingComponent reportingComponent)
{
this.reportingComponent = reportingComponent;
}
public void setMessageId(String messageId)
{
this.messageId = messageId;
}
public void setMessageText(String messageText)
{
this.messageText = messageText;
}
public void setAdditionalInformation(ArrayList<String> additionalInformation)
{
this.additionalInformation = additionalInformation;
}
public String getSystemAction()
{
return systemAction;
}
/**
* Set up the description of the actions taken by the local server as a result of the reported situation.
*
* @param systemAction
*/
public void setSystemAction(String systemAction)
{
this.systemAction = systemAction;
}
/**
* Return details of the actions (if any) that a user can take in response to the reported situation.
*
* @return String instructions
*/
public String getUserAction()
{
return userAction;
}
/**
* Set up details of the actions (if any) that a user can take in response to the reported situation.
*
* @param userAction - String instructions
*/
public void setUserAction(String userAction)
{
this.userAction = userAction;
}
@Override
public String toString()
{
......
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