You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sh...@apache.org on 2014/02/20 02:29:38 UTC

git commit: SENTRY-98: Add Sentry Service startup/shutdown scripts (Brock via Shreepadma)

Repository: incubator-sentry
Updated Branches:
  refs/heads/db_policy_store c40040e4c -> a8cea47e9


SENTRY-98: Add Sentry Service startup/shutdown scripts (Brock via Shreepadma)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/a8cea47e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/a8cea47e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/a8cea47e

Branch: refs/heads/db_policy_store
Commit: a8cea47e909d15ddced518436ba4baf75da70f8a
Parents: c40040e
Author: Shreepadma Venugopalan <sh...@apache.org>
Authored: Wed Feb 19 17:24:49 2014 -0800
Committer: Shreepadma Venugopalan <sh...@apache.org>
Committed: Wed Feb 19 17:24:49 2014 -0800

----------------------------------------------------------------------
 pom.xml                                         | 11 +++
 sentry-dist/pom.xml                             |  4 +
 sentry-dist/src/main/assembly/src.xml           |  9 ++-
 sentry-provider/sentry-provider-db/pom.xml      |  4 +
 .../main/java/org/apache/sentry/Command.java    | 23 ++++++
 .../main/java/org/apache/sentry/SentryMain.java | 59 +++++++++++++++
 .../thrift/SentryPolicyServiceClient.java       |  4 +-
 .../apache/sentry/service/thrift/Constants.java | 78 --------------------
 .../sentry/service/thrift/SentryService.java    | 70 ++++++++++--------
 .../sentry/service/thrift/ServiceConstants.java | 78 ++++++++++++++++++++
 .../apache/sentry/service/thrift/Status.java    |  2 +-
 .../thrift/TestSentryServiceFailureCase.java    |  2 +-
 .../thrift/TestSentryServiceIntegration.java    |  2 +-
 .../thrift/SentryServiceIntegrationBase.java    |  4 +-
 14 files changed, 234 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 001f3b8..423623a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,6 +64,7 @@ limitations under the License.
     <datanucleus-rdbms.version>3.2.1</datanucleus-rdbms.version>
     <jdo-api.version>3.0.1</jdo-api.version>
     <derby.version>10.4.2.0</derby.version>
+    <commons-cli.version>1.2</commons-cli.version>
     <hive.version>0.12.0-cdh5.0.0-beta-2-SNAPSHOT</hive.version>
     <hadoop.version>2.2.0-cdh5.0.0-beta-2-SNAPSHOT</hadoop.version>
     <fest.reflect.version>1.4.1</fest.reflect.version>
@@ -86,6 +87,11 @@ limitations under the License.
         <version>1.0b3</version>
       </dependency>
       <dependency>
