accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [44/50] [abbrv] git commit: ACCUMULO-1496 slightly more optimized version using scannotation
Date Wed, 17 Jul 2013 02:33:46 GMT
ACCUMULO-1496 slightly more optimized version using scannotation

git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/ACCUMULO-1496@1491920 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/424caaa1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/424caaa1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/424caaa1

Branch: refs/heads/ACCUMULO-1496
Commit: 424caaa1356dc47be8e8c63b875b3121a6e6bc89
Parents: dd0b97e
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Tue Jun 11 19:33:53 2013 +0000
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Tue Jul 16 15:02:12 2013 -0400

----------------------------------------------------------------------
 api/pom.xml                                     | 27 --------
 .../api/annotations/AccumuloService.java        | 33 ----------
 assemble/pom.xml                                |  4 --
 bin/accumulo                                    |  6 +-
 .../accumulo/core/file/rfile/PrintInfo.java     |  2 +-
 .../apache/accumulo/core/util/CreateToken.java  |  2 +-
 .../apache/accumulo/core/util/shell/Shell.java  |  2 +-
 .../minicluster/MiniAccumuloRunner.java         |  2 +-
 pom.xml                                         |  6 --
 .../java/org/apache/accumulo/proxy/Proxy.java   |  2 +-
 .../server/gc/SimpleGarbageCollector.java       |  2 +-
 .../apache/accumulo/server/master/Master.java   |  2 +-
 .../apache/accumulo/server/monitor/Monitor.java |  2 +-
 .../server/tabletserver/TabletServer.java       |  2 +-
 .../accumulo/server/trace/TraceServer.java      |  2 +-
 .../org/apache/accumulo/server/util/Admin.java  |  2 +-
 .../apache/accumulo/server/util/Initialize.java |  2 +-
 .../accumulo/server/util/ZooKeeperMain.java     |  3 +-
 start/pom.xml                                   |  4 --
 .../java/org/apache/accumulo/start/Main.java    | 47 +++++---------
 .../start/annotations/AccumuloService.java      | 33 ++++++++++
 .../classloader/vfs/AccumuloVFSClassLoader.java | 68 ++++++++++++++++++--
 22 files changed, 128 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
deleted file mode 100644
index 9fe5f60..0000000
--- a/api/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.accumulo</groupId>
-    <artifactId>accumulo-project</artifactId>
-    <version>1.6.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>accumulo-api</artifactId>
-  <name>API</name>
-</project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/api/src/main/java/org/apache/accumulo/api/annotations/AccumuloService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/accumulo/api/annotations/AccumuloService.java b/api/src/main/java/org/apache/accumulo/api/annotations/AccumuloService.java
deleted file mode 100644
index 31fbc67..0000000
--- a/api/src/main/java/org/apache/accumulo/api/annotations/AccumuloService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.api.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to describe a class that can be launched by Accumulo
- * 
- * @since 1.6.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface AccumuloService {
-  String value();
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/assemble/pom.xml
----------------------------------------------------------------------
diff --git a/assemble/pom.xml b/assemble/pom.xml
index 7584510..96a1094 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -52,10 +52,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
       <artifactId>accumulo-core</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/bin/accumulo
----------------------------------------------------------------------
diff --git a/bin/accumulo b/bin/accumulo
index a3b0a21..a55e579 100755
--- a/bin/accumulo
+++ b/bin/accumulo
@@ -29,9 +29,7 @@ script=$( basename "$SOURCE" )
 . "$bin"/config.sh
 
 START_JAR=$ACCUMULO_HOME/lib/accumulo-start.jar
-API_JAR=$ACCUMULO_HOME/lib/accumulo-api.jar
-SCANNOTATION_JAR=$ACCUMULO_HOME/lib/scannotation.jar
-JAVASSIST_JAR=$ACCUMULO_HOME/lib/javassist.jar
+SCANNOTATION_JARS=$ACCUMULO_HOME/lib/scannotation.jar:$ACCUMULO_HOME/lib/javassist.jar
 
 #
 # Resolve a program to its installation directory
@@ -84,7 +82,7 @@ esac
 
 XML_FILES=${ACCUMULO_HOME}/conf
 LOG4J_JAR=$(find $HADOOP_PREFIX/lib $HADOOP_PREFIX/share/hadoop/common/lib -name 'log4j*.jar'
-print 2>/dev/null | head -1)
-CLASSPATH=${XML_FILES}:${API_JAR}:${JAVASSIST_JAR}:${SCANNOTATION_JAR}:${START_JAR}:${LOG4J_JAR}
+CLASSPATH=${XML_FILES}:${SCANNOTATION_JARS}:${START_JAR}:${LOG4J_JAR}
 
 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ]; then
    echo "JAVA_HOME is not set or is not a directory.  Please make sure it's set globally
