From commits-return-24188-apmail-accumulo-commits-archive=accumulo.apache.org@accumulo.apache.org Sat Sep 26 03:22:29 2020 Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by minotaur.apache.org (Postfix) with ESMTP id 2D35F1AB9F for ; Sat, 26 Sep 2020 03:22:28 +0000 (UTC) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id EBBAE44AD5 for ; Sat, 26 Sep 2020 03:22:27 +0000 (UTC) Received: (qmail 91947 invoked by uid 500); 26 Sep 2020 03:22:27 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 91824 invoked by uid 500); 26 Sep 2020 03:22:27 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 91716 invoked by uid 99); 26 Sep 2020 03:22:27 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Sep 2020 03:22:27 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 46058811B2; Sat, 26 Sep 2020 03:22:25 +0000 (UTC) Date: Sat, 26 Sep 2020 03:22:28 +0000 To: "commits@accumulo.apache.org" Subject: [accumulo-classloaders] 03/03: Make changes to get the initial code buildable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: ctubbsii@apache.org In-Reply-To: <160109054576.5149.4037911861158188789@gitbox.apache.org> References: <160109054576.5149.4037911861158188789@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: accumulo-classloaders X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Rev: 99f918713b3af3be28bb25af41a822c58e48b561 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20200926032226.46058811B2@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-classloaders.git commit 99f918713b3af3be28bb25af41a822c58e48b561 Author: Christopher Tubbs AuthorDate: Fri Sep 25 23:21:20 2020 -0400 Make changes to get the initial code buildable --- modules/classloaderfactory-substitute/.gitignore | 32 ++++++++++++ modules/classloaderfactory-substitute/pom.xml | 39 ++++++++++++++ .../core/spi/common/ClassLoaderFactory.java | 61 ++++++++++++++++++++++ modules/vfs-class-loader/WIP.txt | 17 ++++++ modules/vfs-class-loader/pom.xml | 32 +++++++++--- .../classloader/vfs/ReloadingVFSClassLoader.java | 4 +- pom.xml | 1 + 7 files changed, 176 insertions(+), 10 deletions(-) diff --git a/modules/classloaderfactory-substitute/.gitignore b/modules/classloaderfactory-substitute/.gitignore new file mode 100644 index 0000000..3d5bdae --- /dev/null +++ b/modules/classloaderfactory-substitute/.gitignore @@ -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. + +# Maven ignores +/target/ + +# IDE ignores +/.settings/ +/.project +/.classpath +/.pydevproject +/.idea +/*.iml +/*.ipr +/*.iws +/nbproject/ +/nbactions.xml +/nb-configuration.xml +.vscode/ +.factorypath diff --git a/modules/classloaderfactory-substitute/pom.xml b/modules/classloaderfactory-substitute/pom.xml new file mode 100644 index 0000000..d5475fc --- /dev/null +++ b/modules/classloaderfactory-substitute/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.accumulo + classloader-extras + 1.0.0-SNAPSHOT + ../../pom.xml + + classloaderfactory-substitute + ClassloaderFactory substitute + This exists temporarily, until a version of Accumulo is published containing the required ClassloaderFactory interface + + ../../contrib/Eclipse-Accumulo-Codestyle.xml + true + + true + + diff --git a/modules/classloaderfactory-substitute/src/main/java/org/apache/accumulo/core/spi/common/ClassLoaderFactory.java b/modules/classloaderfactory-substitute/src/main/java/org/apache/accumulo/core/spi/common/ClassLoaderFactory.java new file mode 100644 index 0000000..7fb1d59 --- /dev/null +++ b/modules/classloaderfactory-substitute/src/main/java/org/apache/accumulo/core/spi/common/ClassLoaderFactory.java @@ -0,0 +1,61 @@ +/* + * 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.accumulo.core.spi.common; + +import java.util.Collections; +import java.util.Iterator; +import java.util.Map.Entry; + +/** + * The ClassLoaderFactory is defined by the property general.context.factory. The factory + * implementation is configured externally to Accumulo and will return a ClassLoader for a given + * contextName. + * + */ +public interface ClassLoaderFactory { + + static class ClassLoaderFactoryConfiguration { + + public Iterator> get() { + return Collections.emptyIterator(); + } + } + + /** + * Initialize the ClassLoaderFactory. Implementations may need a reference to the configuration so + * that it can clean up contexts that are no longer being used. + * + * @param conf + * Accumulo configuration properties + * @throws Exception + * if error initializing ClassLoaderFactory + */ + void initialize(ClassLoaderFactoryConfiguration conf) throws Exception; + + /** + * + * @param contextName + * name of classloader context + * @return classloader configured for the context + * @throws IllegalArgumentException + * if contextName is not supported + */ + ClassLoader getClassLoader(String contextName) throws IllegalArgumentException; + +} diff --git a/modules/vfs-class-loader/WIP.txt b/modules/vfs-class-loader/WIP.txt index 7f92d22..09edcb9 100644 --- a/modules/vfs-class-loader/WIP.txt +++ b/modules/vfs-class-loader/WIP.txt @@ -1,3 +1,20 @@ +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. + 1. Running Accumulo with new VFS ClassLoader as SystemClassLoader a. Add accumulo/test/target/TestJar-Iterators.jar to HDFS directory diff --git a/modules/vfs-class-loader/pom.xml b/modules/vfs-class-loader/pom.xml index e727d2f..981c258 100644 --- a/modules/vfs-class-loader/pom.xml +++ b/modules/vfs-class-loader/pom.xml @@ -31,12 +31,27 @@ VFS Reloading ClassLoader ../../contrib/Eclipse-Accumulo-Codestyle.xml + + true + + true + com.google.protobuf + protobuf-java + 3.7.1 + + org.apache.commons commons-vfs2 2.6.0 + + + org.apache.hadoop + hadoop-hdfs-client + + org.apache.logging.log4j @@ -63,15 +78,9 @@ org.apache.accumulo - accumulo-core - 2.1.0-SNAPSHOT + classloaderfactory-substitute + ${project.version} provided - - - org.apache.accumulo - accumulo-start - - org.apache.hadoop @@ -86,6 +95,12 @@ provided + com.google.guava + guava + 28.2-jre + test + + junit junit 4.13 @@ -170,6 +185,7 @@ org.codehaus.mojo exec-maven-plugin + 1.6.0 Build Test jars diff --git a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/ReloadingVFSClassLoader.java b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/ReloadingVFSClassLoader.java index 552076a..755f0d8 100644 --- a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/ReloadingVFSClassLoader.java +++ b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/ReloadingVFSClassLoader.java @@ -408,7 +408,7 @@ public class ReloadingVFSClassLoader extends ClassLoader implements Closeable, F /** * Remove the file from the monitor - * + * * @param file * to remove * @throws RuntimeException @@ -500,7 +500,7 @@ public class ReloadingVFSClassLoader extends ClassLoader implements Closeable, F /** * Return a reference to the delegate classloader, create a new one if necessary - * + * * @return reference to delegate classloader */ synchronized ClassLoader getDelegateClassLoader() { diff --git a/pom.xml b/pom.xml index 21ca3e3..f91a08b 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,7 @@ + modules/classloaderfactory-substitute modules/vfs-class-loader