File tree Expand file tree Collapse file tree 7 files changed +65
-11
lines changed
runtime/admin/src/main/java/org/apache/polaris/admintool Expand file tree Collapse file tree 7 files changed +65
-11
lines changed Original file line number Diff line number Diff line change 1818 */
1919package org .apache .polaris .admintool ;
2020
21- import jakarta .inject .Inject ;
2221import java .util .concurrent .Callable ;
23- import org .apache .polaris .core .persistence .MetaStoreManagerFactory ;
2422import picocli .CommandLine .Model .CommandSpec ;
2523import picocli .CommandLine .Spec ;
2624
@@ -30,7 +28,5 @@ public abstract class BaseCommand implements Callable<Integer> {
3028 public static final int EXIT_CODE_BOOTSTRAP_ERROR = 3 ;
3129 public static final int EXIT_CODE_PURGE_ERROR = 4 ;
3230
33- @ Inject MetaStoreManagerFactory metaStoreManagerFactory ;
34-
35- @ Spec CommandSpec spec ;
31+ @ Spec protected CommandSpec spec ;
3632}
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+ package org .apache .polaris .admintool ;
20+
21+ import jakarta .inject .Inject ;
22+ import org .apache .polaris .core .persistence .MetaStoreManagerFactory ;
23+
24+ public abstract class BaseMetaStoreCommand extends BaseCommand {
25+ @ Inject protected MetaStoreManagerFactory metaStoreManagerFactory ;
26+ }
Original file line number Diff line number Diff line change 3333 name = "bootstrap" ,
3434 mixinStandardHelpOptions = true ,
3535 description = "Bootstraps realms and root principal credentials." )
36- public class BootstrapCommand extends BaseCommand {
36+ public class BootstrapCommand extends BaseMetaStoreCommand {
3737
3838 @ CommandLine .Mixin InputOptions inputOptions ;
3939
Original file line number Diff line number Diff line change 3232 BootstrapCommand .class ,
3333 PurgeCommand .class ,
3434 })
35- public class PolarisAdminTool extends BaseCommand {
35+ public class PolarisAdminTool extends BaseMetaStoreCommand {
3636
3737 @ Override
3838 public Integer call () {
Original file line number Diff line number Diff line change 2626 name = "purge" ,
2727 mixinStandardHelpOptions = true ,
2828 description = "Purge realms and all associated entities." )
29- public class PurgeCommand extends BaseCommand {
29+ public class PurgeCommand extends BaseMetaStoreCommand {
3030
3131 @ CommandLine .Option (
3232 names = {"-r" , "--realm" },
Original file line number Diff line number Diff line change 3232import org .apache .polaris .core .storage .PolarisStorageConfigurationInfo ;
3333import org .apache .polaris .core .storage .PolarisStorageIntegration ;
3434import org .apache .polaris .core .storage .PolarisStorageIntegrationProvider ;
35- import org .eclipse .microprofile .config .inject .ConfigProperty ;
3635
3736public class AdminToolProducers {
3837
3938 @ Produces
4039 public MetaStoreManagerFactory metaStoreManagerFactory (
41- @ ConfigProperty ( name = "polaris.persistence.type" ) String persistenceType ,
40+ QuarkusPersistenceConfiguration persistenceConfiguration ,
4241 @ Any Instance <MetaStoreManagerFactory > metaStoreManagerFactories ) {
43- return metaStoreManagerFactories .select (Identifier .Literal .of (persistenceType )).get ();
42+ return metaStoreManagerFactories
43+ .select (Identifier .Literal .of (persistenceConfiguration .type ()))
44+ .get ();
4445 }
4546
4647 @ Produces
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+ package org .apache .polaris .admintool .config ;
20+
21+ import io .smallrye .config .ConfigMapping ;
22+
23+ @ ConfigMapping (prefix = "polaris.persistence" )
24+ public interface QuarkusPersistenceConfiguration {
25+
26+ /**
27+ * The type of the persistence to use. Must be a registered {@link
28+ * org.apache.polaris.core.persistence.MetaStoreManagerFactory} identifier.
29+ */
30+ String type ();
31+ }
You can’t perform that action at this time.
0 commit comments