Skip to content

Commit

Permalink
spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
TungYuChiang committed Jan 9, 2025
1 parent ca71a04 commit a680fe6
Show file tree
Hide file tree
Showing 14 changed files with 552 additions and 542 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package org.apache.gravitino.listener;

import java.util.Map;

import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.exceptions.NoSuchTagException;
import org.apache.gravitino.listener.api.event.AlterTagEvent;
import org.apache.gravitino.listener.api.event.AssociateTagsForMetadataObjectEvent;
import org.apache.gravitino.listener.api.event.AlterTagFailureEvent;
import org.apache.gravitino.listener.api.event.AssociateTagsForMetadataObjectFailureEvent;
Expand All @@ -42,7 +42,6 @@
import org.apache.gravitino.listener.api.event.ListMetadataObjectsForTagEvent;
import org.apache.gravitino.listener.api.event.ListTagEvent;
import org.apache.gravitino.listener.api.event.ListTagInfoEvent;
import org.apache.gravitino.listener.api.event.AlterTagEvent;
import org.apache.gravitino.listener.api.event.ListTagsForMetadataObjectEvent;
import org.apache.gravitino.listener.api.event.ListTagsInfoForMetadataObjectEvent;
import org.apache.gravitino.listener.api.info.TagInfo;
Expand All @@ -58,13 +57,13 @@
* of tag operations.
*/
public class TagEventDispatcher implements TagDispatcher {
private final EventBus eventBus;
private final TagDispatcher dispatcher;
private final EventBus eventBus;
private final TagDispatcher dispatcher;

public TagEventDispatcher(EventBus eventBus, TagDispatcher dispatcher) {
this.eventBus = eventBus;
this.dispatcher = dispatcher;
}
public TagEventDispatcher(EventBus eventBus, TagDispatcher dispatcher) {
this.eventBus = eventBus;
this.dispatcher = dispatcher;
}

@Override
public String[] listTags(String metalake) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,60 @@
package org.apache.gravitino.listener.api.event;

import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.tag.TagChange;
import org.apache.gravitino.annotation.DeveloperApi;
import org.apache.gravitino.listener.api.info.TagInfo;
import org.apache.gravitino.tag.TagChange;

/** Represents an event triggered upon the successful alteration of a tag. */
@DeveloperApi
public final class AlterTagEvent extends TagEvent {
private final TagInfo updatedTagInfo;
private final TagChange[] tagChanges;
private final TagInfo updatedTagInfo;
private final TagChange[] tagChanges;

/**
* Constructs an instance of {@code AlterTagEvent}, encapsulating the key details about the
* successful alteration of a tag.
*
* @param user The username of the individual responsible for initiating the tag alteration.
* @param metalake The metalake from which the tag is being altered.
* @param tagChanges An array of {@link TagChange} objects representing the specific
* changes applied to the tag during the alteration process.
* @param updatedTagInfo The post-alteration state of the tag.
*/
public AlterTagEvent(
String user,
String metalake,
TagChange[] tagChanges,
TagInfo updatedTagInfo) {
super(user, NameIdentifier.of(metalake));
this.tagChanges = tagChanges.clone();
this.updatedTagInfo = updatedTagInfo;
}
/**
* Constructs an instance of {@code AlterTagEvent}, encapsulating the key details about the
* successful alteration of a tag.
*
* @param user The username of the individual responsible for initiating the tag alteration.
* @param metalake The metalake from which the tag is being altered.
* @param tagChanges An array of {@link TagChange} objects representing the specific changes
* applied to the tag during the alteration process.
* @param updatedTagInfo The post-alteration state of the tag.
*/
public AlterTagEvent(
String user, String metalake, TagChange[] tagChanges, TagInfo updatedTagInfo) {
super(user, NameIdentifier.of(metalake));
this.tagChanges = tagChanges.clone();
this.updatedTagInfo = updatedTagInfo;
}

/**
* Retrieves the final state of the tag as it was returned to the user after successful
* alteration.
*
* @return A {@link TagInfo} instance encapsulating the comprehensive details of the newly
* altered tag.
*/
public TagInfo updatedTagInfo() {
return updatedTagInfo;
}
/**
* Retrieves the final state of the tag as it was returned to the user after successful
* alteration.
*
* @return A {@link TagInfo} instance encapsulating the comprehensive details of the newly altered
* tag.
*/
public TagInfo updatedTagInfo() {
return updatedTagInfo;
}

/**
* Retrieves the specific changes that were made to the tag during the alteration process.
*
* @return An array of {@link TagChange} objects detailing each modification applied to the
* tag.
*/
public TagChange[] tagChanges() {
return tagChanges;
}
/**
* Retrieves the specific changes that were made to the tag during the alteration process.
*
* @return An array of {@link TagChange} objects detailing each modification applied to the tag.
*/
public TagChange[] tagChanges() {
return tagChanges;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.ALTER_TAG;
}
/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.ALTER_TAG;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,90 +19,98 @@

package org.apache.gravitino.listener.api.event;

import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.annotation.DeveloperApi;
import org.apache.gravitino.MetadataObject;

/** Represents an event that is triggered upon successfully associating tags with a metadata object. */
/**
* Represents an event that is triggered upon successfully associating tags with a metadata object.
*/
@DeveloperApi
public final class AssociateTagsForMetadataObjectEvent extends TagEvent {
private final String metalake;
private final MetadataObject metadataObject;
private final String[] tagsToAdd;
private final String[] tagsToRemove;
private final String[] associatedTags;
private final String metalake;
private final MetadataObject metadataObject;
private final String[] tagsToAdd;
private final String[] tagsToRemove;
private final String[] associatedTags;

/**
* Constructs an instance of {@code AssociateTagsForMetadataObjectEvent}.
*
* @param user The username of the individual who initiated the tag association.
* @param metalake The metalake from which the tags were associated.
* @param metadataObject The metadata object with which the tags were associated.
* @param tagsToAdd The tags that were added.
* @param tagsToRemove The tags that were removed.
* @param associatedTags The resulting list of associated tags after the operation.
*/
public AssociateTagsForMetadataObjectEvent(String user, String metalake, MetadataObject metadataObject, String[] tagsToAdd, String[] tagsToRemove, String[] associatedTags) {
super(user, NameIdentifier.of(metalake));
this.metalake = metalake;
this.metadataObject = metadataObject;
this.tagsToAdd = tagsToAdd;
this.tagsToRemove = tagsToRemove;
this.associatedTags = associatedTags;
}
/**
* Constructs an instance of {@code AssociateTagsForMetadataObjectEvent}.
*
* @param user The username of the individual who initiated the tag association.
* @param metalake The metalake from which the tags were associated.
* @param metadataObject The metadata object with which the tags were associated.
* @param tagsToAdd The tags that were added.
* @param tagsToRemove The tags that were removed.
* @param associatedTags The resulting list of associated tags after the operation.
*/
public AssociateTagsForMetadataObjectEvent(
String user,
String metalake,
MetadataObject metadataObject,
String[] tagsToAdd,
String[] tagsToRemove,
String[] associatedTags) {
super(user, NameIdentifier.of(metalake));
this.metalake = metalake;
this.metadataObject = metadataObject;
this.tagsToAdd = tagsToAdd;
this.tagsToRemove = tagsToRemove;
this.associatedTags = associatedTags;
}

/**
* Provides the metalake associated with this event.
*
* @return The metalake from which the tags were associated.
*/
public String metalake() {
return metalake;
}
/**
* Provides the metalake associated with this event.
*
* @return The metalake from which the tags were associated.
*/
public String metalake() {
return metalake;
}

/**
* Provides the metadata object associated with this event.
*
* @return The {@link MetadataObject} with which the tags were associated.
*/
public MetadataObject metadataObject() {
return metadataObject;
}
/**
* Provides the metadata object associated with this event.
*
* @return The {@link MetadataObject} with which the tags were associated.
*/
public MetadataObject metadataObject() {
return metadataObject;
}

/**
* Provides the tags that were added in this operation.
*
* @return An array of tag names that were added.
*/
public String[] tagsToAdd() {
return tagsToAdd;
}
/**
* Provides the tags that were added in this operation.
*
* @return An array of tag names that were added.
*/
public String[] tagsToAdd() {
return tagsToAdd;
}

/**
* Provides the tags that were removed in this operation.
*
* @return An array of tag names that were removed.
*/
public String[] tagsToRemove() {
return tagsToRemove;
}
/**
* Provides the tags that were removed in this operation.
*
* @return An array of tag names that were removed.
*/
public String[] tagsToRemove() {
return tagsToRemove;
}

/**
* Provides the resulting list of associated tags after the operation.
*
* @return An array of tag names representing the associated tags.
*/
public String[] associatedTags() {
return associatedTags;
}
/**
* Provides the resulting list of associated tags after the operation.
*
* @return An array of tag names representing the associated tags.
*/
public String[] associatedTags() {
return associatedTags;
}

/**
* Returns the type of operation.
*
* @return The operation type.
*/
@Override
public OperationType operationType() {
return OperationType.ASSOCIATE_TAGS_FOR_METADATA_OBJECT;
}
/**
* Returns the type of operation.
*
* @return The operation type.
*/
@Override
public OperationType operationType() {
return OperationType.ASSOCIATE_TAGS_FOR_METADATA_OBJECT;
}
}
Loading

0 comments on commit a680fe6

Please sign in to comment.