or in conf/accumulo-env.sh"

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
index 2f06474..029a3f5 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
@@ -19,7 +19,6 @@ package org.apache.accumulo.core.file.rfile;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -29,6 +28,7 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
 import org.apache.accumulo.core.file.rfile.RFile.Reader;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
index 5b25424..1617626 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
@@ -23,7 +23,6 @@ import java.io.PrintStream;
 
 import jline.console.ConsoleReader;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.ClientOpts.Password;
 import org.apache.accumulo.core.cli.ClientOpts.PasswordConverter;
@@ -33,6 +32,7 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Prope
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.TokenProperty;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.start.annotations.AccumuloService;
 
 import com.beust.jcommander.Parameter;
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
index 129fff7..92e09b7 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
@@ -37,7 +37,6 @@ import java.util.UUID;
 import jline.console.ConsoleReader;
 import jline.console.history.FileHistory;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -142,6 +141,7 @@ import org.apache.accumulo.core.util.shell.commands.UserPermissionsCommand;
 import org.apache.accumulo.core.util.shell.commands.UsersCommand;
 import org.apache.accumulo.core.util.shell.commands.WhoAmICommand;
 import org.apache.accumulo.fate.zookeeper.ZooReader;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.commons.cli.BasicParser;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.HelpFormatter;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
index d3b2f94..e6c3971 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
@@ -27,9 +27,9 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.regex.Pattern;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.util.Pair;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.commons.io.FileUtils;
 
 import com.beust.jcommander.IStringConverter;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6d6539c..f1534f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,6 @@
     <maven>${maven.min-version}</maven>
   </prerequisites>
   <modules>
-    <module>api</module>
     <module>trace</module>
     <module>core</module>
     <module>fate</module>
@@ -213,11 +212,6 @@
       </dependency>
       <dependency>
         <groupId>org.apache.accumulo</groupId>
-        <artifactId>accumulo-api</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.accumulo</groupId>
         <artifactId>accumulo-core</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
----------------------------------------------------------------------
diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java b/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
index 9552456..4e9b256 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
@@ -23,11 +23,11 @@ import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.util.Properties;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
 import org.apache.accumulo.proxy.thrift.AccumuloProxy;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TProcessor;
 import org.apache.thrift.protocol.TCompactProtocol;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
index 864717f..4c717d6 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
@@ -36,7 +36,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -91,6 +90,7 @@ import org.apache.accumulo.server.util.Halt;
 import org.apache.accumulo.server.util.TServerUtils;
 import org.apache.accumulo.server.util.TabletIterator;
 import org.apache.accumulo.server.zookeeper.ZooLock;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.trace.instrument.CountSampler;
 import org.apache.accumulo.trace.instrument.Sampler;
 import org.apache.accumulo.trace.instrument.Span;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/Master.java b/server/src/main/java/org/apache/accumulo/server/master/Master.java
index fa8a7e5..30894fd 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -34,7 +34,6 @@ import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -143,6 +142,7 @@ import org.apache.accumulo.server.util.TabletIterator.TabletDeletedException;
 import org.apache.accumulo.server.util.time.SimpleTimer;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.accumulo.trace.instrument.thrift.TraceWrap;
 import org.apache.accumulo.trace.thrift.TInfo;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
index 6069f64..6bca1a3 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
@@ -27,7 +27,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.MasterClient;
@@ -73,6 +72,7 @@ import org.apache.accumulo.server.problems.ProblemReports;
 import org.apache.accumulo.server.problems.ProblemType;
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.util.EmbeddedWebServer;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.trace.instrument.Tracer;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
index 9ddf6bb..bdf7947 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
@@ -62,7 +62,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.management.ObjectName;
 import javax.management.StandardMBean;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -198,6 +197,7 @@ import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.start.Platform;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.accumulo.start.classloader.vfs.ContextManager;
 import org.apache.accumulo.trace.instrument.Span;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java b/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
