accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo-classloaders] 03/03: Make changes to get the initial code buildable
Date Sat, 26 Sep 2020 03:22:28 GMT
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 <ctubbsii@apache.org>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.accumulo</groupId>
+    <artifactId>classloader-extras</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+  <artifactId>classloaderfactory-substitute</artifactId>
+  <name>ClassloaderFactory substitute</name>
+  <description>This exists temporarily, until a version of Accumulo is published containing
the required ClassloaderFactory interface</description>
+  <properties>
+    <eclipseFormatterStyle>../../contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
+    <maven.deploy.skip>true</maven.deploy.skip>
+    <!-- temporarily skip analyzing dependencies until things are fixed, in order to build
-->
+    <mdep.analyze.skip>true</mdep.analyze.skip>
+  </properties>
+</project>
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<Entry<String,String>> 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 @@
   <name>VFS Reloading ClassLoader</name>
   <properties>
     <eclipseFormatterStyle>../../contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
+    <!-- temporarily skip analyzing dependencies until things are fixed, in order to build
-->
+    <mdep.analyze.skip>true</mdep.analyze.skip>
+    <!-- temporarily skip spotbugs until things are fixed, in order to build -->
+    <spotbugs.skip>true</spotbugs.skip>
   </properties>
   <dependencies>
     <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+      <version>3.7.1</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-vfs2</artifactId>
       <version>2.6.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.hadoop</groupId>
+          <artifactId>hadoop-hdfs-client</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
@@ -63,15 +78,9 @@
     </dependency>
     <dependency>
       <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-core</artifactId>
-      <version>2.1.0-SNAPSHOT</version>
+      <artifactId>classloaderfactory-substitute</artifactId>
+      <version>${project.version}</version>
       <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.accumulo</groupId>
-          <artifactId>accumulo-start</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
@@ -86,6 +95,12 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>28.2-jre</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.13</version>
@@ -170,6 +185,7 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
+        <version>1.6.0</version>
         <executions>
           <execution>
             <id>Build Test jars</id>
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 @@
     </mailingList>
   </mailingLists>
   <modules>
+    <module>modules/classloaderfactory-substitute</module>
     <module>modules/vfs-class-loader</module>
   </modules>
   <scm>


Mime
View raw message