-
Notifications
You must be signed in to change notification settings - Fork 293
SigV4 Auth Support for Catalog Federation - Part 1: Entity Transformation System #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.polaris.core.entity.transformation; | ||
|
||
import org.apache.polaris.core.entity.PolarisBaseEntity; | ||
|
||
/** | ||
* Engine responsible for applying a sequence of {@link EntityTransformer} transformations to a | ||
* {@link PolarisBaseEntity}. | ||
* | ||
* <p>This abstraction allows Polaris to customize or enrich entities during runtime or persistence, | ||
* based on configured or contextual logic (e.g., injecting service identity info, computing derived | ||
* fields). | ||
*/ | ||
public interface EntityTransformationEngine { | ||
/** | ||
* Applies all registered entity transformers to the provided entity, in order. | ||
* | ||
* @param transformationPoint The point in the entity lifecycle where transformers should be | ||
* applied. | ||
* @param entity The original Polaris entity to mutate. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* @return A new transformed copy of the entity of {@link PolarisBaseEntity} after all | ||
* transformers are applied. | ||
*/ | ||
PolarisBaseEntity applyTransformers( | ||
TransformationPoint transformationPoint, PolarisBaseEntity entity); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.polaris.core.entity.transformation; | ||
|
||
import org.apache.polaris.core.entity.PolarisBaseEntity; | ||
|
||
/** | ||
* A transformation hook that transforms a Polaris entity. The transformer must create a new copy of | ||
* the entity rather than updating them in-place. | ||
* | ||
* <p>Implementations of this interface apply custom logic to modify or enrich a {@link | ||
* PolarisBaseEntity}. | ||
*/ | ||
public interface EntityTransformer { | ||
|
||
/** | ||
* Applies the transformation logic to the given entity. It can be also used to add custom logic | ||
* around the transformation point. | ||
* | ||
* @param entity the entity to be transformed | ||
* @return the transformed entity | ||
*/ | ||
PolarisBaseEntity apply(PolarisBaseEntity entity); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.polaris.core.entity.transformation; | ||
|
||
import org.apache.polaris.core.entity.PolarisBaseEntity; | ||
|
||
/** | ||
* A no-op implementation of {@link EntityTransformationEngine} that returns the input entity | ||
* unchanged. | ||
* | ||
* <p>This can be used in environments where entity transformation is disabled or unnecessary. | ||
*/ | ||
public class NoOpEntityTransformationEngine implements EntityTransformationEngine { | ||
|
||
@Override | ||
public PolarisBaseEntity applyTransformers( | ||
TransformationPoint transformationPoint, final PolarisBaseEntity entity) { | ||
return entity; | ||
} | ||
} |
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.polaris.core.entity.transformation; | ||
|
||
/** | ||
* Defines points in the entity lifecycle where {@link EntityTransformer} can be applied. | ||
* | ||
* <p>Each transformation point corresponds to a specific hook where transformers may be executed. | ||
* Transformers can declare which points they support, allowing the engine to invoke only the | ||
* relevant ones. | ||
*/ | ||
public enum TransformationPoint { | ||
|
||
/** Applied before a catalog entity is persisted. */ | ||
CATALOG_PRE_PERSIST(0), | ||
; | ||
|
||
private final int id; | ||
|
||
TransformationPoint(int id) { | ||
this.id = id; | ||
} | ||
|
||
public int id() { | ||
return id; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.