index 841166d..09cebd1 100644
--- a/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
@@ -23,7 +23,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
@@ -52,6 +51,7 @@ import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.util.time.SimpleTimer;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.start.classloader.AccumuloClassLoader;
 import org.apache.accumulo.trace.instrument.Span;
 import org.apache.accumulo.trace.thrift.RemoteSpan;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/util/Admin.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/src/main/java/org/apache/accumulo/server/util/Admin.java
index a415de7..88dca6f 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -39,6 +38,7 @@ import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.server.cli.ClientOpts;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.security.SecurityConstants;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.trace.instrument.Tracer;
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
index af053aa..288a135 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
@@ -28,7 +28,6 @@ import java.util.UUID;
 
 import jline.console.ConsoleReader;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -68,6 +67,7 @@ import org.apache.accumulo.server.security.AuditedSecurityOperation;
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.tabletserver.TabletTime;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java b/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
index dc01915..730f421 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
@@ -16,13 +16,14 @@
  */
 package org.apache.accumulo.server.util;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/start/pom.xml
----------------------------------------------------------------------
diff --git a/start/pom.xml b/start/pom.xml
index 133413e..61496bf 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -30,10 +30,6 @@
       <artifactId>scannotation</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-api</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-vfs2</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index 3821c3f..98ca303 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -16,22 +16,15 @@
  */
 package org.apache.accumulo.start;
 
-import java.io.IOException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Set;
 
-import org.apache.accumulo.api.annotations.AccumuloService;
 import org.apache.accumulo.start.classloader.AccumuloClassLoader;
