forked from apache/gravitino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support catalog pre event for Gravitino server apache#5549
- Loading branch information
1 parent
a246cb1
commit d3f5574
Showing
9 changed files
with
308 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/src/main/java/org/apache/gravitino/listener/api/event/AlterCatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* 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.CatalogChange; | ||
import org.apache.gravitino.NameIdentifier; | ||
import org.apache.gravitino.annotation.DeveloperApi; | ||
|
||
/** Represents an event triggered before altering a catalog. */ | ||
@DeveloperApi | ||
public final class AlterCatalogPreEvent extends CatalogPreEvent { | ||
private final CatalogChange[] catalogChanges; | ||
|
||
/** | ||
* Constructs an instance of {@code AlterCatalogEvent}, encapsulating the key details about the | ||
* successful alteration of a catalog. | ||
* | ||
* @param user The username of the individual responsible for initiating the catalog alteration. | ||
* @param identifier The unique identifier of the altered catalog, serving as a clear reference | ||
* point for the catalog in question. | ||
* @param catalogChanges An array of {@link CatalogChange} objects representing the specific | ||
* changes applied to the catalog during the alteration process. | ||
*/ | ||
public AlterCatalogPreEvent( | ||
String user, NameIdentifier identifier, CatalogChange[] catalogChanges) { | ||
super(user, identifier); | ||
this.catalogChanges = catalogChanges.clone(); | ||
} | ||
|
||
/** | ||
* Retrieves the specific changes that were made to the catalog during the alteration process. | ||
* | ||
* @return An array of {@link CatalogChange} objects detailing each modification applied to the | ||
* catalog. | ||
*/ | ||
public CatalogChange[] catalogChanges() { | ||
return catalogChanges; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
core/src/main/java/org/apache/gravitino/listener/api/event/CatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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 a pre-event for catalog operations. */ | ||
@DeveloperApi | ||
public abstract class CatalogPreEvent extends PreEvent { | ||
protected CatalogPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
core/src/main/java/org/apache/gravitino/listener/api/event/CreateCatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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; | ||
import org.apache.gravitino.listener.api.info.CatalogInfo; | ||
|
||
/** Represents an event triggered before creating a catalog. */ | ||
@DeveloperApi | ||
public class CreateCatalogPreEvent extends CatalogPreEvent { | ||
private final CatalogInfo createdCatalogInfo; | ||
|
||
/** | ||
* Constructs an instance of {@code CreateCatalogEvent}, capturing essential details about the | ||
* successful creation of a catalog. | ||
* | ||
* @param user The username of the individual who initiated the catalog creation. | ||
* @param identifier The unique identifier of the catalog that was created. | ||
* @param createdCatalogInfo The final state of the catalog post-creation. | ||
*/ | ||
public CreateCatalogPreEvent( | ||
String user, NameIdentifier identifier, CatalogInfo createdCatalogInfo) { | ||
super(user, identifier); | ||
this.createdCatalogInfo = createdCatalogInfo; | ||
} | ||
|
||
/** | ||
* Provides the final state of the catalog as it is presented to the user following the successful | ||
* creation. | ||
* | ||
* @return A {@link CatalogInfo} object that encapsulates the detailed characteristics of the | ||
* newly created catalog. | ||
*/ | ||
public CatalogInfo createdCatalogInfo() { | ||
return createdCatalogInfo; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
core/src/main/java/org/apache/gravitino/listener/api/event/DropCatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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 that is generated before a catalog is successfully dropped. */ | ||
@DeveloperApi | ||
public final class DropCatalogPreEvent extends CatalogPreEvent { | ||
public DropCatalogPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
core/src/main/java/org/apache/gravitino/listener/api/event/ListCatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.Namespace; | ||
import org.apache.gravitino.annotation.DeveloperApi; | ||
|
||
/** Represents an event that is triggered before listing of catalogs within a namespace. */ | ||
@DeveloperApi | ||
public final class ListCatalogPreEvent extends CatalogPreEvent { | ||
private final Namespace namespace; | ||
|
||
/** | ||
* Constructs an instance of {@code ListCatalogEvent}. | ||
* | ||
* @param user The username of the individual who initiated the catalog listing. | ||
* @param namespace The namespace from which catalogs were listed. | ||
*/ | ||
public ListCatalogPreEvent(String user, Namespace namespace) { | ||
super(user, NameIdentifier.of(namespace.levels())); | ||
this.namespace = namespace; | ||
} | ||
|
||
/** | ||
* Provides the namespace associated with this event. | ||
* | ||
* @return A {@link Namespace} instance from which catalogs were listed. | ||
*/ | ||
public Namespace namespace() { | ||
return namespace; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
core/src/main/java/org/apache/gravitino/listener/api/event/LoadCatalogPreEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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 before loading a catalog. */ | ||
@DeveloperApi | ||
public final class LoadCatalogPreEvent extends CatalogPreEvent { | ||
|
||
/** | ||
* Constructs an instance of {@code LoadCatalogEvent}. | ||
* | ||
* @param user The username of the individual who initiated the catalog loading. | ||
* @param identifier The unique identifier of the catalog that was loaded. | ||
*/ | ||
public LoadCatalogPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
Oops, something went wrong.