Commit cbfdd7fc by Mandy Chessell Committed by David Radley

ATLAS-1095:final code drop for OCF

parent 804c4635
<!--
~ 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.
-->
# Open Connector Framework (OCF)
The OCF, as the name suggests, is an open framework for supporting connectors.
Connectors support access to remote assets such as data sets, APIs and software components.
OCF Connectors also provide access to metadata about the asset and they may call the Governance Action Framework
GAF to execute appropriate governance actions related to the use of these assets in real-time.
## Terminology
There are a number of key components within the OCF:
* **Connector** - this is a Java object for accessing an asset and its
related metadata and governance functions.
* **Connection** - this is a Java object containing the properties needed to
create a connector instance.
Connection properties are typically managed as metadata entities in the metadata
repository but they can also be manually populated.
Connections have 2 sub-objects:
* **ConnectorType** - this is a Java object that describes the type of
the connector, including the Java implementation class of its connector provider (see below).
* **Endpoint** - this is the Java object that describes the server endpoint where the asset is accessed from.
* **Connector Broker** - this is a generic factory for all OCF connectors.
* **Connector Provider** - this is a factory for a specific type of connector.
It is used by the Connector Broker.
* **Connected Asset** - this is the asset that the connector is accessing. It is hosted on a server
and the connector makes the remote calls necessary to retrieve, update, delete the asset itself.
The connector also includes an API to retrieve the metadata properties about the connected asset.
## Open Metadata Type Models
Model 0040 defines the structure of an Endpoint and
model 0201 defines the structures for Connections and Connector Types.
Model 0205 defines the linkage between the connection and the connected asset.
## Java Implementation
The OCF provides the interface schema and base class implementation for these components.
The Java implementation is located in packages org.apache.atlas.ocf.*:
* **org.apache.atlas.ocf** - Java interface and base classes for Connector and Connector Provider
plus the implementation of the Connector Broker.
* **org.apache.atlas.ocf.ffdc** - Implementation of the OCF's error codes and exceptions.
* **org.apache.atlas.ocf.properties** - Implementation of the properties for connections and connected assets.
These are simple POJO objects.
## Related Modules
The ConnectedAsset OMAS (omas-connectedasset) supports the retrieval
of connection and connected asset properties from the open metadata
repository/repositories.
The AssetConsumer OMAS (omas-assetconsumer) embeds the OCF to provide
client-side support for connectors.
The Open Metadata Repository Services (omrs) provides implementations
of OCF connectors for accessing open metadata repository servers.
These connectors are collectively called the OMRS Connectors.
## Wiki References
Further information on the OCF at: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=69408729
<?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/xsd/maven-4.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>om-fwk-ocf</artifactId>
<name>Open Connector Framework (OCF)</name>
<description>Open Connector Framework (OCF) interfaces and implementation for building metadata and governance enabled connectors.</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</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
*
* 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.
*/
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.ConnectedAssetProperties;
import org.apache.atlas.ocf.properties.Connection;
/**
* <p>
* The Connector is the interface for all connector instances. Connectors are client-side interfaces to assets
* such as data stores, data sets, APIs, analytical functions. They handle the communication with the server that
* hosts the assets, along with the communication with the metadata server to serve up metadata (properties) about
* the assets.
* </p>
* <p>
* Each connector implementation is paired with a connector provider. The connector provider is the factory for
* connector instances.
* </p>
* <p>
* The Connector interface defines that a connector instance should be able to return a unique
* identifier, a connection object and a metadata object called ConnectedAssetProperties.
* </p>
* <p>
* Each specific implementation of a connector then extends the Connector interface to add the methods to work with the
* particular type of asset it supports. For example, a JDBC connector would add the standard JDBC SQL interface, the
* OMRS Connectors add the metadata repository management APIs...
* </p>
* <p>
* The initialize() method is called by the Connector Provider to set up the connector instance Id and the
* Connection properties for the connector as part of its construction process.
* </p>
* <p>
* ConnectedAssetProperties provides descriptive properties about the asset that the connector is accessing.
* It is supplied to the connector later during its initialization through the initializeConnectedAssetProperties() method.
* See AssetConsumer OMAS for an example of this.
* </p>
* <p>
* Both the connector and the connector provider have base classes (ConnectorBase and
* ConnectorProviderBase respectively) that implement all of the standard methods. The connector developer extends
* these classes to add the specific methods to manage the asset and configure the base classes.
* </p>
*/
public abstract class Connector
{
/**
* Call made by the ConnectorProvider to initialize the Connector with the base services.
*
* @param connectorInstanceId - unique id for the connector instance - useful for messages etc
* @param connection - POJO for the configuration used to create the connector.
*/
public abstract void initialize(String connectorInstanceId,
Connection connection);
/**
* Returns the unique connector instance id that assigned to the connector instance when it was created.
* It is useful for error and audit messages.
*
* @return guid for the connector instance
*/
public abstract String getConnectorInstanceId();
/**
* Returns the connection object that was used to create the connector instance. Its contents are never refreshed
* during the lifetime of a connector instance even if the connection information is updated or removed from
* the originating metadata repository.
*
* @return connection object
*/
public abstract Connection getConnection();
/**
* Set up the connected asset properties object. This provides the known metadata properties stored in one or more
* metadata repositories. The implementation of the connected asset properties object is free to determine when
* the properties are populated. It may be as lazy as whenever getConnectedAssetProperties() is called.
*
* @param connectedAssetProperties - properties of the connected asset
*/
public abstract void initializeConnectedAssetProperties(ConnectedAssetProperties connectedAssetProperties);
/**
* Returns the properties that contain the metadata for the asset. The asset metadata is retrieved from the
* metadata repository and cached in the ConnectedAssetProperties object each time the getConnectedAssetProperties
* method is requested by the caller. Once the ConnectedAssetProperties object has the metadata cached, it can be
* used to access the asset property values many times without a return to the metadata repository.
* The cache of metadata can be refreshed simply by calling this getConnectedAssetProperties() method again.
*
* @return ConnectedAssetProperties - connected asset properties
* @throws PropertyServerException - indicates a problem retrieving properties from a metadata repository
*/
public abstract ConnectedAssetProperties getConnectedAssetProperties() throws PropertyServerException;
/**
* Free up any resources held since the connector is no longer needed.
*
* @throws ConnectorCheckedException - there is a problem disconnecting the connector.
*/
public abstract void disconnect() throws ConnectorCheckedException;
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.ocf;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
import org.apache.atlas.ocf.properties.ConnectedAssetProperties;
import org.apache.atlas.ocf.properties.Connection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
/**
* The ConnectorBase is an implementation of the Connector interface.
*
* Connectors are client-side interfaces to assets such as data stores, data sets, APIs, analytical functions.
* They handle the communication with the server that hosts the assets, along with the communication with the
* metadata server to serve up metadata about the assets, and support for an audit log for the caller to log its
* activity.
*
* Each connector implementation is paired with a connector provider. The connector provider is the factory for
* connector instances.
*
* The Connector interface defines that a connector instance should be able to return a unique
* identifier, a connection object and a metadata properties object for its connected asset.
* These are supplied to the connector during its initialization.
*
* The ConnectorBase base class implements all of the methods required by the Connector interface.
* Each specific implementation of a connector then extends this interface to add the methods to work with the
* particular type of asset it supports. For example, a JDBC connector would add the standard JDBC SQL interface, the
* OMRS Connectors add the metadata repository management APIs...
*/
public abstract class ConnectorBase extends Connector
{
protected String connectorInstanceId = null;
protected Connection connection = null;
protected ConnectedAssetProperties connectedAssetProperties = null;
private static final int hashCode = UUID.randomUUID().hashCode();
private static final Logger log = LoggerFactory.getLogger(ConnectorBase.class);
/**
* Typical Constructor - Connectors should always have a constructor requiring no parameters and perform
* initialization in the initialize method.
*/
public ConnectorBase()
{
/*
* Nothing to do - real initialization happens in the initialize() method.
* This pattern is used to make it possible for ConnectorBrokerBase to support the dynamic loading and
* instantiation of arbitrary connector instances without needing to know the specifics of their constructor
* methods
*/
if (log.isDebugEnabled())
{
log.debug("New Connector Requested");
}
}
/**
* Call made by the ConnectorProvider to initialize the Connector with the base services.
*
* @param connectorInstanceId - unique id for the connector instance - useful for messages etc
* @param connection - POJO for the configuration used to create the connector.
*/
public void initialize(String connectorInstanceId,
Connection connection)
{
this.connectorInstanceId = connectorInstanceId;
this.connection = connection;
if (log.isDebugEnabled())
{
log.debug("New Connector initialized: " + connectorInstanceId + ", " + connection.getConnectionName());
}
}
/**
* Returns the unique connector instance id that assigned to the connector instance when it was created.
* It is useful for error and audit messages.
*
* @return guid for the connector instance
*/
public String getConnectorInstanceId()
{
return connectorInstanceId;
}
/**
* Returns the connection object that was used to create the connector instance. Its contents are never refreshed
* during the lifetime of the connector instance, even if the connection information is updated or removed
* from the originating metadata repository.
*
* @return connection object
*/
public Connection getConnection()
{
return connection;
}
/**
* Set up the connected asset properties object. This provides the known metadata properties stored in one or more
* metadata repositories. The properties are populated whenever getConnectedAssetProperties() is called.
*
* @param connectedAssetProperties - properties of the connected asset
*/
public void initializeConnectedAssetProperties(ConnectedAssetProperties connectedAssetProperties)
{
this.connectedAssetProperties = connectedAssetProperties;
}
/**
* Returns the properties that contain the metadata for the asset. The asset metadata is retrieved from the
* metadata repository and cached in the ConnectedAssetProperties object each time the getConnectedAssetProperties
* method is requested by the caller. Once the ConnectedAssetProperties object has the metadata cached, it can be
* used to access the asset property values many times without a return to the metadata repository.
* The cache of metadata can be refreshed simply by calling this getConnectedAssetProperties() method again.
*
* @return ConnectedAssetProperties - connected asset properties
* @throws PropertyServerException - indicates a problem retrieving properties from a metadata repository
*/
public ConnectedAssetProperties getConnectedAssetProperties() throws PropertyServerException
{
if (log.isDebugEnabled())
{
log.debug("ConnectedAssetProperties requested: " + connectorInstanceId + ", " + connection.getConnectionName());
}
if (connectedAssetProperties != null)
{
connectedAssetProperties.refresh();
}
return connectedAssetProperties;
}
/**
* 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.
*
* @return random UUID as hashcode
*/
public int hashCode()
{
return hashCode;
}
/**
* Provide a common implementation of equals for all OCF Connector Provider objects. The UUID is unique and
* is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the connector
* provider object.
*
* @param object - object to test
* @return boolean flag
*/
@Override
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (object == null || getClass() != object.getClass())
{
return false;
}
ConnectorBase that = (ConnectorBase) object;
if (connectorInstanceId != null ? !connectorInstanceId.equals(that.connectorInstanceId) : that.connectorInstanceId != null)
{
return false;
}
if (connection != null ? !connection.equals(that.connection) : that.connection != null)
{
return false;
}
return connectedAssetProperties != null ? connectedAssetProperties.equals(that.connectedAssetProperties) : that.connectedAssetProperties == null;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ConnectorBase{" +
"connectorInstanceId='" + connectorInstanceId + '\'' +
", connection=" + connection +
", connectedAssetProperties=" + connectedAssetProperties +
'}';
}
}
\ 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.ocf;
import org.apache.atlas.ocf.ffdc.*;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.ocf.properties.ConnectorType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
/**
* The ConnectorBroker is a generic factory for Open Connector Framework (OCF) Connectors.
* The OCF provides a default implementation because all of the implementation that is specific to a
* particular type of connector is delegated to the connector provider specified in the connection.
*/
public class ConnectorBroker
{
private static final Logger log = LoggerFactory.getLogger(ConnectorBroker.class);
private final int hashCode = UUID.randomUUID().hashCode();
/**
* Typical constructor
*/
public ConnectorBroker()
{
/* Nothing to do */
}
/**
* Creates a new instance of a connector using the name of the connector provider in the supplied connection.
*
* @param connection - properties for the connector and connector provider.
* @return new connector instance.
* @throws ConnectionCheckedException - an error with the connection.
* @throws ConnectorCheckedException - an error initializing the connector.
*/
public Connector getConnector(Connection connection) throws ConnectionCheckedException, ConnectorCheckedException
{
ConnectorProvider connectorProvider = null;
Connector connectorInstance = null;
if (log.isDebugEnabled())
{
log.debug("==> ConnectorBroker.getConnector()");
}
if (connection == null)
{
/*
* It is not possible to create a connector without a connection.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTION;
String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* Within the connection is a structure called the connector type. This defines the factory for a new
* connector instance. This factory is called the Connector Provider.
*/
ConnectorType requestedConnectorType = connection.getConnectorType();
if (requestedConnectorType == null)
{
/*
* It is not possible to create a connector without a connector type since it
* holds the name of the connector provider's Java class. Build an exception.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTOR_TYPE;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* The connection has a valid connector type so the next step is to extract the class name for the
* connector provider. This is the specialized factory for the connector.
*/
String connectorProviderClassName = requestedConnectorType.getConnectorProviderClassName();
if (connectorProviderClassName == null)
{
/*
* The connector provider class name is blank so it is not possible to create the
* connector provider. Throw an exception.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTOR_PROVIDER;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* Extract the class for the connector provider and then create a connector provider object.
* These actions may reveal that the class is not known to local JVM (ClassNotFound) or
* the class is there but its dependencies are not (LinkageError) or it is there and loads
* but it is not a connector provider (ClassCastException). Each of these error conditions
* results in a connection error exception that hopefully guides the consumer to correct
* the config and/or setup error.
*/
try
{
Class connectorProviderClass = Class.forName(connectorProviderClassName);
Object potentialConnectorProvider = connectorProviderClass.newInstance();
connectorProvider = (ConnectorProvider)potentialConnectorProvider;
}
catch (ClassNotFoundException classException)
{
/*
* Wrap exception in the ConnectionCheckedException with a suitable message
*/
OCFErrorCode errorCode = OCFErrorCode.UNKNOWN_CONNECTOR_PROVIDER;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorProviderClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
classException);
}
catch (LinkageError linkageError)
{
/*
* Wrap linkage error in an exception
*/
OCFErrorCode errorCode = OCFErrorCode.INCOMPLETE_CONNECTOR_PROVIDER;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorProviderClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
linkageError);
}
catch (ClassCastException castException)
{
/*
* Wrap class cast exception in a connection exception with error message to say that
*/
OCFErrorCode errorCode = OCFErrorCode.NOT_CONNECTOR_PROVIDER;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorProviderClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
castException);
}
catch (Throwable unexpectedSomething)
{
/*
* Wrap throwable in a connection exception with error message to say that there was a problem with
* the connector provider.
*/
OCFErrorCode errorCode = OCFErrorCode.INVALID_CONNECTOR_PROVIDER;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorProviderClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
unexpectedSomething);
}
/*
* At this point we hopefully have a valid connector provider so all that is left to do is call
* it to get the connector instance. This is done in a different try ... catch block from the
* instantiation of the connector provider so we can separate errors in the Connection from
* errors generated in the Connector Provider, since both classes are
* potentially code from a source outside of Apache Atlas.
*/
try
{
connectorInstance = connectorProvider.getConnector(connection);
}
catch (ConnectionCheckedException connectionError)
{
/*
* The connector provider has already provided first failure data capture in a ConnectionCheckedException.
* This exception is rethrown to the caller.
*/
throw connectionError;
}
catch (ConnectorCheckedException connectorError)
{
/*
* The connector provider has already provided first failure data capture in a ConnectorCheckedException.
* This exception is rethrown to the caller.
*/
throw connectorError;
}
catch (Throwable unexpectedSomething)
{
/*
* The connector provider threw an unexpected runtime exception or error. This is wrapped in a
* ConnectorError and thrown to caller.
*/
OCFErrorCode errorCode = OCFErrorCode.CAUGHT_EXCEPTION;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage();
throw new ConnectorCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
unexpectedSomething);
}
/*
* If the connector provider has returned a null connector with no exception then raise a generic exception
* since something has gone wrong.
*/
if (connectorInstance == null)
{
/*
* Build and throw exception.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTOR;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connection.getConnectionName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* If we reach this point the connector provider has returned a connector that can be passed to the caller.
*/
if (log.isDebugEnabled())
{
log.debug("New connector returned: " + connectorInstance.getConnectorInstanceId());
log.debug("Using Connection: " + connectorInstance.getConnection().getQualifiedName() + "(" + connectorInstance.getConnection().getDisplayName() + ")");
log.debug("<== ConnectorBroker.getConnector()");
}
return connectorInstance;
}
/**
* Provide an implementation of hashCode for all OCF Connector Broker 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
* broker object.
*/
public int hashCode()
{
return hashCode;
}
/**
* Provide a common implementation of equals for all OCF Connector Broker objects. The UUID is unique and
* is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the connector
* broker object.
*
* @param object - object to test
* @return boolean flag
*/
@Override
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (object == null || getClass() != object.getClass())
{
return false;
}
ConnectorBroker that = (ConnectorBroker) object;
return hashCode == that.hashCode;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ConnectorBroker{" +
"hashCode=" + hashCode +
'}';
}
}
\ 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.ocf;
import org.apache.atlas.ocf.ffdc.ConnectionCheckedException;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.ocf.properties.Connection;
/**
* The ConnectorProvider is a formal plug-in interface for the Open Connector Framework (OCF). It provides a factory
* class for a specific type of connector. Therefore is it typical to find the ConnectorProvider and Connector
* implementation written as a pair.
*
* The ConnectorProvider uses the properties stored in a Connection object to initialize itself and its Connector instances.
* the Connection object has the endpoint properties for the server that the connector must communicate with
* as well as optional additional properties that may be needed for a particular type of connector.
*
* It is suggested that the ConnectorProvider validates the contents of the connection and throws
* ConnectionErrorExceptions if the connection has missing or invalid properties. If there are errors detected in the
* instantiations or initialization of the connector, then these should be thrown as ConnectorErrorExceptions.
*/
public abstract class ConnectorProvider
{
/**
* Creates a new instance of a connector based on the information in the supplied connection.
*
* @param connection - connection that should have all of the properties needed by the Connector Provider
* to create a connector instance.
* @return Connector - instance of the connector.
* @throws ConnectionCheckedException - if there are missing or invalid properties in the connection
* @throws ConnectorCheckedException - if there are issues instantiating or initializing the connector
*/
public abstract Connector getConnector(Connection connection) throws ConnectionCheckedException, ConnectorCheckedException;
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.ocf;
import org.apache.atlas.ocf.properties.Connection;
import org.apache.atlas.ocf.ffdc.ConnectionCheckedException;
import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
import org.apache.atlas.ocf.ffdc.OCFErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
/**
* ConnectorProviderBase is a base class for a new connector provider. It manages all of the class loading
* for subclass implementations of the connector provider along with the generation of new connector guids.
*
* ConnectorProviderBase creates a connector instance with the class name from the private variable called
* connectorClassName. This class name is initialized to null. If the getConnector method is called when
* the connectorClassName is null, it throws ConnectorCheckedException.
* This is its default behaviour.
*
* To use the ConnectorProviderBase, create a new class that extends the ConnectorProviderBase class
* and in the constructor call super.setConnectorClassName("your connector's class name");
*/
public abstract class ConnectorProviderBase extends ConnectorProvider
{
private String connectorClassName = null;
private final int hashCode = UUID.randomUUID().hashCode();
private static final Logger log = LoggerFactory.getLogger(ConnectorProviderBase.class);
/**
* Typical constructor
*/
public ConnectorProviderBase ()
{
/*
* Nothing to do
*/
}
/**
* Each connector has a guid to make it easier to correlate log messages from the various components that
* serve it. It uses a type 4 (pseudo randomly generated) UUID.
* The UUID is generated using a cryptographically strong pseudo random number generator.
*
* @return guid for a new connector instance
*/
private String getNewConnectorGUID()
{
UUID newUUID = UUID.randomUUID();
return newUUID.toString();
}
/**
* Return the class name for the connector that the connector provider generates.
*
* @return connectorClassName - will be null initially.
*/
public String getConnectorClassName()
{
return connectorClassName;
}
/**
* Update the class name for this connector provider.
*
* @param newConnectorClassName - this must be a valid Java class name for a class that implements the
* org.apache.atlas.ocf.Connector interface.
*/
public void setConnectorClassName(String newConnectorClassName)
{
if (log.isDebugEnabled())
{
log.debug("Connector class name set: " + newConnectorClassName);
}
connectorClassName = newConnectorClassName;
}
/**
* Creates a new instance of a connector based on the information in the supplied connection.
*
* @param connection - connection that should have all of the properties needed by the Connector Provider
* to create a connector instance.
* @return Connector - instance of the connector.
* @throws ConnectionCheckedException - if there are missing or invalid properties in the connection
* @throws ConnectorCheckedException - if there are issues instantiating or initializing the connector
*/
public Connector getConnector(Connection connection) throws ConnectionCheckedException, ConnectorCheckedException
{
Connector connector = null;
String guid = null;
if (log.isDebugEnabled())
{
log.debug("getConnector called");
}
if (connection == null)
{
/*
* It is not possible to create a connector without a connection.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTION;
String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* Validate that a subclass (or external class) has set up the class name of the connector.
*/
if (connectorClassName == null)
{
/*
* This instance of the connector provider is not initialised with the connector's class name so
* throw an exception because a connector can not be generated.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CONNECTOR_CLASS;
String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
/*
* Generate a new GUID for the connector.
*/
guid = getNewConnectorGUID();
/*
* Create a new instance of the connector and initialize it with the guid and connection.
*/
try
{
Class connectorClass = Class.forName(connectorClassName);
Object potentialConnector = connectorClass.newInstance();
connector = (Connector)potentialConnector;
connector.initialize(guid, connection);
}
catch (ClassNotFoundException classException)
{
/*
* Wrap exception in the ConnectionCheckedException with a suitable message
*/
OCFErrorCode errorCode = OCFErrorCode.UNKNOWN_CONNECTOR;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
classException);
}
catch (LinkageError linkageError)
{
/*
* Wrap linkage error in an exception
*/
OCFErrorCode errorCode = OCFErrorCode.INCOMPLETE_CONNECTOR;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
linkageError);
}
catch (ClassCastException castException)
{
/*
* Wrap class cast exception in a connection exception with error message to say that
*/
OCFErrorCode errorCode = OCFErrorCode.NOT_CONNECTOR;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
castException);
}
catch (Throwable unexpectedSomething)
{
/*
* Wrap throwable in a connection exception with error message to say that there was a problem with
* the connector implementation.
*/
OCFErrorCode errorCode = OCFErrorCode.INVALID_CONNECTOR;
String connectionName = connection.getConnectionName();
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(connectorClassName, connectionName);
throw new ConnectionCheckedException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"getConnector",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
unexpectedSomething);
}
/*
* Return the initialized connector ready for use.
*/
if (log.isDebugEnabled())
{
log.debug("getConnector returns: " + connector.getConnectorInstanceId() + ", " + connection.getConnectionName());
}
return connector;
}
/**
* Provide a common implementation of hashCode for all OCF Connector Provider 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 properties
* object.
*
* @return random UUID as hashcode
*/
public int hashCode()
{
return hashCode;
}
/**
* Provide a common implementation of equals for all OCF Connector Provider objects. The UUID is unique and
* is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the connector
* provider object.
*
* @param object - object to test
* @return boolean flag
*/
@Override
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (object == null || getClass() != object.getClass())
{
return false;
}
ConnectorProviderBase that = (ConnectorProviderBase) object;
if (hashCode != that.hashCode)
{
return false;
}
return connectorClassName != null ? connectorClassName.equals(that.connectorClassName) : that.connectorClassName == null;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ConnectorProviderBase{" +
"connectorClassName='" + connectorClassName + '\'' +
", hashCode=" + hashCode +
'}';
}
}
\ 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.ocf.ffdc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ConnectionCheckedException provides a checked exception for reporting errors found in connection objects.
* Typically these errors are configuration errors that can be fixed by an administrator or power user.
* The connection object has a complex structure and the aim of this exception, in conjunction with
* OCFErrorCode, is to identify exactly what is wrong with the contents of the connection object
* and the consequences of this error.
*/
public class ConnectionCheckedException extends OCFCheckedExceptionBase
{
private static final Logger log = LoggerFactory.getLogger(ConnectionCheckedException.class);
/**
* This is the typical constructor for creating a ConnectionCheckedException. It captures the essential details
* about the error, where it occurred and how to fix it.
*
* @param httpCode code to use across a REST interface
* @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 ConnectionCheckedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription);
}
}
/**
* This constructor is used when an unexpected exception has been caught that needs to be wrapped in a
* ConnectionCheckedException in order to add the essential details about the error, where it occurred and
* how to fix it.
*
* @param httpCode code to use across a REST interface
* @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 exception/error that caused this exception to be raised
*/
public ConnectionCheckedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription + ", " + caughtError.toString());
}
}
}
\ 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.ocf.ffdc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ConnectorCheckedException provides a checked exception for reporting errors found when using OCF connectors.
* 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 OCFErrorCode can be used with
* this exception to populate it with standard messages. Otherwise messages defined uniquely for a
* ConnectorProvider/Connector implementation can be used. The aim is to be able to uniquely identify the cause
* and remedy for the error.
*/
public class ConnectorCheckedException extends OCFCheckedExceptionBase
{
private static final Logger log = LoggerFactory.getLogger(ConnectorCheckedException.class);
/**
* This is the typical constructor used for creating a ConnectorCheckedException.
*
* @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 ConnectorCheckedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription);
}
}
/**
* This is the constructor used for creating a ConnectorCheckedException in response to a previous exception.
*
* @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 ConnectorCheckedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription + ", " + caughtError.toString());
}
}
}
\ 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.ocf.ffdc;
import java.util.UUID;
/**
* OCFCheckedExceptionBase provides a checked exception for reporting errors found when using OCF connectors.
* 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 OCFErrorCode can be used with
* this exception to populate it with standard messages. Otherwise messages defined uniquely for a
* ConnectorProvider/Connector implementation can be used. The aim is to be able to uniquely identify the cause
* and remedy for the error.
*/
public class OCFCheckedExceptionBase extends Exception
{
private static final int hashCode = UUID.randomUUID().hashCode();
/*
* These default values are only seen if this exception is initialized using one of its superclass constructors.
*/
private int reportedHTTPCode = 500;
private String reportingClassName = "<Unknown>";
private String reportingActionDescription = "<Unknown>";
private String reportedErrorMessage = "<Unknown>";
private String reportedSystemAction = "<Unknown>";
private String reportedUserAction = "<Unknown>";
private Throwable reportedCaughtException = null;
/**
* This is the typical constructor used for creating an OCFCheckedException.
*
* @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 OCFCheckedExceptionBase(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 an OCFCheckedException 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 OCFCheckedExceptionBase(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; }
/**
* Provide a common implementation of hashCode for all OCF properties 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 properties
* object.
*/
public int hashCode()
{
return hashCode;
}
}
\ 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.ocf.ffdc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.MessageFormat;
import java.util.Arrays;
/**
* The OCF error code is used to define first failure data capture (FFDC) for errors that occur when working with
* OCF Connectors. It is used in conjunction with all OCF Exceptions, both Checked and Runtime (unchecked).
*
* The 5 fields in the enum are:
* <ul>
* <li>HTTP Error Code - for translating between REST and JAVA - Typically the numbers used are:</li>
* <li><ul>
* <li>500 - internal error</li>
* <li>400 - invalid parameters</li>
* <li>404 - not found</li>
* <li>409 - data conflict errors - eg item already defined</li>
* </ul></li>
* <li>Error Message Id - to uniquely identify the message</li>
* <li>Error Message Text - includes placeholder to allow additional values to be captured</li>
* <li>SystemAction - describes the result of the error</li>
* <li>UserAction - describes how a user should correct the error</li>
* </ul>
*/
public enum OCFErrorCode
{
NULL_CONNECTION(400, "OCF-CONNECTION-400-001 ",
"Null connection object passed on request for new connector instance",
"The system is unable to create the requested connector instance without the connection information that describes which type of connector is required.",
"Recode call to system to include a correctly formatted connection object and retry the request."),
UNNAMED_CONNECTION(400, "OCF-CONNECTION-400-002 ",
"Unnamed connection object passed to requested action {0}",
"The system is unable to perform the requested action without a connection name.",
"Update connection configuration to include a value for at least one of the following name properties: qualifiedName, displayName, guid. Then retry the request."),
NULL_CONNECTOR_TYPE(400, "OCF-CONNECTION-400-003 ",
"Null connectorType property passed in connection {0}",
"The system is unable to create the requested connector instance without information on the type of connection required.",
"Update the connection configuration to include a valid connectorType definition. Then retry the request."),
NULL_CONNECTOR_PROVIDER(400, "OCF-CONNECTION-400-004 ",
"Null Connector Provider passed in connection {0}",
"The system is unable to create the requested connector instance without information on the type of connection required.",
"Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
UNKNOWN_CONNECTOR_PROVIDER(400, "OCF-CONNECTION-400-005 ",
"Unknown Connector Provider class {0} passed in connection {1}",
"The system is unable to create the requested connector instance because the Connector Provider's class is not known to the JVM. This may be because the Connector Provider's jar is not installed in the local JVM or the wrong Java class name has been configured in the connection. ",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
NOT_CONNECTOR_PROVIDER(400, "OCF-CONNECTION-400-006 ",
"Class {0} passed in connection {1} is not a Connector Provider",
"The system is unable to create the requested connector instance because the Connector Provider's class does not implement org.apache.atlas.ocf.ConnectorProvider. ",
"Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
INCOMPLETE_CONNECTOR_PROVIDER(400, "OCF-CONNECTION-400-007 ",
"Unable to load Connector Provider class {0} passed in connection {1}",
"The system is unable to create the requested connector instance because the Connector Provider's class is failing to load in the JVM. This has resulted in an exception in the class loader.",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
INVALID_CONNECTOR_PROVIDER(400, "OCF-CONNECTION-400-008 ",
"Invalid Connector Provider class {0} passed in connection {1}",
"The system is unable to create the requested connector instance because the Connector Provider's class is failing to initialize in the JVM. This has resulted in an exception in the class loader.",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
NULL_ENDPOINT_IN_CONNECTION(400, "OCF-CONNECTION-400-009 ",
"Null endpoint detected in connection {0}",
"The system is unable to initialize the requested connector because the endpoint information in the connection is missing.",
"Add the endpoint information into the connection object and retry the request."),
MALFORMED_ENDPOINT(400, "OCF-CONNECTION-400-010 ",
"The endpoint attribute {0} in connection {1} is set to \"{2}\" which is invalid",
"The system is unable to initialize the requested connector because the endpoint information in the connection is not formatted correctly for this type of connection.",
"Correct the endpoint information into the connection object and retry the request."),
NULL_PROPERTY_NAME(400, "OCF-PROPERTIES-400-011 ",
"Null property name passed to entity {0} of type {1}",
"A request to set an additional property failed because the property name passed was null",
"Recode the call to the property object with a valid property name and retry."),
INVALID_PROPERTY_NAMES(400, "OCF-PROPERTIES-400-012 ",
"Non-string property names stored in entity {0} of type {1}",
"A request to retrieve additional properties failed because the properties have become corrupted.",
"Debug the calls to the properties object."),
NULL_SECURED_PROPERTY_NAME(400, "OCF-CONNECTION-400-013 ",
"Null securedProperty name passed to connection {0})",
"A request to set a secured property failed because the property name passed was null",
"Recode the call to the connection object with a valid property name and retry."),
NO_MORE_ELEMENTS(400, "OCF-PROPERTIES-400-014 ",
"No more elements in {0} iterator for entity {1} of type {2}",
"A caller stepping through an iterator has requested more elements when there are none left.",
"Recode the caller to use the hasNext() method to check for more elements before calling next() and then retry."),
NO_ITERATOR(400, "OCF-PROPERTIES-400-015 ",
"No type-specific iterator for {0} paging iterator for entity {1} of type {2}",
"A caller requesting a paging iterator has not supplied a type-specific iterator in the constructor.",
"Recode the caller to use the hasNext() method to check for more elements before calling next() and then retry."),
NULL_CLASSIFICATION_NAME(400, "OCF-PROPERTIES-400-016 ",
"No classification name for entity {0} of type {1}",
"A classification with a null name is assigned to an entity. This value should come from a metadata repository, and always be filled in.",
"Look for other error messages to identify the source of the problem. Identify the metadata repository where the asset came from. Correct the cause of the error and then retry."),
NULL_TAG_NAME(400, "OCF-PROPERTIES-400-017 ",
"No tag name for entity {0} of type {1}",
"A tag with a null name is assigned to an entity. This value should come from a metadata repository, and always be filled in.",
"Look for other error messages to identify the source of the problem. Identify the metadata repository where the asset came from. Correct the cause of the error and then retry."),
UNKNOWN_ENDPOINT(404, "OCF-CONNECTOR-404-001 ",
"Endpoint {0} in connection {1} for connector instance {2} is either unknown or unavailable",
"The requested action is not able to complete because the remote endpoint where the assets are located is not responding. It may be unavailable or unknown.",
"Verify that the endpoint information is correct and the server that supports it is operational, then retry the request."),
PROPERTIES_NOT_AVAILABLE(404, "OCF-PROPERTIES-404-002 ",
"Exception with error message \"{0}\" was returned to object {1} resulted from a request for connected asset properties",
"The requested action is not able to complete which may mean that the server is not able to return all of the properties associated with the asset.",
"Verify that the endpoint information is correct and the server that supports it is operational, then retry the request."),
CAUGHT_EXCEPTION(500, "OCF-CONNECTION-500-001 ",
"OCF method detected an unexpected exception",
"The system detected an error during connector processing.",
"The root cause of the error is captured in previous reported messages."),
CAUGHT_EXCEPTION_WITHMSG(500, "OCF-CONNECTION-500-002 ",
"OCF method {0} detected an unexpected exception, message was {1}",
"The system detected an error during connector processing.",
"The root cause of the error is captured in previous reported messages."),
NOT_IMPLEMENTED(500, "OCF-CONNECTION-500-003 ",
"OCF method {0} not yet implemented",
"The system is not able to process a request because a feature is not yet implemented.",
"Contact your support organization for help in discovering a workaround, fix or upgrade to the system."),
UNKNOWN_ERROR(500, "OCF-CONNECTION-500-004 ",
"Connection error detected",
"The system detected an error during connection processing.",
"The root cause of the error is captured in previous reported messages."),
INTERNAL_ERROR(500, "OCF-CONNECTION-500-005 ",
"Internal error in OCF method {0}",
"The system detected an error during connection processing.",
"The root cause of the error is captured in previous reported messages."),
NULL_CONNECTOR_CLASS(500, "OCF-CONNECTOR-500-006 ",
"The class name for the connector is not set up",
"The system is unable to create the requested connector instance without the name of the Java class for the connector.",
"Update the implementation of the connector provider to ensure the connector's java class is intitialized correctly"),
UNKNOWN_CONNECTOR(500,"OCF-CONNECTOR-500-007 ",
"Unknown Connector Java class {0}",
"The system is unable to create the requested connector instance because the Connector's class is not known to the JVM. This may be because the Connector Provider's jar is not installed in the local JVM or the wrong Java class name has been configured in the connection. ",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
NOT_CONNECTOR(500,"OCF-CONNECTOR-500-008 ",
"Java class {0} is not a Connector",
"The system is unable to create the requested connector instance because the Connector's class does not implement org.apache.atlas.ocf.Connector. ",
"Update the connection configuration to include a valid Java class name for the connector provider in the connectorProviderClassName property of the connection's connectorType. Then retry the request."),
INCOMPLETE_CONNECTOR(500,"OCF-CONNECTOR-500-009 ",
"Unable to load Connector Java class {0}",
"The system is unable to create the requested connector instance because the Connector's class is failing to load in the JVM. This has resulted in an exception in the class loader.",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Then retry the request."),
INVALID_CONNECTOR(500, "OCF-CONNECTION-500-010 ",
"Invalid Connector class {0}",
"The system is unable to create the requested connector instance because the Connector's class is failing to initialize in the JVM. This has resulted in an exception in the class loader.",
"Verify that the Connector Provider and Connector jar files are properly configured in the process. Then retry the request."),
NULL_CONNECTOR(500, "OCF-CONNECTION-500-011 ",
"Connector Provider {0} returned a null connector instance for connection {1}",
"The system detected an error during connector processing and was unable to create a connector.",
"The root cause of the error is captured in previous reported messages.");
private int httpErrorCode;
private String errorMessageId;
private String errorMessage;
private String systemAction;
private String userAction;
private static final Logger log = LoggerFactory.getLogger(OCFErrorCode.class);
/**
* The constructor for OCFErrorCode expects to be passed one of the enumeration rows defined in
* OCFErrorCode above. For example:
*
* OCFErrorCode errorCode = OCFErrorCode.UNKNOWN_ENDPOINT;
*
* This will expand out to the 5 parameters shown below.
*
* @param httpErrorCode - error code to use over REST calls
* @param errorMessageId - unique Id for the message
* @param errorMessage - text for the message
* @param systemAction - description of the action taken by the system when the error condition happened
* @param userAction - instructions for resolving the error
*/
OCFErrorCode(int httpErrorCode, String errorMessageId, String errorMessage, String systemAction, String userAction)
{
this.httpErrorCode = httpErrorCode;
this.errorMessageId = errorMessageId;
this.errorMessage = errorMessage;
this.systemAction = systemAction;
this.userAction = userAction;
}
public int getHTTPErrorCode()
{
return httpErrorCode;
}
/**
* Returns the unique identifier for the error message.
*
* @return errorMessageId
*/
public String getErrorMessageId()
{
return errorMessageId;
}
/**
* Returns the error message with placeholders for specific details.
*
* @return errorMessage (unformatted)
*/
public String getUnformattedErrorMessage()
{
return errorMessage;
}
/**
* Returns the error message with the placeholders filled out with the supplied parameters.
*
* @param params - strings that plug into the placeholders in the errorMessage
* @return errorMessage (formatted with supplied parameters)
*/
public String getFormattedErrorMessage(String... params)
{
MessageFormat mf = new MessageFormat(errorMessage);
String result = mf.format(params);
if (log.isDebugEnabled())
{
log.debug(String.format("OCFErrorCode.getMessage(%s): %s", Arrays.toString(params), result));
}
return result;
}
/**
* Returns a description of the action taken by the system when the condition that caused this exception was
* detected.
*
* @return systemAction
*/
public String getSystemAction()
{
return systemAction;
}
/**
* Returns instructions of how to resolve the issue reported in this exception.
*
* @return userAction
*/
public String getUserAction()
{
return userAction;
}
}
\ 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.ocf.ffdc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
/**
* OCFRuntimeException is used for all runtime exceptions generated by the OCF. The OCFErrorCode provides
* first failure data capture information for this exception, although this information can also be provided
* using custom values.
*/
public class OCFRuntimeException extends RuntimeException
{
private static final int hashCode = UUID.randomUUID().hashCode();
/*
* These default values are only seen if this exception is initialized using one of its superclass constructors.
*/
private int reportedHTTPCode = 500;
private String reportingClassName = "<Unknown>";
private String reportingActionDescription = "<Unknown>";
private String reportedErrorMessage = "<Unknown>";
private String reportedSystemAction = "<Unknown>";
private String reportedUserAction = "<Unknown>";
private Throwable reportedCaughtException = null;
private static final Logger log = LoggerFactory.getLogger(OCFRuntimeException.class);
/**
* This is the typical constructor used for creating an OCFRuntimeException.
*
* @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 OCFRuntimeException(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;
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription);
}
}
/**
* This is the constructor used for creating a OCFRuntimeException that results from a previous error/exception
* being thrown.
*
* @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 OCFRuntimeException(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;
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription + ", " + caughtError.toString());
}
}
/**
* 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; }
/**
* Provide a common implementation of hashCode for all OCF properties 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 properties
* object.
*/
public int hashCode()
{
return hashCode;
}
}
\ 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.ocf.ffdc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* PropertyServerException provides a checked exception for reporting errors when connecting to a
* metadata repository to retrieve properties about the connected asset.
* It may be a configuration error or temporary outage. The parameters captured by the constructors
* pinpoint the type an cause of the error.
*/
public class PropertyServerException extends OCFCheckedExceptionBase
{
private static final Logger log = LoggerFactory.getLogger(PropertyServerException.class);
/**
* This is the typical constructor for creating a PropertyServerException. It captures the essential details
* about the error, where it occurred and how to fix it.
*
* @param httpCode - code to use on a REST interface
* @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 PropertyServerException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription);
}
}
/**
* This constructor is used when an unexpected exception has been caught that needs to be wrapped in a
* PropertyServerException in order to add the essential details about the error, where it occurred and
* how to fix it.
*
* @param httpCode -- code to use on a REST interface
* @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 exception/error that caused this exception to be raised
*/
public PropertyServerException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError)
{
super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError);
if (log.isDebugEnabled())
{
log.debug(httpCode + ", " + className + ", " + actionDescription + ", " + caughtError.toString());
}
}
}
\ 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
~
~ 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.
-->
# Open Connector Framework (OCF) FFDC
Package org.apache.atlas.ocf.ffdc provides the first failure data capture
(FFDC) support for the OCF module. This includes an error code enum,
a runtime exception, a base class for checked exceptions plus
implementation of each specific checked exception.
The error code enum (OCFErrorCode) has an entry for each unique situation
where an exception is returned. Each entry defines:
* A unique id for the error
* An HTTP error code for rest calls
* A unique message Id
* Message text with place holders for specific values
* A description of the cause of the error and system action as a result.
* A description of how to correct the error (if known)
Each exception (whether a checked or runtime exception) has two constructors.
* The first constructor is used when a new error has been detected.
* The second constructor is used when another exception has been caught.
This caught exception is passed on the constructor so it is effectively
embedded in the OCF exception.
Both constructors take the values from the OCFErrorCode
enum to define the cause and resolution. These values are passed
as individual parameters so that subclasses implemented outside of
the OCF packages can define their own FFDC values.
\ 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.ocf.properties;
import java.util.*;
/**
* The AdditionalProperties class provides support for arbitrary properties to be added to a properties object.
* It wraps a java.util.Map map object built around HashMap.
*/
public class AdditionalProperties extends AssetPropertyBase
{
private Map<String,Object> additionalProperties = new HashMap<>();
/**
* Constructor for a new set of additional properties that are not connected either directly or indirectly to an asset.
*
* @param additionalProperties - map of properties for the metadata element.
*/
public AdditionalProperties(Map<String,Object> additionalProperties)
{
this(null, additionalProperties);
}
/**
* Constructor for a new set of additional properties that are connected either directly or indirectly to an asset.
*
* @param parentAsset - description of the asset that these additional properties are attached to.
* @param additionalProperties - map of properties for the metadata element.
*/
public AdditionalProperties(AssetDescriptor parentAsset,
Map<String,Object> additionalProperties)
{
super(parentAsset);
if (additionalProperties != null)
{
this.additionalProperties = new HashMap<>(additionalProperties);
}
}
/**
* 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.
* @param templateProperties - template object to copy.
*/
public AdditionalProperties(AssetDescriptor parentAsset, AdditionalProperties templateProperties)
{
super(parentAsset, templateProperties);
/*
* An empty properties object is created in the private variable declaration so nothing to do.
*/
if (templateProperties != null)
{
/*
* Process templateProperties if they are not null
*/
Iterator<String> propertyNames = templateProperties.getPropertyNames();
if (propertyNames != null)
{
while (propertyNames.hasNext())
{
String newPropertyName = propertyNames.next();
Object newPropertyValue = templateProperties.getProperty(newPropertyName);
additionalProperties.put(newPropertyName, newPropertyValue);
}
}
}
}
/**
* Returns a list of the additional stored properties for the element.
* If no stored properties are present then null is returned.
*
* @return list of additional properties
*/
public Iterator<String> getPropertyNames()
{
return additionalProperties.keySet().iterator();
}
/**
* Returns the requested additional stored property for the element.
* If no stored property with that name is present then null is returned.
*
* @param name - String name of the property to return.
* @return requested property value.
*/
public Object getProperty(String name)
{
return additionalProperties.get(name);
}
/**
* Test whether the supplied object is equal to this object.
*
* @param testObject - object to test
* @return boolean indicating if the supplied object represents the same content as this object.
*/
@Override
public boolean equals(Object testObject)
{
if (this == testObject)
{
return true;
}
if (testObject == null || getClass() != testObject.getClass())
{
return false;
}
AdditionalProperties that = (AdditionalProperties) testObject;
return additionalProperties != null ? additionalProperties.equals(that.additionalProperties) : that.additionalProperties == null;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AdditionalProperties{" +
"additionalProperties=" + additionalProperties +
'}';
}
}
\ 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.ocf.properties;
import java.util.Date;
/**
* An annotation describes the results of an analysis undertaken by an Open Discovery Framework (ODF) discovery service.
* It describes when the analysis happened, the type of analysis and the results.
*/
public class Annotation extends ElementHeader
{
/*
* Details from the AnnotationReport entity
*/
private String reportName = null;
private String reportDescription = null;
private Date creationDate = null;
private AdditionalProperties analysisParameters = null;
/*
* Details from the Annotation entity itself
*/
private String annotationType = null;
private String summary = null;
private int confidenceLevel = 0;
private String expression = null;
private String explanation = null;
private String analysisStep = null;
private String jsonProperties = null;
private AnnotationStatus annotationStatus = null;
/*
* Details from the latest AnnotationReview entity.
*/
private Date reviewDate = null;
private String steward = null;
private String reviewComment = null;
/*
* Additional properties added directly to the Annotation entity and supported by
* the sub-types of Annotation.
*/
private AdditionalProperties additionalProperties = null;
/**
* Typical Constructor
*
* @param parentAsset - description of the asset that this annotation is attached to.
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - List of classifications
* @param reportName - report name string
* @param reportDescription - String for the report description
* @param creationDate - Date that annotation was created.
* @param analysisParameters - Properties that hold the parameters used to drive the discovery service's analysis.
* @param annotationType - String for annotation type
* @param summary - String for summary
* @param confidenceLevel - int for confidence level
* @param expression - String for the expression that represent the relationship between the annotation and the asset.
* @param explanation - String for the explanation for the annotation
* @param analysisStep - String describing the analysis step that the discovery service was in when it created the annotation.
* @param jsonProperties String - JSON properties associated with the annotation
* @param annotationStatus - AnnotationStatus enum
* @param reviewDate - date that this annotation was reviewed. If no review has taken place then this property is null.
* @param steward String name of steward that reviewed the annotation.
* @param reviewComment - string comment made by the steward as part of the review of the annotation. The comment covers the
* whole review which may have looked at multiple annotations so the comment may not necessarily refer only to this annotation.
* @param additionalProperties - additional properties object for annotation. These are a combination of the additional
* properties from the Annotation entity and any properties introduced by the subtypes of annotation.
* The naming convention for subtype property names is entityName.attributeName.value. If the property
* is a map then the map contents are named entityName.attributeName.propertyName.propertyValue.
*/
public Annotation(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String reportName,
String reportDescription,
Date creationDate,
AdditionalProperties analysisParameters,
String annotationType,
String summary,
int confidenceLevel,
String expression,
String explanation,
String analysisStep,
String jsonProperties,
AnnotationStatus annotationStatus,
Date reviewDate,
String steward,
String reviewComment,
AdditionalProperties additionalProperties)
{
super(parentAsset, type, guid, url, classifications);
this.reportName = reportName;
this.reportDescription = reportDescription;
this.creationDate = creationDate;
this.analysisParameters = analysisParameters;
this.annotationType = annotationType;
this.summary = summary;
this.confidenceLevel = confidenceLevel;
this.expression = expression;
this.explanation = explanation;
this.analysisStep = analysisStep;
this.jsonProperties = jsonProperties;
this.annotationStatus = annotationStatus;
this.reviewDate = reviewDate;
this.steward = steward;
this.reviewComment = reviewComment;
this.additionalProperties = additionalProperties;
}
/**
* Copy/clone Constructor
*
* @param parentAsset - description of the asset that this annotation is attached to.
* @param templateAnnotation - template object to copy.
*/
public Annotation(AssetDescriptor parentAsset, Annotation templateAnnotation)
{
/*
* Remember the parent
*/
super(parentAsset, templateAnnotation);
if (templateAnnotation != null)
{
/*
* Copy the properties from the template into this annotation.
*/
this.reportName = templateAnnotation.getReportName();
this.reportDescription = templateAnnotation.getReportDescription();
this.creationDate = templateAnnotation.getCreationDate();
this.analysisParameters = templateAnnotation.getAnalysisParameters();
this.annotationType = templateAnnotation.getAnnotationType();
this.summary = templateAnnotation.getSummary();
this.confidenceLevel = templateAnnotation.getConfidenceLevel();
this.expression = templateAnnotation.getExpression();
this.explanation = templateAnnotation.getExplanation();
this.analysisStep = templateAnnotation.getAnalysisStep();
this.jsonProperties = templateAnnotation.getJsonProperties();
this.annotationStatus = templateAnnotation.getAnnotationStatus();
this.reviewDate = templateAnnotation.getReviewDate();
this.steward = templateAnnotation.getSteward();
this.reviewComment = templateAnnotation.getReviewComment();
this.additionalProperties = new AdditionalProperties(parentAsset, templateAnnotation.getAdditionalProperties());
}
}
/**
* Return the name of the discovery analysis report that created this annotation.
*
* @return String - report name
*/
public String getReportName()
{
return reportName;
}
/**
* Return the discovery analysis report description that this annotation is a part of.
*
* @return String - report description
*/
public String getReportDescription()
{
return reportDescription;
}
/**
* Return the creation date for the annotation. If this date is not known then null is returned.
*
* @return Date that the annotation was created.
*/
public Date getCreationDate() {
return creationDate;
}
/**
* Return the properties that hold the parameters used to drive the discovery service's analysis.
*
* @return AdditionalProperties - object storing the analysis parameters
*/
public AdditionalProperties getAnalysisParameters()
{
return analysisParameters;
}
/**
* Return the informal name for the type of annotation.
*
* @return String - annotation type
*/
public String getAnnotationType()
{
return annotationType;
}
/**
* Return the summary description for the annotation.
*
* @return String - summary of annotation
*/
public String getSummary()
{
return summary;
}
/**
* Return the confidence level of the discovery service that the annotation is correct.
*
* @return int - confidence level
*/
public int getConfidenceLevel()
{
return confidenceLevel;
}
/**
* Return the expression that represent the relationship between the annotation and the asset.
*
* @return String - expression
*/
public String getExpression()
{
return expression;
}
/**
* Return the explanation for the annotation.
*
* @return String - explanation
*/
public String getExplanation() {
return explanation;
}
/**
* Return a description of the analysis step that the discovery service was in when it created the annotation.
*
* @return String - analysis step
*/
public String getAnalysisStep()
{
return analysisStep;
}
/**
* Return the JSON properties associated with the annotation.
*
* @return String - JSON properties of annotation
*/
public String getJsonProperties()
{
return jsonProperties;
}
/**
* Return the current status of the annotation.
*
* @return AnnotationStatus - current status of annotation
*/
public AnnotationStatus getAnnotationStatus()
{
return annotationStatus;
}
/**
* Return the date that this annotation was reviewed. If no review has taken place then this property is null.
*
* @return Date - review date
*/
public Date getReviewDate()
{
return reviewDate;
}
/**
* Return the name of the steward that reviewed the annotation.
*
* @return String - steward's name.
*/
public String getSteward()
{
return steward;
}
/**
* Return any comments made by the steward during the review.
*
* @return String - review comment
*/
public String getReviewComment()
{
return reviewComment;
}
/**
* Return the additional properties for the Annotation.
*
* @return AdditionalProperties - additional properties object
*/
public AdditionalProperties getAdditionalProperties()
{
return additionalProperties;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Annotation{" +
"reportName='" + reportName + '\'' +
", reportDescription='" + reportDescription + '\'' +
", creationDate=" + creationDate +
", analysisParameters=" + analysisParameters +
", annotationType='" + annotationType + '\'' +
", summary='" + summary + '\'' +
", confidenceLevel=" + confidenceLevel +
", expression='" + expression + '\'' +
", explanation='" + explanation + '\'' +
", analysisStep='" + analysisStep + '\'' +
", jsonProperties='" + jsonProperties + '\'' +
", annotationStatus=" + annotationStatus +
", reviewDate=" + reviewDate +
", steward='" + steward + '\'' +
", reviewComment='" + reviewComment + '\'' +
", additionalProperties=" + additionalProperties +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* An AnnotationStatus defines the current status for an annotation plus some default descriptive text.
*/
public enum AnnotationStatus implements Serializable
{
NEW_ANNOTATION (0, "New", "Annotation has been created but not reviewed"),
REVIEWED_ANNOTATION (1, "Reviewed", "Annotation has been reviewed by no decision has been made"),
APPROVED_ANNOTATION (2, "Approved", "Annotation has been approved"),
ACTIONED_ANNOTATION (3, "Actioned", "Annotation has been approved and insight has been added to Asset's metadata"),
INVALID_ANNOTATION (4, "Invalid", "Annotation has been reviewed and declared invalid"),
IGNORE_ANNOTATION (5, "Ignore", "Annotation is invalid and should be ignored"),
OTHER_STATUS (98, "Other", "Annotation's status stored in additional properties"),
UNKNOWN_STATUS (99, "Unknown", "Annotation has not had a status assigned");
private static final long serialVersionUID = 1L;
private int statusCode;
private String statusName;
private String statusDescription;
/**
* Typical Constructor
*/
AnnotationStatus(int statusCode, String statusName, String statusDescription)
{
/*
* Save the values supplied
*/
this.statusCode = statusCode;
this.statusName = statusName;
this.statusDescription = statusDescription;
}
/**
* Return the status code for this enum instance
*
* @return int - status code
*/
public int getStatusCode()
{
return statusCode;
}
/**
* Return the default name for the status for this enum instance.
*
* @return String - default status name
*/
public String getStatusName()
{
return statusName;
}
/**
* REturn the default description for the status for this enum instance.
*
* @return String - default status description
*/
public String getStatusDescription()
{
return statusDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AnnotationStatus{" +
"statusCode=" + statusCode +
", statusName='" + statusName + '\'' +
", statusDescription='" + statusDescription + '\'' +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
import java.util.Iterator;
/**
* Annotations supports an iterator over a list of annotations. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Annotations extends AssetPropertyIteratorBase implements Iterator<Annotation>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Annotations(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Annotations(AssetDescriptor parentAsset, Annotations template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Annotation(parentAsset, (Annotation)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Annotations cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Annotation - next element object that has been cloned.
*/
@Override
public Annotation next()
{
return (Annotation)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Annotations{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* This is the base class for a connected asset. It is passed to all of the embedded property objects so the name
* and type can be used for error messages and other diagnostics. It also carries the URL of the asset in the
* metadata repository where this is known to enable properties to be retrieved on request.
*/
public abstract class AssetDescriptor extends PropertyBase
{
/*
* Derived name and type for use by nested property object for messages/debug. If these default values
* are seen it is a sign that the asset properties are not being populated from the metadata repository.
*/
private String assetName = "<Unknown>";
private String assetTypeName = "<Unknown>";
/*
* URL where the metadata about the asset is located. It remains null if no repository is known.
*/
private String url = null;
/*
* Unique id for the asset.
*/
private String guid = null;
/**
* Typical constructor - the asset descriptor is effectively empty - and the protected
* set methods need to be called to add useful content to it.
*/
public AssetDescriptor()
{
/*
* Nothing to do except call superclass
*/
super();
}
/**
* Explicit constructor - the asset descriptor is explicitly given the url for the asset.
*
* @param guid - unique id for the asset
* @param url - URL for the asset in the metadata repository
*/
public AssetDescriptor(String guid, String url)
{
super();
this.guid = guid;
this.url = url;
}
/**
* Copy/clone Constructor - used to copy the asset descriptor for a new consumer.
*
* @param templateAssetDescriptor - template asset descriptor to copy.
*/
public AssetDescriptor(AssetDescriptor templateAssetDescriptor)
{
super();
this.guid = templateAssetDescriptor.getGUID();
this.assetName = templateAssetDescriptor.getAssetName();
this.assetTypeName = templateAssetDescriptor.getAssetTypeName();
this.url = templateAssetDescriptor.getURL();
}
/**
* Method to enable a subclass to set up the asset name.
*
* @param assetName - String - name of asset for messages etc
*/
protected void setAssetName(String assetName)
{
this.assetName = assetName;
}
/**
* Method to enable a subclass to set up the asset type name.
*
* @param assetTypeName - String - new type name
*/
protected void setAssetTypeName(String assetTypeName)
{
this.assetTypeName = assetTypeName;
}
/**
* Return the unique id for this element.
*
* @return guid - unique id
*/
public String getGUID() {
return guid;
}
/**
* Return the name of the asset - for use in messages and other diagnostics.
*
* @return String - asset name
*/
public String getAssetName()
{
return assetName;
}
/**
* Return the name of the asset's type - for use in messages and other diagnostics.
*
* @return String - asset type name
*/
public String getAssetTypeName()
{
return assetTypeName;
}
/**
* Return the URL of the asset in the metadata repository if supported.
*
* @return String - URL
*/
public String getURL() { return url; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AssetDescriptor{" +
"assetName='" + assetName + '\'' +
", assetTypeName='" + assetTypeName + '\'' +
", url='" + url + '\'' +
", guid='" + guid + '\'' +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* AssetDetail extends AssetSummary to provide all of the properties related to this asset. It includes:
* <ul>
* <li>AssetProperties - properties unique to the particular type of asset including any vendor-specific facets.</li>
* <li>ExternalIdentifiers - list of identifiers for this asset that are used in other systems.</li>
* <li>RelatedMediaReferences - list of links to external media (images, audio, video) about this asset.</li>
* <li>NoteLogs - list of NoteLogs for this asset, often providing more detail on how to use the asset and
* its current status.</li>
* <li>ExternalReferences - list of links to additional information about this asset.</li>
* <li>Connections - list of connections defined to access this asset.</li>
* <li>Licenses - list of licenses associated with the asset.</li>
* <li>Certifications - list of certifications that have been awarded to this asset.</li>
* </ul>
*/
public class AssetDetail extends AssetSummary
{
private AdditionalProperties assetProperties = null;
private ExternalIdentifiers externalIdentifiers = null;
private RelatedMediaReferences relatedMediaReferences = null;
private NoteLogs noteLogs = null;
private ExternalReferences externalReferences = null;
private Connections connections = null;
private Licenses licenses = null;
private Certifications certifications = null;
/**
* Typical constructor - initialize superclasses
*
* @param type - details of the metadata type for this asset
* @param guid - guid property
* @param url - element URL used to access its properties in the metadata repository.
* @param qualifiedName - unique name
* @param displayName - consumable name
* @param description - description of the asset
* @param shortDescription - short description from relationship with Connection
* @param owner - owner name
* @param classifications - enumeration of classifications
* @param assetProperties - AdditionalProperties object
* @param externalIdentifiers - ExternalIdentifiers enumeration
* @param relatedMediaReferences - RelatedMediaReferences enumeration
* @param noteLogs - NoteLogs iterator
* @param externalReferences - ExternalReferences iterator
* @param connections - List of connections attached to the asset
* @param licenses - List of licenses
* @param certifications - Certifications - list of certifications
*/
public AssetDetail(ElementType type,
String guid,
String url,
String qualifiedName,
String displayName,
String shortDescription,
String description,
String owner,
Classifications classifications,
AdditionalProperties assetProperties,
ExternalIdentifiers externalIdentifiers,
RelatedMediaReferences relatedMediaReferences,
NoteLogs noteLogs,
ExternalReferences externalReferences,
Connections connections,
Licenses licenses,
Certifications certifications)
{
super(type,
guid,
url,
qualifiedName,
displayName,
shortDescription,
description,
owner,
classifications);
this.assetProperties = assetProperties;
this.externalIdentifiers = externalIdentifiers;
this.relatedMediaReferences = relatedMediaReferences;
this.noteLogs = noteLogs;
this.externalReferences = externalReferences;
this.connections = connections;
this.licenses = licenses;
this.certifications = certifications;
}
/**
* Copy/clone constructor. Note, this is a deep copy
*
* @param templateAssetDetail - template to copy
*/
public AssetDetail(AssetDetail templateAssetDetail)
{
/*
* Initialize superclass
*/
super(templateAssetDetail);
/*
* Copy details from template, ensuring the parentAsset is this object, not the template's.
*/
if (templateAssetDetail != null)
{
AdditionalProperties templateAssetProperties = templateAssetDetail.getAssetProperties();
ExternalIdentifiers templateExternalIdentifiers = templateAssetDetail.getExternalIdentifiers();
RelatedMediaReferences templateRelatedMediaReferences = templateAssetDetail.getRelatedMediaReferences();
NoteLogs templateNoteLogs = templateAssetDetail.getNoteLogs();
ExternalReferences templateExternalReferences = templateAssetDetail.getExternalReferences();
Connections templateConnections = templateAssetDetail.getConnections();
Licenses templateLicenses = templateAssetDetail.getLicenses();
Certifications templateCertifications = templateAssetDetail.getCertifications();
if (templateAssetProperties != null)
{
assetProperties = new AdditionalProperties(this, templateAssetProperties);
}
if (templateExternalIdentifiers != null)
{
externalIdentifiers = templateExternalIdentifiers.cloneIterator(this);
}
if (templateRelatedMediaReferences != null)
{
relatedMediaReferences = templateRelatedMediaReferences.cloneIterator(this);
}
if (templateNoteLogs != null)
{
noteLogs = templateNoteLogs.cloneIterator(this);
}
if (templateExternalReferences != null)
{
externalReferences = templateExternalReferences.cloneIterator(this);
}
if (templateConnections != null)
{
connections = templateConnections.cloneIterator(this);
}
if (templateLicenses != null)
{
licenses = templateLicenses.cloneIterator(this);
}
if (templateCertifications != null)
{
certifications = templateCertifications.cloneIterator(this);
}
}
}
/**
* Return the set of properties that are specific to the particular type of asset. The caller is given their
* own copy of the property object. The properties are named entityName.attributeName. The values are all strings.
*
* @return AdditionalProperties - asset properties using the name of attributes from the model.
*/
public AdditionalProperties getAssetProperties()
{
if (assetProperties == null)
{
return assetProperties;
}
else
{
return new AdditionalProperties(this, assetProperties);
}
}
/**
* Return an enumeration of the external identifiers for this asset (or null if none).
*
* @return ExternalIdentifiers enumeration
*/
public ExternalIdentifiers getExternalIdentifiers()
{
if (externalIdentifiers == null)
{
return externalIdentifiers;
}
else
{
return externalIdentifiers.cloneIterator(this);
}
}
/**
* Return an enumeration of references to the related media associated with this asset.
*
* @return RelatedMediaReferences enumeration
*/
public RelatedMediaReferences getRelatedMediaReferences()
{
if (relatedMediaReferences == null)
{
return relatedMediaReferences;
}
else
{
return relatedMediaReferences.cloneIterator(this);
}
}
/**
* Return an enumeration of NoteLogs linked to this asset.
*
* @return Notelogs iterator
*/
public NoteLogs getNoteLogs()
{
if (noteLogs == null)
{
return noteLogs;
}
else
{
return noteLogs.cloneIterator(this);
}
}
/**
* Return the enumeration of external references associated with this asset.
*
* @return ExternalReferences iterator
*/
public ExternalReferences getExternalReferences()
{
if (externalReferences == null)
{
return externalReferences;
}
else
{
return externalReferences.cloneIterator(this);
}
}
/**
* Return an enumeration of the connections defined for this asset.
*
* @return Connections enumeration
*/
public Connections getConnections()
{
if (connections == null)
{
return connections;
}
else
{
return connections.cloneIterator(this);
}
}
/**
* Return the list of licenses associated with the asset.
*
* @return Licenses
*/
public Licenses getLicenses()
{
if (licenses == null)
{
return licenses;
}
else
{
return licenses.cloneIterator(this);
}
}
/**
* Return the list of certifications awarded to the asset.
*
* @return Certifications - list of certifications
*/
public Certifications getCertifications()
{
if (certifications == null)
{
return certifications;
}
else
{
return certifications.cloneIterator(this);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AssetDetail{" +
"assetProperties=" + assetProperties +
", externalIdentifiers=" + externalIdentifiers +
", relatedMediaReferences=" + relatedMediaReferences +
", noteLogs=" + noteLogs +
", externalReferences=" + externalReferences +
", connections=" + connections +
", licenses=" + licenses +
", certifications=" + certifications +
'}';
}
}
/*
* 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;
/**
* The AssetPropertyBase class is a base class for all properties that link off of the connected asset.
* It manages the information about the parent asset.
*/
public abstract class AssetPropertyBase extends PropertyBase
{
private AssetDescriptor parentAsset = null;
/**
* Typical constructor that sets the link to the connected asset to null
*
* @param parentAsset - descriptor of asset that his property relates to.
*/
protected AssetPropertyBase(AssetDescriptor parentAsset)
{
/*
* Initialize superclass and save the parent asset.
*/
super();
this.parentAsset = parentAsset;
}
/**
* Copy/clone constructor - sets up details of the parent asset from the template
*
* @param parentAsset - descriptor of asset that his property relates to.
* @param template - AssetPropertyBase to copy
*/
protected AssetPropertyBase(AssetDescriptor parentAsset, AssetPropertyBase template)
{
/*
* Initialize superclass and save the parentAsset
*/
super(template);
this.parentAsset = parentAsset;
}
/**
* Return the asset descriptor of the parent asset.
*
* @return AssetDescriptor
*/
protected AssetDescriptor getParentAsset() { return parentAsset; }
/**
* Return the name of the connected asset that this property is connected to.
*
* @return String name of the connected asset
*/
protected String getParentAssetName()
{
String parentAssetName = "<Unknown>";
if (parentAsset != null)
{
parentAssetName = parentAsset.getAssetName();
}
return parentAssetName;
}
/**
* Return the type of the connected asset that this property relates to.
*
* @return String name of the connected asset's type.
*/
protected String getParentAssetTypeName()
{
String parentAssetTypeName = "<Unknown>";
if (parentAsset != null)
{
parentAssetTypeName = parentAsset.getAssetTypeName();
}
return parentAssetTypeName;
}
/**
* An equals() method for subclasses to check they are connected to the same parent asset.
*
* @param testObject - object to test
* @return boolean indicating whether this object is connected to equivalent parent assets.
*/
@Override
public boolean equals(Object testObject)
{
if (this == testObject)
{
return true;
}
if (testObject == null || getClass() != testObject.getClass())
{
return false;
}
AssetPropertyBase that = (AssetPropertyBase) testObject;
return parentAsset != null ? parentAsset.equals(that.parentAsset) : that.parentAsset == null;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AssetPropertyBase{" +
"parentAsset=" + parentAsset +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
import java.util.ArrayList;
public abstract class AssetPropertyIteratorBase extends AssetPropertyBase
{
protected PagingIterator pagingIterator = null;
/**
* Typical Constructor creates an iterator with the supplied list of comments.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
protected AssetPropertyIteratorBase(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
/*
* Initialize superclass.
*/
super(parentAsset);
pagingIterator = new PagingIterator(parentAsset, this, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor - sets up details of the parent asset from the template
*
* @param parentAsset - descriptor of asset that his property relates to.
* @param template - AssetPropertyBaseImpl to copy
*/
protected AssetPropertyIteratorBase(AssetDescriptor parentAsset, AssetPropertyIteratorBase template)
{
/*
* Initialize superclass.
*/
super(parentAsset, template);
if (template != null)
{
pagingIterator = new PagingIterator(parentAsset, this, template.pagingIterator);
}
}
/**
* Return the number of elements in the list.
*
* @return elementCount
*/
public int getElementCount()
{
if (pagingIterator == null)
{
return 0;
}
else
{
return pagingIterator.getElementCount();
}
}
/**
* Method implemented by a subclass that ensures the cloning process is a deep clone.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected abstract AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template);
/**
* Method implemented by subclass to retrieve the next cached list of elements.
*
* @param cacheStartPointer - where to start the cache.
* @param maximumSize - maximum number of elements in the cache.
* @return list of elements corresponding to the supplied cache pointers.
* @throws PropertyServerException - there is a problem retrieving elements from the property (metadata) server.
*/
protected abstract ArrayList<AssetPropertyBase> getCachedList(int cacheStartPointer,
int maximumSize) throws PropertyServerException;
}
/**
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* AssetSummary holds asset properties that are used for displaying details of
* an asset in summary lists or hover text. It includes the following properties:
* <ul>
* <li>type - metadata type information for the asset properties</li>
* <li>guid - globally unique identifier for the asset</li>
* <li>url - external link for the asset</li>
* <li>qualifiedName - The official (unique) name for the asset. This is often defined by the IT systems
* management organization and should be used (when available) on audit logs and error messages.
* (qualifiedName from Referenceable - model 0010)</li>
* <li>displayName - A consumable name for the endpoint. Often a shortened form of the assetQualifiedName
* for use on user interfaces and messages. The assetDisplayName should be only be used for audit logs and error
* messages if the assetQualifiedName is not set. (Sourced from attribute name within Asset - model 0010)</li>
* <li>shortDescription - short description about the asset.
* (Sourced from assetSummary within ConnectionsToAsset - model 0205)</li>
* <li>description - full description of the asset.
* (Sourced from attribute description within Asset - model 0010)</li>
* <li>owner - name of the person or organization that owns the asset.
* (Sourced from attribute owner within Asset - model 0010)</li>
* <li>classifications - list of classifications assigned to the asset</li>
* </ul>
*/
public class AssetSummary extends AssetDescriptor
{
private ElementType type = null;
private String qualifiedName = null;
private String displayName = null;
private String shortDescription = null;
private String description = null;
private String owner = null;
private Classifications classifications = null;
/**
* Typical constructor with parameters to fill properties.
*
* @param type - details of the metadata type for this asset
* @param guid - guid property
* @param url - element URL used to access its properties in the metadata repository.
* @param qualifiedName - unique name
* @param displayName - consumable name
* @param description - description of the asset
* @param shortDescription - short description from relationship with Connection
* @param owner - owner name
* @param classifications - enumeration of classifications
*/
public AssetSummary(ElementType type,
String guid,
String url,
String qualifiedName,
String displayName,
String shortDescription,
String description,
String owner,
Classifications classifications)
{
super(guid, url);
this.type = type;
if (type != null)
{
super.setAssetTypeName(type.getElementTypeName());
}
this.qualifiedName = qualifiedName;
this.displayName = displayName;
/*
* Use the qualified name as the asset name if it is not null or the empty string.
* Otherwise use display name (unless it is null or the empty string).
*/
if ((qualifiedName == null) || (qualifiedName.equals("")))
{
if ((displayName != null) && (!displayName.equals("")))
{
/*
* Good display name
*/
super.setAssetName(displayName);
}
}
else /* good qualified name */
{
super.setAssetName(qualifiedName);
}
this.shortDescription = shortDescription;
this.description = description;
this.owner = owner;
this.classifications = classifications;
}
/**
* Copy/clone constructor. Note, this is a deep copy
*
* @param templateAssetSummary - template values for asset summary
*/
public AssetSummary(AssetSummary templateAssetSummary)
{
/*
* Initialize super class
*/
super(templateAssetSummary);
/*
* Copy relevant values from the template
*/
if (templateAssetSummary != null)
{
type = templateAssetSummary.getType();
qualifiedName = templateAssetSummary.getQualifiedName();
displayName = templateAssetSummary.getDisplayName();
shortDescription = templateAssetSummary.getShortDescription();
description = templateAssetSummary.getDescription();
owner = templateAssetSummary.getOwner();
Classifications templateClassifications = templateAssetSummary.getClassifications();
if (templateClassifications != null)
{
classifications = templateClassifications.cloneIterator(this);
}
}
}
/**
* Return the element type properties for this asset. These values are set up by the metadata repository
* and define details to the metadata entity used to represent this element.
*
* @return ElementType - type information.
*/
public ElementType getType()
{
return type;
}
/**
* Returns the stored qualified name property for the asset.
* If no qualified name is provided then null is returned.
*
* @return qualifiedName
*/
public String getQualifiedName() {
return qualifiedName;
}
/**
* Returns the stored display name property for the asset.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Returns the short description of the asset from relationship with Connection.
*
* @return shortDescription String
*/
public String getShortDescription()
{
return shortDescription;
}
/**
* Returns the stored description property for the asset.
* If no description is provided then null is returned.
*
* @return description String
*/
public String getDescription()
{
return description;
}
/**
* Returns the name of the owner for this asset.
*
* @return owner String
*/
public String getOwner() {
return owner;
}
/**
* Return the list of classifications associated with the asset. This is an enumeration and the
* pointers are set to the start of the list of classifications
*
* @return Classifications - enumeration of classifications
*/
public Classifications getClassifications()
{
if (classifications == null)
{
return classifications;
}
else
{
return classifications.cloneIterator(this);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AssetSummary{" +
"type=" + type +
", qualifiedName='" + qualifiedName + '\'' +
", displayName='" + displayName + '\'' +
", shortDescription='" + shortDescription + '\'' +
", description='" + description + '\'' +
", owner='" + owner + '\'' +
", classifications=" + classifications +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* AssetUniverse extends AssetDetail which extend AssetSummary. AssetUniverse adds information about the
* common open metadata entities related to this asset.
* <ul>
* <li>Meanings - glossary term(s) assigned to this asset.</li>
* <li>Schema - details of the schema associated with the asset.</li>
* <li>Analysis - details of the annotations added by the discovery services.</li>
* <li>Feedback - details of the people, products and feedback that are connected to the asset.</li>
* <li>Locations - details of the known locations of the asset.</li>
* <li>Lineage - details of the lineage for the asset.</li>
* <li>Related Assets - details of the assets lined to this asset.</li>
* </ul>
*
*/
public class AssetUniverse extends AssetDetail
{
private Meanings meanings = null;
private SchemaElement schema = null;
private Annotations analysis = null;
private Feedback feedback = null;
private Locations knownLocations = null;
private Lineage lineage = null;
private RelatedAssets relatedAssets = null;
/**
* Typical Constructor
*
* @param type - details of the metadata type for this asset
* @param guid - guid property
* @param url - element URL used to access its properties in the metadata repository.
* @param qualifiedName - unique name
* @param displayName - consumable name
* @param description - description of the asset
* @param shortDescription - short description from relationship with Connection
* @param owner - owner name
* @param classifications - enumeration of classifications
* @param assetProperties - AdditionalProperties object
* @param externalIdentifiers - ExternalIdentifiers enumeration
* @param relatedMediaReferences - RelatedMediaReferences enumeration
* @param noteLogs - NoteLogs iterator
* @param externalReferences - ExternalReferences iterator
* @param connections - List of connections attached to the asset
* @param licenses - List of licenses
* @param certifications - Certifications - list of certifications
* @param meanings - Meanings - list of glossary definitions.
* @param schema - Schema object to query schema and related glossary definitions.
* @param analysis - Annotations from metadata discovery.
* @param feedback - Feedback object to query the feedback.
* @param knownLocations - Locations list
* @param lineage - lineage object to query the origin of the asset.
* @param relatedAssets - RelatedAssets list
*/
public AssetUniverse(ElementType type,
String guid,
String url,
String qualifiedName,
String displayName,
String shortDescription,
String description,
String owner,
Classifications classifications,
AdditionalProperties assetProperties,
ExternalIdentifiers externalIdentifiers,
RelatedMediaReferences relatedMediaReferences,
NoteLogs noteLogs,
ExternalReferences externalReferences,
Connections connections,
Licenses licenses,
Certifications certifications,
Meanings meanings,
SchemaElement schema,
Annotations analysis,
Feedback feedback,
Locations knownLocations,
Lineage lineage,
RelatedAssets relatedAssets)
{
super(type,
guid,
url,
qualifiedName,
displayName,
shortDescription,
description,
owner,
classifications,
assetProperties,
externalIdentifiers,
relatedMediaReferences,
noteLogs,
externalReferences,
connections,
licenses,
certifications);
this.meanings = meanings;
this.schema = schema;
this.analysis = analysis;
this.feedback = feedback;
this.knownLocations = knownLocations;
this.lineage = lineage;
this.relatedAssets = relatedAssets;
}
/**
* Copy/clone Constructor - note this is a deep copy
*
* @param templateAssetUniverse - template to copy
*/
public AssetUniverse(AssetUniverse templateAssetUniverse)
{
/*
* Initialize the super classes
*/
super(templateAssetUniverse);
/*
* Set up the universe private variables.
*/
if (templateAssetUniverse != null)
{
/*
* Create the top-level property objects for this new asset using the values from the template.
* The get methods create clones of the returned objects so no need to duplicate objects here.
*/
Meanings templateMeanings = templateAssetUniverse.getMeanings();
SchemaElement templateSchema = templateAssetUniverse.getSchema();
Annotations templateAnalysis = templateAssetUniverse.getAnalysis();
Feedback templateFeedback = templateAssetUniverse.getFeedback();
Locations templateLocations = templateAssetUniverse.getKnownLocations();
Lineage templateLineage = templateAssetUniverse.getLineage();
RelatedAssets templateRelatedAssets = templateAssetUniverse.getRelatedAssets();
if (templateMeanings != null)
{
meanings = templateMeanings.cloneIterator(this);
}
if (templateSchema != null)
{
if (templateSchema.getType().equals("Schema"))
{
schema = new Schema(this, (Schema) templateSchema);
}
else
{
schema = new PrimitiveSchemaElement(this, (PrimitiveSchemaElement) templateSchema);
}
}
if (templateAnalysis != null)
{
analysis = templateAnalysis.cloneIterator(this);
}
if (templateFeedback != null)
{
feedback = new Feedback(this, templateFeedback);
}
if (templateLocations != null)
{
knownLocations = templateLocations.cloneIterator(this);
}
if (templateLineage != null)
{
lineage = new Lineage(this, templateLineage);
}
if (templateRelatedAssets != null)
{
relatedAssets = templateRelatedAssets.cloneIterator(this);
}
}
}
/**
* Return the list of glossary definitions assigned directly to this asset.
*
* @return Meanings - list of glossary definitions.
*/
public Meanings getMeanings()
{
if (meanings == null)
{
return meanings;
}
else
{
return meanings.cloneIterator(this);
}
}
/**
* Return details of the schema associated with the asset.
*
* @return SchemaElement - schema object to query the schema associated with the connected asset.
*/
public SchemaElement getSchema()
{
if (schema == null)
{
return schema;
}
else
{
return schema.cloneSchemaElement(this);
}
}
/**
* Return details of the metadata discovery analysis for the asset.
*
* @return Annotations - List of annotations from metadata discovery
*/
public Annotations getAnalysis()
{
if (analysis == null)
{
return analysis;
}
else
{
return analysis.cloneIterator(this);
}
}
/**
* Return details of the people, products and feedback that are connected to the asset.
*
* @return Feedback - feedback object to query the feedback on the asset.
*/
public Feedback getFeedback()
{
if (feedback == null)
{
return feedback;
}
else
{
return new Feedback(this, feedback);
}
}
/**
* Return the list of locations for the asset.
*
* @return Locations - list of locations.
*/
public Locations getKnownLocations()
{
if (knownLocations == null)
{
return knownLocations;
}
else
{
return knownLocations.cloneIterator(this);
}
}
/**
* Return details of the lineage for the asset.
*
* @return Lineage - lineage object that allows queries about the lineage of the asset.
*/
public Lineage getLineage()
{
if (lineage == null)
{
return lineage;
}
else
{
return new Lineage(this, lineage);
}
}
/**
* Return the list of assets related to this asset.
*
* @return RelatedAssets list
*/
public RelatedAssets getRelatedAssets()
{
if (relatedAssets == null)
{
return relatedAssets;
}
else
{
return relatedAssets.cloneIterator(this);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "AssetUniverse{" +
"meanings=" + meanings +
", schema=" + schema +
", analysis=" + analysis +
", feedback=" + feedback +
", knownLocations=" + knownLocations +
", lineage=" + lineage +
", relatedAssets=" + relatedAssets +
'}';
}
}
\ 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.ocf.properties;
import java.util.Date;
/**
* <p>
* Certification stores the certifications awarded to the asset.
* </p>
* <p>
* Many regulations and industry bodies define certifications that can confirm a level of support,
* capability or competence in an aspect of a digital organization’s operation.
* Having certifications may be necessary to operating legally or may be a business advantage.
* </p>
* <p>
* The certifications awarded to an asset can be captured in the metadata repository to enable both
* effective use and management of the certification process.
* </p>
*/
public class Certification extends Referenceable
{
/*
* Properties of a certification
*/
private String certificationTypeGUID = null;
private String certificationTypeName = null;
private String examiner = null;
private String summary = null;
private ExternalReference link = null;
private Date startDate = null;
private Date endDate = null;
private String certificationConditions = null;
private String createdBy = null;
private String custodian = null;
private String notes = null;
/**
* Typical constructor.
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - unique id
* @param url - URL of the certification in the metadata repository
* @param classifications - enumeration of classifications
* @param qualifiedName - unique name
* @param additionalProperties - additional properties for the referenceable object
* @param meanings - list of glossary terms (summary)
* @param certificationTypeGUID - certification type GUID
* @param certificationTypeName - certification type name
* @param examiner - name of the organization or person that issued the certification
* @param summary - brief summary of the certification
* @param link - external reference for full text of the certification.
* @param startDate - start date for the certification. Null means unknown or not relevant.
* @param endDate - end date for the certification. Null means it does not expire.
* @param certificationConditions - any special conditions that apply to the certification - such as endorsements
* @param createdBy - name of the person or organization that set up the certification for this asset
* @param custodian - String name of the person or organization that is responsible for the correct management
* of the asset according to the certification
* @param notes - String notes from the custodian
*/
public Certification(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String certificationTypeGUID,
String certificationTypeName,
String examiner,
String summary,
ExternalReference link,
Date startDate,
Date endDate,
String certificationConditions,
String createdBy,
String custodian,
String notes)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.certificationTypeGUID = certificationTypeGUID;
this.certificationTypeName = certificationTypeName;
this.examiner = examiner;
this.summary = summary;
this.link = link;
this.startDate = startDate;
this.endDate = endDate;
this.certificationConditions = certificationConditions;
this.createdBy = createdBy;
this.custodian = custodian;
this.notes = notes;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateCertification - element to copy
*/
public Certification(AssetDescriptor parentAsset, Certification templateCertification)
{
super(parentAsset, templateCertification);
if (templateCertification != null)
{
certificationTypeGUID = templateCertification.getCertificationTypeGUID();
certificationTypeName = templateCertification.getCertificationTypeName();
examiner = templateCertification.getExaminer();
summary = templateCertification.getSummary();
ExternalReference templateLink = templateCertification.getLink();
if (templateLink != null)
{
link = new ExternalReference(parentAsset, templateLink);
}
Date templateStartDate = templateCertification.getStartDate();
if (templateStartDate != null)
{
startDate = new Date(templateStartDate.getTime());
}
Date templateEndDate = templateCertification.getEndDate();
if (templateEndDate != null)
{
endDate = new Date(templateStartDate.getTime());
}
certificationConditions = templateCertification.getCertificationConditions();
createdBy = templateCertification.getCreatedBy();
custodian = templateCertification.getCustodian();
notes = templateCertification.getNotes();
}
}
/**
* Return the unique id for the type of certification.
*
* @return String certification type GUID
*/
public String getCertificationTypeGUID() { return certificationTypeGUID; }
/**
* Return the type of the certification.
*
* @return String certification type
*/
public String getCertificationTypeName() { return certificationTypeName; }
/**
* Return the name of the organization or person that issued the certification.
*
* @return String name
*/
public String getExaminer() { return examiner; }
/**
* Return a brief summary of the certification.
*
* @return String summary
*/
public String getSummary() { return summary; }
/**
* Return the link to the full text of the certification.
*
* @return ExternalReference for full text
*/
public ExternalReference getLink()
{
if (link == null)
{
return link;
}
else
{
return new ExternalReference(super.getParentAsset(), link);
}
}
/**
* Return the start date for the certification. Null means unknown or not relevant.
*
* @return Date - start date for the certification
*/
public Date getStartDate()
{
if (startDate == null)
{
return startDate;
}
else
{
return new Date(startDate.getTime());
}
}
/**
* Return the end date for the certification. Null means it does not expire.
*
* @return Date - end date for the certification
*/
public Date getEndDate()
{
if (endDate == null)
{
return endDate;
}
else
{
return new Date(endDate.getTime());
}
}
/**
* Return any special conditions that apply to the certification - such as endorsements.
*
* @return String certification conditions
*/
public String getCertificationConditions() { return certificationConditions; }
/**
* Return the name of the person or organization that set up the certification for this asset.
*
* @return String name
*/
public String getCreatedBy() { return createdBy; }
/**
* Return the name of the person or organization that is responsible for the correct management of the asset
* according to the certification.
*
* @return String name
*/
public String getCustodian() { return custodian; }
/**
* Return the notes from the custodian.
*
* @return String notes
*/
public String getNotes() { return notes; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Certification{" +
"certificationTypeGUID='" + certificationTypeGUID + '\'' +
", certificationTypeName='" + certificationTypeName + '\'' +
", examiner='" + examiner + '\'' +
", summary='" + summary + '\'' +
", link=" + link +
", startDate=" + startDate +
", endDate=" + endDate +
", certificationConditions='" + certificationConditions + '\'' +
", createdBy='" + createdBy + '\'' +
", custodian='" + custodian + '\'' +
", notes='" + notes + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Certifications supports an iterator over a list of certifications awarded to the asset.
* Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Certifications extends AssetPropertyIteratorBase implements Iterator<Certification>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Certifications(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Certifications(AssetDescriptor parentAsset, Certifications template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected Certification cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Certification(parentAsset, (Certification)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Certifications cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Certification - next element object that has been cloned.
*/
@Override
public Certification next()
{
return (Certification)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Certifications{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.OCFErrorCode;
import org.apache.atlas.ocf.ffdc.OCFRuntimeException;
/**
* The Classification class stores information about a classification assigned to an asset. The Classification
* has a name and some properties. It also stores the typename of the asset it is connected to for debug purposes.
*
* Note: it is not valid to have a classification with a null or blank name.
*/
public class Classification extends AssetPropertyBase
{
private String classificationName = null;
private AdditionalProperties classificationProperties = null;
/**
* A private validation method used by the constructors.
*
* @param name - name to check
* @return validated name
*/
private String validateName(String name)
{
/*
* Throw an exception if the classification's name is null because that does not make sense.
* The constructors do not catch this exception so it is received by the creator of the classification
* object.
*/
if (name == null || name.equals(""))
{
/*
* Build and throw exception. This should not happen - likely to be a problem in the
* repository connector.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CLASSIFICATION_NAME;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(super.getParentAssetName(),
super.getParentAssetTypeName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"validateName",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
else
{
return name;
}
}
/**
* Typical constructor - verifies and saves parameters.
*
* @param parentAsset - name and type of related asset
* @param name - name of the classification
* @param properties - additional properties for the classification
*/
public Classification(AssetDescriptor parentAsset,
String name,
AdditionalProperties properties)
{
super(parentAsset);
this.classificationName = validateName(name);
this.classificationProperties = properties;
}
/**
* Copy/clone Constructor - sets up new classification using values from the template
*
* @param parentAsset - details of the asset that this classification is linked to.
* @param templateClassification - object to copy
*/
public Classification(AssetDescriptor parentAsset, Classification templateClassification)
{
super(parentAsset, templateClassification);
/*
* An empty classification object is passed in the variable declaration so throw exception
* because we need the classification name.
*/
if (templateClassification == null)
{
/*
* Build and throw exception. This should not happen - likely to be a problem in the
* repository connector.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_CLASSIFICATION_NAME;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage("<Unknown>");
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"Copy Constructor",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
else
{
/*
* Save the name and properties.
*/
this.classificationName = validateName(templateClassification.getName());
this.classificationProperties = templateClassification.getProperties();
}
}
/**
* Return the name of the classification
*
* @return name of classification
*/
public String getName()
{
return classificationName;
}
/**
* Returns a collection of the additional stored properties for the classification.
* If no stored properties are present then null is returned.
*
* @return properties for the classification
*/
public AdditionalProperties getProperties()
{
if (classificationProperties == null)
{
return classificationProperties;
}
else
{
return new AdditionalProperties(super.getParentAsset(), classificationProperties);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Classification{" +
"classificationName='" + classificationName + '\'' +
", classificationProperties=" + classificationProperties +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Classifications supports an iterator over a list of classifications. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Classifications extends AssetPropertyIteratorBase implements Iterator<Classification>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Classifications(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Classifications(AssetDescriptor parentAsset, Classifications template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Classification(parentAsset, (Classification)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Classifications cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Classification - next element object that has been cloned.
*/
@Override
public Classification next()
{
return (Classification)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Classifications{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* Stores information about a comment connected to an asset. Comments provide informal feedback to assets
* and can be added at any time.
*
* Comments have the userId of the person who added the feedback, along with their comment text.
*
* Comments can have other comments attached.
*
* The content of the comment is a personal statement (which is why the user's id is in the comment)
* and there is no formal review of the content.
*/
public class Comment extends ElementHeader
{
/*
* Attributes of a Comment
*/
private CommentType commentType = null;
private String commentText = null;
private String user = null;
private Comments commentReplies = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - list of classifications
* @param commentType - enum describing the type of the comment
* @param commentText - comment text String
* @param user - String - user id of the person who created the comment. Null means the user id is not known.
* @param commentReplies - Nested list of comments replies
*/
public Comment(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
CommentType commentType,
String commentText,
String user,
Comments commentReplies)
{
super(parentAsset, type, guid, url, classifications);
this.commentType = commentType;
this.commentText = commentText;
this.user = user;
this.commentReplies = commentReplies;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateComment - element to copy
*/
public Comment(AssetDescriptor parentAsset, Comment templateComment)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateComment);
if (templateComment != null)
{
/*
* Copy the values from the supplied comment.
*/
commentType = templateComment.getCommentType();
user = templateComment.getUser();
commentText = templateComment.getCommentText();
Comments templateCommentReplies = templateComment.getCommentReplies();
if (templateCommentReplies != null)
{
/*
* Ensure comment replies has this object's parent asset, not the template's.
*/
commentReplies = templateCommentReplies.cloneIterator(parentAsset);
}
}
}
/**
* Return an enum that describes the type of comment.
*
* @return CommentType enum
*/
public CommentType getCommentType()
{
return commentType;
}
/**
* Return the user id of the person who created the comment. Null means the user id is not known.
*
* @return String - commenting user
*/
public String getUser()
{
return user;
}
/**
* Return the comment text.
*
* @return String - commentText
*/
public String getCommentText()
{
return commentText;
}
/**
* Return an iterator of the replies to this comment - null means no replies are available.
*
* @return Comments - comment replies iterator
*/
public Comments getCommentReplies()
{
if (commentReplies == null)
{
return commentReplies;
}
else
{
return commentReplies.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Comment{" +
"commentText='" + commentText + '\'' +
", user='" + user + '\'' +
", commentReplies=" + commentReplies +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* The CommentType allows comments to be used to ask and answer questions as well as make suggestions and
* provide useful information to other users.
*/
public enum CommentType implements Serializable
{
STANDARD_COMMENT (0, "Comment", "General comment about the asset."),
QUESTION (1, "Question", "Asks a question to the people owning, managing or using the asset."),
ANSWER (2, "Answer", "Answers a question (posted as a reply to the question)."),
SUGGESTION (3, "Suggestion", "Provides a suggestion on how to improve the asset or its properties and description."),
USAGE_EXPERIENCE (4, "Experience", "Describes situations where this asset has been used and related hints and tips.");
private static final long serialVersionUID = 1L;
private int commentTypeCode;
private String commentType;
private String commentTypeDescription;
/**
* Typical Constructor
*/
CommentType(int commentTypeCode, String commentType, String commentTypeDescription)
{
/*
* Save the values supplied
*/
this.commentTypeCode = commentTypeCode;
this.commentType = commentType;
this.commentTypeDescription = commentTypeDescription;
}
/**
* Return the code for this enum instance
*
* @return int - comment type code
*/
public int getCommentTypeCode()
{
return commentTypeCode;
}
/**
* Return the default type name for this enum instance.
*
* @return String - default type name
*/
public String getCommentType()
{
return commentType;
}
/**
* Return the default description for the star rating for this enum instance.
*
* @return String - default description
*/
public String getCommentTypeDescription()
{
return commentTypeDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "CommentType{" +
"commentTypeCode=" + commentTypeCode +
", commentType='" + commentType + '\'' +
", commentTypeDescription='" + commentTypeDescription + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Comments supports an iterator over a list of Comment objects. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Comments extends AssetPropertyIteratorBase implements Iterator<Comment>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Comments(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Comments(AssetDescriptor parentAsset, Comments template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Comment(parentAsset, (Comment)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Comments cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Comment - next element object that has been cloned.
*/
@Override
public Comment next()
{
return (Comment)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Comments{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ConnectedAssetProperties is associated with a Connector. Connectors provide access to
* assets. ConnectedAssetProperties returns properties (metadata) about the connector's asset.
*
* It is a generic interface for all types of open metadata assets. However, it assumes the asset's metadata model
* inherits from <b>Asset</b> (see model 0010 in Area 0).
*
* The ConnectedAssetProperties returns metadata about the asset at three levels of detail:
* <ul>
* <li><b>assetSummary</b> - used for displaying details of the asset in summary lists or hover text</li>
* <li><b>assetDetail</b> - used to display all of the information known about the asset with summaries
* of the relationships to other metadata entities</li>
* <li><b>assetUniverse</b> - used to define the broader context for the asset</li>
* </ul>
*
* ConnectedAssetProperties is a base class for the connector's metadata API that returns null,
* for the asset's properties. Metadata repository implementations extend this class to add their
* implementation of the refresh() method that calls to the metadata repository to populate the metadata properties.
*/
public abstract class ConnectedAssetProperties extends PropertyBase
{
/*
* AssetUniverse extends AssetDetails which extends AssetSummary. The interaction with the metadata repository
* pulls the asset universe in one single network interaction and the caller can then explore the metadata
* property by property without incurring many network interactions (unless there are too many instances
* of a particular type of property and one of the iterators is forced to use paging).
*
* If null is returned, the connector is not linked to a metadata repository.
*/
protected AssetUniverse assetProperties = null;
private static final Logger log = LoggerFactory.getLogger(ConnectedAssetProperties.class);
/**
* Typical constructor.
*/
public ConnectedAssetProperties()
{
/*
* Nothing to do except initialize superclass.
*/
super();
}
/**
* Copy/clone constructor.
*
* @param templateProperties - template to copy.
*/
public ConnectedAssetProperties(ConnectedAssetProperties templateProperties)
{
super(templateProperties);
if (templateProperties != null)
{
AssetUniverse templateAssetUniverse = templateProperties.getAssetUniverse();
if (templateAssetUniverse != null)
{
assetProperties = new AssetUniverse(templateAssetUniverse);
}
}
}
/**
* Returns the summary information organized in the assetSummary structure.
*
* @return AssetSummary - summary object
*/
public AssetSummary getAssetSummary() { return assetProperties; }
/**
* Returns detailed information about the asset organized in the assetDetail structure.
*
* @return AssetDetail - detail object
*/
public AssetDetail getAssetDetail() { return assetProperties; }
/**
* Returns all of the detail of the asset and information connected to it in organized in the assetUniverse
* structure.
*
* @return AssetUniverse - universe object
*/
public AssetUniverse getAssetUniverse() { return assetProperties; }
/**
* Request the values in the ConnectedAssetProperties are refreshed with the current values from the
* metadata repository.
*
* @throws PropertyServerException - there is a problem connecting to the server to retrieve metadata.
*/
public abstract void refresh() throws PropertyServerException;
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ConnectedAssetProperties{" +
"assetProperties=" + assetProperties +
'}';
}
}
\ 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.ocf.properties;
/**
* The connection is an object that contains the properties needed to create and initialise a connector to access a
* specific data assets.
*
* The properties for a connection are defined in model 0201. They include the following options for connector name:
* <ul>
* <li>
* guid - Globally unique identifier for the connection.
* </li>
* <li>
* url - URL of the connection definition in the metadata repository.
* This URL can be stored as a property in another entity to create an explicit link to this connection.
* </li>
* <li>
* qualifiedName - The official (unique) name for the connection.
* This is often defined by the IT systems management organization and should be used (when available) on
* audit logs and error messages. The qualifiedName is defined in the 0010 model as part of Referenceable.
* </li>
* <li>
* displayName - A consumable name for the connection. Often a shortened form of the qualifiedName for use
* on user interfaces and messages. The displayName should be only be used for audit logs and error messages
* if the qualifiedName is not set.
* </li>
* </ul>
* Either the guid, qualifiedName or displayName can be used to specify the name for a connection.
*
* Other properties for the connection include:
*
* <ul>
* <li>
* type - information about the TypeDef for Connection
* </li>
* <li>
* description - A full description of the connection covering details of the assets it connects to
* along with usage and versioning information.
* </li>
* <li>
* additionalProperties - Any additional properties associated with the connection.
* </li>
* <li>
* securedProperties - Protected properties for secure log on by connector to back end server. These
* are protected properties that can only be retrieved by privileged connector code.
* </li>
* <li>
* connectorType - Properties that describe the connector type for the connector.
* </li>
* <li>
* endpoint - Properties that describe the server endpoint where the connector will retrieve the assets.
* </li>
* </ul>
* The connection class is simply used to cache the properties for an connection.
* It is used by other classes to exchange this information between a metadata repository and a consumer.
*/
public class Connection extends Referenceable
{
/*
* Attributes of a connector
*/
private String displayName = null;
private String description = null;
private ConnectorType connectorType = null;
private Endpoint endpoint = null;
/*
* Secured properties are protected so they can only be accessed by subclassing this object.
*/
protected AdditionalProperties securedProperties = null;
/**
* Typical Constructor - for constructing a new, independent populated Connection.
*
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - stored description property for the connection.
* @param connectorType - connector type to copy
* @param endpoint - endpoint properties
* @param securedProperties - typically user credentials for the connection
*/
public Connection(ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
ConnectorType connectorType,
Endpoint endpoint,
AdditionalProperties securedProperties)
{
super(null, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.connectorType = connectorType;
this.endpoint = endpoint;
this.securedProperties = securedProperties;
}
/**
* Typical Constructor - for constructing a new, populated Connection as part of connected asset properties.
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - stored description property for the connection.
* @param connectorType - connector type to copy
* @param endpoint - endpoint properties
* @param securedProperties - typically user credentials for the connection
*/
public Connection(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
ConnectorType connectorType,
Endpoint endpoint,
AdditionalProperties securedProperties)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.connectorType = connectorType;
this.endpoint = endpoint;
this.securedProperties = securedProperties;
}
/**
* 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
*/
this(null, templateConnection);
}
/**
* Copy/clone Constructor to return a copy of a connection object that is connected to an asset.
*
* @param parentAsset - description of the asset that this connection is attached to.
* @param templateConnection - template object to copy.
*/
public Connection(AssetDescriptor parentAsset, Connection templateConnection)
{
/*
* Save parentAsset
*/
super(parentAsset, templateConnection);
/*
* Copy over properties from the template.
*/
if (templateConnection != null)
{
displayName = templateConnection.getDisplayName();
description = templateConnection.getDescription();
ConnectorType templateConnectorType = templateConnection.getConnectorType();
Endpoint templateEndpoint = templateConnection.getEndpoint();
AdditionalProperties templateSecuredProperties = templateConnection.getSecuredProperties();
if (templateConnectorType != null)
{
connectorType = new ConnectorType(parentAsset, templateConnectorType);
}
if (templateEndpoint != null)
{
endpoint = new Endpoint(parentAsset, templateEndpoint);
}
if (templateSecuredProperties != null)
{
securedProperties = new AdditionalProperties(parentAsset, templateSecuredProperties);
}
}
}
/**
* Returns the stored display name property for the connection.
* Null means no displayName is available.
*
* @return displayName
*/
public String getDisplayName() { return displayName; }
/**
* Returns a formatted string with the connection name. It is used in formatting error messages for the
* exceptions thrown by consuming components. It is extremely cautious because most of the exceptions
* are reporting a malformed connection object so who knows what else is wrong with it.
*
* Within the connection are 2 possible properties that could
* contain the connection name:
* ** qualifiedName - this is a uniqueName and should be there
* ** displayName - shorter simpler name but may not be unique - so may not identify the connection in error
*
* This method inspects these properties and builds up a string to represent the connection name
*
* @return connection name
*/
public String getConnectionName()
{
String connectionName = "<Unknown>"; /* if all properties are blank */
/*
* The qualifiedName is preferred because it is unique.
*/
if (qualifiedName != null && (!qualifiedName.equals("")))
{
/*
* Use qualified name.
*/
connectionName = qualifiedName;
}
else if (displayName != null && (!displayName.equals("")))
{
/*
* The qualifiedName is not set but the displayName is available so use it.
*/
connectionName = displayName;
}
return connectionName;
}
/**
* Returns the stored description property for the connection.
* If no description is provided then null is returned.
*
* @return description
*/
public String getDescription()
{
return description;
}
/**
* Returns a copy of the properties for this connection's connector type.
* A null means there is no connection type.
*
* @return connector type for the connection
*/
public ConnectorType getConnectorType()
{
if (connectorType == null)
{
return connectorType;
}
else
{
return new ConnectorType(super.getParentAsset(), connectorType);
}
}
/**
* Returns a copy of the properties for this connection's endpoint.
* Null means no endpoint information available.
*
* @return endpoint for the connection
*/
public Endpoint getEndpoint()
{
if (endpoint == null)
{
return endpoint;
}
else
{
return new Endpoint(super.getParentAsset(), endpoint);
}
}
/**
* Return a copy of the secured properties. Null means no secured properties are available.
* This method is protected so only OCF (or subclasses) can access them. When Connector is passed to calling
* OMAS, the secured properties are not available.
*
* @return secured properties - typically user credentials for the connection
*/
protected AdditionalProperties getSecuredProperties()
{
if (securedProperties == null)
{
return securedProperties;
}
else
{
return new AdditionalProperties(super.getParentAsset(), securedProperties);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Connection{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", connectorType=" + connectorType +
", endpoint=" + endpoint +
", securedProperties=" + securedProperties +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Connections supports an iterator over a list of connections. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Connections extends AssetPropertyIteratorBase implements Iterator<Connection>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Connections(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Connections(AssetDescriptor parentAsset, Connections template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Connection(parentAsset, (Connection)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Connections cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Connection - next element object that has been cloned.
*/
@Override
public Connection next()
{
return (Connection)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Connections{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* The ConnectorType describe the implementation details of a particular type of OCF connector.
* The properties for a connector type are defined in model 0201.
* They include:
*
* <ul>
* <li>
* guid - Globally unique identifier for the connector type.
* </li>
* <li>
* url - External link address for the connector type properties in the metadata repository. This URL can be
* stored as a property in another entity to create an explicit link to this connector type.
* </li>
* <li>
* qualifiedName - The official (unique) name for the connector type. This is often defined by the IT
* systems management organization and should be used (when available) on audit logs and error messages.
* </li>
* <li>
* displayName - A consumable name for the connector type. Often a shortened form of the qualifiedName for use
* on user interfaces and messages. The displayName should be only be used for audit logs and error messages
* if the qualifiedName is not set.
* </li>
* <li>
* description - A full description of the connector type covering details of the assets it connects to
* along with usage and versioning information.
* </li>
* <li>
* connectorProviderClassName - The connector provider is the factory for a particular type of connector.
* This property defines the class name for the connector provider that the Connector Broker should use to request
* new connector instances.
* </li>
* <li>
* additionalProperties - Any additional properties that the connector provider needs to know in order to
* create connector instances.
* </li>
* </ul>
*
* The connectorTypeProperties class is simply used to cache the properties for an connector type.
* It is used by other classes to exchange this information between a metadata repository and a consumer.
*/
public class ConnectorType extends Referenceable
{
/*
* Attributes of a connector type
*/
private String displayName = null;
private String description = null;
private String connectorProviderClassName = null;
/**
* Typical Constructor - used when Connector Type is used inside a connection object which is itself
* not yet connected to an asset. In this case the ParentAsset is null.
*
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name property stored for the connector type.
* @param description - description property stored for the connector type.
* @param connectorProviderClassName - class name (including package name)
*/
public ConnectorType(ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
String connectorProviderClassName)
{
super(null, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.connectorProviderClassName = connectorProviderClassName;
}
/**
* Typical constructor for creating a connectorType linked to an asset.
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name property stored for the connector type.
* @param description - description property stored for the connector type.
* @param connectorProviderClassName - class name (including package name)
*/
public ConnectorType(AssetDescriptor parentAsset, ElementType type, String guid, String url, Classifications classifications, String qualifiedName, AdditionalProperties additionalProperties, Meanings meanings, String displayName, String description, String connectorProviderClassName)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.connectorProviderClassName = connectorProviderClassName;
}
/**
* 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)
{
this(null, templateConnectorType);
}
/**
* Copy/clone constructor for a connectorType that is connected to an asset (either directly or indirectly).
*
* @param parentAsset - description of the asset that this connector type is attached to.
* @param templateConnectorType - template object to copy.
*/
public ConnectorType(AssetDescriptor parentAsset, ConnectorType templateConnectorType)
{
/*
* Save parentAsset.
*/
super(parentAsset, templateConnectorType);
/*
* All properties are initialised as null so only change their default setting if the template is
* not null
*/
if (templateConnectorType != null)
{
displayName = templateConnectorType.getDisplayName();
description = templateConnectorType.getDescription();
connectorProviderClassName = templateConnectorType.getConnectorProviderClassName();
}
}
/**
* Returns the stored display name property for the connector type.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Returns the stored description property for the connector type.
* If no description is available then null is returned.
*
* @return description
*/
public String getDescription()
{
return description;
}
/**
* Returns the stored connectorProviderClassName property for the connector type.
* If no connectorProviderClassName is available then null is returned.
*
* @return connectorProviderClassName - class name (including package name)
*/
public String getConnectorProviderClassName()
{
return connectorProviderClassName;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ConnectorType{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", connectorProviderClassName='" + connectorProviderClassName + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* Derived schema elements are used in views to define elements that are calculated using data from other sources.
* It contains a list of queries and a formula to combine the resulting values.
*/
public class DerivedSchemaElement extends PrimitiveSchemaElement
{
private String formula = null;
private SchemaImplementationQueries queries = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param versionNumber - the version number of the schema element - null means no version number.
* @param author - the name of the author of the schema element. Null means the author is unknown.
* @param usage - the usage guidance for this schema element. Null means no guidance available.
* @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
* @param dataType - the name of the data type for this element. Null means unknown data type.
* @param defaultValue - String containing default value for the element
* @param formula - the formula used to combine the values of the queries. Each query is numbers 0, 1, ... and the
* formula has placeholders in it to show how the query results are combined.
* @param queries - list of queries that are used to create the derived schema element.
*/
public DerivedSchemaElement(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String versionNumber,
String author,
String usage,
String encodingStandard,
String dataType,
String defaultValue,
String formula,
SchemaImplementationQueries queries)
{
super(parentAsset,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
versionNumber,
author,
usage,
encodingStandard,
dataType,
defaultValue);
this.formula = formula;
this.queries = queries;
}
/**
* Copy/clone Constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the definitions clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @param templateSchemaElement - template object to copy.
*/
public DerivedSchemaElement(AssetDescriptor parentAsset, DerivedSchemaElement templateSchemaElement)
{
super(parentAsset, templateSchemaElement);
if (templateSchemaElement != null)
{
SchemaImplementationQueries templateQueries = templateSchemaElement.getQueries();
formula = templateSchemaElement.getFormula();
queries = templateQueries.cloneIterator(super.getParentAsset());
}
}
/**
* Return the formula used to combine the values of the queries. Each query is numbers 0, 1, ... and the
* formula has placeholders in it to show how the query results are combined.
*
* @return String formula
*/
public String getFormula() { return formula; }
/**
* Return the list of queries that are used to create the derived schema element.
*
* @return SchemaImplementationQueries - list of queries
*/
public SchemaImplementationQueries getQueries()
{
if (queries == null)
{
return queries;
}
else
{
return queries.cloneIterator(super.getParentAsset());
}
}
/**
* Returns a clone of this object as the abstract SchemaElement class.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @return PrimitiveSchemaElement object
*/
@Override
public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset)
{
return new DerivedSchemaElement(parentAsset, this);
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "DerivedSchemaElement{" +
"formula='" + formula + '\'' +
", queries=" + queries +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* ElementHeader provides the common identifier and type information for all properties objects
* that link off of the asset and have a guid associated with them. This typically means it is
* represented by an entity in the metadata repository.
*/
public abstract class ElementHeader extends AssetPropertyBase
{
/*
* Common header for first class elements from a metadata repository
*/
protected ElementType type = null;
protected String guid = null;
protected String url = null;
/*
* Attached classifications
*/
private Classifications classifications = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - enumeration of classifications
*/
public ElementHeader(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications)
{
super(parentAsset);
this.type = type;
this.guid = guid;
this.url = url;
this.classifications = classifications;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateHeader - element to copy
*/
public ElementHeader(AssetDescriptor parentAsset, ElementHeader templateHeader)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateHeader);
if (templateHeader != null)
{
/*
* Copy the values from the supplied parameters.
*/
type = templateHeader.getType();
guid = templateHeader.getGUID();
url = templateHeader.getURL();
Classifications templateClassifications = templateHeader.getClassifications();
if (templateClassifications != null)
{
classifications = templateClassifications.cloneIterator(parentAsset);
}
}
}
/**
* Return the element type properties for this properties object. These values are set up by the metadata repository
* and define details to the metadata entity used to represent this element.
*
* @return ElementType - type information.
*/
public ElementType getType() {
return type;
}
/**
* Return the unique id for the properties object. Null means no guid is assigned.
*
* @return String - unique id
*/
public String getGUID() {
return guid;
}
/**
* Returns the URL to access the properties object in the metadata repository.
* If no url is available then null is returned.
*
* @return String - URL
*/
public String getURL() {
return url;
}
/**
* Return the list of classifications associated with the asset. This is an enumeration and the
* pointers are set to the start of the list of classifications
*
* @return Classifications - enumeration of classifications
*/
public Classifications getClassifications()
{
if (classifications == null)
{
return classifications;
}
else
{
return classifications.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ElementHeader{" +
"type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
", classifications=" + classifications +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* ElementOrigin defines where the metadata comes from and, hence if it can be updated.
* <ul>
* <li>
* LOCAL_COHORT - the element is being maintained within the local cohort.
* The metadata collection id is for one of the repositories in the cohort.
* This metadata collection id identifies the home repository for this element.
* </li>
* <li>
* EXPORT_ARCHIVE - the element was created from an export archive.
* The metadata collection id for the element is the metadata collection id of the originating server.
* If the originating server later joins the cohort with the same metadata collection id then these
* elements will be refreshed from the originating server’s current repository.
* </li>
* <li>
* CONTENT_PACK - the element comes from an open metadata content pack.
* The metadata collection id of the elements is set to the GUID of the pack.
* </li>
* <li>
* DEREGISTERED_REPOSITORY - the element comes from a metadata repository that used to be a part
* of the repository cohort but has been deregistered. The metadata collection id remains the same.
* If the repository rejoins the cohort then these elements can be refreshed from the rejoining repository.
* </li>
* </ul>
*/
public enum ElementOrigin implements Serializable
{
LOCAL_COHORT(0, "Local to cohort", "The element is being maintained within one of the local cohort members. " +
"The metadata collection id is for one of the repositories in the cohort. " +
"This metadata collection id identifies the home repository for this element. "),
EXPORT_ARCHIVE(1, "Export Archive", "The element was created from an export archive. " +
"The metadata collection id for the element is the metadata collection id of the originating server. " +
"If the originating server later joins the cohort with the same metadata collection Id " +
"then these elements will be refreshed from the originating server’s current repository."),
CONTENT_PACK(2, "Content Pack", "The element comes from an open metadata content pack. " +
"The metadata collection id of the elements is set to the GUID of the pack."),
DEREGISTERED_REPOSITORY(3, "Deregistered Repository", "The element comes from a metadata repository that " +
"used to be a member of the one of the local repository's cohorts but it has been deregistered. " +
"The metadata collection id remains the same. If the repository rejoins the cohort " +
"then these elements can be refreshed from the rejoining repository."),
CONFIGURATION(4, "Configuration",
"The element is part of a service's configuration. The metadata collection id is null.");
private static final long serialVersionUID = 1L;
private int originCode;
private String originName;
private String originDescription;
/**
* Constructor for the enum.
*
* @param originCode - code number for origin
* @param originName - name for origin
* @param originDescription - description for origin
*/
ElementOrigin(int originCode, String originName, String originDescription)
{
this.originCode = originCode;
this.originName = originName;
this.originDescription = originDescription;
}
/**
* Return the code for metadata element.
*
* @return int code for the origin
*/
public int getOriginCode()
{
return originCode;
}
/**
* Return the name of the metadata element origin.
*
* @return String name
*/
public String getOriginName()
{
return originName;
}
/**
* Return the description of the metadata element origin.
*
* @return String description
*/
public String getOriginDescription()
{
return originDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ElementOrigin{" +
"originCode=" + originCode +
", originName='" + originName + '\'' +
", originDescription='" + originDescription + '\'' +
'}';
}
}
/*
* 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;
/**
* The ElementType provide details of the type information associated with the element. Most consumers
* of the properties do not need this information. It is provided to asset consumers primarily as diagnostic
* information.
*/
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;
/**
* Typical Constructor
*
* @param elementTypeId - identifier for the element's type
* @param elementTypeName - element type name
* @param elementTypeVersion - version number for the element type
* @param elementTypeDescription - description of element type
* @param elementAccessServiceURL - url of the OMAS server
* @param elementOrigin - enum describing type of origin
* @param elementHomeMetadataCollectionId - metadata collection id
*/
public ElementType(String elementTypeId,
String elementTypeName,
String elementTypeVersion,
String elementTypeDescription,
String elementAccessServiceURL,
ElementOrigin elementOrigin,
String elementHomeMetadataCollectionId)
{
super();
this.elementTypeId = elementTypeId;
this.elementTypeName = elementTypeName;
this.elementTypeVersion = elementTypeVersion;
this.elementTypeDescription = elementTypeDescription;
this.elementAccessServiceURL = elementAccessServiceURL;
this.elementOrigin = elementOrigin;
this.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId;
}
/**
* Copy/clone constructor
*
* @param templateType - type to clone
*/
public ElementType(ElementType templateType)
{
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();
}
/**
* Return unique identifier for the element's type.
*
* @return element type id
*/
public String getElementTypeId()
{
return elementTypeId;
}
/**
* Return name of element's type.
*
* @return - elementTypeName
*/
public String getElementTypeName()
{
return elementTypeName;
}
/**
* Return the version number for the element type.
*
* @return elementTypeVersion - version number for the element type.
*/
public String getElementTypeVersion()
{
return elementTypeVersion;
}
/**
* Return the description for the element type.
*
* @return elementTypeDescription - description for the element type
*/
public String getElementTypeDescription()
{
return elementTypeDescription;
}
/**
* Return 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.
*
* @return elementSourceServerURL - the url of the server where the element came from
*/
public String getElementAccessServiceURL()
{
return elementAccessServiceURL;
}
/**
* Return the origin of the metadata element.
*
* @return ElementOrigin enum
*/
public ElementOrigin getElementOrigin() { return elementOrigin; }
/**
* Returns the OMRS identifier for the metadata collection that is managed by the repository
* where the element originates (its home repository).
*
* @return String metadata collection id
*/
public String getElementHomeMetadataCollectionId()
{
return elementHomeMetadataCollectionId;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ElementType{" +
"elementTypeId='" + elementTypeId + '\'' +
", elementTypeName='" + elementTypeName + '\'' +
", elementTypeVersion='" + elementTypeVersion + '\'' +
", elementTypeDescription='" + elementTypeDescription + '\'' +
", elementAccessServiceURL='" + elementAccessServiceURL + '\'' +
", elementOrigin=" + elementOrigin +
", 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;
/**
* The EmbeddedConnection is used within a VirtualConnection. It contains a connection and additional properties
* the VirtualConnection uses when working with the EmbeddedConnection.
*/
public class EmbeddedConnection extends AssetPropertyBase
{
/*
* Attributes of an embedded connection
*/
private AdditionalProperties embeddedConnectionProperties = null;
private Connection embeddedConnection = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param embeddedConnectionProperties - Additional properties
* @param embeddedConnection - Connection
*/
public EmbeddedConnection(AssetDescriptor parentAsset,
AdditionalProperties embeddedConnectionProperties,
Connection embeddedConnection)
{
super(parentAsset);
this.embeddedConnectionProperties = embeddedConnectionProperties;
this.embeddedConnection = embeddedConnection;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateEmbeddedConnection - element to copy
*/
public EmbeddedConnection(AssetDescriptor parentAsset, EmbeddedConnection templateEmbeddedConnection)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateEmbeddedConnection);
if (templateEmbeddedConnection != null)
{
AdditionalProperties templateConnectionProperties = templateEmbeddedConnection.getEmbeddedConnectionProperties();
Connection templateConnection = templateEmbeddedConnection.getEmbeddedConnection();
if (templateConnectionProperties != null)
{
embeddedConnectionProperties = new AdditionalProperties(parentAsset, templateConnectionProperties);
}
if (templateConnection != null)
{
embeddedConnection = new Connection(parentAsset, templateConnection);
}
}
}
/**
* Return the properties for the embedded connection.
*
* @return AdditionalProperties
*/
public AdditionalProperties getEmbeddedConnectionProperties()
{
if (embeddedConnectionProperties == null)
{
return embeddedConnectionProperties;
}
else
{
return new AdditionalProperties(this.getParentAsset(), embeddedConnectionProperties);
}
}
/**
* Return the embedded connection.
*
* @return Connection object.
*/
public Connection getEmbeddedConnection()
{
if (embeddedConnection == null)
{
return embeddedConnection;
}
else
{
return new Connection(this.getParentAsset(), embeddedConnection);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "EmbeddedConnection{" +
"embeddedConnectionProperties=" + embeddedConnectionProperties +
", embeddedConnection=" + embeddedConnection +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* EmbeddedConnections supports an iterator over a list of connections that are embedded in a virtual connection.
* Callers can use it to step through the list just once. If they want to parse the list again,
* they could use the copy/clone constructor to create a new iterator.
*/
public abstract class EmbeddedConnections extends AssetPropertyIteratorBase implements Iterator<EmbeddedConnection>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public EmbeddedConnections(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public EmbeddedConnections(AssetDescriptor parentAsset, EmbeddedConnections template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new EmbeddedConnection(parentAsset, (EmbeddedConnection)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract EmbeddedConnections cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return EmbeddedConnection - next element object that has been cloned.
*/
@Override
public EmbeddedConnection next()
{
return (EmbeddedConnection)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "EmbeddedConnections{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* The Endpoint describes the network information necessary for a connector to connect to the server
* where the Asset is accessible from. The properties for an endpoint are defined in model 0040.
* They include:
* <ul>
* <li>
* type - definition of the specific metadata type for the endpoint.
* </li>
* <li>
* guid - Globally unique identifier for the endpoint.
* </li>
* <li>
* url - External link address for the endpoint properties in the metadata repository.
* This URL can be stored as a property in another entity to create an explicit link to this endpoint.
* </li>
* <li>
* qualifiedName - The official (unique) name for the endpoint. This is often defined by the IT systems management
* organization and should be used (when available) on audit logs and error messages.
* </li>
* <li>
* displayName - A consumable name for the endpoint. Often a shortened form of the qualifiedName for use
* on user interfaces and messages. The displayName should be only be used for audit logs and error messages
* if the qualifiedName is not set.
* </li>
* <li>
* description - A description for the endpoint.
* </li>
* <li>
* address - The location of the asset. For network connected resources, this is typically the
* URL and port number (if needed) for the server where the asset is located
* (or at least accessible by the connector). For file-based resources, this is typically the name of the file.
* </li>
* <li>
* protocol - The communication protocol that the connection should use to connect to the server.
* </li>
* <li>
* encryptionMethod - Describes the encryption method to use (if any). This is an open value allowing
* information needed by the connector user to retrieve all of the information they need to work with
* the endpoint.
* </li>
* <li>
* additionalProperties - Any additional properties that the connector need to know in order to
* access the Asset.
* </li>
* </ul>
*
* The Endpoint class is simply used to cache the properties for an endpoint.
* It is used by other classes to exchange this information between a metadata repository and a consumer.
*/
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;
/**
* Admin Constructor - used when Endpoint is inside a Connection that is not part of the connected asset
* properties. In this case there is no parent asset.
*
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - simple name for the endpoint
* @param description - String description for the endpoint
* @param address - network url for the server/resource
* @param protocol - endpoint protocol
* @param encryptionMethod - encryption mechanism in use by the endpoint
*/
public Endpoint(ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
String address,
String protocol,
String encryptionMethod)
{
this(null,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
displayName,
description,
address,
protocol,
encryptionMethod);
}
/**
* Typical Constructor for a new endpoint that is connected to an asset (either directly or indirectly.)
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - simple name for the endpoint
* @param description - String description for the endpoint
* @param address - network url for the server/resource
* @param protocol - endpoint protocol
* @param encryptionMethod - encryption mechanism in use by the endpoint
*/
public Endpoint(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
String address,
String protocol,
String encryptionMethod)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.address = address;
this.protocol = protocol;
this.encryptionMethod = encryptionMethod;
}
/**
* Copy/clone constructor for an Endpoint not connected to an asset.
*
* @param templateEndpoint - template object to copy.
*/
public Endpoint(Endpoint templateEndpoint)
{
this(null, templateEndpoint);
}
/**
* Copy/clone constructor for an Endpoint that is connected to an Asset (either directly or indirectly).
*
* @param parentAsset - description of the asset that this endpoint is attached to.
* @param templateEndpoint - template object to copy.
*/
public Endpoint(AssetDescriptor parentAsset, Endpoint templateEndpoint)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateEndpoint);
/*
* All properties are initialised as null so only change their default setting if the template is
* not null
*/
if (templateEndpoint != null)
{
displayName = templateEndpoint.getDisplayName();
address = templateEndpoint.getAddress();
protocol = templateEndpoint.getProtocol();
encryptionMethod = templateEndpoint.getEncryptionMethod();
AdditionalProperties templateAdditionalProperties = templateEndpoint.getAdditionalProperties();
if (templateAdditionalProperties != null)
{
additionalProperties = new AdditionalProperties(parentAsset, templateAdditionalProperties);
}
}
}
/**
* Returns the stored display name property for the endpoint.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Return the description for the endpoint.
*
* @return String description
*/
public String getDescription()
{
return description;
}
/**
* Returns the stored address property for the endpoint.
* If no network address is available then null is returned.
*
* @return address
*/
public String getAddress()
{
return address;
}
/**
* Returns the stored protocol property for the endpoint.
* If no protocol is available then null is returned.
*
* @return protocol
*/
public String getProtocol()
{
return protocol;
}
/**
* Returns the stored encryptionMethod property for the endpoint. This is an open type allowing the information
* needed to work with a specific encryption mechanism used by the endpoint to be defined.
* If no encryptionMethod property is available (typically because this is an unencrypted endpoint)
* then null is returned.
*
* @return encryption method information
*/
public String getEncryptionMethod()
{
return encryptionMethod;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Endpoint{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", address='" + address + '\'' +
", protocol='" + protocol + '\'' +
", encryptionMethod='" + encryptionMethod + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* ExternalIdentifier stores information about an identifier for the asset that is used in an external system.
* This is used for correlating information about the asset across different systems.
*/
public class ExternalIdentifier extends Referenceable
{
/*
* Attributes of an external identifier
*/
private String identifier = null;
private String description = null;
private String usage = null;
private String source = null;
private KeyPattern keyPattern = null;
private Referenceable scope = null;
private String scopeDescription = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param identifier - the external identifier for the asset.
* @param description - the description of the external identifier.
* @param usage - usage guidance for this external identifier.
* @param source - source description for this external identifier.
* @param keyPattern enum - name of the key pattern used for this external identifier.
* @param scope - Referenceable scope of this external identifier. This depends on the key pattern.
* It may be a server definition, a reference data set or glossary term.
* @param scopeDescription - description of the scope for this external identifier.
*/
public ExternalIdentifier(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String identifier,
String description,
String usage,
String source,
KeyPattern keyPattern,
Referenceable scope,
String scopeDescription)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.identifier = identifier;
this.description = description;
this.usage = usage;
this.source = source;
this.keyPattern = keyPattern;
this.scope = scope;
this.scopeDescription = scopeDescription;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateExternalIdentifier - element to copy
*/
public ExternalIdentifier(AssetDescriptor parentAsset, ExternalIdentifier templateExternalIdentifier)
{
/*
* Initialize the super class.
*/
super(parentAsset, templateExternalIdentifier);
if (templateExternalIdentifier != null)
{
/*
* Copy the values from the supplied template.
*/
identifier = templateExternalIdentifier.getIdentifier();
description = templateExternalIdentifier.getDescription();
usage = templateExternalIdentifier.getUsage();
source = templateExternalIdentifier.getSource();
keyPattern = templateExternalIdentifier.getKeyPattern();
Referenceable templateScope = templateExternalIdentifier.getScope();
if (templateScope != null)
{
/*
* Ensure comment replies has this object's parent asset, not the template's.
*/
scope = new Referenceable(parentAsset, templateScope);
}
scopeDescription = templateExternalIdentifier.getScopeDescription();
}
}
/**
* Return the external identifier for this asset.
*
* @return String identifier
*/
public String getIdentifier() { return identifier; }
/**
* Return the description of the external identifier.
*
* @return String description
*/
public String getDescription() { return description; }
/**
* Return details of how, where and when this external identifier is used.
*
* @return String usage
*/
public String getUsage() { return usage; }
/**
* Return details of the source system where this external identifier comes from.
*
* @return String server
*/
public String getSource() { return source; }
/**
* Return the key pattern that is used with this external identifier.
*
* @return KeyPattern enum
*/
public KeyPattern getKeyPattern() { return keyPattern; }
/**
* Return the scope of this external identifier. This depends on the key pattern. It may be a server definition,
* a reference data set or glossary term.
*
* @return Referenceable scope
*/
public Referenceable getScope()
{
if (scope == null)
{
return scope;
}
else
{
return new Referenceable(super.getParentAsset(), scope);
}
}
/**
* Return the text description of the scope for this external identifier.
*
* @return String scope description
*/
public String getScopeDescription() { return scopeDescription; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ExternalIdentifier{" +
"identifier='" + identifier + '\'' +
", description='" + description + '\'' +
", usage='" + usage + '\'' +
", source='" + source + '\'' +
", keyPattern=" + keyPattern +
", scope=" + scope +
", scopeDescription='" + scopeDescription + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* ExternalIdentifiers supports an iterator over a list of external identifiers. Callers can use it to step through
* the list just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class ExternalIdentifiers extends AssetPropertyIteratorBase implements Iterator<ExternalIdentifier>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public ExternalIdentifiers(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public ExternalIdentifiers(AssetDescriptor parentAsset, ExternalIdentifiers template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new ExternalIdentifier(parentAsset, (ExternalIdentifier)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract ExternalIdentifiers cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return ExternalIdentifier - next element object that has been cloned.
*/
@Override
public ExternalIdentifier next()
{
return (ExternalIdentifier)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ExternalIdentifiers{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* ExternalReference stores information about an link to an external resource that is relevant to this asset.
*/
public class ExternalReference extends Referenceable
{
/*
* Attributes of an external reference
*/
private String referenceId = null;
private String linkDescription = null;
private String displayName = null;
private String uri = null;
private String resourceDescription = null;
private String version = null;
private String organization = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param referenceId the reference identifier for this asset's reference.
* @param linkDescription - description of the reference (with respect to this asset).
* @param displayName - display name for this external reference.
* @param uri - the URI used to retrieve the resource that this external reference represents.
* @param resourceDescription - the description of the resource that this external reference represents.
* @param version - the version of the resource that this external reference represents.
* @param organization - the name of the organization that owns the resource that this external reference represents.
*/
public ExternalReference(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String referenceId,
String linkDescription,
String displayName,
String uri,
String resourceDescription,
String version,
String organization)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.referenceId = referenceId;
this.linkDescription = linkDescription;
this.displayName = displayName;
this.uri = uri;
this.resourceDescription = resourceDescription;
this.version = version;
this.organization = organization;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateExternalReference - element to copy
*/
public ExternalReference(AssetDescriptor parentAsset, ExternalReference templateExternalReference)
{
/*
* Initialize the super class.
*/
super(parentAsset, templateExternalReference);
if (templateExternalReference != null)
{
/*
* Copy the values from the supplied template.
*/
referenceId = templateExternalReference.getReferenceId();
linkDescription = templateExternalReference.getLinkDescription();
displayName = templateExternalReference.getDisplayName();
uri = templateExternalReference.getURI();
resourceDescription = templateExternalReference.getResourceDescription();
version = templateExternalReference.getVersion();
organization = templateExternalReference.getOrganization();
}
}
/**
* Return the identifier given to this reference (with respect to this asset).
*
* @return String referenceId
*/
public String getReferenceId() { return referenceId; }
/**
* Return the description of the reference (with respect to this asset).
*
* @return String link description.
*/
public String getLinkDescription() { return linkDescription; }
/**
* Return the display name of this external reference.
*
* @return String display name.
*/
public String getDisplayName() { return displayName; }
/**
* Return the URI used to retrieve the resource that this external reference represents.
*
* @return String URI
*/
public String getURI() { return uri; }
/**
* Return the description of the resource that this external reference represents.
*
* @return String resource description
*/
public String getResourceDescription() { return resourceDescription; }
/**
* Return the version of the resource that this external reference represents.
*
* @return String version
*/
public String getVersion() { return version; }
/**
* Return the name of the organization that owns the resource that this external reference represents.
*
* @return String organization name
*/
public String getOrganization() { return organization; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ExternalReference{" +
"referenceId='" + referenceId + '\'' +
", linkDescription='" + linkDescription + '\'' +
", displayName='" + displayName + '\'' +
", uri='" + uri + '\'' +
", resourceDescription='" + resourceDescription + '\'' +
", version='" + version + '\'' +
", organization='" + organization + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* ExternalReferences supports an iterator over a list of external references. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class ExternalReferences extends AssetPropertyIteratorBase implements Iterator<ExternalReference>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public ExternalReferences(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public ExternalReferences(AssetDescriptor parentAsset, ExternalReferences template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new ExternalReference(parentAsset, (ExternalReference)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract ExternalReferences cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return ExternalReference - next element object that has been cloned.
*/
@Override
public ExternalReference next()
{
return (ExternalReference)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "ExternalReferences{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* Feedback contains the comments, tags, ratings and likes that consumers of the asset have created.
*/
public class Feedback extends AssetPropertyBase
{
/*
* Lists of objects that make up the feedback on the asset.
*/
private InformalTags informalTags = null;
private Likes likes = null;
private Ratings ratings = null;
private Comments comments = null;
/**
* Typical Constructor
*
* @param parentAsset - description of the asset that this feedback is attached to.
* @param informalTags - list of tags for the asset.
* @param likes - list of likes (one object per person liking the asset) for the asset.
* @param ratings - list of ratings that people have given the asset - one Rating object for each person's rating.
* @param comments - list of comments for the asset.
*/
public Feedback(AssetDescriptor parentAsset, InformalTags informalTags, Likes likes, Ratings ratings, Comments comments)
{
super(parentAsset);
this.informalTags = informalTags;
this.likes = likes;
this.ratings = ratings;
this.comments = comments;
}
/**
* Copy/clone constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the feedback clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this feedback is attached to.
* @param templateFeedback - template object to copy.
*/
public Feedback(AssetDescriptor parentAsset, Feedback templateFeedback)
{
super(parentAsset, templateFeedback);
/*
* Only create a child object if the template is not null.
*/
if (templateFeedback != null)
{
InformalTags templateInformalTags = templateFeedback.getInformalTags();
Likes templateLikes = templateFeedback.getLikes();
Ratings templateRatings = templateFeedback.getRatings();
Comments templateComments = templateFeedback.getComments();
if (templateInformalTags != null)
{
this.informalTags = templateInformalTags.cloneIterator(parentAsset);
}
if (templateLikes != null)
{
this.likes = templateLikes.cloneIterator(parentAsset);
}
if (templateRatings != null)
{
this.ratings = templateRatings.cloneIterator(parentAsset);
}
if (templateComments != null)
{
this.comments = templateComments.cloneIterator(parentAsset);
}
}
}
/**
* Returns a copy of the information tags for the asset in an iterator. This iterator can be used to step
* through the tags once. Therefore call getInformalTags() for each scan of the asset's tags.
*
* @return InformalTags - tag list
*/
public InformalTags getInformalTags()
{
if (informalTags == null)
{
return informalTags;
}
else
{
return informalTags.cloneIterator(super.getParentAsset());
}
}
/**
* Returns a copy of the likes for the asset in an iterator. This iterator can be used to step
* through the list of like once. Therefore call getLikes() for each scan of the asset's like objects.
*
* @return Likes - like object list
*/
public Likes getLikes()
{
if (likes == null)
{
return likes;
}
else
{
return likes.cloneIterator(super.getParentAsset());
}
}
/**
* Returns a copy of the ratings for the asset in an iterator. This iterator can be used to step
* through the ratings once. Therefore call getRatings() for each scan of the asset's ratings.
*
* @return Ratings - rating list
*/
public Ratings getRatings()
{
if (ratings == null)
{
return ratings;
}
else
{
return ratings.cloneIterator(super.getParentAsset());
}
}
/**
* Returns a copy of the comments for the asset in an iterator. This iterator can be used to step
* through the comments once. Therefore call getComments() for each scan of the asset's comments.
*
* @return Comments - comment list
*/
public Comments getComments()
{
if (comments == null)
{
return comments;
}
else
{
return comments.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Feedback{" +
"informalTags=" + informalTags +
", likes=" + likes +
", ratings=" + ratings +
", comments=" + comments +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.OCFErrorCode;
import org.apache.atlas.ocf.ffdc.OCFRuntimeException;
/**
* InformalTag stores information about a tag connected to an asset.
* InformalTags provide informal classifications to assets
* and can be added at any time.
*
* InformalTags have the userId of the person who added the tag, the name of the tag and its description.
*
* The content of the tag is a personal judgement (which is why the user's id is in the tag)
* and there is no formal review of the tags. However, they can be used as a basis for crowd-sourcing
* Glossary terms.
*
* Private InformalTags are only returned to the user that created them.
*/
public class InformalTag extends ElementHeader
{
/*
* Attributes of a InformalTag
*/
private boolean isPrivateTag = false;
private String name = null;
private String description = null;
private String user = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - enumeration of classifications
* @param isPrivateTag - boolean flag to say whether the tag is private or not.
* A private tag is only seen by the person who set it up.
* Public tags are visible to everyone how can sse the asset description.
* @param name - name of the tag. It is not valid to have a tag with no name.
* @param description - tag description
* @param user - the user id of the person who created the tag. Null means the user id is not known.
*/
public InformalTag(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
boolean isPrivateTag,
String name,
String description,
String user)
{
super(parentAsset, type, guid, url, classifications);
if (name == null || name.equals(""))
{
/*
* Build and throw exception. This should not happen - likely to be a problem in the
* repository connector.
*/
OCFErrorCode errorCode = OCFErrorCode.NULL_TAG_NAME;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(super.getParentAssetName(),
super.getParentAssetTypeName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"setName",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
this.isPrivateTag = isPrivateTag;
this.name = name;
this.description = description;
this.user = user;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateInformalTag - element to copy
*/
public InformalTag(AssetDescriptor parentAsset, InformalTag templateInformalTag)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateInformalTag);
if (templateInformalTag != null)
{
/*
* Copy the values from the supplied tag.
*/
isPrivateTag = templateInformalTag.isPrivateTag();
user = templateInformalTag.getUser();
name = templateInformalTag.getName();
description = templateInformalTag.getDescription();
}
}
/**
* Return boolean flag to say whether the tag is private or not. A private tag is only seen by the
* person who set it up. Public tags are visible to everyone who can see the asset description.
*
* @return boolean - is private flag
*/
public boolean isPrivateTag() {
return isPrivateTag;
}
/**
* Return the user id of the person who created the tag. Null means the user id is not known.
*
* @return String - tagging user
*/
public String getUser() {
return user;
}
/**
* Return the name of the tag. It is not valid to have a tag with no name. However, there is a point where
* the tag object is created and the tag name not set, so null is a possible response.
*
* @return String - tag name
*/
public String getName() {
return name;
}
/**
* Return the tag description - null means no description is available.
*
* @return String - tag description
*/
public String getDescription()
{
return description;
}
/**
* Set up the tag description - null means no description is available.
*
* @param tagDescription - tag description
*/
public void setDescription(String tagDescription) {
this.description = tagDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "InformalTag{" +
"isPrivateTag=" + isPrivateTag +
", name='" + name + '\'' +
", description='" + description + '\'' +
", user='" + user + '\'' +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* InformalTags supports an iterator over a list of informal tags. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class InformalTags extends AssetPropertyIteratorBase implements Iterator<InformalTag>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public InformalTags(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public InformalTags(AssetDescriptor parentAsset, InformalTags template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new InformalTag(parentAsset, (InformalTag)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract InformalTags cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return InformalTag - next element object that has been cloned.
*/
@Override
public InformalTag next()
{
return (InformalTag)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "InformalTags{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* A KeyPattern defines the type of External Identifier in use of an asset, or the type of Primary Key used within an
* asset.
*/
public enum KeyPattern implements Serializable
{
LOCAL_KEY(0, "Local Key", "Unique key allocated and used within the scope of a single system."),
RECYCLED_KEY(1, "Recycled Key", "Key allocated and used within the scope of a single system that is periodically reused for different records."),
NATURAL_KEY(2, "Natural Key", "Key derived from an attribute of the entity, such as email address, passport number."),
MIRROR_KEY(3, "Mirror Key", "Key value copied from another system."),
AGGREGATE_KEY(4, "Aggregate Key", "Key formed by combining keys from multiple systems."),
CALLERS_KEY(5, "Caller's Key", "Key from another system can bey used if system name provided."),
STABLE_KEY(6, "Stable Key", "Key value will remain active even if records are merged."),
OTHER(99, "Other", "Another key pattern.");
private static final long serialVersionUID = 1L;
private int keyPatternCode;
private String keyPatternName;
private String keyPatternDescription;
/**
* Typical Constructor
*/
KeyPattern(int keyPatternCode, String keyPatternName, String keyPatternDescription)
{
/*
* Save the values supplied
*/
this.keyPatternCode = keyPatternCode;
this.keyPatternName = keyPatternName;
this.keyPatternDescription = keyPatternDescription;
}
/**
* Return the code for this enum instance
*
* @return int - key pattern code
*/
public int getKeyPatternCode()
{
return keyPatternCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getKeyPatternName()
{
return keyPatternName;
}
/**
* Return the default description for the key pattern for this enum instance.
*
* @return String - default description
*/
public String getKeyPatternDescription()
{
return keyPatternDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "KeyPattern{" +
"keyPatternCode=" + keyPatternCode +
", keyPatternName='" + keyPatternName + '\'' +
", keyPatternDescription='" + keyPatternDescription + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Date;
/**
* <p>
* The data economy brings licensing to data and metadata. Even open data typically has a license.
* License stores the license permission associated with the asset.
* </p>
* <p>
* The license will define the permitted uses and other requirements for using the asset.
* </p>
*
*/
public class License extends Referenceable
{
/*
* properties of a license
*/
private String licenseTypeGUID = null;
private String licenseTypeName = null;
private String licensee = null;
private String summary = null;
private ExternalReference link = null;
private Date startDate = null;
private Date endDate = null;
private String licenseConditions = null;
private String createdBy = null;
private String custodian = null;
private String notes = null;
/**
* Typical constructor.
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param licenseTypeGUID - license type GUID
* @param licenseTypeName - the name of the type of the license.
* @param licensee - name of the organization or person that issued the license
* @param summary - a brief summary of the license.
* @param link - ExternalReference for full text of the license
* @param startDate - start date for the license.
* @param endDate - the end date for the license - null if license does not expire.
* @param licenseConditions - any special conditions that apply to the license - such as endorsements.
* @param createdBy - String name of the person or organization that set up the license agreement for this asset.
* @param custodian - the name of the person or organization that is responsible for the correct management
* of the asset according to the license.
* @param notes - the notes from the custodian.
*/
public License(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String licenseTypeGUID,
String licenseTypeName,
String licensee,
String summary,
ExternalReference link,
Date startDate,
Date endDate,
String licenseConditions,
String createdBy,
String custodian,
String notes)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.licenseTypeGUID = licenseTypeGUID;
this.licenseTypeName = licenseTypeName;
this.licensee = licensee;
this.summary = summary;
this.link = link;
this.startDate = startDate;
this.endDate = endDate;
this.licenseConditions = licenseConditions;
this.createdBy = createdBy;
this.custodian = custodian;
this.notes = notes;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateLicense - element to copy
*/
public License(AssetDescriptor parentAsset, License templateLicense)
{
super(parentAsset, templateLicense);
if (templateLicense != null)
{
licenseTypeGUID = templateLicense.getLicenseTypeGUID();
licenseTypeName = templateLicense.getLicenseName();
licensee = templateLicense.getLicensee();
summary = templateLicense.getSummary();
ExternalReference templateLink = templateLicense.getLink();
if (templateLink != null)
{
link = new ExternalReference(parentAsset, templateLink);
}
Date templateStartDate = templateLicense.getStartDate();
if (templateStartDate != null)
{
startDate = new Date(templateStartDate.getTime());
}
Date templateEndDate = templateLicense.getEndDate();
if (templateEndDate != null)
{
endDate = new Date(templateStartDate.getTime());
}
licenseConditions = templateLicense.getLicenseConditions();
createdBy = templateLicense.getCreatedBy();
custodian = templateLicense.getCustodian();
notes = templateLicense.getNotes();
}
}
/**
* Return the unique id for the type of license.
*
* @return String license type GUID
*/
public String getLicenseTypeGUID() { return licenseTypeGUID; }
/**
* Return the type of the license.
*
* @return String license type
*/
public String getLicenseName() { return licenseTypeName; }
/**
* Get the name of the organization or person that issued the license.
*
* @return String name
*/
public String getLicensee() { return licensee; }
/**
* Return a brief summary of the license.
*
* @return String summary
*/
public String getSummary() { return summary; }
/**
* Return the link to the full text of the license.
*
* @return ExternalReference for full text
*/
public ExternalReference getLink()
{
if (link == null)
{
return link;
}
else
{
return new ExternalReference(super.getParentAsset(), link);
}
}
/**
* Return the start date for the license.
*
* @return Date
*/
public Date getStartDate()
{
if (startDate == null)
{
return startDate;
}
else
{
return new Date(startDate.getTime());
}
}
/**
* Return the end date for the license.
*
* @return Date
*/
public Date getEndDate()
{
if (endDate == null)
{
return endDate;
}
else
{
return new Date(endDate.getTime());
}
}
/**
* Return any special conditions that apply to the license - such as endorsements.
*
* @return String license conditions
*/
public String getLicenseConditions() { return licenseConditions; }
/**
* Return the name of the person or organization that set up the license agreement for this asset.
*
* @return String name
*/
public String getCreatedBy() { return createdBy; }
/**
* Return the name of the person or organization that is responsible for the correct management of the asset
* according to the license.
*
* @return String name
*/
public String getCustodian() { return custodian; }
/**
* Return the notes for the custodian.
*
* @return String notes
*/
public String getNotes() { return notes; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "License{" +
"licenseTypeGUID='" + licenseTypeGUID + '\'' +
", licenseTypeName='" + licenseTypeName + '\'' +
", licensee='" + licensee + '\'' +
", summary='" + summary + '\'' +
", link=" + link +
", startDate=" + startDate +
", endDate=" + endDate +
", licenseConditions='" + licenseConditions + '\'' +
", createdBy='" + createdBy + '\'' +
", custodian='" + custodian + '\'' +
", notes='" + notes + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Licenses supports an iterator over a list of licenses for the asset. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Licenses extends AssetPropertyIteratorBase implements Iterator<License>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Licenses(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Licenses(AssetDescriptor parentAsset, Licenses template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new License(parentAsset, (License)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Licenses cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return License - next element object that has been cloned.
*/
@Override
public License next()
{
return (License)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Licenses{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* The Like properties object records a single user's "like" of an asset.
*/
public class Like extends ElementHeader
{
/*
* Attributes of a Like
*/
private String user = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - enumeration of classifications
* @param user - the user id of the person who created the like.
*/
public Like(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String user)
{
super(parentAsset, type, guid, url, classifications);
this.user = user;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateLike - element to copy
*/
public Like(AssetDescriptor parentAsset, Like templateLike)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateLike);
if (templateLike != null)
{
/*
* Copy the user name from the supplied like.
*/
user = templateLike.getUser();
}
}
/**
* Return the user id of the person who created the like. Null means the user id is not known.
*
* @return String - liking user
*/
public String getUser() {
return user;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Like{" +
"user='" + user + '\'' +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Likes supports an iterator over a list of like objects. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Likes extends AssetPropertyIteratorBase implements Iterator<Like>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Likes(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Likes(AssetDescriptor parentAsset, Likes template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Like(parentAsset, (Like)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Likes cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Like - next element object that has been cloned.
*/
@Override
public Like next()
{
return (Like)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Likes{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* Lineage shows the origin of the connected asset. It covers:
* <ul>
* <li>Design lineage - the known data movement and data stores that can supply data to this asset.</li>
* <li>Operational lineage - showing the jobs that ran to create this asset</li>
* </ul>
*
* Currently lineage is not implemented in the ConnectedAssetProperties interface because more design work is needed.
* This class is therefore a placeholder for lineage information.
*/
public class Lineage extends AssetPropertyBase
{
/**
* Typical constructor.
*
* @param parentAsset - description of the asset that this lineage is attached to.
*/
public Lineage(AssetDescriptor parentAsset)
{
/*
* Save descriptor of the asset that this lineage is attached to
*/
super(parentAsset);
}
/**
* Copy/clone constructor - - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the lineage clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this lineage is attached to.
* @param templateLineage - lineage object to copy.
*/
public Lineage(AssetDescriptor parentAsset, Lineage templateLineage)
{
super(parentAsset, templateLineage);
/*
* The open lineage design is still in progress so for the time being, this object does not do anything
* useful
*/
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Lineage{}";
}
}
\ 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.ocf.properties;
/**
* Location describes where the asset is located. The model allows a very flexible definition of location
* that can be set up at different levels of granularity.
*/
public class Location extends Referenceable
{
/*
* Properties that make up the location of the asset.
*/
private String displayName = null;
private String description = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - description property stored for the location.
*/
public Location(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
}
/**
* Copy/clone constructor
*
* @param parentAsset - description of the asset that this location is attached to.
* @param templateLocation - template object to copy.
*/
public Location(AssetDescriptor parentAsset, Location templateLocation)
{
super(parentAsset, templateLocation);
if (templateLocation != null)
{
displayName = templateLocation.getDisplayName();
description = templateLocation.getDescription();
}
}
/**
* Returns the stored display name property for the location.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Returns the stored description property for the location.
* If no description is provided then null is returned.
*
* @return description
*/
public String getDescription()
{
return description;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Location{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Locations supports an iterator over a list of locations. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Locations extends AssetPropertyIteratorBase implements Iterator<Location>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Locations(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Locations(AssetDescriptor parentAsset, Locations template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Location(parentAsset, (Location)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Locations cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Location - next element object that has been cloned.
*/
@Override
public Location next()
{
return (Location)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Locations{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* MapSchemaElement describes a schema element of type map. It stores the type of schema element for the domain
* (eg property name) for the map and the schema element for the range (eg property value) for the map.
*/
public class MapSchemaElement extends SchemaElement
{
private SchemaElement mapFromElement = null;
private SchemaElement mapToElement = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param versionNumber - the version number of the schema element - null means no version number.
* @param author - the name of the author of the schema element. Null means the author is unknown.
* @param usage - the usage guidance for this schema element. Null means no guidance available.
* @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
* @param mapFromElement - the type of schema element that represents the key or property name for the map.
* This is also called the domain of the map.
* @param mapToElement - the type of schema element that represents the property value for the map.
* This is also called the range of the map.
*/
public MapSchemaElement(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String versionNumber,
String author,
String usage,
String encodingStandard,
SchemaElement mapFromElement,
SchemaElement mapToElement)
{
super(parentAsset,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
versionNumber,
author,
usage,
encodingStandard);
this.mapFromElement = mapFromElement;
this.mapToElement = mapToElement;
}
/**
* Copy/clone Constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the definitions clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this map is attached to.
* @param templateSchema - template object to copy.
*/
public MapSchemaElement(AssetDescriptor parentAsset, MapSchemaElement templateSchema)
{
super(parentAsset, templateSchema);
if (templateSchema != null)
{
SchemaElement templateMapFromElement = templateSchema.getMapFromElement();
SchemaElement templateMapToElement = templateSchema.getMapToElement();
if (templateMapFromElement != null)
{
mapFromElement = templateMapFromElement.cloneSchemaElement(super.getParentAsset());
}
if (templateMapToElement != null)
{
mapToElement = templateMapToElement.cloneSchemaElement(super.getParentAsset());
}
}
}
/**
* Return the type of schema element that represents the key or property name for the map.
* This is also called the domain of the map.
*
* @return SchemaElement
*/
public SchemaElement getMapFromElement()
{
return mapFromElement;
}
/**
* Return the type of schema element that represents the property value for the map.
* This is also called the range of the map.
*
* @return SchemaElement
*/
public SchemaElement getMapToElement()
{
return mapToElement;
}
/**
* Returns a clone of this object as the abstract SchemaElement class.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @return SchemaElement
*/
@Override
public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset)
{
return new MapSchemaElement(parentAsset, this);
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "MapSchemaElement{" +
"mapFromElement=" + mapFromElement +
", mapToElement=" + mapToElement +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.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
{
/*
* Attributes of a meaning object definition
*/
private String name = null;
private String description = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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.
*/
public Meaning(AssetDescriptor parentAsset,
ElementType type,
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);
this.name = name;
this.description = description;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateMeaning - element to copy
*/
public Meaning(AssetDescriptor parentAsset, Meaning templateMeaning)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateMeaning);
if (templateMeaning != null)
{
/*
* Copy the values from the supplied meaning object.
*/
name = templateMeaning.getName();
description = templateMeaning.getDescription();
}
}
/**
* Return the glossary term name.
*
* @return String name
*/
public String getName()
{
return name;
}
/**
* Return the description of the glossary term.
*
* @return String description
*/
public String getDescription()
{
return description;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Meaning{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Meanings supports an iterator over a list of glossary definitions. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Meanings extends AssetPropertyIteratorBase implements Iterator<Meaning>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Meanings(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Meanings(AssetDescriptor parentAsset, Meanings template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Meaning(parentAsset, (Meaning)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Meanings cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Meaning - next element object that has been cloned.
*/
@Override
public Meaning next()
{
return (Meaning)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Meanings{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import java.util.Date;
/**
* Note defines the properties of a single note in a note log.
*/
public class Note extends Referenceable
{
/*
* Attributes of a Note
*/
private String text = null;
private Date lastUpdate = null;
private String user = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param text - the text of the note
* @param lastUpdate - the last update date for the note.
* @param user - the user id of the person who created the note
*/
public Note(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String text,
Date lastUpdate,
String user)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.text = text;
this.lastUpdate = lastUpdate;
this.user = user;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateNote - note to copy
*/
public Note(AssetDescriptor parentAsset, Note templateNote)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateNote);
if (templateNote != null)
{
/*
* Copy the properties from the supplied note.
*/
text = templateNote.getText();
user = templateNote.getUser();
Date templateLastUpdate = templateNote.getLastUpdate();
if (templateLastUpdate != null)
{
lastUpdate = new Date(templateLastUpdate.getTime());
}
}
}
/**
* Return the text of the note.
*
* @return String text
*/
public String getText() { return text; }
/**
* Return the last time a change was made to this note.
*
* @return Date last update
*/
public Date getLastUpdate()
{
if (lastUpdate == null)
{
return lastUpdate;
}
else
{
return new Date(lastUpdate.getTime());
}
}
/**
* Return the user id of the person who created the note. Null means the user id is not known.
*
* @return String - liking user
*/
public String getUser() {
return user;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Note{" +
"text='" + text + '\'' +
", lastUpdate=" + lastUpdate +
", user='" + user + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* NoteLog manages a list of notes for an asset
*/
public class NoteLog extends Referenceable
{
/*
* Attributes of an note log
*/
private String displayName = null;
private String description = null;
private Notes notes = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - description property stored for the note log.
* @param notes - list of notes for this note log.
*/
public NoteLog(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
Notes notes)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.notes = notes;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateNotelog - note log to copy
*/
public NoteLog(AssetDescriptor parentAsset, NoteLog templateNotelog)
{
/*
* Initialize the super class.
*/
super(parentAsset, templateNotelog);
if (templateNotelog != null)
{
/*
* Copy the values from the supplied template.
*/
displayName = templateNotelog.getDisplayName();
description = templateNotelog.getDescription();
Notes templateNotes = templateNotelog.getNotes();
if (templateNotes != null)
{
notes = templateNotes.cloneIterator(parentAsset);
}
}
}
/**
* Returns the stored display name property for the note log.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Returns the stored description property for the note log.
* If no description is provided then null is returned.
*
* @return description
*/
public String getDescription()
{
return description;
}
/**
* Return the list of notes defined for this note log.
*
* @return Notes - list of notes
*/
public Notes getNotes()
{
if (notes == null)
{
return notes;
}
else
{
return notes.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "NoteLog{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", notes=" + notes +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* NoteLogs supports an iterator over a list of note logs. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class NoteLogs extends AssetPropertyIteratorBase implements Iterator<NoteLog>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public NoteLogs(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public NoteLogs(AssetDescriptor parentAsset, NoteLogs template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new NoteLog(parentAsset, (NoteLog)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract NoteLogs cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return NoteLog - next element object that has been cloned.
*/
@Override
public NoteLog next()
{
return (NoteLog)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "NoteLogs{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Notes supports an iterator over a list of notes within a note log. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Notes extends AssetPropertyIteratorBase implements Iterator<Note>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Notes(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Notes(AssetDescriptor parentAsset, Notes template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Note(parentAsset, (Note)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Notes cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Note - next element object that has been cloned.
*/
@Override
public Note next()
{
return (Note)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Notes{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.OCFErrorCode;
import org.apache.atlas.ocf.ffdc.OCFRuntimeException;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Iterator;
/**
* PagingIterator supports an iterator over a list of objects that extend AssetPropertyBase.
* Callers can use it to step through the list just once. If they want to parse the list again,
* they could use the copy/clone constructor to create a new iterator.
*
* PagingIterator provides paging support to enable the list in the iterator to be much bigger than
* can be stored in memory. It maintains pointers for the full list, and a potentially smaller
* cached list that is used to batch up elements being retrieved from the property (metadata) server.
* Thus is combines the ability to process very large lists whilst minimising the chatter with the property server.
*
* The class uses a number of pointers and counts. Imagine a list of 4000 columns in a table.
* We can not retrieve all 4000 columns on one call. So we retrieve subsets over a number of REST calls as the
* caller walks through the full list.
* <ul>
* <li>
* totalElement is 4000 - ie how many elements there are in total.
* </li>
* <li>
* maxCacheSize is the maximum elements we can retrieve in one call
* </li>
* <li>
* cachedElementList.size() is how many elements we have in memory at this time.
* </li>
* </ul>
*
* cachedElementList.size() is set to maxCacheSize() for all retrieves except for processing the last cache of elements.
* For example, if the totalElement is 25 and the maxCacheSize() is 10 then we would retrieve 3 caches -
* the first two would have 10 elements in them and the third will have 5 elements.
* In the first 2 retrieves, maxCacheSize and cachedElementList.size() are set to 10.
* In the last one, maxCacheSize==10 and cachedElementList.size()==5.
*/
public class PagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase>
{
private int maxCacheSize = 1;
private int totalElementCount = 0;
private int cachedElementStart = 0;
private ArrayList<AssetPropertyBase> cachedElementList = new ArrayList<>();
private int cachedElementPointer = 0;
private AssetPropertyIteratorBase iterator = null;
private static final Logger log = LoggerFactory.getLogger(PagingIterator.class);
/**
* Typical Constructor creates an iterator with the supplied list of comments.
*
* @param parentAsset - descriptor of parent asset.
* @param iterator - type-specific iterator that wraps this paging iterator.
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public PagingIterator(AssetDescriptor parentAsset,
AssetPropertyIteratorBase iterator,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset);
if (log.isDebugEnabled())
{
log.debug("New PagingIterator:");
log.debug("==> totalElementCount: " + totalElementCount);
log.debug("==> maxCacheSize: " + maxCacheSize);
}
if (totalElementCount > 0)
{
this.totalElementCount = totalElementCount;
}
if (maxCacheSize > 0)
{
this.maxCacheSize = maxCacheSize;
}
if (iterator != null)
{
this.iterator = iterator;
}
else
{
/*
* Throw runtime exception to show the caller they are not using the list correctly.
*/
OCFErrorCode errorCode = OCFErrorCode.NO_ITERATOR;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(),
super.getParentAssetName(),
super.getParentAssetTypeName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"next",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param iterator - type-specific iterator that wraps this paging iterator.
* @param templateIterator - template to copy; null to create an empty iterator
*/
public PagingIterator(AssetDescriptor parentAsset,
AssetPropertyIteratorBase iterator,
PagingIterator templateIterator)
{
super(parentAsset, templateIterator);
if (templateIterator != null)
{
this.cachedElementStart = 0;
this.cachedElementPointer = 0;
this.cachedElementList = new ArrayList<>();
if (templateIterator.totalElementCount > 0)
{
this.totalElementCount = templateIterator.totalElementCount;
}
if (templateIterator.maxCacheSize > 0)
{
this.maxCacheSize = templateIterator.maxCacheSize;
}
if (iterator != null)
{
this.iterator = iterator;
}
else
{
/*
* Throw runtime exception to show the caller they are not using the list correctly.
*/
OCFErrorCode errorCode = OCFErrorCode.NO_ITERATOR;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(),
super.getParentAssetName(),
super.getParentAssetTypeName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"next",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
if (templateIterator.cachedElementStart == 0)
{
/*
* The template's cache starts at the beginning of the total list so ok to copy it.
*/
for (AssetPropertyBase templateElement : templateIterator.cachedElementList)
{
this.cachedElementList.add(iterator.cloneElement(parentAsset, templateElement));
}
}
}
}
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return (cachedElementStart < totalElementCount);
}
/**
* Return the next element in the list
*
* @return AssetPropertyBase - next element.
* @throws OCFRuntimeException - if there are no more elements in the list or there are problems retrieving
* elements from the property (metadata) server.
*/
@Override
public AssetPropertyBase next()
{
/*
* Check more elements available
*/
if (this.hasNext())
{
AssetPropertyBase retrievedElement = null;
/*
* If the pointer is at the end of the cache then retrieve more content from the property (metadata)
* server.
*/
if (cachedElementPointer == cachedElementList.size())
{
try
{
cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize);
cachedElementPointer = 0;
}
catch (PropertyServerException error)
{
/*
* Problem retrieving next cache. The exception includes a detailed error message,
*/
OCFErrorCode errorCode = OCFErrorCode.PROPERTIES_NOT_AVAILABLE;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(error.getErrorMessage(),
this.toString());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"next",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction(),
error);
}
}
retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer));
cachedElementPointer++;
cachedElementStart++;
if (log.isDebugEnabled())
{
log.debug("Returning next element:");
log.debug("==> totalElementCount: " + totalElementCount);
log.debug("==> cachedElementPointer: " + cachedElementPointer);
log.debug("==> cachedElementStart:" + cachedElementStart);
log.debug("==> maxCacheSize:" + maxCacheSize);
}
return retrievedElement;
}
else
{
/*
* Throw runtime exception to show the caller they are not using the list correctly.
*/
OCFErrorCode errorCode = OCFErrorCode.NO_MORE_ELEMENTS;
String errorMessage = errorCode.getErrorMessageId()
+ errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(),
super.getParentAssetName(),
super.getParentAssetTypeName());
throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
this.getClass().getName(),
"next",
errorMessage,
errorCode.getSystemAction(),
errorCode.getUserAction());
}
}
/**
* Return the number of elements in the list.
*
* @return elementCount
*/
public int getElementCount()
{
return totalElementCount;
}
/**
* Remove the current element in the iterator.
*/
@Override
public void remove()
{
/*
* Nothing to do since the removed element can never be revisited through this instance.
*/
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "PagingIterator{" +
"maxCacheSize=" + maxCacheSize +
", totalElementCount=" + totalElementCount +
", cachedElementStart=" + cachedElementStart +
", cachedElementList=" + cachedElementList +
", cachedElementPointer=" + cachedElementPointer +
'}';
}
}
\ 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.ocf.properties;
/**
* PrimitiveSchemaElement describes a schema element that has a primitive type. This class stores which
* type of primitive type it is an a default value if supplied.
*/
public class PrimitiveSchemaElement extends SchemaElement
{
private String dataType = null;
private String defaultValue = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param versionNumber - the version number of the schema element - null means no version number.
* @param author - the name of the author of the schema element. Null means the author is unknown.
* @param usage - the usage guidance for this schema element. Null means no guidance available.
* @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
* @param dataType - the name of the data type for this element. Null means unknown data type.
* @param defaultValue - String containing default value for the element
*/
public PrimitiveSchemaElement(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String versionNumber,
String author,
String usage,
String encodingStandard,
String dataType,
String defaultValue)
{
super(parentAsset,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
versionNumber,
author,
usage,
encodingStandard);
this.dataType = dataType;
this.defaultValue = defaultValue;
}
/**
* Copy/clone Constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the definitions clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @param templateSchemaElement - template object to copy.
*/
public PrimitiveSchemaElement(AssetDescriptor parentAsset, PrimitiveSchemaElement templateSchemaElement)
{
super(parentAsset, templateSchemaElement);
if (templateSchemaElement != null)
{
dataType = templateSchemaElement.getDataType();
defaultValue = templateSchemaElement.getDefaultValue();
}
}
/**
* Return the data type for this element. Null means unknown data type.
*
* @return String DataType
*/
public String getDataType() { return dataType; }
/**
* Return the default value for the element. Null means no default value set up.
*
* @return String containing default value
*/
public String getDefaultValue() { return defaultValue; }
/**
* Returns a clone of this object as the abstract SchemaElement class.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @return PrimitiveSchemaElement object
*/
@Override
public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset)
{
return new PrimitiveSchemaElement(parentAsset, this);
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "PrimitiveSchemaElement{" +
"dataType='" + dataType + '\'' +
", defaultValue='" + defaultValue + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
import java.util.UUID;
/**
* This property header implements any common mechanisms that all property objects need.
*/
public abstract class PropertyBase implements Serializable
{
private static final long serialVersionUID = 1L;
private int hashCode = UUID.randomUUID().hashCode();
/**
* Typical Constructor
*/
public PropertyBase()
{
/*
* Nothing to do. This constructor is included so variables are added in this class at a later date
* without impacting the subclasses.
*/
}
/**
* Copy/clone Constructor - the resulting object will return true if tested with this.equals(template) as
* long as the template object is not null;
*
* @param template - object being copied
*/
public PropertyBase(PropertyBase template)
{
/*
* The hashCode value is replaced with the value from the template so the template object and this
* new object will return equals set to true.
*/
if (template != null)
{
hashCode = template.hashCode();
}
}
/**
* Provide a common implementation of hashCode for all OCF properties 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 properties
* object. This method may be overridden by subclasses.
*/
public int hashCode()
{
return hashCode;
}
/**
* Provide a common implementation of equals for all OCF properties objects. The UUID is unique and
* is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the properties
* object.
*
* @param object - object to test
* @return boolean flag
*/
@Override
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (object == null || getClass() != object.getClass())
{
return false;
}
PropertyBase that = (PropertyBase) object;
return hashCode == that.hashCode;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "PropertyBase{" +
"hashCode=" + hashCode +
'}';
}
}
\ 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.ocf.properties;
/**
* Stores information about a rating connected to an asset. Ratings provide informal feedback on the quality of assets
* and can be added at any time.
*
* Ratings have the userId of the person who added it, a star rating and an optional review comment.
*
* The content of the rating is a personal judgement (which is why the user's id is in the object)
* and there is no formal review of the ratings. However, they can be used as a basis for crowd-sourcing
* feedback to asset owners.
*/
public class Rating extends ElementHeader
{
/*
* Attributes of a Rating
*/
private StarRating starRating = null;
private String review = null;
private String user = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @param guid - String - unique id
* @param url - String - URL
* @param classifications - enumeration of classifications
* @param starRating - StarRating enum - the star value for the rating.
* @param review - String - review comments
* @param user - String - user id of person providing the rating
*/
public Rating(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
StarRating starRating,
String review,
String user)
{
super(parentAsset, type, guid, url, classifications);
this.starRating = starRating;
this.review = review;
this.user = user;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateRating - element to copy
*/
public Rating(AssetDescriptor parentAsset, Rating templateRating)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateRating);
if (templateRating != null)
{
/*
* Copy the values from the supplied tag.
*/
user = templateRating.getUser();
starRating = templateRating.getStarRating();
review = templateRating.getReview();
}
}
/**
* Return the user id of the person who created the rating. Null means the user id is not known.
*
* @return String - user
*/
public String getUser() {
return user;
}
/**
* Return the stars for the rating.
*
* @return StarRating - starRating
*/
public StarRating getStarRating() {
return starRating;
}
/**
* Return the review comments - null means no review is available.
*
* @return String - review comments
*/
public String getReview()
{
return review;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Rating{" +
"starRating=" + starRating +
", review='" + review + '\'' +
", user='" + user + '\'' +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* Ratings supports an iterator over a list of ratings for an asset.
* Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class Ratings extends AssetPropertyIteratorBase implements Iterator<Rating>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public Ratings(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public Ratings(AssetDescriptor parentAsset, Ratings template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new Rating(parentAsset, (Rating)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract Ratings cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return Rating - next element object that has been cloned.
*/
@Override
public Rating next()
{
return (Rating)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Ratings{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* Many open metadata entities are referenceable. It means that they have a qualified name and additional
* properties. In addition the Referenceable class adds support for the parent asset, guid, url and type
* for the entity through extending ElementHeader.
*/
public class Referenceable extends ElementHeader
{
/*
* Attributes of a Referenceable
*/
protected String qualifiedName = null;
protected AdditionalProperties additionalProperties = null;
/*
* Attached glossary terms
*/
protected Meanings meanings = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
*/
public Referenceable(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings)
{
super(parentAsset, type, guid, url, classifications);
this.qualifiedName = qualifiedName;
this.additionalProperties = additionalProperties;
this.meanings = meanings;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateReferenceable - element to copy
*/
public Referenceable(AssetDescriptor parentAsset, Referenceable templateReferenceable)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateReferenceable);
if (templateReferenceable != null)
{
/*
* Copy the qualified name from the supplied template.
*/
qualifiedName = templateReferenceable.getQualifiedName();
/*
* Create a copy of the additional properties since the parent asset may have changed.
*/
AdditionalProperties templateAdditionalProperties = templateReferenceable.getAdditionalProperties();
if (templateAdditionalProperties != null)
{
additionalProperties = new AdditionalProperties(parentAsset, templateAdditionalProperties);
}
/*
* Create a copy of any glossary terms
*/
Meanings templateMeanings = templateReferenceable.getMeanings();
if (templateMeanings != null)
{
meanings = templateMeanings.cloneIterator(parentAsset);
}
}
}
/**
* Returns the stored qualified name property for the metadata entity.
* If no qualified name is available then the empty string is returned.
*
* @return qualifiedName
*/
public String getQualifiedName()
{
return qualifiedName;
}
/**
* Return a copy of the additional properties. Null means no additional properties are available.
*
* @return AdditionalProperties
*/
public AdditionalProperties getAdditionalProperties()
{
if (additionalProperties == null)
{
return additionalProperties;
}
else
{
return new AdditionalProperties(super.getParentAsset(), additionalProperties);
}
}
/**
* Return a list of the glossary terms attached to this referenceable object. Null means no terms available.
*
* @return list of glossary terms (summary)
*/
public Meanings getMeanings()
{
if (meanings == null)
{
return meanings;
}
else
{
return meanings.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Referenceable{" +
"qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
/**
* RelatedAsset describes assets that are related to this asset. For example, if the asset is a data store, the
* related assets could be its supported data sets.
*/
public class RelatedAsset extends Referenceable
{
/*
* Properties that make up the summary properties of the related asset.
*/
private String displayName = null;
private String description = null;
private String owner = null;
/*
* The detailed properties that are retrieved from the server
*/
private RelatedAssetProperties relatedAssetProperties = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - description property stored for the related asset.
* @param owner - the owner details for this related asset.
* @param relatedAssetProperties - detailed properties of the asset.
*/
public RelatedAsset(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
String owner,
RelatedAssetProperties relatedAssetProperties)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.displayName = displayName;
this.description = description;
this.owner = owner;
this.relatedAssetProperties = relatedAssetProperties;
}
/**
* Copy/clone constructor
*
* @param parentAsset - description of the asset that this related asset is attached to.
* @param templateRelatedAsset - template object to copy.
*/
public RelatedAsset(AssetDescriptor parentAsset, RelatedAsset templateRelatedAsset)
{
super(parentAsset, templateRelatedAsset);
if (templateRelatedAsset != null)
{
displayName = templateRelatedAsset.getDisplayName();
description = templateRelatedAsset.getDescription();
owner = templateRelatedAsset.getOwner();
}
}
/**
* Returns the stored display name property for the related asset.
* If no display name is available then null is returned.
*
* @return displayName
*/
public String getDisplayName()
{
return displayName;
}
/**
* Returns the stored description property for the related asset.
* If no description is provided then null is returned.
*
* @return description
*/
public String getDescription()
{
return description;
}
/**
* Returns the details of the owner for this related asset.
*
* @return String owner
*/
public String getOwner() { return owner; }
/**
* Return the detailed properties for a related asset.
*
* @return a refreshed version of the RelatedAssetProperties
* @throws PropertyServerException - problems communicating with the property (metadata) server
*/
public RelatedAssetProperties getRelatedAssetProperties() throws PropertyServerException
{
if (relatedAssetProperties != null)
{
relatedAssetProperties.refresh();
}
return relatedAssetProperties;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedAsset{" +
"displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", owner='" + owner + '\'' +
", relatedAssetProperties=" + relatedAssetProperties +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import org.apache.atlas.ocf.ffdc.PropertyServerException;
/**
* RelatedAssetProperties returns detailed information about an asset that is related to a connected asset.
*
* It is a generic interface for all types of open metadata assets. However, it assumes the asset's metadata model
* inherits from <b>Asset</b> (see model 0010 in Area 0).
*
* The RelatedAssetProperties returns metadata about the asset at three levels of detail:
* <ul>
* <li><b>assetSummary</b> - used for displaying details of the asset in summary lists or hover text</li>
* <li><b>assetDetail</b> - used to display all of the information known about the asset with summaries
* of the relationships to other metadata entities</li>
* <li><b>assetUniverse</b> - used to define the broader context for the asset</li>
* </ul>
*
* RelatedAssetProperties is a base class for the asset information that returns null,
* for the asset's properties. Metadata repository implementations extend this class to add their
* implementation of the refresh() method that calls to the metadata repository to populate the metadata properties.
*/
public abstract class RelatedAssetProperties extends PropertyBase
{
/*
* AssetUniverse extends AssetDetails which extends AssetSummary. The interaction with the metadata repository
* pulls the asset universe in one single network interaction and the caller can then explore the metadata
* property by property without incurring many network interactions (unless there are too many instances
* of a particular type of property and one of the iterators is forced to use paging).
*
* If null is returned, the caller is not linked to a metadata repository.
*/
protected AssetUniverse assetProperties = null;
protected AssetDescriptor connectedAsset = null;
protected RelatedAsset relatedAsset = null;
/**
* Typical constructor.
*
* @param connectedAsset - original top-level asset
* @param relatedAsset - asset to extract the full set of properties.
*/
public RelatedAssetProperties(AssetDescriptor connectedAsset, RelatedAsset relatedAsset)
{
/*
* Remember the parent asset and details of the related asset to be retrieved.
*/
this.connectedAsset = connectedAsset;
this.relatedAsset = relatedAsset;
}
/**
* Copy/clone constructor*
*
* @param templateProperties - template to copy
*/
public RelatedAssetProperties(RelatedAssetProperties templateProperties)
{
if (templateProperties != null)
{
AssetUniverse templateAssetUniverse = templateProperties.getAssetUniverse();
if (templateAssetUniverse != null)
{
assetProperties = new AssetUniverse(templateAssetUniverse);
connectedAsset = templateProperties.connectedAsset;
relatedAsset = templateProperties.relatedAsset;
}
}
}
/**
* Returns the summary information organized in the assetSummary structure.
*
* @return AssetSummary - summary object
*/
public AssetSummary getAssetSummary() { return assetProperties; }
/**
* Returns detailed information about the asset organized in the assetDetail structure.
*
* @return AssetDetail - detail object
*/
public AssetDetail getAssetDetail() { return assetProperties; }
/**
* Returns all of the detail of the asset and information connected to it in organized in the assetUniverse
* structure.
*
* @return AssetUniverse - universe object
*/
public AssetUniverse getAssetUniverse() { return assetProperties; }
/**
* Request the values in the RelatedAssetProperties are refreshed with the current values from the
* metadata repository.
*
* @throws PropertyServerException - there is a problem connecting to the server to retrieve metadata.
*/
public abstract void refresh() throws PropertyServerException;
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedAssetProperties{" +
"assetProperties=" + assetProperties +
", connectedAsset=" + connectedAsset +
", relatedAsset=" + relatedAsset +
'}';
}
}
/*
* 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;
import java.util.Iterator;
/**
* RelatedAssets supports an iterator over a list of related assets. Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class RelatedAssets extends AssetPropertyIteratorBase implements Iterator<RelatedAsset>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public RelatedAssets(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public RelatedAssets(AssetDescriptor parentAsset, RelatedAssets template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new RelatedAsset(parentAsset, (RelatedAsset)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract RelatedAssets cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return RelatedAsset - next element object that has been cloned.
*/
@Override
public RelatedAsset next()
{
return (RelatedAsset)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedAssets{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import java.util.ArrayList;
import java.util.List;
/**
* RelatedMediaReference stores information about an link to an external media file that
* is relevant to this asset.
*/
public class RelatedMediaReference extends Referenceable
{
/*
* Attributes of a related media reference
*/
private String mediaId = null;
private String linkDescription = null;
private String displayName = null;
private String uri = null;
private String resourceDescription = null;
private String version = null;
private String organization = null;
private RelatedMediaType mediaType = null;
private ArrayList<RelatedMediaUsage> mediaUsageList = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param mediaId the reference identifier for this asset's related media.
* @param linkDescription - description of the reference (with respect to this asset).
* @param displayName - consumable name
* @param uri - the URI used to retrieve the resource for this media reference.
* @param resourceDescription - the description of this external media.
* @param version - the version of the resource that this external reference represents.
* @param organization - the name of the organization that owns the resource that this external reference represents.
* @param mediaType - the type of media referenced
* @param mediaUsageList - List of ways the media may be used
*/
public RelatedMediaReference(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String mediaId,
String linkDescription,
String displayName,
String uri,
String resourceDescription,
String version,
String organization,
RelatedMediaType mediaType,
ArrayList<RelatedMediaUsage> mediaUsageList)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.mediaId = mediaId;
this.linkDescription = linkDescription;
this.displayName = displayName;
this.uri = uri;
this.resourceDescription = resourceDescription;
this.version = version;
this.organization = organization;
this.mediaType = mediaType;
this.mediaUsageList = mediaUsageList;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateRelatedMediaReference - element to copy
*/
public RelatedMediaReference(AssetDescriptor parentAsset,
RelatedMediaReference templateRelatedMediaReference)
{
/*
* Initialize the super class.
*/
super(parentAsset, templateRelatedMediaReference);
if (templateRelatedMediaReference != null)
{
/*
* Copy the values from the supplied template.
*/
mediaId = templateRelatedMediaReference.getMediaId();
linkDescription = templateRelatedMediaReference.getLinkDescription();
displayName = templateRelatedMediaReference.getDisplayName();
uri = templateRelatedMediaReference.getURI();
resourceDescription = templateRelatedMediaReference.getResourceDescription();
version = templateRelatedMediaReference.getVersion();
organization = templateRelatedMediaReference.getOrganization();
mediaType = templateRelatedMediaReference.getMediaType();
List<RelatedMediaUsage> templateMediaUsageList = templateRelatedMediaReference.getMediaUsageList();
if (templateMediaUsageList != null)
{
mediaUsageList = new ArrayList<RelatedMediaUsage>(templateMediaUsageList);
}
}
}
/**
* Return the identifier given to this reference (with respect to this asset).
*
* @return String mediaId
*/
public String getMediaId() { return mediaId; }
/**
* Return the description of the reference (with respect to this asset).
*
* @return String link description.
*/
public String getLinkDescription() { return linkDescription; }
/**
* Return the display name of this media reference.
*
* @return String display name.
*/
public String getDisplayName() { return displayName; }
/**
* Return the URI used to retrieve the resource for this media reference.
*
* @return String URI
*/
public String getURI() { return uri; }
/**
* Return the description of this external media.
*
* @return String resource description
*/
public String getResourceDescription() { return resourceDescription; }
/**
* Return the version of the resource that this media reference represents.
*
* @return String version
*/
public String getVersion() { return version; }
/**
* Return the name of the organization that owns the resource that this external reference represents.
*
* @return String organization name
*/
public String getOrganization() { return organization; }
/**
* Return the type of media referenced.
*
* @return RelatedMediaType
*/
public RelatedMediaType getMediaType() { return mediaType; }
/**
* Return the list of recommended usage for the related media. Null means no usage guidance is available.
*
* @return List of RelatedMediaUsage
*/
public ArrayList<RelatedMediaUsage> getMediaUsageList()
{
if (mediaUsageList != null)
{
return mediaUsageList;
}
else
{
return new ArrayList<RelatedMediaUsage>(mediaUsageList);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedMediaReference{" +
"mediaId='" + mediaId + '\'' +
", linkDescription='" + linkDescription + '\'' +
", displayName='" + displayName + '\'' +
", uri='" + uri + '\'' +
", resourceDescription='" + resourceDescription + '\'' +
", version='" + version + '\'' +
", organization='" + organization + '\'' +
", mediaType=" + mediaType +
", mediaUsageList=" + mediaUsageList +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* RelatedMediaReferences supports an iterator over a list of related media references. Callers can use it to step
* through the list just once. If they want to parse the list again, they could use the copy/clone constructor to
* create a new iterator.
*/
public abstract class RelatedMediaReferences extends AssetPropertyIteratorBase implements Iterator<RelatedMediaReference>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public RelatedMediaReferences(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public RelatedMediaReferences(AssetDescriptor parentAsset, RelatedMediaReferences template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new RelatedMediaReference(parentAsset, (RelatedMediaReference)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract RelatedMediaReferences cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return RelatedMediaReference - next element object that has been cloned.
*/
@Override
public RelatedMediaReference next()
{
return (RelatedMediaReference)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedMediaReferences{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* The RelatedMediaType defines the type of resource referenced in a related media reference.
* <ul>
* <li>Image - The media is an image.</li>
* <li>Audio - The media is an audio recording.</li>
* <li>Document - The media is a text document - probably rich text.</li>
* <li>Video - The media is a video recording.</li>
* <li>Other - The media type is not supported.</li>
* </ul>
*/
public enum RelatedMediaType implements Serializable
{
IMAGE(0, "Image", "The media is an image."),
AUDIO(1, "Audio", "The media is an audio recording."),
DOCUMENT(2, "Document", "The media is a text document - probably rich text."),
VIDEO(3, "Video", "The media is a video recording."),
OTHER(99, "Other", "The media type is not supported.");
private static final long serialVersionUID = 1L;
private int mediaTypeCode;
private String mediaTypeName;
private String mediaTypeDescription;
/**
* Typical Constructor
*/
RelatedMediaType(int mediaTypeCode, String mediaTypeName, String mediaTypeDescription)
{
/*
* Save the values supplied
*/
this.mediaTypeCode = mediaTypeCode;
this.mediaTypeName = mediaTypeName;
this.mediaTypeDescription = mediaTypeDescription;
}
/**
* Return the code for this enum instance
*
* @return int - media type code
*/
public int getMediaUsageCode()
{
return mediaTypeCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getMediaUsageName()
{
return mediaTypeName;
}
/**
* Return the default description for this enum instance.
*
* @return String - default description
*/
public String getMediaTypeDescription()
{
return mediaTypeDescription;
}
}
\ 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.ocf.properties;
import java.io.Serializable;
/**
* The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties.
* These usage options are not mutually exclusive.
*/
public enum RelatedMediaUsage implements Serializable
{
ICON (0, "Icon", "Provides a small image to represent the asset in tree views and graphs."),
THUMBNAIL (1, "Thumbnail", "Provides a small image about the asset that can be used in lists."),
ILLUSTRATION (2, "Illustration", "Illustrates how the asset works or what it contains. It is complementary to the asset's description."),
USAGE_GUIDANCE (3, "Usage Guidance", "Provides guidance to a person on how to use the asset."),
OTHER (99, "Other", "Another usage.");
private static final long serialVersionUID = 1L;
private int mediaUsageCode;
private String mediaUsageName;
private String mediaUsageDescription;
/**
* Typical Constructor
*/
RelatedMediaUsage(int mediaUsageCode, String mediaUsageName, String mediaUsageDescription)
{
/*
* Save the values supplied
*/
this.mediaUsageCode = mediaUsageCode;
this.mediaUsageName = mediaUsageName;
this.mediaUsageDescription = mediaUsageDescription;
}
/**
* Return the code for this enum instance
*
* @return int - media usage code
*/
public int getMediaUsageCode()
{
return mediaUsageCode;
}
/**
* Return the default name for this enum instance.
*
* @return String - default name
*/
public String getMediaUsageName()
{
return mediaUsageName;
}
/**
* Return the default description for the media usage pattern for this enum instance.
*
* @return String - default description
*/
public String getMediaUsageDescription()
{
return mediaUsageDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelatedMediaUsage{" +
"mediaUsageCode=" + mediaUsageCode +
", mediaUsageName='" + mediaUsageName + '\'' +
", mediaUsageDescription='" + mediaUsageDescription + '\'' +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* The Schema object provides information about how the asset structures the data it supports. Schemas are typically
* described as nested structures of linked schema elements. Schemas can also be reused in other schemas.
*
* The schema object can be used to represent a Struct, Array, Set or Map.
* <ul>
* <li>
* A Struct has an ordered list of attributes - the position of an attribute is set up as one of its properties.
* </li>
* <li>
* An Array has one schema attribute and a maximum size plus element count.
* </li>
* <li>
* A Set also has one schema attribute and a maximum size plus element count.
* </li>
* <li>
* A Map is a Set of MapSchemaElements
* </li>
* </ul>
*/
public class Schema extends SchemaElement
{
/*
* Properties specific to a Schema
*/
SchemaType schemaType = SchemaType.UNKNOWN;
SchemaAttributes schemaAttributes = null;
int maximumElements = 0;
SchemaLinks schemaLinks = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param versionNumber - the version number of the schema element - null means no version number.
* @param author - the name of the author of the schema element. Null means the author is unknown.
* @param usage - the usage guidance for this schema element. Null means no guidance available.
* @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
* @param schemaType - Struct, Array or Set
* @param schemaAttributes - the list of schema attributes in this schema.
* @param maximumElements - the maximum elements that can be stored in this schema. This is set up by the caller.
* Zero means not bounded. For a STRUCT the max elements are the number of elements in
* the structure.
* @param schemaLinks - a list of any links that exist between the schema attributes of this schema (or others).
* These links are typically used for network type schemas such as a graph schema - or may be used to show
* linkage to an element in another schema.
*/
public Schema(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String versionNumber,
String author,
String usage,
String encodingStandard,
SchemaType schemaType,
SchemaAttributes schemaAttributes,
int maximumElements,
SchemaLinks schemaLinks)
{
super(parentAsset,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
versionNumber,
author,
usage,
encodingStandard);
this.schemaType = schemaType;
this.schemaAttributes = schemaAttributes;
this.maximumElements = maximumElements;
this.schemaLinks = schemaLinks;
}
/**
* Copy/clone Constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the definitions clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this schema is attached to.
* @param templateSchema - template object to copy.
*/
public Schema(AssetDescriptor parentAsset, Schema templateSchema)
{
super(parentAsset, templateSchema);
if (templateSchema != null)
{
SchemaAttributes templateSchemaAttributes = templateSchema.getSchemaAttributes();
if (templateSchemaAttributes != null)
{
schemaAttributes = templateSchemaAttributes.cloneIterator(parentAsset);
}
schemaType = templateSchema.getSchemaType();
maximumElements = templateSchema.getMaximumElements();
SchemaLinks templateSchemaLinks = templateSchema.getSchemaLinks();
if (templateSchemaLinks != null)
{
schemaLinks = templateSchemaLinks.cloneIterator(parentAsset);
}
}
}
/**
* Return the type of the schema.
*
* @return SchemaType
*/
public SchemaType getSchemaType() { return schemaType; }
/**
* Return the list of schema attributes in this schema.
*
* @return SchemaAttributes
*/
public SchemaAttributes getSchemaAttributes()
{
if (schemaAttributes == null)
{
return schemaAttributes;
}
else
{
return schemaAttributes.cloneIterator(super.getParentAsset());
}
}
/**
* Return the maximum elements that can be stored in this schema. This is set up by the caller.
* Zero means not bounded. For a STRUCT the max elements are the number of elements in
* the structure.
*
* @return int maximum number of elements
*/
public int getMaximumElements()
{
if (schemaType == SchemaType.STRUCT)
{
maximumElements = schemaAttributes.getElementCount();
}
return maximumElements;
}
/**
* Return a list of any links that exist between the schema attributes of this schema (or others).
* These links are typically used for network type schemas such as a grpah schema - or may be used to show
* linkage to an element in another schema.
*
* @return SchemaLinks - list of linked schema attributes
*/
public SchemaLinks getSchemaLinks()
{
if (schemaLinks == null)
{
return schemaLinks;
}
else
{
return schemaLinks.cloneIterator(super.getParentAsset());
}
}
/**
* Returns a clone of this object as the abstract SchemaElement class.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @return a copy of this schema as a SchemaElement
*/
@Override
public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset)
{
return new Schema(parentAsset, this);
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "Schema{" +
"schemaType=" + schemaType +
", schemaAttributes=" + schemaAttributes +
", maximumElements=" + maximumElements +
", schemaLinks=" + schemaLinks +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* <p>
* SchemaAttribute describes a single attribute within a schema. The attribute has a name, order in the
* schema and cardinality.
* Its type is another SchemaElement (either Schema or PrimitiveSchemaElement).
* </p>
* <p>
* If it is a PrimitiveSchemaElement it may have an override for the default value within.
* </p>
*/
public class SchemaAttribute extends AssetPropertyBase
{
String attributeName = null;
int elementPosition = 0;
String cardinality = null;
String defaultValueOverride = null;
SchemaElement attributeType = null;
/**
* Typical Constructor
*
* @param parentAsset - description of the asset that this schema attribute is attached to.
* @param attributeName - the name of this attribute
* @param elementPosition - position in schema - 0 means first
* @param cardinality - cardinality defined for this schema attribute.
* @param defaultValueOverride - default value for this attribute that would override the default defined in the
* schema element for this attribute's type (note only used is type is primitive).
* @param attributeType - the SchemaElement that relates to the type of this attribute.
*/
public SchemaAttribute(AssetDescriptor parentAsset,
String attributeName,
int elementPosition,
String cardinality,
String defaultValueOverride,
SchemaElement attributeType)
{
super(parentAsset);
this.attributeName = attributeName;
this.elementPosition = elementPosition;
this.cardinality = cardinality;
this.defaultValueOverride = defaultValueOverride;
this.attributeType = attributeType;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - description of the asset that this schema attribute is attached to.
* @param template - template schema attribute to copy.
*/
public SchemaAttribute(AssetDescriptor parentAsset, SchemaAttribute template)
{
super(parentAsset, template);
if (template != null)
{
attributeName = template.getAttributeName();
elementPosition = template.getElementPosition();
cardinality = template.getCardinality();
defaultValueOverride = template.getDefaultValueOverride();
SchemaElement templateAttributeType = template.getAttributeType();
if (templateAttributeType != null)
{
/*
* SchemaElement is an abstract class with a placeholder method to clone an object
* of its sub-class. When cloneSchemaElement() is called, the implementation in the
* sub-class is called.
*/
attributeType = templateAttributeType.cloneSchemaElement(parentAsset);
}
}
}
/**
* Return the name of this schema attribute.
*
* @return String attribute name
*/
public String getAttributeName() { return attributeName; }
/**
* Return the position of this schema attribute in its parent schema.
*
* @return int position in schema - 0 means first
*/
public int getElementPosition() { return elementPosition; }
/**
* Return the cardinality defined for this schema attribute.
*
* @return String cardinality defined for this schema attribute.
*/
public String getCardinality() { return cardinality; }
/**
* Return any default value for this attribute that would override the default defined in the
* schema element for this attribute's type (note only used is type is primitive).
*
* @return String default value override
*/
public String getDefaultValueOverride() { return defaultValueOverride; }
/**
* Return the SchemaElement that relates to the type of this attribute.
*
* @return SchemaElement
*/
public SchemaElement getAttributeType()
{
if (attributeType == null)
{
return attributeType;
}
else
{
return attributeType.cloneSchemaElement(super.getParentAsset());
}
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* SchemaAttributes supports an iterator over a list of schema attribute elements that make up a schema.
* Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class SchemaAttributes extends AssetPropertyIteratorBase implements Iterator<SchemaAttribute>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public SchemaAttributes(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public SchemaAttributes(AssetDescriptor parentAsset, SchemaAttributes template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new SchemaAttribute(parentAsset, (SchemaAttribute)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract SchemaAttributes cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return SchemaAttribute - next element object that has been cloned.
*/
@Override
public SchemaAttribute next()
{
return (SchemaAttribute)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaAttributes{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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
*
* 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.
*/
package org.apache.atlas.ocf.properties;
/**
* <p>
* The SchemaElement object provides a base class for the pieces that make up a schema for a data asset.
* A schema provides information about how the data is structured in the asset. Schemas are typically
* described as nested structures of linked schema elements. Schemas can also be reused in other schemas.
* </p>
* SchemaElement is an abstract class - used to enable the most accurate and precise mapping of the
* elements in a schema to the asset.
* <ul>
* <li>PrimitiveSchemaElement is for a leaf element in a schema.</li>
* <li>Schema is a complex structure of nested schema elements.</li>
* <li>MapSchemaElement is for an attribute of type Map</li>
* </ul>
* Most assets will be linked to a Schema.
* <p>
* Schema elements can be linked to one another using SchemaLink.
* </p>
*/
public abstract class SchemaElement extends Referenceable
{
private String versionNumber = null;
private String author = null;
private String usage = null;
private String encodingStandard = null;
/**
* Typical constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param versionNumber - the version number of the schema element - null means no version number.
* @param author - the name of the author of the schema element. Null means the author is unknown.
* @param usage - the usage guidance for this schema element. Null means no guidance available.
* @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
*/
public SchemaElement(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String versionNumber,
String author,
String usage,
String encodingStandard)
{
super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
this.versionNumber = versionNumber;
this.author = author;
this.usage = usage;
this.encodingStandard = encodingStandard;
}
/**
* Copy/clone Constructor - the parentAsset is passed separately to the template because it is also
* likely to be being cloned in the same operation and we want the definitions clone to point to the
* asset clone and not the original asset.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @param templateSchema - template object to copy.
*/
public SchemaElement(AssetDescriptor parentAsset, SchemaElement templateSchema)
{
super(parentAsset, templateSchema);
if (templateSchema != null)
{
versionNumber = templateSchema.getVersionNumber();
author = templateSchema.getAuthor();
usage = templateSchema.getUsage();
encodingStandard = templateSchema.getEncodingStandard();
}
}
/**
* Return a clone of this schema element. This method is needed because schema element
* is abstract.
*
* @param parentAsset - description of the asset that this schema element is attached to.
* @return Either a Schema or a PrimitiveSchemaElement depending on the type of the template.
*/
public abstract SchemaElement cloneSchemaElement(AssetDescriptor parentAsset);
/**
* Return the version number of the schema element - null means no version number.
*
* @return String version number
*/
public String getVersionNumber() { return versionNumber; }
/**
* Return the name of the author of the schema element. Null means the author is unknown.
*
* @return String author name
*/
public String getAuthor() { return author; }
/**
* Return the usage guidance for this schema element. Null means no guidance available.
*
* @return String usage guidance
*/
public String getUsage() { return usage; }
/**
* Return the format (encoding standard) used for this schema. It may be XML, JSON, SQL DDL or something else.
* Null means the encoding standard is unknown or there are many choices.
*
* @return String encoding standard
*/
public String getEncodingStandard() { return encodingStandard; }
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaElement{" +
"versionNumber='" + versionNumber + '\'' +
", author='" + author + '\'' +
", usage='" + usage + '\'' +
", encodingStandard='" + encodingStandard + '\'' +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* SchemaImplementationQuery supports an iterator over a list of schema query elements that make up a
* formula for a derived schema element.
* Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class SchemaImplementationQueries extends AssetPropertyIteratorBase implements Iterator<SchemaImplementationQuery>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public SchemaImplementationQueries(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public SchemaImplementationQueries(AssetDescriptor parentAsset, SchemaImplementationQueries template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new SchemaImplementationQuery(parentAsset, (SchemaImplementationQuery) template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract SchemaImplementationQueries cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return SchemaImplementationQuery - next element object that has been cloned.
*/
@Override
public SchemaImplementationQuery next()
{
return (SchemaImplementationQuery)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaImplementationQueries{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* SchemaImplementationQuery defines a query on a schema attribute that returns all or part of the value for a
* derived field.
*/
public class SchemaImplementationQuery extends AssetPropertyBase
{
private int queryId = 0;
private String query = null;
private String queryType = null;
private SchemaAttribute queryTargetElement = null;
/**
* Typical Constructor - sets attributes to null.
*
* @param parentAsset - description of the asset that this schema query is attached to.
* @param queryId - int query identifier - this is used to identify where the results of this query should be plugged into
* the other queries or the formula for the parent derived schema element.
* @param query - query string for this element. The query string may have placeholders for values returned
* by queries that have a lower queryId than this element.
* @param queryType - the name of the query language used in the query.
* @param queryTargetElement - the SchemaAttribute that describes the type of the data source that
* will be queried to get the derived value.
*/
public SchemaImplementationQuery(AssetDescriptor parentAsset, int queryId, String query, String queryType, SchemaAttribute queryTargetElement)
{
super(parentAsset);
this.queryId = queryId;
this.query = query;
this.queryType = queryType;
this.queryTargetElement = queryTargetElement;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - description of the asset that this schema query is attached to.
* @param template - template schema query to copy.
*/
public SchemaImplementationQuery(AssetDescriptor parentAsset, SchemaImplementationQuery template)
{
super(parentAsset, template);
if (template != null)
{
queryId = template.getQueryId();
query = template.getQuery();
queryType = template.getQueryType();
SchemaAttribute templateQueryTargetElement = template.getQueryTargetElement();
if (templateQueryTargetElement != null)
{
queryTargetElement = new SchemaAttribute(super.getParentAsset(), templateQueryTargetElement);
}
}
}
/**
* Return the query id - this is used to identify where the results of this query should be plugged into
* the other queries or the formula for the parent derived schema element.
*
* @return int query identifier
*/
public int getQueryId() { return queryId; }
/**
* Return the query string for this element. The query string may have placeholders for values returned
* by queries that have a lower queryId than this element.
*
* @return String query
*/
public String getQuery() { return query; }
/**
* Return the name of the query language used in the query.
*
* @return queryType String
*/
public String getQueryType() { return queryType; }
/**
* Return the SchemaAttribute that describes the type of the data source that will be queried to get the
* derived value.
*
* @return SchemaAttribute
*/
public SchemaAttribute getQueryTargetElement()
{
if (queryTargetElement == null)
{
return queryTargetElement;
}
else
{
return new SchemaAttribute(super.getParentAsset(), queryTargetElement);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaImplementationQuery{" +
"queryId=" + queryId +
", query='" + query + '\'' +
", queryType='" + queryType + '\'' +
", queryTargetElement=" + queryTargetElement +
'}';
}
}
\ 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.ocf.properties;
import java.util.ArrayList;
/**
* SchemaLink defines a relationship between 2 SchemaElements. It is used in network type schemas such as a graph.
*/
public class SchemaLink extends AssetPropertyBase
{
/*
* Attributes from the relationship
*/
private String linkGUID = null;
private String linkType = null;
/*
* Attributes specific to SchemaLink
*/
private String linkName = null;
private AdditionalProperties linkProperties = null;
private ArrayList<String> linkedAttributeGUIDs = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor of parent asset
* @param linkGUID - the identifier of the schema link.
* @param linkType - the type of the link - this is related to the type of the schema it is a part of.
* @param linkName - the name of the schema link.
* @param linkProperties - the list of properties associated with this schema link.
* @param linkedAttributeGUIDs - GUIDs for either end of the link - return as an iterator.
*/
public SchemaLink(AssetDescriptor parentAsset,
String linkGUID,
String linkType,
String linkName,
AdditionalProperties linkProperties,
ArrayList<String> linkedAttributeGUIDs)
{
super(parentAsset);
this.linkGUID = linkGUID;
this.linkType = linkType;
this.linkName = linkName;
this.linkProperties = linkProperties;
this.linkedAttributeGUIDs = linkedAttributeGUIDs;
}
/**
* Copy/clone constructor - makes a copy of the supplied object.
*
* @param parentAsset - descriptor of parent asset
* @param template - template object to copy
*/
public SchemaLink(AssetDescriptor parentAsset, SchemaLink template)
{
super(parentAsset, template);
if (template != null)
{
linkGUID = template.getLinkGUID();
linkName = template.getLinkName();
linkType = template.getLinkType();
AdditionalProperties templateLinkProperties = template.getLinkProperties();
if (templateLinkProperties != null)
{
linkProperties = new AdditionalProperties(super.getParentAsset(), templateLinkProperties);
}
linkedAttributeGUIDs = template.getLinkedAttributeGUIDs();
}
}
/**
* Return the identifier for the schema link.
*
* @return String guid
*/
public String getLinkGUID() { return linkGUID; }
/**
* Return the type of the link - this is related to the type of the schema it is a part of.
*
* @return String link type
*/
public String getLinkType() { return linkType; }
/**
* Return the name of this link
*
* @return String name
*/
public String getLinkName() { return linkName; }
/**
* Return the list of properties associated with this schema link.
*
* @return AdditionalProperties
*/
public AdditionalProperties getLinkProperties()
{
if (linkProperties == null)
{
return linkProperties;
}
else
{
return new AdditionalProperties(super.getParentAsset(), linkProperties);
}
}
/**
* Return the GUIDs of the schema attributes that this link connects together.
*
* @return SchemaAttributeGUIDs - GUIDs for either end of the link - return as a list.
*/
public ArrayList<String> getLinkedAttributeGUIDs()
{
if (linkedAttributeGUIDs == null)
{
return linkedAttributeGUIDs;
}
else
{
return new ArrayList<>(linkedAttributeGUIDs);
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaLink{" +
"linkGUID='" + linkGUID + '\'' +
", linkType='" + linkType + '\'' +
", linkName='" + linkName + '\'' +
", linkProperties=" + linkProperties +
", linkedAttributeGUIDs=" + linkedAttributeGUIDs +
'}';
}
}
\ 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.ocf.properties;
import java.util.Iterator;
/**
* SchemaLinks supports an iterator over a list of schema attribute links for a schema.
* Callers can use it to step through the list
* just once. If they want to parse the list again, they could use the copy/clone constructor to create
* a new iterator.
*/
public abstract class SchemaLinks extends AssetPropertyIteratorBase implements Iterator<SchemaLink>
{
/**
* Typical Constructor creates an iterator with the supplied list of elements.
*
* @param parentAsset - descriptor of parent asset
* @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
* @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
* cached in the element list at any one time. If a number less than one is supplied, 1 is used.
*/
public SchemaLinks(AssetDescriptor parentAsset,
int totalElementCount,
int maxCacheSize)
{
super(parentAsset, totalElementCount, maxCacheSize);
}
/**
* Copy/clone constructor. Used to reset iterator element pointer to 0;
*
* @param parentAsset - descriptor of parent asset
* @param template - type-specific iterator to copy; null to create an empty iterator
*/
public SchemaLinks(AssetDescriptor parentAsset, SchemaLinks template)
{
super(parentAsset, template);
}
/**
* Provides a concrete implementation of cloneElement for the specific iterator type.
*
* @param parentAsset - descriptor of parent asset
* @param template - object to clone
* @return new cloned object.
*/
protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
{
return new SchemaLink(parentAsset, (SchemaLink)template);
}
/**
* Clones this iterator.
*
* @param parentAsset - descriptor of parent asset
* @return new cloned object.
*/
protected abstract SchemaLinks cloneIterator(AssetDescriptor parentAsset);
/**
* The iterator can only be used once to step through the elements. This method returns
* a boolean to indicate if it has got to the end of the list yet.
*
* @return boolean indicating whether there are more elements.
*/
@Override
public boolean hasNext()
{
return super.pagingIterator.hasNext();
}
/**
* Return the next element in the iteration.
*
* @return SchemaLink - next element object that has been cloned.
*/
@Override
public SchemaLink next()
{
return (SchemaLink)super.pagingIterator.next();
}
/**
* Remove the current element in the iterator. (Null implementation since this iterator works off of cached
* elements from the property (metadata) server.)
*/
@Override
public void remove()
{
super.pagingIterator.remove();
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaLinks{" +
"pagingIterator=" + pagingIterator +
'}';
}
}
\ 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.ocf.properties;
/**
* SchemaType describes the type of schema element.
*/
public enum SchemaType
{
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."),
ARRAY (2, "Array" , "The schema type is a structure containing an ordered list of properties all of the same type."),
SET (3, "Set" , "The schema type is a structure containing an unordered collection of properties, all of the same type.");
private int schemaTypeCode;
private String schemaTypeName;
private String schemaTypeDescription;
/**
* Constructor to set up the instance of this enum.
*
* @param schemaTypeCode - code number
* @param schemaTypeName - default name
* @param schemaTypeDescription - default description
*/
SchemaType(int schemaTypeCode, String schemaTypeName, String schemaTypeDescription)
{
this.schemaTypeCode = schemaTypeCode;
this.schemaTypeName = schemaTypeName;
this.schemaTypeDescription = schemaTypeDescription;
}
/**
* Return the code for this enum used for indexing based on the enum value.
*
* @return int code number
*/
public int getSchemaTypeCode()
{
return schemaTypeCode;
}
/**
* Return the default name for this enum type.
*
* @return String name
*/
public String getSchemaTypeName()
{
return schemaTypeName;
}
/**
* Return the default description for this enum.
*
* @return String description
*/
public String getSchemaTypeDescription()
{
return schemaTypeDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "SchemaType{" +
"schemaTypeCode=" + schemaTypeCode +
", schemaTypeName='" + schemaTypeName + '\'' +
", schemaTypeDescription='" + schemaTypeDescription + '\'' +
'}';
}
}
/*
* 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;
import java.io.Serializable;
/**
* A StarRating defines the rating that a user has placed against an asset. This ranges from not recommended
* through to five stars (excellent).
*/
public enum StarRating implements Serializable
{
NOT_RECOMMENDED (0, "X", "Not recommended"),
ONE_STAR (1, "*", "Poor"),
TWO_STARS (2, "**", "Usable"),
THREE_STARS (3, "***", "Good"),
FOUR_STARS (4, "****", "Very Good"),
FIVE_STARS (5, "*****", "Excellent");
private static final long serialVersionUID = 1L;
private int starRatingCode;
private String starRatingSymbol;
private String starRatingDescription;
/**
* Typical Constructor
*/
StarRating(int starRatingCode, String starRatingSymbol, String starRatingDescription)
{
/*
* Save the values supplied
*/
this.starRatingCode = starRatingCode;
this.starRatingSymbol = starRatingSymbol;
this.starRatingDescription = starRatingDescription;
}
/**
* Return the code for this enum instance
*
* @return int - star rating code
*/
public int getStarRatingCode()
{
return starRatingCode;
}
/**
* Return the default symbol for this enum instance.
*
* @return String - default symbol
*/
public String getStarRatingSymbol()
{
return starRatingSymbol;
}
/**
* Return the default description for the star rating for this enum instance.
*
* @return String - default description
*/
public String getStarRatingDescription()
{
return starRatingDescription;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "StarRating{" +
"starRatingCode=" + starRatingCode +
", starRatingSymbol='" + starRatingSymbol + '\'' +
", starRatingDescription='" + starRatingDescription + '\'' +
'}';
}
}
\ 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.ocf.properties;
/**
* A virtual connection is for an asset that provides data by delegating requests to one or more other connections.
* it maintains a list of the connections that are used by its asset. These are referred to as embedded connections.
*/
public class VirtualConnection extends Connection
{
/*
* Attributes of a virtual connection
*/
protected EmbeddedConnections embeddedConnections = null;
/**
* Typical Constructor
*
* @param parentAsset - descriptor for parent asset
* @param type - details of the metadata type for this properties object
* @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)
* @param displayName - consumable name
* @param description - stored description property for the connection.
* @param connectorType - connector type to copy
* @param endpoint - endpoint properties
* @param securedProperties - typically user credentials for the connection
* @param embeddedConnections - the embedded connections for this virtual connection.
*/
public VirtualConnection(AssetDescriptor parentAsset,
ElementType type,
String guid,
String url,
Classifications classifications,
String qualifiedName,
AdditionalProperties additionalProperties,
Meanings meanings,
String displayName,
String description,
ConnectorType connectorType,
Endpoint endpoint,
AdditionalProperties securedProperties,
EmbeddedConnections embeddedConnections)
{
super(parentAsset,
type,
guid,
url,
classifications,
qualifiedName,
additionalProperties,
meanings,
displayName,
description,
connectorType,
endpoint,
securedProperties);
this.embeddedConnections = embeddedConnections;
}
/**
* Copy/clone constructor.
*
* @param parentAsset - descriptor for parent asset
* @param templateVirtualConnection - element to copy
*/
public VirtualConnection(AssetDescriptor parentAsset, VirtualConnection templateVirtualConnection)
{
/*
* Save the parent asset description.
*/
super(parentAsset, templateVirtualConnection);
/*
* Extract additional information from the template if available
*/
if (templateVirtualConnection != null)
{
EmbeddedConnections templateEmbeddedConnections = templateVirtualConnection.getEmbeddedConnections();
if (templateEmbeddedConnections != null)
{
/*
* Ensure comment replies has this object's parent asset, not the template's.
*/
embeddedConnections = templateEmbeddedConnections.cloneIterator(parentAsset);
}
}
}
/**
* Return the enumeration of embedded connections for this virtual connection.
*
* @return EmbeddedConnections
*/
public EmbeddedConnections getEmbeddedConnections()
{
if (embeddedConnections == null)
{
return embeddedConnections;
}
else
{
return embeddedConnections.cloneIterator(super.getParentAsset());
}
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "VirtualConnection{" +
"embeddedConnections=" + embeddedConnections +
", securedProperties=" + securedProperties +
", qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", meanings=" + meanings +
", type=" + type +
", guid='" + guid + '\'' +
", url='" + url + '\'' +
'}';
}
}
\ No newline at end of file
...@@ -377,6 +377,17 @@ ...@@ -377,6 +377,17 @@
<!--<organizationUrl>http://www.hortonworks.com</organizationUrl>--> <!--<organizationUrl>http://www.hortonworks.com</organizationUrl>-->
</developer> </developer>
<developer> <developer>
<id>mandy</id>
<name>Mandy Chessell</name>
<email>mandy@apache.org</email>
<timezone>Europe/London</timezone>
<roles>
<role>committer</role>
</roles>
<organization>IBM Corporation</organization>
<!--<organizationUrl>http://www.ibm.com</organizationUrl>-->
</developer>
<developer>
<id>mschussler</id> <id>mschussler</id>
<name>Mitch Schussler</name> <name>Mitch Schussler</name>
<email>mschussler@apache.org</email> <email>mschussler@apache.org</email>
...@@ -716,6 +727,8 @@ ...@@ -716,6 +727,8 @@
<modules> <modules>
<module>build-tools</module> <module>build-tools</module>
<module>test-tools</module> <module>test-tools</module>
<module>om-fwk-ocf</module>
<module>intg</module> <module>intg</module>
<module>common</module> <module>common</module>
<module>server-api</module> <module>server-api</module>
......
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