+        <groupId>commons-cli</groupId>
+        <artifactId>commons-cli</artifactId>
+        <version>${commons-cli.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.derby</groupId>
         <artifactId>derby</artifactId>
         <version>${derby.version}</version>
@@ -252,6 +258,11 @@ limitations under the License.
       </dependency>
       <dependency>
         <groupId>org.apache.sentry</groupId>
+        <artifactId>sentry-provider-db</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.sentry</groupId>
         <artifactId>sentry-policy-common</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-dist/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-dist/pom.xml b/sentry-dist/pom.xml
index 1190fe1..aa2185a 100644
--- a/sentry-dist/pom.xml
+++ b/sentry-dist/pom.xml
@@ -56,6 +56,10 @@ limitations under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.sentry</groupId>
+      <artifactId>sentry-provider-db</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sentry</groupId>
       <artifactId>sentry-policy-common</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-dist/src/main/assembly/src.xml
----------------------------------------------------------------------
diff --git a/sentry-dist/src/main/assembly/src.xml b/sentry-dist/src/main/assembly/src.xml
index 323488b..3d2e5ee 100644
--- a/sentry-dist/src/main/assembly/src.xml
+++ b/sentry-dist/src/main/assembly/src.xml
@@ -46,6 +46,7 @@
         <include>org.apache.sentry:sentry-provider</include>
         <include>org.apache.sentry:sentry-provider-common</include>
         <include>org.apache.sentry:sentry-provider-file</include>
+        <include>org.apache.sentry:sentry-provider-db</include>
         <include>org.apache.sentry:sentry-policy</include>
         <include>org.apache.sentry:sentry-policy-common</include>
         <include>org.apache.sentry:sentry-policy-db</include>
@@ -110,13 +111,19 @@
 
       <includes>
         <include>.gitignore</include>
-        <include>bin/**</include>
         <include>conf/**</include>
         <include>pom.xml</include>
         <include>LICENSE.txt</include>
         <include>NOTICE</include>
       </includes>
     </fileSet>
+    <fileSet>
+      <directory>../</directory>
+      <fileMode>755</fileMode>
+      <includes>
+        <include>bin/**</include>
+      </includes>
+    </fileSet>
   </fileSets>
 
 </assembly>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/pom.xml b/sentry-provider/sentry-provider-db/pom.xml
index 0df8a61..5181988 100644
--- a/sentry-provider/sentry-provider-db/pom.xml
+++ b/sentry-provider/sentry-provider-db/pom.xml
@@ -29,6 +29,10 @@ limitations under the License.
 
   <dependencies>
     <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/Command.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/Command.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/Command.java
new file mode 100644
index 0000000..528f7d7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/Command.java
@@ -0,0 +1,23 @@
+/**
+ * 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.sentry;
+
+
+public interface Command {
+  public void run(String[] args) throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/SentryMain.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/SentryMain.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/SentryMain.java
new file mode 100644
index 0000000..3cb5e54
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/SentryMain.java
@@ -0,0 +1,59 @@
+/**
+ * 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.sentry;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.sentry.service.thrift.SentryService;
+
+import com.google.common.collect.ImmutableMap;
+
+public class SentryMain {
+  private static final String HELP_SHORT = "h";
+  private static final String HELP_LONG = "help";
+  private static final String COMMAND = "command";
+  private static final ImmutableMap<String, Command> COMMANDS = ImmutableMap
+      .<String, Command>builder()
+      .put("service", new SentryService.CommandImpl())
+      .build();
+  public static void main(String[] args)
+      throws Exception {
+    CommandLineParser parser = new GnuParser();
+    Options options = new Options();
+    options.addOption(HELP_SHORT, HELP_LONG, false, "Print this help text");
+    options.addOption(null, COMMAND, true, "Command to run. Options: " + COMMANDS.keySet());
+    CommandLine commandLine = parser.parse(options, args);
+    String commandName = commandLine.getOptionValue(COMMAND);
+    if (commandName == null || options.hasOption(HELP_SHORT) || options.hasOption(HELP_LONG)) {
+      printHelp(options);
+    }
+    Command command = COMMANDS.get(commandName);
+    if (command == null) {
+      printHelp(options);
+    }
+    command.run(commandLine.getArgs());
+  }
+  private static void printHelp(Options options) {
+    (new HelpFormatter()).printHelp("sentry.sh --" + COMMAND + "=" + COMMANDS.keySet(),
+        options);
+    System.exit(1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
index 2efff2a..aa83ffd 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
@@ -24,8 +24,8 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SaslRpcServer;
 import org.apache.hadoop.security.SaslRpcServer.AuthMethod;
-import org.apache.sentry.service.thrift.Constants.ClientConfig;
-import org.apache.sentry.service.thrift.Constants.ServerConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TMultiplexedProtocol;

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Constants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Constants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Constants.java
deleted file mode 100644
index 16b2aad..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Constants.java
+++ /dev/null
@@ -1,78 +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.sentry.service.thrift;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.sasl.Sasl;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableMap;
-
-public class Constants {
-
-  private static final ImmutableMap<String, String> SASL_PROPERTIES;
-
-  static {
-    Map<String, String> saslProps = new HashMap<String, String>();
-    saslProps.put(Sasl.SERVER_AUTH, "true");
-    saslProps.put(Sasl.QOP, "auth-conf");
-    SASL_PROPERTIES = ImmutableMap.copyOf(saslProps);
-  }
-
-  public static class ConfUtilties {
-    public static final Splitter CLASS_SPLITTER = Splitter.onPattern("[\\s,]")
-        .trimResults().omitEmptyStrings();
-  }
-  public static class ServerArgs {
-    public static final String CONFIG_FILE = "--conf-file";
-  }
-  public static class ServerConfig {
-    public static final ImmutableMap<String, String> SASL_PROPERTIES = Constants.SASL_PROPERTIES;
-    public static final String PRINCIPAL = "sentry.service.server.principal";
-    public static final String KEY_TAB = "sentry.service.server.keytab";
-    public static final String RPC_PORT = "sentry.service.server.rpc-port";
-    public static final int RPC_PORT_DEFAULT = 8038;
-    public static final String RPC_ADDRESS = "sentry.service.server.rpc-address";
-    public static final String RPC_ADDRESS_DEFAULT = "0.0.0.0";
-    public static final String RPC_MAX_THREADS = "sentry.service.server-max-threads";
-    public static final int RPC_MAX_THREADS_DEFAULT = 500;
-    public static final String RPC_MIN_THREADS = "sentry.service.server-min-threads";
-    public static final int RPC_MIN_THREADS_DEFAULT = 10;
-    public static final String ALLOW_CONNECT = "sentry.service.allow.connect";
-    public static final String PROCESSOR_FACTORIES = "sentry.service.processor.factories";
-    public static final String PROCESSOR_FACTORIES_DEFAULT =
-        "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory";
-  }
-  public static class ClientConfig {
-    public static final ImmutableMap<String, String> SASL_PROPERTIES = Constants.SASL_PROPERTIES;
-    public static final String SERVER_RPC_PORT = "sentry.service.client.server.rpc-port";
-    public static final int SERVER_RPC_PORT_DEFAULT = ServerConfig.RPC_PORT_DEFAULT;
-    public static final String SERVER_RPC_ADDRESS = "sentry.service.client.server.rpc-address";
-    public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout";
-    public static final int SERVER_RPC_CONN_TIMEOUT_DEFAULT = 200000;
-  }
-
-  /**
-   * Thrift generates terrible constant class names
-   */
-  public static class ThriftConstants extends org.apache.sentry.service.thrift.sentry_common_serviceConstants {
-    public static final int TSENTRY_SERVICE_VERSION_CURRENT = TSENTRY_SERVICE_V1;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
index 29fde59..fbb0eef 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
@@ -34,12 +34,17 @@ import javax.security.auth.kerberos.KerberosPrincipal;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
 
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Options;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SaslRpcServer;
 import org.apache.hadoop.security.SaslRpcServer.AuthMethod;
-import org.apache.sentry.service.thrift.Constants.ConfUtilties;
-import org.apache.sentry.service.thrift.Constants.ServerConfig;
+import org.apache.sentry.Command;
+import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.apache.thrift.TMultiplexedProcessor;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.server.TServer;
@@ -229,34 +234,39 @@ public class SentryService implements Runnable {
     }
     throw new IllegalStateException("Unable to find a port after 1000 attempts");
   }
-
-  @SuppressWarnings("deprecation")
-  public static void main(String[] args) throws Exception {
-    // XXX if more more than one argument is handled here, use an options parser
-    File configFile = null;
-    if (args.length != 2
-        || !args[0].equalsIgnoreCase(Constants.ServerArgs.CONFIG_FILE)) {
-      throw new IllegalArgumentException("Usage: "
-          + Constants.ServerArgs.CONFIG_FILE + " path/to/sentry-service.xml");
-    } else if (!((configFile = new File(args[1])).isFile() && configFile
-        .canRead())) {
-      throw new IllegalArgumentException("Cannot read configuration file "
-          + configFile);
-    }
-    Configuration conf = new Configuration(false);
-    conf.addResource(configFile.toURL());
-    final SentryService server = new SentryService(conf);
-    server.start();
-    Runtime.getRuntime().addShutdownHook(new Thread() {
-      @Override
-      public void run() {
-        LOGGER.info("ShutdownHook shutting down server");
-        try {
-          server.stop();
-        } catch (Throwable t) {
-          LOGGER.error("Error stopping SentryService", t);
-        }
+  public static class CommandImpl implements Command {
+    @Override
+    @SuppressWarnings("deprecation")
+    public void run(String[] args) throws Exception {
+      CommandLineParser parser = new GnuParser();
+      Options options = new Options();
+      options.addOption(null, ServiceConstants.ServiceArgs.CONFIG_FILE,
+          true, "Sentry Service configuration file");
+      CommandLine commandLine = parser.parse(options, args);
+      String configFileName = commandLine.getOptionValue(ServiceConstants.
+          ServiceArgs.CONFIG_FILE);
+      File configFile = null;
+      if (configFileName == null) {
+        throw new IllegalArgumentException("Usage: " + ServiceConstants.ServiceArgs.CONFIG_FILE +
+            " path/to/sentry-service.xml");
+      } else if(!((configFile = new File(configFileName)).isFile() && configFile.canRead())) {
+        throw new IllegalArgumentException("Cannot read configuration file " + configFile);
       }
-    });
+      Configuration conf = new Configuration(false);
+      conf.addResource(configFile.toURL());
+      final SentryService server = new SentryService(conf);
+      server.start();
+      Runtime.getRuntime().addShutdownHook(new Thread() {
+        @Override
+        public void run() {
+          LOGGER.info("ShutdownHook shutting down server");
+          try {
+            server.stop();
+          } catch (Throwable t) {
+            LOGGER.error("Error stopping SentryService", t);
+          }
+        }
+      });
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
new file mode 100644
index 0000000..253f88e
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
@@ -0,0 +1,78 @@
+/**
+ * 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.sentry.service.thrift;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.sasl.Sasl;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableMap;
+
+public class ServiceConstants {
+
+  private static final ImmutableMap<String, String> SASL_PROPERTIES;
+
+  static {
+    Map<String, String> saslProps = new HashMap<String, String>();
+    saslProps.put(Sasl.SERVER_AUTH, "true");
+    saslProps.put(Sasl.QOP, "auth-conf");
+    SASL_PROPERTIES = ImmutableMap.copyOf(saslProps);
+  }
+
+  public static class ConfUtilties {
+    public static final Splitter CLASS_SPLITTER = Splitter.onPattern("[\\s,]")
+        .trimResults().omitEmptyStrings();
+  }
+  public static class ServiceArgs {
+    public static final String CONFIG_FILE = "--conf-file";
+  }
+  public static class ServerConfig {
+    public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES;
+    public static final String PRINCIPAL = "sentry.service.server.principal";
+    public static final String KEY_TAB = "sentry.service.server.keytab";
+    public static final String RPC_PORT = "sentry.service.server.rpc-port";
+    public static final int RPC_PORT_DEFAULT = 8038;
+    public static final String RPC_ADDRESS = "sentry.service.server.rpc-address";
+    public static final String RPC_ADDRESS_DEFAULT = "0.0.0.0";
+    public static final String RPC_MAX_THREADS = "sentry.service.server-max-threads";
+    public static final int RPC_MAX_THREADS_DEFAULT = 500;
+    public static final String RPC_MIN_THREADS = "sentry.service.server-min-threads";
+    public static final int RPC_MIN_THREADS_DEFAULT = 10;
+    public static final String ALLOW_CONNECT = "sentry.service.allow.connect";
+    public static final String PROCESSOR_FACTORIES = "sentry.service.processor.factories";
+    public static final String PROCESSOR_FACTORIES_DEFAULT =
+        "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory";
+  }
+  public static class ClientConfig {
+    public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES;
+    public static final String SERVER_RPC_PORT = "sentry.service.client.server.rpc-port";
+    public static final int SERVER_RPC_PORT_DEFAULT = ServerConfig.RPC_PORT_DEFAULT;
+    public static final String SERVER_RPC_ADDRESS = "sentry.service.client.server.rpc-address";
+    public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout";
+    public static final int SERVER_RPC_CONN_TIMEOUT_DEFAULT = 200000;
+  }
+
+  /**
+   * Thrift generates terrible constant class names
+   */
+  public static class ThriftConstants extends org.apache.sentry.service.thrift.sentry_common_serviceConstants {
+    public static final int TSENTRY_SERVICE_VERSION_CURRENT = TSENTRY_SERVICE_V1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
index 73ef64c..5fba2a1 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
@@ -22,7 +22,7 @@ import java.io.StringWriter;
 
 import javax.annotation.Nullable;
 
-import org.apache.sentry.service.thrift.Constants.ThriftConstants;
+import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
 
 /**
  * Simple factory to make returning TSentryStatus objects easy

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
index cb82bef..a4643bf 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
@@ -21,7 +21,7 @@ package org.apache.sentry.provider.db.service.thrift;
 import java.security.PrivilegedActionException;
 
 import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.apache.sentry.service.thrift.Constants.ServerConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
index 913e26a..692dbfa 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
@@ -22,8 +22,8 @@ import com.google.common.base.Preconditions;
 
 import java.util.Set;
 
-import org.apache.sentry.service.thrift.Constants.ThriftConstants;
 import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/a8cea47e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
index 6b5b7d6..c1bb887 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
@@ -30,8 +30,8 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.minikdc.KerberosSecurityTestcase;
 import org.apache.hadoop.minikdc.MiniKdc;
 import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
-import org.apache.sentry.service.thrift.Constants.ClientConfig;
-import org.apache.sentry.service.thrift.Constants.ServerConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;