ctubbsii commented on code in PR #69: URL: https://github.com/apache/accumulo-classloaders/pull/69#discussion_r2784188797
########## modules/caching-class-loader/src/main/java/org/apache/accumulo/classloader/ccl/cli/InitializeCache.java: ########## @@ -0,0 +1,80 @@ +/* + * 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 + * + * https://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.accumulo.classloader.ccl.cli; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.accumulo.classloader.ccl.CachingClassLoaderFactory; +import org.apache.accumulo.classloader.ccl.LocalStore; +import org.apache.accumulo.classloader.ccl.manifest.Manifest; +import org.apache.accumulo.start.spi.KeywordExecutable; + +import com.beust.jcommander.Parameter; +import com.google.auto.service.AutoService; + +@AutoService(KeywordExecutable.class) +public class InitializeCache implements KeywordExecutable { + + static class Opts extends Help { + @Parameter(names = {"-d", "--directory"}, required = true, + description = "the local directory to initialize and stage", arity = 1, order = 1) + String directory; + + @Parameter(names = {"-v", "--verify"}, required = false, + description = "also verify existing files if they were found already present", arity = 0, + order = 2) + boolean verify; + + @Parameter(required = false, + description = "URLs for context manifests to load (<url>[ <url>...])", arity = -1, + order = 3) + public List<String> manifests = new ArrayList<>(); + } + + public InitializeCache() {} + + @Override + public String keyword() { + return "init-classloader-cache-dir"; + } + + @Override + public String description() { + return "Initializes the specified directory for the " + + CachingClassLoaderFactory.class.getSimpleName() + + " and stages any resources for the specified context manifest locations"; + } + + @Override + public void execute(String[] args) throws Exception { + var opts = new Opts(); + opts.parseArgs(InitializeCache.class.getName(), args); + var localStore = new LocalStore(opts.directory, (a, b) -> {/* allow all */}); Review Comment: Because this is a command that would be run by a system administrator, and the URLs are passed on the command-line. It doesn't make sense for the user to specify a pattern to allow when the same administrator is the one specifying the URLs directly on the same command-line. The pattern would also be enforced on resource URLs, which would not be specified on the command-line... but I think that's still the administrator's call. They should know the content of any manifest URL they are providing already. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
