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
13c92f9
commit a806479
Showing
9 changed files
with
278 additions
and
1 deletion.
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
46 changes: 46 additions & 0 deletions
46
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,46 @@ | ||
/* | ||
* 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; | ||
|
||
public AlterCatalogPreEvent( | ||
String user, NameIdentifier identifier, CatalogChange[] catalogChanges) { | ||
super(user, identifier); | ||
this.catalogChanges = catalogChanges; | ||
} | ||
|
||
/** | ||
* 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); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
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,46 @@ | ||
/* | ||
* 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 createCatalogRequest; | ||
|
||
public CreateCatalogPreEvent( | ||
String user, NameIdentifier identifier, CatalogInfo createCatalogRequest) { | ||
super(user, identifier); | ||
this.createCatalogRequest = createCatalogRequest; | ||
} | ||
|
||
/** | ||
* Retrieves the create catalog request. | ||
* | ||
* @return A {@link CatalogInfo} instance encapsulating the comprehensive details of create | ||
* catalog request. | ||
*/ | ||
public CatalogInfo createCatalogRequest() { | ||
return createCatalogRequest; | ||
} | ||
} |
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 dropped. */ | ||
@DeveloperApi | ||
public final class DropCatalogPreEvent extends CatalogPreEvent { | ||
public DropCatalogPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
/* | ||
* 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; | ||
|
||
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; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
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,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.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 { | ||
|
||
public LoadCatalogPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
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
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