http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLog.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLog.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLog.java deleted file mode 100644 index 46ea3e3..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLog.java +++ /dev/null @@ -1,228 +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.omrs.auditlog; - - -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogRecord; -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogRecordOriginator; -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogReportingComponent; -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogStore; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -/** - * OMRSAuditLog is a class for managing the audit logging of activity for the OMRS components. Each auditing component - * will have their own instance of an OMRSAuditLog. OMRSAuditLog will ensure audit log records are written to - * disk in the common OMRSAuditLog for this local server. - * - * There are different levels of log record to cover all of the activity of the OMRS. - * - * This audit log is critical to validate the behavior of the OMRS, particularly in the initial interaction of - * a new metadata repository to the OMRS Cohort. - */ -public class OMRSAuditLog -{ - static private final OMRSAuditLogRecordOriginator originator = new OMRSAuditLogRecordOriginator(); - static private ArrayList<OMRSAuditLogStore> auditLogStores = null; - - private static final Logger log = LoggerFactory.getLogger(OMRSAuditLog.class); - - private OMRSAuditLogReportingComponent reportingComponent; /* Initialized in the constructor */ - - - /** - * Initialize the static values used in all log records. These values help to pin-point the source of messages - * when audit log records from many servers are consolidated into centralized operational tooling. - * - * @param localServerName - name of the local server - * @param localServerType - type of the local server - * @param localOrganizationName - name of the organization that owns the local server - * @param auditLogStores - list of destinations for the audit log records - */ - public static void initialize(String localServerName, - String localServerType, - String localOrganizationName, - List<OMRSAuditLogStore> auditLogStores) - { - OMRSAuditLog.originator.setServerName(localServerName); - OMRSAuditLog.originator.setServerType(localServerType); - OMRSAuditLog.originator.setOrganizationName(localOrganizationName); - - if (auditLogStores != null) - { - OMRSAuditLog.auditLogStores = new ArrayList<>(auditLogStores); - } - } - - - /** - * Set up the local metadata collection Id. This is null if there is no local repository. - * - * @param localMetadataCollectionId - String unique identifier for the metadata collection - */ - public static void setLocalMetadataCollectionId(String localMetadataCollectionId) - { - OMRSAuditLog.originator.setMetadataCollectionId(localMetadataCollectionId); - } - - - /** - * Typical constructor - Each component using the Audit log will create their own OMRSAuditLog instance and - * will push log records to it. - * - * @param componentId - numerical identifier for the component. - * @param componentName - display name for the component. - * @param componentDescription - description of the component. - * @param componentWikiURL - link to more information. - */ - public OMRSAuditLog(int componentId, - String componentName, - String componentDescription, - String componentWikiURL) - { - this.reportingComponent = new OMRSAuditLogReportingComponent(componentId, - componentName, - componentDescription, - componentWikiURL); - } - - - /** - * External constructor - used to create an audit log for a component outside of OMRS - * - * @param reportingComponent - information about the component that will use this instance of the audit log. - */ - public OMRSAuditLog(OMRSAuditingComponent reportingComponent) - { - this.reportingComponent = new OMRSAuditLogReportingComponent(reportingComponent.getComponentId(), - reportingComponent.getComponentName(), - reportingComponent.getComponentDescription(), - reportingComponent.getComponentWikiURL()); - } - - - /** - * Log an audit log record for an event, decision, error, or exception detected by the OMRS. - * - * @param actionDescription - description of the activity creating the audit log record - * @param logMessageId - id for the audit log record - * @param severity - is this an event, decision, error or exception? - * @param logMessage - description of the audit log record including specific resources involved - * @param additionalInformation - additional data to help resolve issues of verify behavior - * @param systemAction - the related action taken by the OMRS. - * @param userAction - details of any action that an administrator needs to take. - */ - public void logRecord(String actionDescription, - String logMessageId, - OMRSAuditLogRecordSeverity severity, - String logMessage, - String additionalInformation, - String systemAction, - String userAction) - { - if (severity != null) - { - if ((severity == OMRSAuditLogRecordSeverity.ERROR) || (severity == OMRSAuditLogRecordSeverity.EXCEPTION)) - { - log.error(logMessageId + " " + logMessage, actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction); - } - else - { - log.info(logMessageId + " " + logMessage, actionDescription, logMessageId, severity, logMessage, additionalInformation, systemAction, userAction); - } - } - else - { - severity = OMRSAuditLogRecordSeverity.UNKNOWN; - } - - if (auditLogStores != null) - { - for (OMRSAuditLogStore auditLogStore : auditLogStores) - { - if (auditLogStore != null) - { - List<String> additionalInformationArray = null; - - if (additionalInformation != null) - { - additionalInformationArray = new ArrayList<>(); - additionalInformationArray.add(additionalInformation); - } - - OMRSAuditLogRecord logRecord = new OMRSAuditLogRecord(originator, - reportingComponent, - severity.getSeverityName(), - logMessageId, - logMessage, - additionalInformationArray, - systemAction, - userAction); - try - { - auditLogStore.storeLogRecord(logRecord); - } - catch (Throwable error) - { - log.error("Error writing audit log: ", logRecord, error); - } - } - } - } - } - - - /** - * Log details of an unexpected exception detected by the OMRS. These exceptions typically mean that the local - * server is not configured correctly, or there is a logic error in the code. When exceptions are logged, it is - * important that they are investigated and the cause corrected since the local repository is not able to operate - * as a proper peer in the metadata repository cluster whilst these conditions persist. - * - * @param actionDescription - description of the activity in progress when the error occurred - * @param logMessageId - id for the type of exception caught - * @param severity - severity of the error - * @param logMessage - description of the exception including specific resources involved - * @param additionalInformation - additional data to help resolve issues of verify behavior - * @param systemAction - the action taken by the OMRS in response to the error. - * @param userAction - details of any action that an administrator needs to take. - * @param caughtException - the original exception. - */ - public void logException(String actionDescription, - String logMessageId, - OMRSAuditLogRecordSeverity severity, - String logMessage, - String additionalInformation, - String systemAction, - String userAction, - Throwable caughtException) - { - if (caughtException != null) - { - this.logRecord(actionDescription, - logMessageId, - severity, - logMessage, - additionalInformation + caughtException.toString(), - systemAction, - userAction); - } - } -}
http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLogRecordSeverity.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLogRecordSeverity.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLogRecordSeverity.java deleted file mode 100644 index 61b1e16..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditLogRecordSeverity.java +++ /dev/null @@ -1,122 +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.omrs.auditlog; - -/** - * OMRSAuditLogRecordSeverity defines the different levels of severity for log records stored in the OMRSAuditLogRecord. - * <ul> - * <li> - * UNKNOWN - Uninitialized Severity - if this is seen then there is a logic error in the audit log processing. - * </li> - * <li> - * INFO - An activity occurred as part of the normal operation of the open metadata repository. - * </li> - * <li> - * EVENT - An OMRS Event was sent to or received from members of an open metadata repository cohort. - * </li> - * <li> - * DECISION - A decision has been made related to the interaction of the local metadata repository and the - * rest of the open metadata repository cohort. - * </li> - * <li> - * ACTION - A situation has been detected that requires administrator intervention. - * </li> - * <li> - * ERROR - An unexpected error occurred, possibly caused by an incompatibility between the local metadata repository - * and one of the remote repositories. The local repository may restrict some of the metadata interchange - * functions as a result. - * </li> - * <li> - * EXCEPTION - Unexpected exception occurred. This means that the local repository needs some administration - * attention to correct configuration or fix a logic error because it is not operating as a proper peer in the - * metadata repository cluster. - * </li> - * </ul> - */ -public enum OMRSAuditLogRecordSeverity -{ - UNKNOWN (0, "<Unknown>", "Uninitialized Severity."), - INFO (1, "Information", "The server is providing information about its normal operation."), - EVENT (2, "Event", "An OMRSEvent was exchanged amongst members of the metadata repository cohort."), - DECISION (3, "Decision", "A decision has been made related to the interaction of the local metadata repository and the rest of the cohort."), - ACTION (4, "Action", "Action is required by the administrator. " + - "At a minimum, the situation needs to be investigated and if necessary, corrective action taken."), - ERROR (5, "Error", "An error occurred, possibly caused by an incompatibility between the local metadata repository \n" + - "and one of the remote repositories. " + - "The local repository may restrict some of the metadata interchange \n" + - "functions as a result."), - EXCEPTION (6, "Exception", "Unexpected exception occurred. This means that the local repository needs some administration\n" + - " attention to correct configuration or fix a logic error because it is not operating as a proper peer in the\n" + - " metadata repository cohort."); - - - private int severityCode; - private String severityName; - private String severityDescription; - - - /** - * Typical constructor sets up the selected enum value. - * - * @param severityCode - numeric of this enum. - * @param severityName - name of enum. - * @param severityDescription - default description of enum.. - */ - OMRSAuditLogRecordSeverity(int severityCode, - String severityName, - String severityDescription) - { - this.severityCode = severityCode; - this.severityName = severityName; - this.severityDescription = severityDescription; - } - - /** - * Return the code for this enum. - * - * @return int numeric for this enum - */ - public int getSeverityCode() - { - return severityCode; - } - - - /** - * Return the name of this enum. - * - * @return String name - */ - public String getSeverityName() - { - return severityName; - } - - - /** - * Return the default description of this enum. This description is in English. Natural language translations can be - * created using a Resource Bundle indexed by the severity code. This description is a fall back when the resource - * bundle is not available. - * - * @return String default description - */ - public String getSeverityDescription() - { - return severityDescription; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditingComponent.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditingComponent.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditingComponent.java deleted file mode 100644 index 5e1e33b..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/OMRSAuditingComponent.java +++ /dev/null @@ -1,261 +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.omrs.auditlog; - -import org.apache.atlas.omrs.admin.OMRSConfigurationFactory; -import org.apache.atlas.omrs.admin.OMRSOperationalServices; -import org.apache.atlas.omrs.archivemanager.OMRSArchiveManager; -import org.apache.atlas.omrs.enterprise.connectormanager.OMRSEnterpriseConnectorManager; -import org.apache.atlas.omrs.enterprise.repositoryconnector.EnterpriseOMRSRepositoryConnector; -import org.apache.atlas.omrs.eventmanagement.OMRSRepositoryEventManager; -import org.apache.atlas.omrs.localrepository.repositoryconnector.LocalOMRSInstanceEventProcessor; -import org.apache.atlas.omrs.localrepository.repositoryconnector.LocalOMRSRepositoryConnector; -import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryContentManager; -import org.apache.atlas.omrs.metadatahighway.OMRSMetadataHighwayManager; -import org.apache.atlas.omrs.metadatahighway.cohortregistry.OMRSCohortRegistry; -import org.apache.atlas.omrs.metadatahighway.cohortregistry.store.OMRSCohortRegistryStore; -import org.apache.atlas.omrs.eventmanagement.OMRSEventListener; -import org.apache.atlas.omrs.eventmanagement.OMRSEventPublisher; -import org.apache.atlas.omrs.metadatahighway.OMRSCohortManager; -import org.apache.atlas.omrs.rest.repositoryconnector.OMRSRESTRepositoryConnector; -import org.apache.atlas.omrs.rest.server.OMRSRepositoryRESTServices; -import org.apache.atlas.omrs.topicconnectors.OMRSTopicConnector; - - -/** - * OMRSAuditingComponent provides identifying and background information about the components writing log records - * to the OMRS Audit log. This is to help someone reading the OMRS Audit Log understand the records. - */ -public enum OMRSAuditingComponent -{ - UNKNOWN (0, - "<Unknown>", "Uninitialized component name", null, null), - - AUDIT_LOG (1, - "Audit Log", - "Reads and writes records to the Open Metadata Repository Services (OMRS) audit log.", - OMRSAuditLog.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Audit+Log"), - - CONFIGURATION_FACTORY (2, - "Configuration Factory", - "Generates default values for the Open Metadata Repository Services (OMRS) configuration.", - OMRSConfigurationFactory.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Configuration+Factory"), - - OPERATIONAL_SERVICES (3, - "Operational Services", - "Supports the administration services for the Open Metadata Repository Services (OMRS).", - OMRSOperationalServices.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Operational+Services"), - - ARCHIVE_MANAGER (4, - "Archive Manager", - "Manages the loading of Open Metadata Archives into an open metadata repository.", - OMRSArchiveManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Archive+Manager"), - - ENTERPRISE_CONNECTOR_MANAGER (5, - "Enterprise Connector Manager", - "Manages the list of open metadata repositories that the Enterprise OMRS Repository Connector " + - "should call to retrieve an enterprise view of the metadata collections " + - "supported by these repositories", - OMRSEnterpriseConnectorManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Enterprise+Connector+Manager"), - - ENTERPRISE_REPOSITORY_CONNECTOR (6, - "Enterprise Repository Connector", - "Supports enterprise access to the list of open metadata repositories registered " + - "with the OMRS Enterprise Connector Manager.", - EnterpriseOMRSRepositoryConnector.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/Enterprise+OMRS+Repository+Connector"), - - LOCAL_REPOSITORY_CONNECTOR (7, - "Local Repository Connector", - "Supports access to metadata stored in the local server's repository and ensures " + - "repository events are generated when metadata changes in the local repository", - LocalOMRSRepositoryConnector.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/Local+OMRS+Repository+Connector"), - - TYPEDEF_MANAGER (8, - "Local TypeDef Manager", - "Supports an in-memory cache for open metadata type definitions (TypeDefs) used for " + - "verifying TypeDefs in use in other open metadata repositories and for " + - "constructing new metadata instances.", - OMRSRepositoryContentManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/Local+OMRS+TypeDef+Manager"), - - INSTANCE_EVENT_PROCESSOR (8, - "Local Inbound Instance Event Processor", - "Supports the loading of reference metadata into the local repository that has come from other members of the local server's cohorts and open metadata archives.", - LocalOMRSInstanceEventProcessor.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/Local+OMRS+Instance+Event+Processor"), - - REPOSITORY_EVENT_MANAGER (9, - "Repository Event Manager", - "Distribute repository events (TypeDefs, Entity and Instance events) between internal OMRS components within a server.", - OMRSRepositoryEventManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Repository+Event+Manager"), - - REST_SERVICES (10, - "Repository REST Services", - "Provides the server-side support the the OMRS Repository Services REST API.", - OMRSRepositoryRESTServices.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Repository+REST+Services"), - - REST_REPOSITORY_CONNECTOR (11, - "REST Repository Connector", - "Supports an OMRS Repository Connector for calling the OMRS Repository REST API in a remote " + - "open metadata repository.", - OMRSRESTRepositoryConnector.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+REST+Repository+Connector"), - - METADATA_HIGHWAY_MANAGER (12, - "Metadata Highway Manager", - "Manages the initialization and shutdown of the components that connector to each of the cohorts that the local server is a member of.", - OMRSMetadataHighwayManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Metadata+Highway+Manager"), - - COHORT_MANAGER (13, - "Cohort Manager", - "Manages the initialization and shutdown of the server's connectivity to a cohort.", - OMRSCohortManager.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Cohort+Manager"), - - COHORT_REGISTRY(14, - "Cohort Registry", - "Manages the registration requests send and received from this local repository.", - OMRSCohortRegistry.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Cohort+Registry"), - - REGISTRY_STORE (15, - "Registry Store", - "Stores information about the repositories registered in the open metadata repository cohort.", - OMRSCohortRegistryStore.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Cohort+Registry+Store"), - - EVENT_PUBLISHER (16, - "Event Publisher", - "Manages the publishing of events that this repository sends to the OMRS topic.", - OMRSEventPublisher.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Event+Publisher"), - - EVENT_LISTENER (17, - "Event Listener", - "Manages the receipt of incoming OMRS events.", - OMRSEventListener.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Event+Listener"), - - OMRS_TOPIC_CONNECTOR(18, - "OMRS Topic Connector", - "Provides access to the OMRS Topic that is used to exchange events between members of a cohort, " + - "or to notify Open Metadata Access Services (OMASs) of changes to " + - "metadata in the enterprise.", - OMRSTopicConnector.class.getName(), - "https://cwiki.apache.org/confluence/display/ATLAS/OMRS+Topic+Connector") - ; - - - private int componentId; - private String componentName; - private String componentDescription; - private String componentJavaClass; - private String componentWikiURL; - - - /** - * Set up the values of the enum. - * - * @param componentId - code number for the component. - * @param componentName - name of the component used in the audit log record. - * @param componentDescription - short description of the component. - * @param componentJavaClass - name of java class for the component - if logic errors need to be investigated. - * @param componentWikiURL - URL link to the description of the component. - */ - OMRSAuditingComponent(int componentId, - String componentName, - String componentDescription, - String componentJavaClass, - String componentWikiURL) - { - this.componentId = componentId; - this.componentName = componentName; - this.componentDescription = componentDescription; - this.componentJavaClass = componentJavaClass; - this.componentWikiURL = componentWikiURL; - } - - - /** - * Return the numerical code for this enum. - * - * @return int componentId - */ - public int getComponentId() - { - return componentId; - } - - - /** - * Return the name of the component. This is the name used in the audit log records. - * - * @return String component name - */ - public String getComponentName() - { - return componentName; - } - - - /** - * Return the short description of the component. This is an English description. Natural language support for - * these values can be added to UIs using a resource bundle indexed with the component Id. This value is - * provided as a default if the resource bundle is not available. - * - * @return String description - */ - public String getComponentDescription() - { - return componentDescription; - } - - - /** - * Name of the java class supporting this component. This value is provided for debug and not normally make - * available on end user UIs for security reasons. - * - * @return String fully-qualified java class name - */ - public String getComponentJavaClass() - { - return componentJavaClass; - } - - - /** - * URL link to the wiki page that describes this component. This provides more information to the log reader - * on the operation of the component. - * - * @return String URL - */ - public String getComponentWikiURL() - { - return componentWikiURL; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecord.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecord.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecord.java deleted file mode 100644 index 25ced7d..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecord.java +++ /dev/null @@ -1,383 +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.omrs.auditlog.store; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * OMRSAuditLogRecord provides a carrier for details about a single log record in the OMRS audit log. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class OMRSAuditLogRecord -{ - private String guid = null; - private Date timeStamp = new Date(); - private OMRSAuditLogRecordOriginator originator = null; - private String severity = null; - private OMRSAuditLogReportingComponent reportingComponent = null; - private String messageId = null; - private String messageText = null; - private List<String> additionalInformation = null; - private String systemAction = null; - private String userAction = null; - - - /** - * Default constructor - */ - public OMRSAuditLogRecord() - { - } - - - /** - * Audit log records are immutable so the only way to update the values is through the constructor. - * - * @param originator - details of the originating server - * @param reportingComponent - details of the component making the audit log entry. - * @param severity - OMRSAuditLogRecordSeverity enum that indicates the severity of log record. - * @param messageId - id of the message in the audit log record. - * @param messageText - description of the message for the audit log record. - * @param additionalInformation - additional properties that help to describe the situation. - * @param systemAction - action taken by the system. - * @param userAction - followup action that should be taken by the target end user (typically the server - * administrator). - */ - public OMRSAuditLogRecord(OMRSAuditLogRecordOriginator originator, - OMRSAuditLogReportingComponent reportingComponent, - String severity, - String messageId, - String messageText, - List<String> additionalInformation, - String systemAction, - String userAction) - { - this.guid = UUID.randomUUID().toString(); - this.originator = originator; - this.severity = severity; - this.reportingComponent = reportingComponent; - this.messageId = messageId; - this.messageText = messageText; - this.additionalInformation = additionalInformation; - this.systemAction = systemAction; - this.userAction = userAction; - } - - /** - * Return the unique Id of the audit log record. - * - * @return String guid - */ - public String getGUID() - { - return guid; - } - - - /** - * Set up the unique Id of the audit log record. - * - * @param guid - String guid - */ - public void setGUID(String guid) - { - this.guid = guid; - } - - - /** - * Return the time stamp for when the audit log record was created. - * - * @return Date object - */ - public Date getTimeStamp() - { - return timeStamp; - } - - - /** - * Set up the time stamp for when the audit log record was created. - * - * @param timeStamp Date object - */ - public void setTimeStamp(Date timeStamp) - { - this.timeStamp = timeStamp; - } - - - /** - * Return details of the originator of the log record. - * - * @return OMRSAuditLogRecordOriginator object - */ - public OMRSAuditLogRecordOriginator getOriginator() - { - return originator; - } - - - /** - * Set up details of the originator of the log record. - * - * @param originator - */ - public void setOriginator(OMRSAuditLogRecordOriginator originator) - { - this.originator = originator; - } - - /** - * Return the severity of the situation recorded in the log record. - * - * @return String severity - */ - public String getSeverity() - { - return severity; - } - - - /** - * Set up the severity of the situation recorded in the log record. - * - * @param severity - String severity - */ - public void setSeverity(String severity) - { - this.severity = severity; - } - - - /** - * Return the name of the component that reported the situation recorded in the log record. - * - * @return OMRSAuditLogReportingComponent object - */ - public OMRSAuditLogReportingComponent getReportingComponent() - { - return reportingComponent; - } - - - /** - * Set up the name of the component that reported the situation recorded in the log record. - * - * @param reportingComponent - OMRSAuditLogReportingComponent object - */ - public void setReportingComponent(OMRSAuditLogReportingComponent reportingComponent) - { - this.reportingComponent = reportingComponent; - } - - - /** - * Return the identifier of the message within the log record. - * - * @return String message id - */ - public String getMessageId() - { - return messageId; - } - - - /** - * Set up the identifier of the message within the log record. - * - * @param messageId - String message id - */ - public void setMessageId(String messageId) - { - this.messageId = messageId; - } - - - /** - * Return the text of the message within the log record. - * - * @return String message text - */ - public String getMessageText() - { - return messageText; - } - - - /** - * Set up the text of the message within the log record. - * - * @param messageText - String message text - */ - public void setMessageText(String messageText) - { - this.messageText = messageText; - } - - - /** - * Return any additional information in the audit log record. - * - * @return List of String additional information - */ - public List<String> getAdditionalInformation() - { - return additionalInformation; - } - - - /** - * Set up any additional information in the audit log record. - * - * @param additionalInformation - List of String additional information - */ - public void setAdditionalInformation(List<String> additionalInformation) - { - this.additionalInformation = additionalInformation; - } - - - /** - * Return the description of the actions taken by the local server as a result of the reported situation. - * - * @return string description - */ - public String getSystemAction() - { - return systemAction; - } - - - /** - * Set up the description of the actions taken by the local server as a result of the reported situation. - * - * @param systemAction - a description of the actions taken by the system as a result of the error. - */ - public void setSystemAction(String systemAction) - { - this.systemAction = systemAction; - } - - - /** - * Return details of the actions (if any) that a user can take in response to the reported situation. - * - * @return String instructions - */ - public String getUserAction() - { - return userAction; - } - - - /** - * Set up details of the actions (if any) that a user can take in response to the reported situation. - * - * @param userAction - String instructions - */ - public void setUserAction(String userAction) - { - this.userAction = userAction; - } - - - @Override - public String toString() - { - String originatorString = null; - if (this.originator != null) - { - originatorString = this.originator.toString(); - } - - String reportingComponentString = null; - if (this.reportingComponent != null) - { - reportingComponentString = this.reportingComponent.toString(); - } - - String additionalInformationString = null; - if (this.additionalInformation != null) - { - boolean notFirst = false; - - additionalInformationString = "[ "; - - for (String nugget : additionalInformation) - { - if (notFirst) - { - additionalInformationString = additionalInformationString + ", "; - notFirst = true; - } - - additionalInformationString = additionalInformationString + nugget; - } - - additionalInformationString = additionalInformationString + " ]"; - } - - return "AuditLogRecord { " + - "timestamp : " + timeStamp.toString() + ", " + - "guid : " + guid + ", " + - "originator : " + originatorString + ", " + - "severity : " + severity + ", " + - "reportingComponent : " + reportingComponentString + ", " + - "messageId : " + messageId + ", " + - "messageText : " + messageText + ", " + - "additionalInformation : " + additionalInformationString + ", " + - "systemAction : " + systemAction + ", " + - "userAction : " + userAction + " }"; - } - - @Override - public int hashCode() - { - return super.hashCode(); - } - - @Override - public boolean equals(Object object) - { - if (this == object) - { - return true; - } - if (object == null || getClass() != object.getClass()) - { - return false; - } - - OMRSAuditLogRecord that = (OMRSAuditLogRecord) object; - - return guid.equals(that.guid); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecordOriginator.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecordOriginator.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecordOriginator.java deleted file mode 100644 index 42cffb7..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogRecordOriginator.java +++ /dev/null @@ -1,189 +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.omrs.auditlog.store; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * OMRSAuditLogRecordOriginator describes the server that originated an audit log record. This is useful if - * an organization is aggregating messages from different servers together. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class OMRSAuditLogRecordOriginator -{ - private String metadataCollectionId = null; - private String serverName = null; - private String serverType = null; - private String organizationName = null; - - /** - * Default constructor used by parsing engines and other consumers. - */ - public OMRSAuditLogRecordOriginator() - { - } - - - /** - * Returns the unique identifier (guid) of the originating repository's metadata collection. - * - * @return String guid - */ - public String getMetadataCollectionId() - { - return metadataCollectionId; - } - - - /** - * Sets up the unique identifier (guid) of the originating repository. - * - * @param metadataCollectionId - String guid - */ - public void setMetadataCollectionId(String metadataCollectionId) - { - this.metadataCollectionId = metadataCollectionId; - } - - - /** - * Return the display name for the server that is used in events, messages and UIs to - * make it easier for people to understand the origin of metadata. - * - * @return String server name - */ - public String getServerName() - { - return serverName; - } - - - /** - * Set up the display name for the server that is used in events, messages and UIs to - * make it easier for people to understand the origin of metadata. - * - * @param serverName - String server name - */ - public void setServerName(String serverName) - { - this.serverName = serverName; - } - - - /** - * Return the descriptive string describing the type of the server. This might be the - * name of the product, or similar identifier. - * - * @return String server type - */ - public String getServerType() - { - return serverType; - } - - - /** - * Set up the descriptive string describing the type of the server. This might be the - * name of the product, or similar identifier. - * - * @param serverType - String server type - */ - public void setServerType(String serverType) - { - this.serverType = serverType; - } - - - /** - * Return the name of the organization that runs/owns the server. - * - * @return String organization name - */ - public String getOrganizationName() - { - return organizationName; - } - - - /** - * Set up the name of the organization that runs/owns the server. - * - * @param organizationName - String organization name - */ - public void setOrganizationName(String organizationName) - { - this.organizationName = organizationName; - } - - - @Override - public String toString() - { - return "Originator { " + - "metadataCollectionId : " + this.metadataCollectionId + ", " + - "serverName : " + this.serverName + ", " + - "serverType : " + this.serverType + ", " + - "organizationName : " + this.organizationName + " }"; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - OMRSAuditLogRecordOriginator that = (OMRSAuditLogRecordOriginator) o; - - if (metadataCollectionId != null ? !metadataCollectionId.equals(that.metadataCollectionId) : that.metadataCollectionId != null) - { - return false; - } - if (serverName != null ? !serverName.equals(that.serverName) : that.serverName != null) - { - return false; - } - if (serverType != null ? !serverType.equals(that.serverType) : that.serverType != null) - { - return false; - } - return organizationName != null ? organizationName.equals(that.organizationName) : that.organizationName == null; - } - - @Override - public int hashCode() - { - int result = metadataCollectionId != null ? metadataCollectionId.hashCode() : 0; - result = 31 * result + (serverName != null ? serverName.hashCode() : 0); - result = 31 * result + (serverType != null ? serverType.hashCode() : 0); - result = 31 * result + (organizationName != null ? organizationName.hashCode() : 0); - return result; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogReportingComponent.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogReportingComponent.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogReportingComponent.java deleted file mode 100644 index 47cc2cf..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogReportingComponent.java +++ /dev/null @@ -1,155 +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.omrs.auditlog.store; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * OMRSAuditLogReportingComponent describes the component issuing the audit log record. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class OMRSAuditLogReportingComponent -{ - private int componentId = 0; - private String componentName = null; - private String componentDescription = null; - private String componentWikiURL = null; - - - /** - * Construct the description of the reporting component. - * - * @param componentId - numerical identifier for the component. - * @param componentName - display name for the component. - * @param componentDescription - description of the component. - * @param componentWikiURL - link to more information. - */ - public OMRSAuditLogReportingComponent(int componentId, - String componentName, - String componentDescription, - String componentWikiURL) - { - this.componentId = componentId; - this.componentName = componentName; - this.componentDescription = componentDescription; - this.componentWikiURL = componentWikiURL; - } - - /** - * Return the numerical code for this enum. - * - * @return int componentId - */ - public int getComponentId() - { - return componentId; - } - - - /** - * Return the name of the component. This is the name used in the audit log records. - * - * @return String component name - */ - public String getComponentName() - { - return componentName; - } - - - /** - * Return the short description of the component. This is an English description. Natural language support for - * these values can be added to UIs using a resource bundle indexed with the component Id. This value is - * provided as a default if the resource bundle is not available. - * - * @return String description - */ - public String getComponentDescription() - { - return componentDescription; - } - - - /** - * URL link to the wiki page that describes this component. This provides more information to the log reader - * on the operation of the component. - * - * @return String URL - */ - public String getComponentWikiURL() - { - return componentWikiURL; - } - - - @Override - public String toString() - { - return "ReportingComponent { " + - "id : " + this.componentId + ", " + - "name : " + this.componentName + ", " + - "description : " + this.componentDescription + ", " + - "url : " + this.componentWikiURL + " }"; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - OMRSAuditLogReportingComponent that = (OMRSAuditLogReportingComponent) o; - - if (componentId != that.componentId) - { - return false; - } - if (componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) - { - return false; - } - if (componentDescription != null ? !componentDescription.equals(that.componentDescription) : that.componentDescription != null) - { - return false; - } - return componentWikiURL != null ? componentWikiURL.equals(that.componentWikiURL) : that.componentWikiURL == null; - } - - @Override - public int hashCode() - { - int result = componentId; - result = 31 * result + (componentName != null ? componentName.hashCode() : 0); - result = 31 * result + (componentDescription != null ? componentDescription.hashCode() : 0); - result = 31 * result + (componentWikiURL != null ? componentWikiURL.hashCode() : 0); - return result; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStore.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStore.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStore.java deleted file mode 100644 index 8c5e7d8..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStore.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.omrs.auditlog.store; - -import org.apache.atlas.omrs.ffdc.exception.PagingErrorException; -import org.apache.atlas.omrs.ffdc.exception.InvalidParameterException; - -import java.util.Date; -import java.util.List; - -/** - * OMRSAuditLogStore is the specialized data API for an Audit Log connector. - */ -public interface OMRSAuditLogStore -{ - /** - * Store the audit log record in the audit log store. - * - * @param logRecord - log record to store - * @return unique identifier assigned to the log record - * @throws InvalidParameterException - indicates that the logRecord parameter is invalid. - */ - String storeLogRecord(OMRSAuditLogRecord logRecord) throws InvalidParameterException; - - - /** - * Retrieve a specific audit log record. - * - * @param logRecordId - unique identifier for the log record - * @return requested audit log record - * @throws InvalidParameterException - indicates that the logRecordId parameter is invalid. - */ - OMRSAuditLogRecord getAuditLogRecord(String logRecordId) throws InvalidParameterException; - - - /** - * Retrieve a list of log records written in a specified time period. The offset and maximumRecords - * parameters support a paging - * - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - List<OMRSAuditLogRecord> getAuditLogRecordsByTimeStamp(Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException; - - /** - * Retrieve a list of log records that have specific severity. The offset and maximumRecords - * parameters support a paging model. - * - * @param severity - the severity value of messages to return - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the severity, start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - List<OMRSAuditLogRecord> getAuditLogRecordsBySeverity(String severity, - Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException; - - /** - * Retrieve a list of log records written by a specific component. The offset and maximumRecords - * parameters support a paging model. - * - * @param component - name of the component to retrieve events from - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the component, start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - List<OMRSAuditLogRecord> getAuditLogRecordsByComponent(String component, - Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException; -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreConnectorBase.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreConnectorBase.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreConnectorBase.java deleted file mode 100644 index eb95e57..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreConnectorBase.java +++ /dev/null @@ -1,27 +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.omrs.auditlog.store; - -import org.apache.atlas.ocf.ConnectorBase; - -/** - * OMRSAuditLogStoreConnectorBase is the base class for connectors that support the OMRSAuditLog - */ -public abstract class OMRSAuditLogStoreConnectorBase extends ConnectorBase implements OMRSAuditLogStore -{ -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreProviderBase.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreProviderBase.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreProviderBase.java deleted file mode 100644 index 4f27767..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/OMRSAuditLogStoreProviderBase.java +++ /dev/null @@ -1,41 +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.omrs.auditlog.store; - -import org.apache.atlas.ocf.ConnectorProviderBase; - -/** - * The OMRSAuditLogStoreProviderBase provides a base class for the connector provider supporting OMRS - * audit log stores. It extends ConnectorProviderBase which does the creation of connector instances. - * The subclasses of OMRSAuditLogStoreProviderBase must initialize ConnectorProviderBase with the Java class - * name of the audit log connector implementation (by calling super.setConnectorClassName(className)). - * Then the connector provider will work. - */ -public abstract class OMRSAuditLogStoreProviderBase extends ConnectorProviderBase -{ - /** - * Default Constructor - */ - public OMRSAuditLogStoreProviderBase() - { - /* - * Nothing to do - */ - } -} - http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreConnector.java deleted file mode 100644 index 1914f42..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreConnector.java +++ /dev/null @@ -1,187 +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.omrs.auditlog.store.file; - -import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogRecord; -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogStoreConnectorBase; -import org.apache.atlas.omrs.ffdc.OMRSErrorCode; -import org.apache.atlas.omrs.ffdc.exception.PagingErrorException; -import org.apache.atlas.omrs.ffdc.exception.InvalidParameterException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * FileBasedAuditLogStoreConnector provides a connector implementation for a file based audit log. - * The audit log is stored in a directory and each audit log record is stored as a file with a filename build - * from the record's unique identifier (guid). - */ -public class FileBasedAuditLogStoreConnector extends OMRSAuditLogStoreConnectorBase -{ - private static final Logger log = LoggerFactory.getLogger(FileBasedAuditLogStoreConnector.class); - - - /** - * Default constructor used by the connector provider. - */ - public FileBasedAuditLogStoreConnector() - { - } - - - /** - * Store the audit log record in the audit log store. - * - * @param logRecord - log record to store - * @return unique identifier assigned to the log record - * @throws InvalidParameterException - indicates that the logRecord parameter is invalid. - */ - public String storeLogRecord(OMRSAuditLogRecord logRecord) throws InvalidParameterException - { - final String methodName = "storeLogRecord"; - - if (logRecord == null) - { - OMRSErrorCode errorCode = OMRSErrorCode.NULL_LOG_RECORD; - String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(); - - throw new InvalidParameterException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - - if (log.isDebugEnabled()) - { - log.debug("AuditLogRecord: " + logRecord.toString()); - } - - return null; - } - - - /** - * Retrieve a specific audit log record. - * - * @param logRecordId - unique identifier for the log record - * @return requested audit log record - * @throws InvalidParameterException - indicates that the logRecordId parameter is invalid. - */ - public OMRSAuditLogRecord getAuditLogRecord(String logRecordId) throws InvalidParameterException - { - - return null; - } - - - /** - * Retrieve a list of log records written in a specified time period. The offset and maximumRecords - * parameters support a paging - * - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - public ArrayList<OMRSAuditLogRecord> getAuditLogRecordsByTimeStamp(Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException - { - return null; - } - - /** - * Retrieve a list of log records of a specific severity. The offset and maximumRecords - * parameters support a paging model. - * - * @param severity - the severity value of messages to return - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the severity, start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - public ArrayList<OMRSAuditLogRecord> getAuditLogRecordsBySeverity(String severity, - Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException - { - return null; - } - - - /** - * Retrieve a list of log records written by a specific component. The offset and maximumRecords - * parameters support a paging model. - * - * @param component - name of the component to retrieve events from - * @param startDate - start of time period - * @param endDate - end of time period - * @param offset - offset of full collection to begin the return results - * @param maximumRecords - maximum number of log records to return - * @return list of log records from the specified time period - * @throws InvalidParameterException - indicates that the component, start and/or end date parameters are invalid. - * @throws PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid. - */ - public List<OMRSAuditLogRecord> getAuditLogRecordsByComponent(String component, - Date startDate, - Date endDate, - int offset, - int maximumRecords) throws InvalidParameterException, - PagingErrorException - { - return null; - } - - - /** - * Indicates that the connector is completely configured and can begin processing. - * - * @throws ConnectorCheckedException - there is a problem within the connector. - */ - public void start() throws ConnectorCheckedException - { - super.start(); - } - - - /** - * Free up any resources held since the connector is no longer needed. - * - * @throws ConnectorCheckedException - there is a problem within the connector. - */ - public void disconnect() throws ConnectorCheckedException - { - super.disconnect(); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreProvider.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreProvider.java b/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreProvider.java deleted file mode 100644 index d49045d..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/auditlog/store/file/FileBasedAuditLogStoreProvider.java +++ /dev/null @@ -1,37 +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.omrs.auditlog.store.file; - -import org.apache.atlas.omrs.auditlog.store.OMRSAuditLogStoreProviderBase; - -/** - * FileBasedRegistryStoreProvider is the OCF connector provider for the file based cohort registry store. - */ -public class FileBasedAuditLogStoreProvider extends OMRSAuditLogStoreProviderBase -{ - /** - * Constructor used to initialize the ConnectorProviderBase with the Java class name of the specific - * audit log store implementation. - */ - public FileBasedAuditLogStoreProvider() - { - Class connectorClass = FileBasedAuditLogStoreConnector.class; - - super.setConnectorClassName(connectorClass.getName()); - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectionConsumer.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectionConsumer.java b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectionConsumer.java deleted file mode 100644 index 2a7e6e8..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectionConsumer.java +++ /dev/null @@ -1,68 +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.omrs.enterprise.connectormanager; - -import org.apache.atlas.ocf.ffdc.ConnectionCheckedException; -import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; -import org.apache.atlas.ocf.properties.Connection; - -/** - * OMRSConnectionConsumer provides the interfaces for a connection consumer. This is a component that needs to - * maintain a current list of connections to all of the repositories in the open metadata repository cohort. - */ -public interface OMRSConnectionConsumer -{ - /** - * Pass details of the connection for one of the remote repositories registered in a connected - * open metadata repository cohort. - * - * @param cohortName - name of the cohort adding the remote connection. - * @param remoteServerName - name of the remote server for this connection. - * @param remoteServerType - type of the remote server. - * @param owningOrganizationName - name of the organization the owns the remote server. - * @param metadataCollectionId - Unique identifier for the metadata collection - * @param remoteConnection - Connection object providing properties necessary to create an - * OMRSRepositoryConnector for the remote repository. - * @throws ConnectionCheckedException - there are invalid properties in the Connection - * @throws ConnectorCheckedException - there is a problem initializing the Connector - */ - void addRemoteConnection(String cohortName, - String remoteServerName, - String remoteServerType, - String owningOrganizationName, - String metadataCollectionId, - Connection remoteConnection) throws ConnectionCheckedException, ConnectorCheckedException; - - - /** - * Pass details of the connection for the repository that has left one of the open metadata repository cohorts. - * - * @param cohortName - name of the cohort removing the remote connection. - * @param metadataCollectionId - Unique identifier for the metadata collection. - */ - void removeRemoteConnection(String cohortName, - String metadataCollectionId); - - - /** - * Remove all of the remote connections for the requested open metadata repository cohort. - * - * @param cohortName - name of the cohort - */ - void removeCohort(String cohortName); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorConsumer.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorConsumer.java b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorConsumer.java deleted file mode 100644 index 9ee6246..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorConsumer.java +++ /dev/null @@ -1,61 +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.omrs.enterprise.connectormanager; - -import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; - -/** - * OMRSConnectConsumer provides the interfaces for a connector consumer. This is a component that needs to - * maintain a current list of connectors to all of the remote repositories in the open metadata repository cohorts that - * the local server is a member of. - */ -public interface OMRSConnectorConsumer -{ - /** - * Pass the connector for the local repository to the connector consumer. - * - * @param metadataCollectionId - Unique identifier for the metadata collection - * @param localConnector - OMRSRepositoryConnector object for the local repository. - */ - void setLocalConnector(String metadataCollectionId, - OMRSRepositoryConnector localConnector); - - - /** - * Pass the connector to one of the remote repositories in the metadata repository cohort. - * - * @param metadataCollectionId - Unique identifier for the metadata collection - * @param remoteConnector - OMRSRepositoryConnector object providing access to the remote repository. - */ - void addRemoteConnector(String metadataCollectionId, - OMRSRepositoryConnector remoteConnector); - - - /** - * Pass the metadata collection id for a repository that has just left the metadata repository cohort. - * - * @param metadataCollectionId - identifier of the metadata collection that is no longer available. - */ - void removeRemoteConnector(String metadataCollectionId); - - - /** - * Call disconnect on all registered connectors and stop calling them. The OMRS is about to shutdown. - */ - void disconnectAllConnectors(); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorManager.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorManager.java b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorManager.java deleted file mode 100644 index 0a767d7..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/connectormanager/OMRSConnectorManager.java +++ /dev/null @@ -1,48 +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.omrs.enterprise.connectormanager; - - -/** - * OMRSConnectorManager provides the methods for connector consumers to register with the connector manager. - */ -public interface OMRSConnectorManager -{ - /** - * Register the supplied connector consumer with the connector manager. During the registration - * request, the connector manager will pass the connector to the local repository and - * the connectors to all currently registered remote repositories. Once successfully registered - * the connector manager will call the connector consumer each time the repositories in the - * metadata repository cluster changes. - * - * @param connectorConsumer OMRSConnectorConsumer interested in details of the connectors to - * all repositories registered in the metadata repository cluster. - * @return String identifier for the connectorConsumer - used for the unregister call. - */ - String registerConnectorConsumer(OMRSConnectorConsumer connectorConsumer); - - - /** - * Unregister a connector consumer from the connector manager so it is no longer informed of - * changes to the metadata repository cluster. - * - * @param connectorConsumerId String identifier of the connector consumer returned on the - * registerConnectorConsumer. - */ - void unregisterConnectorConsumer(String connectorConsumerId); -}