-import org.scannotation.AnnotationDB;
 
 public class Main {
   
-  private static AnnotationDB annotationDatabase;
-  
   public static void main(String[] args) throws Exception {
     Runnable r = null;
     
@@ -41,10 +34,8 @@ public class Main {
       ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[]
{}).invoke(null, new Object[] {});
       Thread.currentThread().setContextClassLoader(cl);
       
-      URL[] urls = (URL[]) vfsClassLoader.getMethod("getURLs", new Class[] {}).invoke(null,
new Object[] {});
-      
       if (args.length == 0) {
-        printUsage(cl, urls);
+        printUsage();
         System.exit(1);
       }
       final String argsToPass[] = new String[args.length - 1];
@@ -60,14 +51,7 @@ public class Main {
         System.out.println(runTMP.getField("VERSION").get(null));
         return;
       } else {
-        for (String className : loadAnnotationDB(urls, AccumuloService.class)) {
-          Class<?> runTMPCandidate = cl.loadClass(className);
-          if (args[0].equals(runTMPCandidate.getAnnotation(AccumuloService.class).value()))
{
-            runTMP = runTMPCandidate;
-            break;
-          }
-        }
-        
+        runTMP = getAccumuloServiceClassByKeyword(args[0]);
         if (runTMP == null) {
           try {
             runTMP = cl.loadClass(args[0]);
@@ -111,11 +95,10 @@ public class Main {
     }
   }
   
-  private static void printUsage(ClassLoader cl, URL[] urls) throws IOException, ClassNotFoundException
{
+  private static void printUsage() throws Exception {
     ArrayList<String> keywords = new ArrayList<String>(20);
-    for (String className : loadAnnotationDB(urls, AccumuloService.class)) {
-      Class<?> runTMPCandidate = cl.loadClass(className);
-      keywords.add(runTMPCandidate.getAnnotation(AccumuloService.class).value());
+    for (String keyword : getAccumuloServiceKeywords()) {
+      keywords.add(keyword);
     }
     keywords.add("classpath");
     keywords.add("version");
@@ -129,14 +112,16 @@ public class Main {
     System.out.println("accumulo " + kwString + " | <accumulo class> args");
   }
   
-  protected synchronized static Set<String> loadAnnotationDB(URL[] urls, Class<?>
annotationClass) throws IOException {
-    if (annotationDatabase == null) {
-      AnnotationDB database = new AnnotationDB();
-      database.setScanClassAnnotations(true);
-      database.scanArchives(urls);
-      annotationDatabase = database;
-    }
-    Set<String> retVal = annotationDatabase.getAnnotationIndex().get(annotationClass.getName());
-    return retVal == null ? (retVal = Collections.emptySet()) : retVal;
+  private static Set<String> getAccumuloServiceKeywords() throws Exception {
+    Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
+    @SuppressWarnings("unchecked")
+    Set<String> keywords = (Set<String>) vfsClassLoader.getMethod("getAccumuloServiceKeywords").invoke(null);
+    return keywords;
+  }
+  
+  private static Class<?> getAccumuloServiceClassByKeyword(String keyword) throws Exception
{
+    Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
+    Class<?> serviceClass = (Class<?>) vfsClassLoader.getMethod("getAccumuloServiceClassByKeyword",
String.class).invoke(null, keyword);
+    return serviceClass;
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/start/src/main/java/org/apache/accumulo/start/annotations/AccumuloService.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/annotations/AccumuloService.java
b/start/src/main/java/org/apache/accumulo/start/annotations/AccumuloService.java
new file mode 100644
index 0000000..41095ee
--- /dev/null
+++ b/start/src/main/java/org/apache/accumulo/start/annotations/AccumuloService.java
@@ -0,0 +1,33 @@
+/*
+ * 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.start.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to describe a class that can be launched by Accumulo
+ * 
+ * @since 1.6.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface AccumuloService {
+  String value();
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/424caaa1/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
index 0ff8843..a658829 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
@@ -24,7 +24,10 @@ import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
+import org.apache.accumulo.start.annotations.AccumuloService;
 import org.apache.accumulo.start.classloader.AccumuloClassLoader;
 import org.apache.accumulo.start.classloader.vfs.providers.HdfsFileProvider;
 import org.apache.commons.vfs2.CacheStrategy;
@@ -37,6 +40,7 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
 import org.apache.commons.vfs2.impl.FileContentInfoFilenameFactory;
 import org.apache.commons.vfs2.impl.VFSClassLoader;
 import org.apache.log4j.Logger;
+import org.scannotation.AnnotationDB;
 
 /**
  * This class builds a hierarchy of Classloaders in the form of:
@@ -283,19 +287,73 @@ public class AccumuloVFSClassLoader {
     });
   }
   
-  public static URL[] getURLs() {
+  private static AnnotationDB annotationDatabase;
+  
+  private static void loadAnnotationDatabase() {
+    if (annotationDatabase == null) {
+      AnnotationDB database = new AnnotationDB();
+      database.setScanClassAnnotations(true);
+      try {
+        database.scanArchives(getAccumuloServiceURLs());
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      annotationDatabase = database;
+    }
+  }
+  
+  public static Set<String> getAccumuloServiceClasses() {
+    loadAnnotationDatabase();
+    Set<String> retVal = annotationDatabase.getAnnotationIndex().get(AccumuloService.class.getName());
+    if (retVal == null)
+      retVal = Collections.emptySet();
+    return retVal;
+  }
+  
+  public static Class<?> getAccumuloServiceClassByKeyword(String keyword) {
+    Set<String> classNames = getAccumuloServiceClasses();
+    for (String className : classNames) {
+      try {
+        Class<?> candidate = getClassLoader().loadClass(className);
+        if (candidate.getAnnotation(AccumuloService.class).value().equals(keyword))
+          return candidate;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+    }
+    return null;
+  }
+  
+  public static Set<String> getAccumuloServiceKeywords() {
+    TreeSet<String> keywords = new TreeSet<String>();
+    Set<String> classNames = getAccumuloServiceClasses();
+    for (String className : classNames) {
+      try {
+        keywords.add(getClassLoader().loadClass(className).getAnnotation(AccumuloService.class).value());
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+    }
+    return keywords;
+  }
+  
+  public static URL[] getAccumuloServiceURLs() {
     ArrayList<URL> urls = new ArrayList<URL>(20);
     try {
       ClassLoader cl = getClassLoader();
       while (cl != null && cl != ClassLoader.getSystemClassLoader()) {
         if (cl instanceof URLClassLoader) {
           URLClassLoader ucl = (URLClassLoader) cl;
-          for (URL u : ucl.getURLs())
-            urls.add(u);
+          for (URL u : ucl.getURLs()) {
+            if (u.toExternalForm().contains("accumulo"))
+              urls.add(u);
+          }
         } else if (cl instanceof VFSClassLoader) {
           VFSClassLoader vcl = (VFSClassLoader) cl;
-          for (FileObject f : vcl.getFileObjects())
-            urls.add(f.getURL());
+          for (FileObject f : vcl.getFileObjects()) {
+            if (f.getURL().toExternalForm().contains("accumulo"))
+              urls.add(f.getURL());
+          }
         }
         cl = cl.getParent();
       }


Mime
View raw message