incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/4] git commit: Renaming the server security classes.
Date Tue, 03 Feb 2015 15:25:22 GMT
Renaming the server security classes.


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

Branch: refs/heads/master
Commit: 46a4f4588a118b24f04186157ad98e82c8cd51c9
Parents: 115cfaf
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Feb 3 10:23:07 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Feb 3 10:23:07 2015 -0500

----------------------------------------------------------------------
 .../org/apache/blur/server/ServerSecurity.java  | 30 ---------
 .../blur/server/ServerSecurityFactory.java      | 33 ----------
 .../blur/server/ServerSecurityFilter.java       | 30 +++++++++
 .../server/ServerSecurityFilterFactory.java     | 33 ++++++++++
 .../apache/blur/server/ServerSecurityUtil.java  |  6 +-
 .../org/apache/blur/thrift/ThriftServer.java    | 24 +++-----
 .../blur/trace/ZooKeeperDumpContents.java       | 64 --------------------
 7 files changed, 75 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/server/ServerSecurity.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ServerSecurity.java b/blur-core/src/main/java/org/apache/blur/server/ServerSecurity.java
deleted file mode 100644
index ee74559..0000000
--- a/blur-core/src/main/java/org/apache/blur/server/ServerSecurity.java
+++ /dev/null
@@ -1,30 +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.blur.server;
-
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.user.User;
-
-public abstract class ServerSecurity {
-
-  public abstract boolean canAccess(Method method, Object[] args, User user, InetAddress
address, int port)
-      throws BlurException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFactory.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFactory.java b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFactory.java
deleted file mode 100644
index 759112e..0000000
--- a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFactory.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.blur.server;
-
-import org.apache.blur.BlurConfiguration;
-
-public abstract class ServerSecurityFactory {
-
-  public enum ServerType {
-    CONTROLLER, SHARD
-  }
-  
-  public ServerSecurityFactory() {
-    
-  }
-
-  public abstract ServerSecurity getServerSecurity(ServerType server, BlurConfiguration configuration);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilter.java b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilter.java
new file mode 100644
index 0000000..e9d62f5
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilter.java
@@ -0,0 +1,30 @@
+/**
+ * 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.blur.server;
+
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.user.User;
+
+public abstract class ServerSecurityFilter {
+
+  public abstract boolean canAccess(Method method, Object[] args, User user, InetAddress
address, int port)
+      throws BlurException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilterFactory.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilterFactory.java
b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilterFactory.java
new file mode 100644
index 0000000..b44bad3
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityFilterFactory.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.blur.server;
+
+import org.apache.blur.BlurConfiguration;
+
+public abstract class ServerSecurityFilterFactory {
+
+  public enum ServerType {
+    CONTROLLER, SHARD
+  }
+  
+  public ServerSecurityFilterFactory() {
+    
+  }
+
+  public abstract ServerSecurityFilter getServerSecurity(ServerType server, BlurConfiguration
configuration);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/server/ServerSecurityUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityUtil.java b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityUtil.java
index cd7deca..b853f2d 100644
--- a/blur-core/src/main/java/org/apache/blur/server/ServerSecurityUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/server/ServerSecurityUtil.java
@@ -35,13 +35,13 @@ public class ServerSecurityUtil {
 
   private static final Log LOG = LogFactory.getLog(ServerSecurityUtil.class);
 
-  public static Iface applySecurity(final Iface iface, final List<ServerSecurity> serverSecurityList,
+  public static Iface applySecurity(final Iface iface, final List<ServerSecurityFilter>
serverSecurityList,
       final boolean shardServer) {
     if (serverSecurityList == null || serverSecurityList.isEmpty()) {
       LOG.info("No server security configured.");
       return iface;
     }
-    for (ServerSecurity serverSecurity : serverSecurityList) {
+    for (ServerSecurityFilter serverSecurity : serverSecurityList) {
       LOG.info("Server security configured with [{0}] class [{1}].", serverSecurity, serverSecurity.getClass());
     }
     InvocationHandler handler = new InvocationHandler() {
@@ -57,7 +57,7 @@ public class ServerSecurityUtil {
         InetAddress address = remoteSocketAddress.getAddress();
         int port = remoteSocketAddress.getPort();
         User user = UserContext.getUser();
-        for (ServerSecurity serverSecurity : serverSecurityList) {
+        for (ServerSecurityFilter serverSecurity : serverSecurityList) {
           if (!serverSecurity.canAccess(method, args, user, address, port)) {
             throw new BException("ACCESS DENIED for User [{0}] method [{1}].", user, method.getName());
           }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
index f1c3e94..0204e98 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
@@ -24,8 +24,7 @@ import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
 import static org.apache.blur.metrics.MetricsConstants.SYSTEM;
 import static org.apache.blur.utils.BlurConstants.BLUR_HDFS_TRACE_PATH;
 import static org.apache.blur.utils.BlurConstants.BLUR_HOME;
-import static org.apache.blur.utils.BlurConstants.BLUR_SERVER_SECURITY_CLASS;
-import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TRACE_PATH;
+import static org.apache.blur.utils.BlurConstants.BLUR_SERVER_SECURITY_FILTER_CLASS;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -53,8 +52,8 @@ import org.apache.blur.concurrent.Executors;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
-import org.apache.blur.server.ServerSecurity;
-import org.apache.blur.server.ServerSecurityFactory;
+import org.apache.blur.server.ServerSecurityFilter;
+import org.apache.blur.server.ServerSecurityFilterFactory;
 import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TBinaryProtocol;
 import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol;
 import org.apache.blur.thirdparty.thrift_0_9_0.server.TServer;
@@ -166,12 +165,7 @@ public class ThriftServer {
   }
 
   public static TraceStorage setupTraceStorage(BlurConfiguration configuration) throws IOException
{
-    String zKpath = configuration.get(BLUR_ZOOKEEPER_TRACE_PATH);
     String hdfsPath = configuration.get(BLUR_HDFS_TRACE_PATH);
-    if (zKpath != null && hdfsPath != null) {
-      throw new RuntimeException("Cannot have both [" + BLUR_ZOOKEEPER_TRACE_PATH + "] and
[" + BLUR_HDFS_TRACE_PATH
-          + "] set.");
-    }
     if (hdfsPath != null) {
       return new HdfsTraceStorage(configuration);
     } else {
@@ -443,8 +437,8 @@ public class ThriftServer {
   }
 
   @SuppressWarnings("unchecked")
-  public static List<ServerSecurity> getServerSecurityList(BlurConfiguration configuration,
-      ServerSecurityFactory.ServerType type) {
+  public static List<ServerSecurityFilter> getServerSecurityList(BlurConfiguration
configuration,
+      ServerSecurityFilterFactory.ServerType type) {
     Map<String, String> properties = configuration.getProperties();
     Map<String, String> classMap = new TreeMap<String, String>();
     for (Entry<String, String> e : properties.entrySet()) {
@@ -453,21 +447,21 @@ public class ThriftServer {
       if (value == null || value.isEmpty()) {
         continue;
       }
-      if (property.startsWith(BLUR_SERVER_SECURITY_CLASS)) {
+      if (property.startsWith(BLUR_SERVER_SECURITY_FILTER_CLASS)) {
         classMap.put(property, value);
       }
     }
     if (classMap.isEmpty()) {
       return null;
     }
-    List<ServerSecurity> result = new ArrayList<ServerSecurity>();
+    List<ServerSecurityFilter> result = new ArrayList<ServerSecurityFilter>();
     for (Entry<String, String> entry : classMap.entrySet()) {
       String className = entry.getValue();
       try {
         LOG.info("Loading factory class [{0}]", className);
-        Class<? extends ServerSecurityFactory> clazz = (Class<? extends ServerSecurityFactory>)
Class
+        Class<? extends ServerSecurityFilterFactory> clazz = (Class<? extends ServerSecurityFilterFactory>)
Class
             .forName(className);
-        ServerSecurityFactory serverSecurityFactory = clazz.newInstance();
+        ServerSecurityFilterFactory serverSecurityFactory = clazz.newInstance();
         result.add(serverSecurityFactory.getServerSecurity(type, configuration));
       } catch (Exception e) {
         throw new RuntimeException(e);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/46a4f458/blur-util/src/main/java/org/apache/blur/trace/ZooKeeperDumpContents.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/ZooKeeperDumpContents.java b/blur-util/src/main/java/org/apache/blur/trace/ZooKeeperDumpContents.java
deleted file mode 100644
index 25db507..0000000
--- a/blur-util/src/main/java/org/apache/blur/trace/ZooKeeperDumpContents.java
+++ /dev/null
@@ -1,64 +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.blur.trace;
-
-import static org.apache.blur.utils.BlurConstants.*;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.blur.BlurConfiguration;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
-
-public class ZooKeeperDumpContents {
-
-  public static void main(String[] args) throws IOException, KeeperException, InterruptedException
{
-    BlurConfiguration configuration = new BlurConfiguration();
-    String zkConnectionStr = configuration.get(BLUR_ZOOKEEPER_CONNECTION);
-    ZooKeeper zooKeeper = new ZooKeeper(zkConnectionStr, 30000, new Watcher() {
-      @Override
-      public void process(WatchedEvent event) {
-
-      }
-    });
-
-    String parentPath = configuration.get(BLUR_ZOOKEEPER_TRACE_PATH);
-    String id = args[0];
-
-    String path = parentPath + "/" + id;
-    List<String> children = zooKeeper.getChildren(path, false);
-    System.out.println("[");
-    boolean first = true;
-    for (String c : children) {
-      if (!first) {
-        System.out.println(",");
-      }
-      Stat stat = zooKeeper.exists(path + "/" + c, false);
-      byte[] data = zooKeeper.getData(path + "/" + c, false, stat);
-      String string = new String(data);
-      System.out.println(string);
-      first = false;
-    }
-    System.out.println("]");
-    zooKeeper.close();
-  }
-
-}


Mime
View raw message