http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEventCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEventCreator.java deleted file mode 100644 index 3327eff..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEventCreator.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 - * - * 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.ambari.server.audit.request; - -import java.util.Set; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; -import org.apache.ambari.server.api.services.ResultStatus; -import org.apache.ambari.server.audit.AuditEvent; -import org.apache.ambari.server.controller.spi.Resource; - -/** - * This interface must be implemented by the plugins for the request audit logger - * in order to make custom {@link AuditEvent}s based on {@link org.apache.ambari.server.api.services.Request.Type}s - * and {@link org.apache.ambari.server.controller.spi.Resource.Type} - */ -public interface RequestAuditEventCreator { - - /** - * @return the set of {@link org.apache.ambari.server.api.services.Request.Type}s that are handled by this creator - */ - Set<Request.Type> getRequestTypes(); - - /** - * @return the {@link org.apache.ambari.server.controller.spi.Resource.Type}s that is handled by this creator - */ - Set<Resource.Type> getResourceTypes(); - - /** - * @return the {@link ResultStatus}es that is handled by this creator - */ - Set<ResultStatus.STATUS> getResultStatuses(); - - /** - * Creates and {@link AuditEvent} - * @param request HTTP request object - * @param result HTTP result object - * @return an {@link AuditEvent} - */ - AuditEvent createAuditEvent(Request request, Result result); - -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLogger.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLogger.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLogger.java deleted file mode 100644 index c961f0f..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLogger.java +++ /dev/null @@ -1,36 +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.ambari.server.audit.request; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; - -/** - * Audit logger interface for logging requests - */ -public interface RequestAuditLogger { - - /** - * Logs an audit event based on the http request and result - * @param request - * @param result - */ - void log(Request request, Result result); - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLoggerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLoggerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLoggerImpl.java deleted file mode 100644 index 1feb3ad..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditLoggerImpl.java +++ /dev/null @@ -1,147 +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.ambari.server.audit.request; - - -import java.util.Set; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; -import org.apache.ambari.server.api.services.ResultStatus; -import org.apache.ambari.server.audit.AuditEvent; -import org.apache.ambari.server.audit.AuditLogger; -import org.apache.ambari.server.controller.spi.Resource; - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -/** - * The purpose of this class is to create audit log entries for the HTTP requests - */ -@Singleton -public class RequestAuditLoggerImpl implements RequestAuditLogger { - - /** - * Priorities for searching the proper creator - */ - private static final int REQUEST_TYPE_PRIORITY = 1; - private static final int RESULT_STATUS_PRIORITY = 2; - private static final int RESOURCE_TYPE_PRIORITY = 4; - - /** - * Container for the {@link RequestAuditEventCreator} - */ - private Set<RequestAuditEventCreator> creators; - - /** - * Audit logger that receives {@link AuditEvent}s and does the actual logging - */ - private AuditLogger auditLogger; - - /** - * Injecting dependencies through the constructor - * @param auditLogger Audit Logger - * @param creatorSet Set of plugins that are registered for requests - */ - @Inject - public RequestAuditLoggerImpl(AuditLogger auditLogger, Set<RequestAuditEventCreator> creatorSet) { - this.auditLogger = auditLogger; - this.creators = creatorSet; - } - - /** - * Finds the proper creator, then creates and logs and {@link AuditEvent} - * @param request - * @param result - */ - @Override - public void log(Request request, Result result) { - Resource.Type resourceType = request.getResource().getResourceDefinition().getType(); - Request.Type requestType = request.getRequestType(); - ResultStatus resultStatus = result.getStatus(); - - RequestAuditEventCreator creator = selectCreator(resourceType, resultStatus, requestType); - if (creator != null) { - AuditEvent ae = creator.createAuditEvent(request, result); - if(ae != null) { - auditLogger.log(ae); - } - } - } - - /** - * Select the proper creator. Priority order: resourceType > resultStatus > requestType - * The most matching creator is returned - * If there is no creator found, then null is returned. - * @param resourceType - * @param requestType - * @param resultStatus - * @return - */ - private RequestAuditEventCreator selectCreator(Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - - RequestAuditEventCreator selected = null; - Integer priority = -1; - - for (RequestAuditEventCreator creator : creators) { - Integer creatorPriority = getPriority(creator, resourceType, resultStatus, requestType); - if (creatorPriority != null && priority < creatorPriority) { - priority = creatorPriority; - selected = creator; - } - } - return selected; - } - - /** - * Calculates the creator priority for the actual resouce type, result status and request type - * @param creator - * @param resourceType - * @param resultStatus - * @param requestType - * @return - */ - private Integer getPriority(RequestAuditEventCreator creator, Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - Integer priority = 0; - - if(isIncompatible(creator, resourceType, resultStatus, requestType)) - { - return null; - } - - priority += creator.getRequestTypes() != null && creator.getRequestTypes().contains(requestType) ? REQUEST_TYPE_PRIORITY : 0; - priority += creator.getResultStatuses() != null && creator.getResultStatuses().contains(resultStatus.getStatus()) ? RESULT_STATUS_PRIORITY : 0; - priority += creator.getResourceTypes() != null && creator.getResourceTypes().contains(resourceType) ? RESOURCE_TYPE_PRIORITY : 0; - return priority; - } - - /** - * Checks if the creator is a possible candidate for creating audit log event for the request - * @param creator - * @param resourceType - * @param resultStatus - * @param requestType - * @return - */ - private boolean isIncompatible(RequestAuditEventCreator creator, Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - return creator.getRequestTypes() != null && !creator.getRequestTypes().contains(requestType) || - creator.getResultStatuses() != null && !creator.getResultStatuses().contains(resultStatus.getStatus()) || - creator.getResourceTypes() != null && !creator.getResourceTypes().contains(resourceType); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java deleted file mode 100644 index 4e14671..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java +++ /dev/null @@ -1,87 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class ActivateUserRequestAuditEvent extends RequestAuditEvent { - - public static class ActivateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<ActivateUserRequestAuditEvent, ActivateUserRequestAuditEventBuilder> { - - private boolean active; - - private String username; - - public ActivateUserRequestAuditEventBuilder() { - super.withOperation("Set user activate"); - } - - @Override - protected ActivateUserRequestAuditEvent newAuditEvent() { - return new ActivateUserRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder - .append(", Affected username(") - .append(username) - .append("), ") - .append("Active(") - .append(active ? "yes" : "no") - .append(")"); - } - - public ActivateUserRequestAuditEventBuilder withActive(boolean active) { - this.active = active; - return this; - } - - public ActivateUserRequestAuditEventBuilder withAffectedUsername(String username) { - this.username = username; - return this; - } - - } - - protected ActivateUserRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ActivateUserRequestAuditEvent(ActivateUserRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ActivateUserRequestAuditEvent} - * @return a builder instance - */ - public static ActivateUserRequestAuditEventBuilder builder() { - return new ActivateUserRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertGroupRequestAuditEvent.java deleted file mode 100644 index 46a2273..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertGroupRequestAuditEvent.java +++ /dev/null @@ -1,96 +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.ambari.server.audit.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class AddAlertGroupRequestAuditEvent extends RequestAuditEvent { - - public static class AddAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertGroupRequestAuditEvent, AddAlertGroupRequestAuditEventBuilder> { - - private String name; - - private List<String> definitionIds; - - private List<String> notificationIds; - - public AddAlertGroupRequestAuditEventBuilder() { - super.withOperation("Alert group addition"); - } - - @Override - protected AddAlertGroupRequestAuditEvent newAuditEvent() { - return new AddAlertGroupRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Alert group name(") - .append(name) - .append("), Definition IDs(") - .append(StringUtils.join(definitionIds, ", ")) - .append("), Notification IDs(") - .append(StringUtils.join(notificationIds, ", ")) - .append(")"); - } - - public AddAlertGroupRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public AddAlertGroupRequestAuditEventBuilder withDefinitionIds(List<String> ids) { - this.definitionIds = ids; - return this; - } - - public AddAlertGroupRequestAuditEventBuilder withNotificationIds(List<String> ids) { - this.notificationIds = ids; - return this; - } - } - - protected AddAlertGroupRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddAlertGroupRequestAuditEvent(AddAlertGroupRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddAlertGroupRequestAuditEvent} - * @return a builder instance - */ - public static AddAlertGroupRequestAuditEventBuilder builder() { - return new AddAlertGroupRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertTargetRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertTargetRequestAuditEvent.java deleted file mode 100644 index 60958e3..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddAlertTargetRequestAuditEvent.java +++ /dev/null @@ -1,134 +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.ambari.server.audit.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class AddAlertTargetRequestAuditEvent extends RequestAuditEvent { - - public static class AddAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertTargetRequestAuditEvent, AddAlertTargetRequestAuditEventBuilder> { - - private String name; - private String description; - private String notificationType; - private List<String> groupIds; - private String emailFrom; - private List<String> emailRecipients; - private List<String> alertStates; - - public AddAlertTargetRequestAuditEventBuilder() { - super.withOperation("Notification addition"); - } - - @Override - protected AddAlertTargetRequestAuditEvent newAuditEvent() { - return new AddAlertTargetRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Notification name(") - .append(name) - .append("), Description(") - .append(description) - .append("), Notification type(") - .append(notificationType) - .append("), Group IDs(") - .append(StringUtils.join(groupIds, ", ")); - - if (emailFrom != null) { - builder.append("), Email from(") - .append(emailFrom); - } - - if(emailRecipients != null && !emailRecipients.isEmpty()) { - builder.append("), Email to(") - .append(StringUtils.join(emailRecipients, ", ")); - } - builder.append("), Alert states(") - .append(StringUtils.join(alertStates, ", ")) - .append(")"); - } - - public AddAlertTargetRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withDescription(String description) { - this.description = description; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withNotificationType(String notificationType) { - this.notificationType = notificationType; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withGroupIds(List<String> groupIds) { - this.groupIds = groupIds; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withEmailFrom(String emailFrom) { - this.emailFrom = emailFrom; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withEmailRecipients(List<String> emailRecipients) { - this.emailRecipients = emailRecipients; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withAlertStates(List<String> alertStates) { - this.alertStates = alertStates; - return this; - } - } - - protected AddAlertTargetRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddAlertTargetRequestAuditEvent(AddAlertTargetRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddAlertTargetRequestAuditEvent} - * - * @return a builder instance - */ - public static AddAlertTargetRequestAuditEventBuilder builder() { - return new AddAlertTargetRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java deleted file mode 100644 index afc20da..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java +++ /dev/null @@ -1,77 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddBlueprintRequestAuditEvent extends RequestAuditEvent { - - public static class AddBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<AddBlueprintRequestAuditEvent, AddBlueprintRequestAuditEventBuilder> { - - private String blueprintName; - - public AddBlueprintRequestAuditEventBuilder() { - super.withOperation("Upload blueprint"); - } - - @Override - protected AddBlueprintRequestAuditEvent newAuditEvent() { - return new AddBlueprintRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder - .append(", Blueprint name(") - .append(blueprintName) - .append(")"); - } - - public AddBlueprintRequestAuditEventBuilder withBlueprintName(String blueprintName) { - this.blueprintName = blueprintName; - return this; - } - - } - - protected AddBlueprintRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddBlueprintRequestAuditEvent(AddBlueprintRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddBlueprintRequestAuditEvent} - * @return a builder instance - */ - public static AddBlueprintRequestAuditEventBuilder builder() { - return new AddBlueprintRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddComponentToHostRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddComponentToHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddComponentToHostRequestAuditEvent.java deleted file mode 100644 index 4270505..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddComponentToHostRequestAuditEvent.java +++ /dev/null @@ -1,83 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddComponentToHostRequestAuditEvent extends RequestAuditEvent { - - public static class AddComponentToHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddComponentToHostRequestAuditEvent, AddComponentToHostRequestAuditEventBuilder> { - - private String hostName; - private String component; - - public AddComponentToHostRequestAuditEventBuilder() { - super.withOperation("Component addition to host"); - } - - @Override - protected AddComponentToHostRequestAuditEvent newAuditEvent() { - return new AddComponentToHostRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Hostname(") - .append(hostName) - .append(", Component(") - .append(component) - .append(")"); - } - - public AddComponentToHostRequestAuditEventBuilder withHostName(String hostName) { - this.hostName = hostName; - return this; - } - - public AddComponentToHostRequestAuditEventBuilder withComponent(String component) { - this.component = component; - return this; - } - } - - protected AddComponentToHostRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddComponentToHostRequestAuditEvent(AddComponentToHostRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddComponentToHostRequestAuditEvent} - * @return a builder instance - */ - public static AddComponentToHostRequestAuditEventBuilder builder() { - return new AddComponentToHostRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddCredentialRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddCredentialRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddCredentialRequestAuditEvent.java deleted file mode 100644 index 780e2eb..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddCredentialRequestAuditEvent.java +++ /dev/null @@ -1,105 +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.ambari.server.audit.request.event; - -import java.util.List; -import java.util.Map; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddCredentialRequestAuditEvent extends RequestAuditEvent { - - public static class AddCredentialAuditEventBuilder extends RequestAuditEventBuilder<AddCredentialRequestAuditEvent, AddCredentialAuditEventBuilder> { - - private String type; - - private String clusterName; - - private String principal; - - private String alias; - - public AddCredentialAuditEventBuilder() { - super.withOperation("Credential addition"); - } - - @Override - protected AddCredentialRequestAuditEvent newAuditEvent() { - return new AddCredentialRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Type(") - .append(type) - .append("), Principal(") - .append(principal) - .append("), Alias(") - .append(alias) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddCredentialAuditEventBuilder withType(String type) { - this.type = type; - return this; - } - - public AddCredentialAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - public AddCredentialAuditEventBuilder withPrincipal(String principal) { - this.principal = principal; - return this; - } - - public AddCredentialAuditEventBuilder withAlias(String alias) { - this.alias = alias; - return this; - } - } - - protected AddCredentialRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddCredentialRequestAuditEvent(AddCredentialAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddCredentialRequestAuditEvent} - * @return a builder instance - */ - public static AddCredentialAuditEventBuilder builder() { - return new AddCredentialAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddHostRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddHostRequestAuditEvent.java deleted file mode 100644 index cab8e6e..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddHostRequestAuditEvent.java +++ /dev/null @@ -1,75 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddHostRequestAuditEvent extends RequestAuditEvent { - - public static class AddHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddHostRequestAuditEvent, AddHostRequestAuditEventBuilder> { - - private String hostName; - - public AddHostRequestAuditEventBuilder() { - super.withOperation("Host addition"); - } - - @Override - protected AddHostRequestAuditEvent newAuditEvent() { - return new AddHostRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Hostname(") - .append(hostName) - .append(")"); - } - - public AddHostRequestAuditEventBuilder withHostName(String hostName) { - this.hostName = hostName; - return this; - } - } - - protected AddHostRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddHostRequestAuditEvent(AddHostRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddHostRequestAuditEvent} - * @return a builder instance - */ - public static AddHostRequestAuditEventBuilder builder() { - return new AddHostRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryRequestAuditEvent.java deleted file mode 100644 index 31ba433..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryRequestAuditEvent.java +++ /dev/null @@ -1,111 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddRepositoryRequestAuditEvent extends RequestAuditEvent { - - public static class AddRepositoryRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryRequestAuditEvent, AddRepositoryRequestAuditEventBuilder> { - - private String repo; - - private String stackName; - - private String osType; - - private String baseUrl; - - private String stackVersion; - - public AddRepositoryRequestAuditEventBuilder() { - super.withOperation("Repository addition"); - } - - @Override - protected AddRepositoryRequestAuditEvent newAuditEvent() { - return new AddRepositoryRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Stack(") - .append(stackName) - .append("), Stack version(") - .append(stackVersion) - .append("), OS(") - .append(osType) - .append("), Repo id(") - .append(repo) - .append("), Base URL(") - .append(baseUrl) - .append(")"); - } - - public AddRepositoryRequestAuditEventBuilder withRepo(String repo) { - this.repo = repo; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withStackName(String stackName) { - this.stackName = stackName; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withOsType(String osType) { - this.osType = osType; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withStackVersion(String stackVersion) { - this.stackVersion = stackVersion; - return this; - } - } - - protected AddRepositoryRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRepositoryRequestAuditEvent(AddRepositoryRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRepositoryRequestAuditEvent} - * @return a builder instance - */ - public static AddRepositoryRequestAuditEventBuilder builder() { - return new AddRepositoryRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryVersionRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryVersionRequestAuditEvent.java deleted file mode 100644 index 879582c..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRepositoryVersionRequestAuditEvent.java +++ /dev/null @@ -1,129 +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.ambari.server.audit.request.event; - -import java.util.List; -import java.util.Map; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddRepositoryVersionRequestAuditEvent extends RequestAuditEvent { - - public static class AddRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryVersionRequestAuditEvent, AddRepositoryVersionAuditEventBuilder> { - - private String stackName; - - private String displayName; - - private String stackVersion; - - private String repoVersion; - - private Map<String, List<Map<String, String>>> repos; - - public AddRepositoryVersionAuditEventBuilder() { - super.withOperation("Repository version addition"); - } - - @Override - protected AddRepositoryVersionRequestAuditEvent newAuditEvent() { - return new AddRepositoryVersionRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Stack(") - .append(stackName) - .append("), Stack version(") - .append(stackVersion) - .append("), Display name(") - .append(displayName) - .append("), Repo version(") - .append(repoVersion) - .append("), Repositories("); - - if(!repos.isEmpty()) { - builder.append(System.lineSeparator()); - } - - for(Map.Entry<String, List<Map<String, String>>> repo : repos.entrySet()) { - builder.append("Operating system: ").append(repo.getKey()); - builder.append(System.lineSeparator()); - for(Map<String, String> properties : repo.getValue()) { - builder.append(" Repository ID(").append(properties.get("repo_id")); - builder.append("), Repository name(").append(properties.get("repo_name")); - builder.append("), Base url(").append(properties.get("base_url")).append(")"); - builder.append(System.lineSeparator()); - } - } - - builder.append(")"); - } - - public AddRepositoryVersionAuditEventBuilder withStackName(String stackName) { - this.stackName = stackName; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) { - this.stackVersion = stackVersion; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) { - this.repoVersion = repoVersion; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withRepos(Map<String, List<Map<String, String>>> repos) { - this.repos = repos; - return this; - } - } - - protected AddRepositoryVersionRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRepositoryVersionRequestAuditEvent(AddRepositoryVersionAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRepositoryVersionRequestAuditEvent} - * @return a builder instance - */ - public static AddRepositoryVersionAuditEventBuilder builder() { - return new AddRepositoryVersionAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRequestRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRequestRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRequestRequestAuditEvent.java deleted file mode 100644 index 2332269..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddRequestRequestAuditEvent.java +++ /dev/null @@ -1,84 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddRequestRequestAuditEvent extends RequestAuditEvent { - - public static class AddRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRequestRequestAuditEvent, AddRequestAuditEventBuilder> { - - private String command; - - private String clusterName; - - public AddRequestAuditEventBuilder() { - super.withOperation("Request from server"); - } - - @Override - protected AddRequestRequestAuditEvent newAuditEvent() { - return new AddRequestRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append("), Command(") - .append(command) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddRequestAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - public AddRequestAuditEventBuilder withCommand(String command) { - this.command = command; - return this; - } - } - - protected AddRequestRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRequestRequestAuditEvent(AddRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRequestRequestAuditEvent} - * @return a builder instance - */ - public static AddRequestAuditEventBuilder builder() { - return new AddRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUpgradeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUpgradeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUpgradeRequestAuditEvent.java deleted file mode 100644 index 49adf34..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUpgradeRequestAuditEvent.java +++ /dev/null @@ -1,92 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddUpgradeRequestAuditEvent extends RequestAuditEvent { - - public static class AddUpgradeRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUpgradeRequestAuditEvent, AddUpgradeRequestAuditEventBuilder> { - - private String repositoryVersion; - private String upgradeType; - private String clusterName; - - - public AddUpgradeRequestAuditEventBuilder() { - super.withOperation("Upgrade addition"); - } - - @Override - protected AddUpgradeRequestAuditEvent newAuditEvent() { - return new AddUpgradeRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Repository version(") - .append(repositoryVersion) - .append("), Upgrade type(") - .append(upgradeType) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddUpgradeRequestAuditEventBuilder withRepositoryVersion(String repositoryVersion) { - this.repositoryVersion = repositoryVersion; - return this; - } - - public AddUpgradeRequestAuditEventBuilder withUpgradeType(String upgradeType) { - this.upgradeType = upgradeType; - return this; - } - - public AddUpgradeRequestAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - } - - protected AddUpgradeRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddUpgradeRequestAuditEvent(AddUpgradeRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddUpgradeRequestAuditEvent} - * @return a builder instance - */ - public static AddUpgradeRequestAuditEventBuilder builder() { - return new AddUpgradeRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java deleted file mode 100644 index 0690c30..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java +++ /dev/null @@ -1,83 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddUserToGroupRequestAuditEvent extends RequestAuditEvent { - - public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUserToGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> { - - private String groupName; - private String affectedUserName; - - public AddUserToGroupRequestAuditEventBuilder() { - super.withOperation("User addition to group"); - } - - @Override - protected AddUserToGroupRequestAuditEvent newAuditEvent() { - return new AddUserToGroupRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Group("); - builder.append(groupName); - builder.append("), Affected username("); - builder.append(affectedUserName); - builder.append(")"); - } - - public AddUserToGroupRequestAuditEventBuilder withGroupName(String groupName) { - this.groupName = groupName; - return this; - } - - public AddUserToGroupRequestAuditEventBuilder withAffectedUserName(String userName) { - this.affectedUserName = userName; - return this; - } - } - - protected AddUserToGroupRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddUserToGroupRequestAuditEvent(AddUserToGroupRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddUserToGroupRequestAuditEvent} - * @return a builder instance - */ - public static AddUserToGroupRequestAuditEventBuilder builder() { - return new AddUserToGroupRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddViewInstanceRequestAuditEvent.java deleted file mode 100644 index 25fe583..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddViewInstanceRequestAuditEvent.java +++ /dev/null @@ -1,111 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AddViewInstanceRequestAuditEvent extends RequestAuditEvent { - - public static class AddViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<AddViewInstanceRequestAuditEvent, AddViewInstanceRequestAuditEventBuilder> { - - private String description; - - private String name; - - private String type; - - private String displayName; - - private String version; - - public AddViewInstanceRequestAuditEventBuilder() { - super.withOperation("View addition"); - } - - @Override - protected AddViewInstanceRequestAuditEvent newAuditEvent() { - return new AddViewInstanceRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Type(") - .append(type) - .append("), Version(") - .append(version) - .append("), Name(") - .append(name) - .append("), Display name(") - .append(displayName) - .append("), Description(") - .append(description) - .append(")"); - } - - public AddViewInstanceRequestAuditEventBuilder withDescription(String description) { - this.description = description; - return this; - } - - public AddViewInstanceRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public AddViewInstanceRequestAuditEventBuilder withType(String type) { - this.type = type; - return this; - } - - public AddViewInstanceRequestAuditEventBuilder withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public AddViewInstanceRequestAuditEventBuilder withVersion(String version) { - this.version = version; - return this; - } - } - - protected AddViewInstanceRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddViewInstanceRequestAuditEvent(AddViewInstanceRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddViewInstanceRequestAuditEvent} - * @return a builder instance - */ - public static AddViewInstanceRequestAuditEventBuilder builder() { - return new AddViewInstanceRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AdminUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AdminUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AdminUserRequestAuditEvent.java deleted file mode 100644 index 1f91ea1..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AdminUserRequestAuditEvent.java +++ /dev/null @@ -1,87 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class AdminUserRequestAuditEvent extends RequestAuditEvent { - - public static class AdminUserRequestAuditEventBuilder extends RequestAuditEventBuilder<AdminUserRequestAuditEvent, AdminUserRequestAuditEventBuilder> { - - private boolean admin; - - private String username; - - public AdminUserRequestAuditEventBuilder() { - super.withOperation("Set user admin"); - } - - @Override - protected AdminUserRequestAuditEvent newAuditEvent() { - return new AdminUserRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder - .append(", Affeted username(") - .append(username) - .append("), ") - .append("Administrator(") - .append(admin ? "yes" : "no") - .append(")"); - } - - public AdminUserRequestAuditEventBuilder withAdmin(boolean admin) { - this.admin = admin; - return this; - } - - public AdminUserRequestAuditEventBuilder withAffectedUsername(String username) { - this.username = username; - return this; - } - - } - - protected AdminUserRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AdminUserRequestAuditEvent(AdminUserRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AdminUserRequestAuditEvent} - * @return a builder instance - */ - public static AdminUserRequestAuditEventBuilder builder() { - return new AdminUserRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/BlueprintExportRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/BlueprintExportRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/BlueprintExportRequestAuditEvent.java deleted file mode 100644 index cc2dbef..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/BlueprintExportRequestAuditEvent.java +++ /dev/null @@ -1,64 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class BlueprintExportRequestAuditEvent extends RequestAuditEvent { - - public static class BlueprintExportRequestAuditEventBuilder extends RequestAuditEventBuilder<BlueprintExportRequestAuditEvent, BlueprintExportRequestAuditEventBuilder> { - - public BlueprintExportRequestAuditEventBuilder() { - super.withOperation("Blueprint export"); - } - - @Override - protected BlueprintExportRequestAuditEvent newAuditEvent() { - return new BlueprintExportRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - } - } - - protected BlueprintExportRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected BlueprintExportRequestAuditEvent(BlueprintExportRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link BlueprintExportRequestAuditEvent} - * @return a builder instance - */ - public static BlueprintExportRequestAuditEventBuilder builder() { - return new BlueprintExportRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertGroupRequestAuditEvent.java deleted file mode 100644 index 621eff6..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertGroupRequestAuditEvent.java +++ /dev/null @@ -1,96 +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.ambari.server.audit.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class ChangeAlertGroupRequestAuditEvent extends RequestAuditEvent { - - public static class ChangeAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeAlertGroupRequestAuditEvent, ChangeAlertGroupRequestAuditEventBuilder> { - - private String name; - - private List<String> definitionIds; - - private List<String> notificationIds; - - public ChangeAlertGroupRequestAuditEventBuilder() { - super.withOperation("Alert group change"); - } - - @Override - protected ChangeAlertGroupRequestAuditEvent newAuditEvent() { - return new ChangeAlertGroupRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Alert group name(") - .append(name) - .append("), Definition IDs(") - .append(StringUtils.join(definitionIds, ", ")) - .append("), Notification IDs(") - .append(StringUtils.join(notificationIds, ", ")) - .append(")"); - } - - public ChangeAlertGroupRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public ChangeAlertGroupRequestAuditEventBuilder withDefinitionIds(List<String> ids) { - this.definitionIds = ids; - return this; - } - - public ChangeAlertGroupRequestAuditEventBuilder withNotificationIds(List<String> ids) { - this.notificationIds = ids; - return this; - } - } - - protected ChangeAlertGroupRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ChangeAlertGroupRequestAuditEvent(ChangeAlertGroupRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ChangeAlertGroupRequestAuditEvent} - * @return a builder instance - */ - public static ChangeAlertGroupRequestAuditEventBuilder builder() { - return new ChangeAlertGroupRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertTargetRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertTargetRequestAuditEvent.java deleted file mode 100644 index e8f2c84..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeAlertTargetRequestAuditEvent.java +++ /dev/null @@ -1,134 +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.ambari.server.audit.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class ChangeAlertTargetRequestAuditEvent extends RequestAuditEvent { - - public static class ChangeAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeAlertTargetRequestAuditEvent, ChangeAlertTargetRequestAuditEventBuilder> { - - private String name; - private String description; - private String notificationType; - private List<String> groupIds; - private String emailFrom; - private List<String> emailRecipients; - private List<String> alertStates; - - public ChangeAlertTargetRequestAuditEventBuilder() { - super.withOperation("Notification change"); - } - - @Override - protected ChangeAlertTargetRequestAuditEvent newAuditEvent() { - return new ChangeAlertTargetRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Notification name(") - .append(name) - .append("), Description(") - .append(description) - .append("), Notification type(") - .append(notificationType) - .append("), Group IDs(") - .append(StringUtils.join(groupIds, ", ")); - - if (emailFrom != null) { - builder.append("), Email from(") - .append(emailFrom); - } - - if(emailRecipients != null && !emailRecipients.isEmpty()) { - builder.append("), Email to(") - .append(StringUtils.join(emailRecipients, ", ")); - } - builder.append("), Alert states(") - .append(StringUtils.join(alertStates, ", ")) - .append(")"); - } - - public ChangeAlertTargetRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withDescription(String description) { - this.description = description; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withNotificationType(String notificationType) { - this.notificationType = notificationType; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withGroupIds(List<String> groupIds) { - this.groupIds = groupIds; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withEmailFrom(String emailFrom) { - this.emailFrom = emailFrom; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withEmailRecipients(List<String> emailRecipients) { - this.emailRecipients = emailRecipients; - return this; - } - - public ChangeAlertTargetRequestAuditEventBuilder withAlertStates(List<String> alertStates) { - this.alertStates = alertStates; - return this; - } - } - - protected ChangeAlertTargetRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ChangeAlertTargetRequestAuditEvent(ChangeAlertTargetRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ChangeAlertTargetRequestAuditEvent} - * - * @return a builder instance - */ - public static ChangeAlertTargetRequestAuditEventBuilder builder() { - return new ChangeAlertTargetRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeRepositoryVersionRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeRepositoryVersionRequestAuditEvent.java deleted file mode 100644 index 0089780..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeRepositoryVersionRequestAuditEvent.java +++ /dev/null @@ -1,129 +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.ambari.server.audit.request.event; - -import java.util.List; -import java.util.Map; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class ChangeRepositoryVersionRequestAuditEvent extends RequestAuditEvent { - - public static class ChangeRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<ChangeRepositoryVersionRequestAuditEvent, ChangeRepositoryVersionAuditEventBuilder> { - - private String stackName; - - private String displayName; - - private String stackVersion; - - private String repoVersion; - - private Map<String, List<Map<String, String>>> repos; - - public ChangeRepositoryVersionAuditEventBuilder() { - super.withOperation("Repository version change"); - } - - @Override - protected ChangeRepositoryVersionRequestAuditEvent newAuditEvent() { - return new ChangeRepositoryVersionRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Stack(") - .append(stackName) - .append("), Stack version(") - .append(stackVersion) - .append("), Display name(") - .append(displayName) - .append("), Repo version(") - .append(repoVersion) - .append("), Repositories("); - - if(!repos.isEmpty()) { - builder.append(System.lineSeparator()); - } - - for(Map.Entry<String, List<Map<String, String>>> repo : repos.entrySet()) { - builder.append("Operating system: ").append(repo.getKey()); - builder.append(System.lineSeparator()); - for(Map<String, String> properties : repo.getValue()) { - builder.append(" Repository ID(").append(properties.get("repo_id")); - builder.append("), Repository name(").append(properties.get("repo_name")); - builder.append("), Base url(").append(properties.get("base_url")).append(")"); - builder.append(System.lineSeparator()); - } - } - - builder.append(")"); - } - - public ChangeRepositoryVersionAuditEventBuilder withStackName(String stackName) { - this.stackName = stackName; - return this; - } - - public ChangeRepositoryVersionAuditEventBuilder withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public ChangeRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) { - this.stackVersion = stackVersion; - return this; - } - - public ChangeRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) { - this.repoVersion = repoVersion; - return this; - } - - public ChangeRepositoryVersionAuditEventBuilder withRepos(Map<String, List<Map<String, String>>> repos) { - this.repos = repos; - return this; - } - } - - protected ChangeRepositoryVersionRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ChangeRepositoryVersionRequestAuditEvent(ChangeRepositoryVersionAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ChangeRepositoryVersionRequestAuditEvent} - * @return a builder instance - */ - public static ChangeRepositoryVersionAuditEventBuilder builder() { - return new ChangeRepositoryVersionAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeViewInstanceRequestAuditEvent.java deleted file mode 100644 index c590e3a..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ChangeViewInstanceRequestAuditEvent.java +++ /dev/null @@ -1,111 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class ChangeViewInstanceRequestAuditEvent extends RequestAuditEvent { - - public static class ChangeViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeViewInstanceRequestAuditEvent, ChangeViewInstanceRequestAuditEventBuilder> { - - private String description; - - private String name; - - private String type; - - private String displayName; - - private String version; - - public ChangeViewInstanceRequestAuditEventBuilder() { - super.withOperation("View change"); - } - - @Override - protected ChangeViewInstanceRequestAuditEvent newAuditEvent() { - return new ChangeViewInstanceRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Type(") - .append(type) - .append("), Version(") - .append(version) - .append("), Name(") - .append(name) - .append("), Display name(") - .append(displayName) - .append("), Description(") - .append(description) - .append(")"); - } - - public ChangeViewInstanceRequestAuditEventBuilder withDescription(String description) { - this.description = description; - return this; - } - - public ChangeViewInstanceRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public ChangeViewInstanceRequestAuditEventBuilder withType(String type) { - this.type = type; - return this; - } - - public ChangeViewInstanceRequestAuditEventBuilder withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public ChangeViewInstanceRequestAuditEventBuilder withVersion(String version) { - this.version = version; - return this; - } - } - - protected ChangeViewInstanceRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ChangeViewInstanceRequestAuditEvent(ChangeViewInstanceRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ChangeViewInstanceRequestAuditEvent} - * @return a builder instance - */ - public static ChangeViewInstanceRequestAuditEventBuilder builder() { - return new ChangeViewInstanceRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1b3bc6/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ClientConfigDownloadRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ClientConfigDownloadRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ClientConfigDownloadRequestAuditEvent.java deleted file mode 100644 index b4060c7..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ClientConfigDownloadRequestAuditEvent.java +++ /dev/null @@ -1,86 +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.ambari.server.audit.request.event; - -import org.apache.ambari.server.audit.request.RequestAuditEvent; - -public class ClientConfigDownloadRequestAuditEvent extends RequestAuditEvent { - - public static class ClientConfigDownloadRequestAuditEventBuilder extends RequestAuditEventBuilder<ClientConfigDownloadRequestAuditEvent, ClientConfigDownloadRequestAuditEventBuilder> { - - private String service; - - private String component; - - public ClientConfigDownloadRequestAuditEventBuilder() { - super.withOperation("Client config download"); - } - - @Override - protected ClientConfigDownloadRequestAuditEvent newAuditEvent() { - return new ClientConfigDownloadRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Service(") - .append(service) - .append("), Component(") - .append(component) - .append(")"); - - } - - public ClientConfigDownloadRequestAuditEventBuilder withService(String service) { - this.service = service; - return this; - } - - public ClientConfigDownloadRequestAuditEventBuilder withComponent(String component) { - this.component = component; - return this; - } - - } - - protected ClientConfigDownloadRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ClientConfigDownloadRequestAuditEvent(ClientConfigDownloadRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ClientConfigDownloadRequestAuditEvent} - * @return a builder instance - */ - public static ClientConfigDownloadRequestAuditEventBuilder builder() { - return new ClientConfigDownloadRequestAuditEventBuilder(); - } - -}
