Skip to content

Commit

Permalink
Add docs and license
Browse files Browse the repository at this point in the history
  • Loading branch information
cool9850311 committed Dec 26, 2024
1 parent 259295b commit f73787d
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
/*
* 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.gravitino.listener.api.event;

import org.apache.gravitino.NameIdentifier;

import org.apache.gravitino.annotation.DeveloperApi;
/**
* Represents an event triggered when an attempt to list tags fails due to an exception.
*/
@DeveloperApi
public class ListTagFailureEvent extends TagFailureEvent {
private final String metalake;

/**
* Constructs a new {@code ListTagFailureEvent} instance.
*
* @param user The user who initiated the tag listing operation.
* @param metalake The metalake name where the tags are being listed.
* @param exception The exception encountered during the tag listing operation, providing insights into the reasons behind the failure.
*/
public ListTagFailureEvent(String user, String metalake, Exception exception) {
super(user, NameIdentifier.of(metalake), exception);
this.metalake = metalake;
}

/**
* Returns the metalake name where the tags are being listed.
*
* @return The metalake name.
*/
public String metalake() {
return metalake;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.LIST_TAG;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
/*
* 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.gravitino.listener.api.event;

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

/**
* Represents an event triggered when an attempt to list tag information fails due to an exception.
*/
@DeveloperApi
public class ListTagsInfoFailureEvent extends FailureEvent {
private final String metalake;

/**
* Constructs a new {@code ListTagsInfoFailureEvent} instance.
*
* @param user The user who initiated the tag listing operation.
* @param metalake The metalake name where the tags are being listed.
* @param exception The exception encountered during the tag listing operation, providing insights into the reasons behind the failure.
*/
public ListTagsInfoFailureEvent(String user, String metalake, Exception exception) {
super(user, NameIdentifier.of(metalake), exception);
this.metalake = metalake;
}

/**
* Returns the metalake name where the tags are being listed.
*
* @return The metalake name.
*/
public String metalake() {
return metalake;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.LIST_TAGS_INFO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
/*
* 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.gravitino.listener.api.event;

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

/**
* Represents an event triggered when an attempt to perform a tag operation fails due to an exception.
*/
@DeveloperApi
public class TagFailureEvent extends FailureEvent {

/**
* Constructs a new {@code TagFailureEvent} instance.
*
* @param user The user who initiated the tag operation.
* @param identifier The identifier of the tag involved in the operation.
* @param exception The exception encountered during the tag operation, providing insights into the reasons behind the failure.
*/
public TagFailureEvent(String user, NameIdentifier identifier, Exception exception) {
super(user, identifier, exception);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
/*
* 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.gravitino.listener.api.info;

import com.google.common.collect.ImmutableMap;
import java.util.Map;

import javax.annotation.Nullable;

import org.apache.gravitino.annotation.DeveloperApi;

import com.google.common.collect.ImmutableMap;

/**
* Provides access to metadata about a Tag instance, designed for use by event listeners. This class
* encapsulates the essential attributes of a Tag, including its name, optional description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
package org.apache.gravitino.listener.api.event;
/*
* 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.
*/

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package org.apache.gravitino.listener.api.event;

import com.google.common.collect.ImmutableMap;
import java.util.Arrays;

import org.apache.gravitino.Entity;
import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.exceptions.GravitinoRuntimeException;
Expand All @@ -20,6 +36,10 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.google.common.collect.ImmutableMap;

@TestInstance(Lifecycle.PER_CLASS)
public class TestTagEvent {
Expand Down

0 comments on commit f73787d

Please sign in to comment.