http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ConnectedAssetInterface.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ConnectedAssetInterface.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ConnectedAssetInterface.java deleted file mode 100644 index a87740c..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ConnectedAssetInterface.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * 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.omas.connectedasset; - -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.InvalidParameterException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.PropertyServerException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.UnrecognizedConnectionGUIDException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.UserNotAuthorizedException; -import org.apache.atlas.omas.connectedasset.properties.AssetUniverse; - -/** - * ConnectedAssetInterface is the OMAS client interface of the Connected Asset OMAS. - * - */ -public interface ConnectedAssetInterface -{ - /** - * Returns a comprehensive collection of properties about the requested asset. - * - * @param userId - String - userId of user making request. - * @param assetGUID - String - unique id for asset. - * - * @return AssetUniverse - a comprehensive collection of properties about the asset. - - * @throws InvalidParameterException - one of the parameters is null or invalid. - * @throws PropertyServerException - There is a problem retrieving the asset properties from - * the property server. - * @throws UserNotAuthorizedException - the requesting user is not authorized to issue this request. - */ - AssetUniverse getAssetProperties(String userId, - String assetGUID) throws InvalidParameterException, - PropertyServerException, - UserNotAuthorizedException; - - - /** - * Returns a comprehensive collection of properties about the asset linked to the supplied connection. - * - * @param userId - identifier for calling user - * @param connectionGUID - uniqueId for the connection. - * @return AssetUniverse - a comprehensive collection of properties about the connected asset. - * @throws InvalidParameterException - one of the parameters is null or invalid. - * @throws PropertyServerException - There is a problem retrieving the connected asset properties from - * the property server. - * @throws UnrecognizedConnectionGUIDException - the supplied GUID is not recognized by the property server. - */ - AssetUniverse getAssetPropertiesByConnection(String userId, - String connectionGUID) throws InvalidParameterException, - UnrecognizedConnectionGUIDException, - PropertyServerException; -}
http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/admin/ConnectedAssetAdmin.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/admin/ConnectedAssetAdmin.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/admin/ConnectedAssetAdmin.java deleted file mode 100644 index 4d467a6..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/admin/ConnectedAssetAdmin.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.omas.connectedasset.admin; - - -import org.apache.atlas.omag.configuration.properties.AccessServiceConfig; -import org.apache.atlas.omag.configuration.registration.AccessServiceAdmin; -import org.apache.atlas.omag.ffdc.exception.OMAGConfigurationErrorException; -import org.apache.atlas.omrs.auditlog.OMRSAuditLog; -import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; -import org.apache.atlas.omrs.topicconnectors.OMRSTopicConnector; - -public class ConnectedAssetAdmin implements AccessServiceAdmin -{ - private OMRSRepositoryConnector repositoryConnector = null; - private OMRSTopicConnector omrsTopicConnector = null; - private AccessServiceConfig accessServiceConfig = null; - private OMRSAuditLog auditLog = null; - private String serverUserName = null; - - - /** - * Default constructor - */ - public ConnectedAssetAdmin() - { - } - - /** - * Initialize the access service. - * - * @param accessServiceConfigurationProperties - specific configuration properties for this access service. - * @param enterpriseOMRSTopicConnector - connector for receiving OMRS Events from the cohorts - * @param enterpriseOMRSRepositoryConnector - connector for querying the cohort repositories - * @param auditLog - audit log component for logging messages. - * @param serverUserName - user id to use on OMRS calls where there is no end user. - * @throws OMAGConfigurationErrorException - invalid parameters in the configuration properties. - */ - public void initialize(AccessServiceConfig accessServiceConfigurationProperties, - OMRSTopicConnector enterpriseOMRSTopicConnector, - OMRSRepositoryConnector enterpriseOMRSRepositoryConnector, - OMRSAuditLog auditLog, - String serverUserName) throws OMAGConfigurationErrorException - { - this.accessServiceConfig = accessServiceConfigurationProperties; - this.omrsTopicConnector = enterpriseOMRSTopicConnector; - - this.repositoryConnector = enterpriseOMRSRepositoryConnector; - - this.auditLog = auditLog; - this.serverUserName = serverUserName; - - } - - - /** - * Shutdown the access service. - */ - public void shutdown() - { - /* - * Nothing to do until set up out topic. - */ - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAsset.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAsset.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAsset.java deleted file mode 100644 index b2f3010..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAsset.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.omas.connectedasset.client; - -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.InvalidParameterException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.PropertyServerException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.UnrecognizedConnectionGUIDException; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.UserNotAuthorizedException; -import org.apache.atlas.omas.connectedasset.properties.AssetUniverse; -import org.apache.atlas.omas.connectedasset.ConnectedAssetInterface; - - -/** - * ConnectedAsset is the OMAS client library implementation of the ConnectedAsset OMAS. - * ConnectedAsset provides the metadata for the ConnectedAssetProperties API that is - * supported by all Open Connector Framework (OCF) - * connectors. It provides access to the metadata about the Asset that the connector is linked to. - */ -public class ConnectedAsset implements ConnectedAssetInterface -{ - /* - * The URL of the server where OMAS is active - */ - private String omasServerURL = null; - - - /** - * Default Constructor used once a connector is created. - * - * @param omasServerURL - unique id for the connector instance - */ - public ConnectedAsset(String omasServerURL) - { - /* - * Save OMAS Server URL - */ - this.omasServerURL = omasServerURL; - } - - - - /** - * Returns a comprehensive collection of properties about the requested asset. - * - * @param userId - String - userId of user making request. - * @param assetGUID - String - unique id for asset. - * - * @return AssetUniverse - a comprehensive collection of properties about the asset. - - * @throws InvalidParameterException - one of the parameters is null or invalid. - * @throws PropertyServerException - There is a problem retrieving the asset properties from - * the property server. - * @throws UserNotAuthorizedException - the requesting user is not authorized to issue this request. - */ - public AssetUniverse getAssetProperties(String userId, - String assetGUID) throws InvalidParameterException, - PropertyServerException, - UserNotAuthorizedException - { - return null; - } - - - /** - * Returns a comprehensive collection of properties about the asset linked to the supplied connection. - * - * @param connectionGUID - unique identifier for the connection - * @return AssetUniverse - a comprehensive collection of properties about the connected asset - * @throws PropertyServerException - There is a problem retrieving the connected asset properties from - * the metadata repository. - */ - public AssetUniverse getAssetPropertiesByConnection(String connectionGUID) throws PropertyServerException - { - AssetUniverse extractedAssetProperties = null; - - /* - * Set up the OMAS URL in the asset universe - */ - - return extractedAssetProperties; - } - - - /** - * Returns a comprehensive collection of properties about the asset linked to the supplied connection. - * - * @param connectionGUID - uniqueId for the connection. - * @return AssetUniverse - a comprehensive collection of properties about the connected asset. - * @throws InvalidParameterException - one of the parameters is null or invalid. - * @throws PropertyServerException - There is a problem retrieving the connected asset properties from - * the property server. - * @throws UnrecognizedConnectionGUIDException - the supplied GUID is not recognized by the property server. - */ - public AssetUniverse getAssetPropertiesByConnection(String userId, - String connectionGUID) throws InvalidParameterException, - UnrecognizedConnectionGUIDException, - PropertyServerException - { - return null; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAssetProperties.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAssetProperties.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAssetProperties.java deleted file mode 100644 index a1d8590..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/client/ConnectedAssetProperties.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.omas.connectedasset.client; - -import org.apache.atlas.ocf.ffdc.PropertyServerException; -import org.apache.atlas.ocf.properties.Classifications; -import org.apache.atlas.ocf.properties.ElementType; -import org.apache.atlas.ocf.properties.Connection; - -import org.apache.atlas.omas.connectedasset.properties.AssetUniverse; -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 class ConnectedAssetProperties extends org.apache.atlas.ocf.properties.ConnectedAssetProperties -{ - private String omasServerURL; - private String connectorInstanceId; - private Connection connection; - private String userId; - - private ConnectedAsset connectedAsset; - - private static final Logger log = LoggerFactory.getLogger(ConnectedAssetProperties.class); - - /** - * Typical constructor. - * - * @param userId - identifier of calling user - * @param omasServerURL - url of server - * @param connectorInstanceId - unique identifier of connector. - * @param connection - connection information for connector. - */ - public ConnectedAssetProperties(String userId, - String omasServerURL, - String connectorInstanceId, - Connection connection) - { - super(); - - this.userId = userId; - this.omasServerURL = omasServerURL; - this.connectorInstanceId = connectorInstanceId; - this.connection = connection; - - this.connectedAsset = new ConnectedAsset(omasServerURL); - } - - - /** - * Copy/clone constructor. - * - * @param templateProperties - template to copy. - */ - public ConnectedAssetProperties(ConnectedAssetProperties templateProperties) - { - super(templateProperties); - - this.connection = templateProperties.connection; - this.connectorInstanceId = templateProperties.connectorInstanceId; - this.omasServerURL = templateProperties.omasServerURL; - this.userId = templateProperties.userId; - - this.connectedAsset = new ConnectedAsset(omasServerURL); - } - - - /** - * 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 void refresh() throws PropertyServerException - { - AssetUniverse assetUniverse = null; - - try - { - assetUniverse = connectedAsset.getAssetPropertiesByConnection(connection.getGUID()); - } - catch (Throwable error) - { - /* - * Construct PropertyErrorException - */ - } - - if (assetUniverse == null) - { - super.assetProperties = null; - return; - } - - ElementType elementType = null; - Classifications classifications = null; - - - if (assetUniverse.getType() != null) - { - elementType = new ElementType(assetUniverse.getType().getElementTypeId(), - assetUniverse.getType().getElementTypeName(), - assetUniverse.getType().getElementTypeVersion(), - assetUniverse.getType().getElementTypeDescription(), - assetUniverse.getType().getElementAccessServiceURL(), - assetUniverse.getType().getElementOrigin(), - assetUniverse.getType().getElementHomeMetadataCollectionId()); - } - - - if (assetUniverse.getClassifications() != null) - { - - } - super.assetProperties = new org.apache.atlas.ocf.properties.AssetUniverse(elementType, - assetUniverse.getGUID(), - assetUniverse.getURL(), - assetUniverse.getQualifiedName(), - assetUniverse.getDisplayName(), - assetUniverse.getShortDescription(), - assetUniverse.getDescription(), - assetUniverse.getOwner(), - classifications, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/ConnectedAssetErrorCode.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/ConnectedAssetErrorCode.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/ConnectedAssetErrorCode.java deleted file mode 100644 index 84bf572..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/ConnectedAssetErrorCode.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.MessageFormat; -import java.util.Arrays; - -/** - * The ConnectedAssetErrorCode 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 Connected Asset OMAS 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 ConnectedAssetErrorCode -{ - SERVER_URL_NOT_SPECIFIED(400, "OMAS-CONNECTEDASSET-400-001", - "The OMAS Server URL is null", - "The system is unable to connect to the OMAS Server to populate the ConnectedAssetProperties object.", - "Retry the request when the OMAS Service is available."), - SERVER_URL_MALFORMED(400, "OMAS-CONNECTEDASSET-400-002", - "The OMAS Server URL {0} is not in a recognized format", - "The system is unable to connect to the OMAS Server to populate the ConnectedAssetProperties object.", - "Retry the request when the OMAS Service is available."), - NULL_CONNECTION(400, "OMAS-CONNECTEDASSET-400-003", - "The connection passed to OMASConnectedAssetProperties for connector {0} is null.", - "The system is unable to populate the ConnectedAssetProperties object because it needs the connection to identify the asset.", - "Look for other error messages to identify what caused this error. When the issue is resolved, retry the request."), - NULL_CONNECTION_ID(400, "OMAS-CONNECTEDASSET-400-004", - "The connection \'{0}\' passed to OMASConnectedAssetProperties has a null GUID inside it.", - "The system is unable to populate the ConnectedAssetProperties object because it needs the connection to identify the asset.", - "Look for other error messages to identify what caused this error. When the issue is resolved, retry the request."), - NULL_RELATED_ASSET(400, "OMAS-CONNECTEDASSET-400-005", - "The related asset is null.", - "The system is unable to populate the RelatedAssetProperties object because it needs the URL to identify the asset.", - "Look for other error messages to identify what caused this error. When the issue is resolved, retry the request."), - NULL_PROPERTY_NAME(400, "OMAS-CONNECTEDASSET-400-006 ", - "Null property name passed to operation {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."), - NULL_CLASSIFICATION_NAME(400, "OMAS-CONNECTEDASSET-400-007 ", - "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, "OMAS-CONNECTEDASSET-400-008 ", - "Null tag name passed to operation {0} of type {1}", - "A request to set the name of an informal tag property failed because the name passed was null", - "Recode the call to the property object with a valid name and retry."), - SERVER_NOT_AVAILABLE(404, "OMAS-CONNECTEDASSET-404-001", - "The OMAS Server is not available", - "The system is unable to populate the ConnectedAssetProperties object.", - "Retry the request when the OMAS Service is available.") - ; - - private int httpErrorCode; - private String errorMessageId; - private String errorMessage; - private String systemAction; - private String userAction; - - private static final Logger log = LoggerFactory.getLogger(ConnectedAssetErrorCode.class); - - - /** - * The constructor for ConnectedAssetErrorCode expects to be passed one of the enumeration rows defined in - * ConnectedAssetErrorCode above. For example: - * - * ConnectedAssetErrorCode errorCode = ConnectedAssetErrorCode.SERVER_NOT_AVAILABLE; - * - * This will expand out to the 5 parameters shown below. - * - * @param newHTTPErrorCode - error code to use over REST calls - * @param newErrorMessageId - unique Id for the message - * @param newErrorMessage - text for the message - * @param newSystemAction - description of the action taken by the system when the error condition happened - * @param newUserAction - instructions for resolving the error - */ - ConnectedAssetErrorCode(int newHTTPErrorCode, String newErrorMessageId, String newErrorMessage, String newSystemAction, String newUserAction) - { - this.httpErrorCode = newHTTPErrorCode; - this.errorMessageId = newErrorMessageId; - this.errorMessage = newErrorMessage; - this.systemAction = newSystemAction; - this.userAction = newUserAction; - } - - - 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) - { - if (log.isDebugEnabled()) - { - log.debug(String.format("<== OCFErrorCode.getMessage(%s)", Arrays.toString(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; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/README.md ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/README.md b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/README.md deleted file mode 100644 index 02e6a7f..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/README.md +++ /dev/null @@ -1,46 +0,0 @@ -<!-- - ~ 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. - --> - -# ConnectedAsset OMAS FFDC - -Package org.apache.atlas.omas.connectedasset.ffdc provides the -first failure data capture support for the ConnectedAsset OMAS 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 (ConnectedAssetErrorCode) 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 ConnectedAsset OMAS exception. - -Both constructors take the values from the ConnectedAssetErrorCode -enum to define the cause and resolution. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetCheckedExceptionBase.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetCheckedExceptionBase.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetCheckedExceptionBase.java deleted file mode 100644 index 7ebb080..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetCheckedExceptionBase.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - -/** - * ConnectedAssetCheckedExceptionBase provides a checked exception for reporting errors found when using - * the Connected Asset OMAS services. - * - * Typically these errors are either configuration or operational errors that can be fixed by an administrator. - * However, there may be the odd bug that surfaces here. - * The ConnectedAssetErrorCode can be used with - * this exception to populate it with standard messages. The aim is to be able to uniquely identify the cause - * and remedy for the error. - */ -public class ConnectedAssetCheckedExceptionBase extends Exception -{ - /* - * These default values are only seen if this exception is initialized using one of its superclass constructors. - */ - private int reportedHTTPCode; - private String reportingClassName; - private String reportingActionDescription; - private String reportedErrorMessage; - private String reportedSystemAction; - private String reportedUserAction; - private Throwable reportedCaughtException = null; - - - /** - * This is the typical constructor used for creating a ConnectedAssetCheckedExceptionBase. - * - * @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 ConnectedAssetCheckedExceptionBase(int httpCode, - String className, - String actionDescription, - String errorMessage, - String systemAction, - String userAction) - { - super(errorMessage); - this.reportedHTTPCode = httpCode; - this.reportingClassName = className; - this.reportingActionDescription = actionDescription; - this.reportedErrorMessage = errorMessage; - this.reportedSystemAction = systemAction; - this.reportedUserAction = userAction; - } - - - /** - * This is the constructor used for creating a ConnectedAssetCheckedExceptionBase - * that resulted from a previous error. - * - * @param httpCode - http response code to use if this exception flows over a rest call - * @param className - name of class reporting error - * @param actionDescription - description of function it was performing when error detected - * @param errorMessage - description of error - * @param systemAction - actions of the system as a result of the error - * @param userAction - instructions for correcting the error - * @param caughtError - the error that resulted in this exception. - */ - public ConnectedAssetCheckedExceptionBase(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; } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetRuntimeException.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetRuntimeException.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetRuntimeException.java deleted file mode 100644 index a48f746..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/ConnectedAssetRuntimeException.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - -/** - * ConnectedAssetRuntimeException is used for all runtime exceptions generated by the connected asset OMAS. - * It is used in conjunction with the ConnectedAssetErrorCode to provide first failure data capture for these errors. - */ -public class ConnectedAssetRuntimeException extends RuntimeException -{ - /* - * 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 ConnectedAssetRuntimeException. - * - * @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 ConnectedAssetRuntimeException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) - { - super(errorMessage); - this.reportedHTTPCode = httpCode; - this.reportingClassName = className; - this.reportingActionDescription = actionDescription; - this.reportedErrorMessage = errorMessage; - this.reportedSystemAction = systemAction; - this.reportedUserAction = userAction; - } - - - /** - * This is the constructor used for creating a ConnectedAssetRuntimeException that is the result of - * another error 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 ConnectedAssetRuntimeException(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; } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/InvalidParameterException.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/InvalidParameterException.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/InvalidParameterException.java deleted file mode 100644 index d8b16bc..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/InvalidParameterException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - - -/** - * The InvalidParameterException is thrown by theConnectedAsset OMAS when a parameters is null or an invalid - * value. - */ -public class InvalidParameterException extends ConnectedAssetCheckedExceptionBase -{ - /** - * This is the typical constructor used for creating a InvalidParameterException. - * - * @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 InvalidParameterException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); - } - - - /** - * This is the constructor used for creating a InvalidParameterException that resulted from a previous error. - * - * @param httpCode - http response code to use if this exception flows over a rest call - * @param className - name of class reporting error - * @param actionDescription - description of function it was performing when error detected - * @param errorMessage - description of error - * @param systemAction - actions of the system as a result of the error - * @param userAction - instructions for correcting the error - * @param caughtError - the error that resulted in this exception. - * */ - public InvalidParameterException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/PropertyServerException.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/PropertyServerException.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/PropertyServerException.java deleted file mode 100644 index 7e71368..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/PropertyServerException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - -/** - * The PropertyServerException is thrown by the Connected OMAS when it is not able to communicate with the - * property server. - */ -public class PropertyServerException extends ConnectedAssetCheckedExceptionBase -{ - /** - * This is the typical constructor used for creating a PropertyServerException. - * - * @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 PropertyServerException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); - } - - - /** - * This is the constructor used for creating a PropertyServerException that resulted from a previous error. - * - * @param httpCode - http response code to use if this exception flows over a rest call - * @param className - name of class reporting error - * @param actionDescription - description of function it was performing when error detected - * @param errorMessage - description of error - * @param systemAction - actions of the system as a result of the error - * @param userAction - instructions for correcting the error - * @param caughtError - the error that resulted in this exception. - * */ - public PropertyServerException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UnrecognizedConnectionGUIDException.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UnrecognizedConnectionGUIDException.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UnrecognizedConnectionGUIDException.java deleted file mode 100644 index 2e3a351..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UnrecognizedConnectionGUIDException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - - -/** - * The UnrecognizedConnectionGUIDException is thrown by the Connected Asset OMAS when the unique identifier (guid) - * used to request a connection object from the property server is either unrecognized, or is the identifier - * for a different type of object. - */ -public class UnrecognizedConnectionGUIDException extends ConnectedAssetCheckedExceptionBase -{ - /** - * This is the typical constructor used for creating a UnrecognizedConnectionGUIDException. - * - * @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 UnrecognizedConnectionGUIDException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); - } - - - /** - * This is the constructor used for creating a UnrecognizedConnectionGUIDException that resulted from a previous error. - * - * @param httpCode - http response code to use if this exception flows over a rest call - * @param className - name of class reporting error - * @param actionDescription - description of function it was performing when error detected - * @param errorMessage - description of error - * @param systemAction - actions of the system as a result of the error - * @param userAction - instructions for correcting the error - * @param caughtError - the error that resulted in this exception. - */ - public UnrecognizedConnectionGUIDException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UserNotAuthorizedException.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UserNotAuthorizedException.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UserNotAuthorizedException.java deleted file mode 100644 index 2cf5476..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/ffdc/exceptions/UserNotAuthorizedException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.omas.connectedasset.ffdc.exceptions; - - -/** - * The UserNotAuthorizedException is thrown by the Connected Asset OMAS when a userId passed on a request is not - * authorized to perform the requested action. - */ -public class UserNotAuthorizedException extends ConnectedAssetCheckedExceptionBase -{ - /** - * This is the typical constructor used for creating a UserNotAuthorizedException. - * - * @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 UserNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction); - } - - - /** - * This is the constructor used for creating a UserNotAuthorizedException that resulted from a previous error. - * - * @param httpCode - http response code to use if this exception flows over a rest call - * @param className - name of class reporting error - * @param actionDescription - description of function it was performing when error detected - * @param errorMessage - description of error - * @param systemAction - actions of the system as a result of the error - * @param userAction - instructions for correcting the error - * @param caughtError - the error that resulted in this exception. - * */ - public UserNotAuthorizedException(int httpCode, String className, String actionDescription, String errorMessage, String systemAction, String userAction, Throwable caughtError) - { - super(httpCode, className, actionDescription, errorMessage, systemAction, userAction, caughtError); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/AdditionalProperties.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/AdditionalProperties.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/AdditionalProperties.java deleted file mode 100644 index 689cda0..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/AdditionalProperties.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.omas.connectedasset.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import org.apache.atlas.omas.connectedasset.ffdc.ConnectedAssetErrorCode; -import org.apache.atlas.omas.connectedasset.ffdc.exceptions.ConnectedAssetRuntimeException; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - - -/** - * The AdditionalProperties class provides support for arbitrary properties to be added to a properties object. - * It wraps a java.util.Map map object built around HashMap. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class AdditionalProperties extends PropertyBase -{ - private Map<String,Object> additionalProperties = new HashMap<>(); - - /** - * Constructor for a new set of additional properties that are connected either directly or indirectly to an asset. - */ - public AdditionalProperties() - { - super(); - } - - - /** - * Copy/clone Constructor for additional properties that are connected to an asset. - * - * @param templateProperties - template object to copy. - */ - public AdditionalProperties(AdditionalProperties templateProperties) - { - super(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); - } - - - /** - * Adds or updates an additional property. - * If a null is supplied for the property name, an OCF runtime exception is thrown. - * If a null is supplied for the property value, the property is removed. - * - * @param newPropertyName - name - * @param newPropertyValue - value - */ - public void setProperty(String newPropertyName, Object newPropertyValue) - { - final String methodName = "setProperty"; - - if (newPropertyName == null) - { - /* - * Build and throw exception. - */ - ConnectedAssetErrorCode errorCode = ConnectedAssetErrorCode.NULL_PROPERTY_NAME; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(methodName, this.getClass().getName()); - - throw new ConnectedAssetRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - else if (newPropertyValue == null) - { - additionalProperties.remove(newPropertyName); - } - else - { - additionalProperties.put(newPropertyName, newPropertyValue); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Analysis.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Analysis.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Analysis.java deleted file mode 100644 index e400d7f..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Analysis.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.omas.connectedasset.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.ArrayList; -import java.util.List; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * Analysis returns the Annotations for the connected asset. - * Annotations are created by Open Discovery Framework (ODF) discovery services. Each Annotation - * contains the results of a particular type of analysis. - * - * The Analysis class holds a full list of all of the Annotation and offers methods for retrieving - * different subsets of the Annotations. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class Analysis extends PropertyBase -{ - private List<Annotation> allAnnotations = null; - - - /** - * Default Constructor - */ - public Analysis() - { - super(); - } - - - /** - * 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 analysis clone to point to the - * asset clone and not the original asset. - * - * @param templateAnalysis - template for setting up the properties. - */ - public Analysis(Analysis templateAnalysis) - { - super(templateAnalysis); - - /* - * Only create a child object if the template is not null. - */ - if (templateAnalysis != null) - { - List<Annotation> templateAllAnnotations = templateAnalysis.getAnnotations(); - - if (templateAllAnnotations != null) - { - /* - * Copy over the annotations ensuring the parent asset is this object's parent, not the template's parent. - */ - allAnnotations = new ArrayList<>(templateAnalysis.getAnnotations()); - } - } - } - - - /** - * Return an iterator containing all of the annotations for this asset. - * - * @return Annotations - list of annotations - */ - public List<Annotation> getAnnotations() - { - return new ArrayList<>(allAnnotations); - } - - - /** - * Initialize Analysis with a new set of annotations. This overrides any annotations previously held - * by Analysis. - * - * @param newAnnotations - new annotations - */ - public void setAnnotations(List<Annotation> newAnnotations) - { - /* - * A copy of the annotations is taken to be sure the pointers are all at the start. - */ - allAnnotations = new ArrayList<>(newAnnotations); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Annotation.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Annotation.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Annotation.java deleted file mode 100644 index 174ef33..0000000 --- a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Annotation.java +++ /dev/null @@ -1,472 +0,0 @@ -/* - * 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.omas.connectedasset.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Date; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * 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. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -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; - - - /** - * Default Constructor - */ - public Annotation() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param templateAnnotation - template object to copy. - */ - public Annotation(Annotation templateAnnotation) - { - /* - * Remember the parent - */ - super(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(templateAnnotation.getAdditionalProperties()); - } - } - - - /** - * Return the name of the discovery analysis report that created this annotation. - * - * @return String - report name - */ - public String getReportName() - { - return reportName; - } - - - /** - * Set up the discovery analysis report name. - * - * @param reportName - report name string. - */ - public void setReportName(String reportName) - { - this.reportName = reportName; - } - - /** - * Return the discovery analysis report description that this annotation is a part of. - * - * @return String - report description - */ - public String getReportDescription() - { - return reportDescription; - } - - - /** - * Annotations are created as part of a DiscoveryAnalysisReport. This property contains the overall - * report description associated with this annotation. - * - * @param reportDescription - String for the report description - */ - public void setReportDescription(String reportDescription) - { - this.reportDescription = 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; - } - - - /** - * Set up the creation date for the annotation. This value should be available. It is supplied on the - * DiscoveryAnalysisReport entity. However, if no creation data is available, this property is stored as null. - * - * @param creationDate - Date that annotation was created. - */ - public void setCreationDate(Date creationDate) - { - this.creationDate = 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; - } - - - /** - * Set up the properties that hold the parameters used to drive the discovery service's analysis. - * - * @param analysisParameters - Properties for the analysis parameters - */ - public void setAnalysisParameters(AdditionalProperties analysisParameters) - { - this.analysisParameters = analysisParameters; - } - - - /** - * Return the informal name for the type of annotation. - * - * @return String - annotation type - */ - public String getAnnotationType() - { - return annotationType; - } - - - /** - * Set up the informal name for the type of annotation. The formal name in the model is given in the - * ElementType. - * - * @param annotationType - String for annotation type - */ - public void setAnnotationType(String annotationType) - { - this.annotationType = annotationType; - } - - - /** - * Return the summary description for the annotation. - * - * @return String - summary of annotation - */ - public String getSummary() - { - return summary; - } - - - /** - * Set up the summary description of the annotation. - * - * @param summary - String for summary - */ - public void setSummary(String summary) - { - this.summary = summary; - } - - - /** - * Return the confidence level of the discovery service that the annotation is correct. - * - * @return int - confidence level - */ - public int getConfidenceLevel() - { - return confidenceLevel; - } - - - /** - * Set up the confidence level of the discovery service that the annotation is correct. - * - * @param confidenceLevel - int for confidence level - */ - public void setConfidence(int confidenceLevel) - { - this.confidenceLevel = confidenceLevel; - } - - - /** - * Return the expression that represent the relationship between the annotation and the asset. - * - * @return String - expression - */ - public String getExpression() - { - return expression; - } - - - /** - * Set up the expression that represent the relationship between the annotation and the asset. - * - * @param expression - string for expression - */ - public void setExpression(String expression) - { - this.expression = expression; - } - - - /** - * Return the explanation for the annotation. - * - * @return String - explanation - */ - public String getExplanation() { - return explanation; - } - - - /** - * Set up the explanation for the annotation. - * - * @param explanation - String for the explanation - */ - public void setExplanation(String explanation) - { - this.explanation = 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; - } - - - /** - * Set up the description of the analysis step that the discovery service was in when it created the annotation. - * - * @param analysisStep - String describing the analysis step - */ - public void setAnalysisStep(String analysisStep) - { - this.analysisStep = analysisStep; - } - - - /** - * Return the JSON properties associated with the annotation. - * - * @return String - JSON properties of annotation - */ - public String getJsonProperties() - { - return jsonProperties; - } - - - /** - * Set up the JSON properties associated with the annotation. - * - * @param jsonProperties String - JSON properties of annotation - */ - public void setJsonProperties(String jsonProperties) - { - this.jsonProperties = jsonProperties; - } - - - /** - * Return the current status of the annotation. - * - * @return AnnotationStatus - current status of annotation - */ - public AnnotationStatus getAnnotationStatus() - { - return annotationStatus; - } - - /** - * Set up the current status of the annotation. - * - * @param annotationStatus - AnnotationStatus enum - */ - public void setAnnotationStatus(AnnotationStatus annotationStatus) - { - this.annotationStatus = 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; - } - - - /** - * Set up the date that this annotation was reviewed. If no review has taken place then this property is null. - * - * @param reviewDate - date review conducted - */ - public void setReviewDate(Date reviewDate) - { - this.reviewDate = reviewDate; - } - - - /** - * Return the name of the steward that reviewed the annotation. - * - * @return String - steward's name. - */ - public String getSteward() - { - return steward; - } - - - /** - * Set up the name of the steward that reviewed the annotation. - * - * @param steward String name of steward that reviewed the annotation. - */ - public void setSteward(String steward) - { - this.steward = steward; - } - - - /** - * Return any comments made by the steward during the review. - * - * @return String - review comment - */ - public String getReviewComment() - { - return reviewComment; - } - - - /** - * Set the 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 to this annotation. - * - * @param reviewComment - string comment - */ - public void setReviewComment(String reviewComment) - { - this.reviewComment = reviewComment; - } - - - /** - * Return the additional properties for the Annotation. - * - * @return AdditionalProperties - additional properties object - */ - public AdditionalProperties getAdditionalProperties() - { - return additionalProperties; - } - - - /** - * Set up the additional properties for the 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. - * - * @param additionalProperties - additional properties object for annotation. - */ - public void setAdditionalProperties(AdditionalProperties additionalProperties) - { - this.additionalProperties = additionalProperties; - } -} \ No newline at end of file