incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [27/50] [abbrv] git commit: Got the packaging working, still needs to be slimmed down though
Date Sat, 31 May 2014 14:22:00 GMT
Got the packaging working, still needs to be slimmed down though


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

Branch: refs/heads/apache-blur-0.2
Commit: 14e70fa25be5790bdefaa577acb38c632d62afd1
Parents: 38a56fe
Author: Chris Rohr <crohr@nearinfinity.com>
Authored: Wed May 28 03:24:51 2014 -0400
Committer: Chris Rohr <crohr@nearinfinity.com>
Committed: Wed May 28 03:24:51 2014 -0400

----------------------------------------------------------------------
 contrib/blur-console/src/assemble/bin.xml       | 42 ++++++++---
 .../org/apache/blur/console/util/Config.java    | 79 +++++++++++++-------
 2 files changed, 83 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/14e70fa2/contrib/blur-console/src/assemble/bin.xml
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/assemble/bin.xml b/contrib/blur-console/src/assemble/bin.xml
index 6337148..b721234 100644
--- a/contrib/blur-console/src/assemble/bin.xml
+++ b/contrib/blur-console/src/assemble/bin.xml
@@ -25,14 +25,26 @@ under the License.
   </formats>
   <includeBaseDirectory>false</includeBaseDirectory>
   <dependencySets>
-    <dependencySet>
+    <!-- <dependencySet>
       <unpack>true</unpack>
+      <scope>provided</scope>
       <useTransitiveDependencies>true</useTransitiveDependencies>
       <includes>
         <include>org.apache.blur:blur-thrift</include>
         <include>org.apache.blur:blur-core</include>
         <include>org.codehaus.jackson:*</include>
       </includes>
+    </dependencySet> -->
+    <dependencySet>
+        <unpack>true</unpack>
+        <scope>runtime</scope>
+        <excludes>
+          <exclude>org.apache.blur:blur-core:test-jar</exclude>
+          <exclude>org.apache.blur:blur-util:test-jar</exclude>
+          <exclude>org.apache.hadoop:hadoop-test</exclude>
+          <exclude>org.apache.hadoop:hadoop-client</exclude>
+          <exclude>org.apache.hadoop:hadoop-minicluster</exclude>
+      </excludes>
     </dependencySet>
   </dependencySets>
   <fileSets>
@@ -45,17 +57,25 @@ under the License.
       <outputDirectory>webapp</outputDirectory>
       <!-- Remove unneccessary web files -->
       <includes>
-          <include>*/**/.css</include>
-          <include>*/**/.js</include>
-          <include>*/**/.gif</include>
+          <include>css/**</include>
+          <include>img/**</include>
+          <include>js/**</include>
+          <include>libs/flot/jquery.flot.js</include>
+          <include>libs/flot/jquery.flot.pie.js</include>
+          <include>libs/flot/jquery.flot.categories.js</include>
+          <include>libs/flot/jquery.flot.stack.js</include>
+          <include>libs/jquery/dist/jquery.js</include>
+          <include>libs/modernizr/modernizr.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/fonts/bootstrap/**</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tooltip.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/modal.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/transition.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/popover.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/collapse.js</include>
+          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tab.js</include>
+          <include>views/**</include>
+          <include>index.html</include>
       </includes>
-      <excludes>
-      	<exclude>*/node_modules/*</exclude>
-      	<exclude>/src/main/webapp/.sass-cache</exclude>
-      	<exclude>**/libs/chai/*</exclude>
-      	<exclude>**/libs/flot/examples/*</exclude>
-      	<exclude>**/libs/jquery/src/*</exclude>
-      </excludes>
     </fileSet>
   </fileSets>
 </assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/14e70fa2/contrib/blur-console/src/main/java/org/apache/blur/console/util/Config.java
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/java/org/apache/blur/console/util/Config.java b/contrib/blur-console/src/main/java/org/apache/blur/console/util/Config.java
index fc75989..cd9ca18 100644
--- a/contrib/blur-console/src/main/java/org/apache/blur/console/util/Config.java
+++ b/contrib/blur-console/src/main/java/org/apache/blur/console/util/Config.java
@@ -19,30 +19,26 @@ package org.apache.blur.console.util;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.blur.BlurConfiguration;
-import org.apache.blur.MiniCluster;
 import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.utils.GCWatcher;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class Config {
 	private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/mini-cluster"));
+	private static final Log log = LogFactory.getLog(Config.class);
 	
 	private static int port = 8080;
 	private static BlurConfiguration blurConfig;
 	private static ZookeeperClusterStatus zk;
 	private static String blurConnection;
-	private static MiniCluster cluster;
+	private static Object cluster;
 
 	public static int getConsolePort() {
 		return port;
@@ -56,7 +52,16 @@ public class Config {
 			blurConfig = new BlurConfiguration();
 		} else {
 			blurConfig = new BlurConfiguration(false);
-			blurConfig.set("blur.zookeeper.connection", cluster.getZkConnectionString());
+			
+			String zkConnection = "";
+			try {
+				Method zkMethod = cluster.getClass().getMethod("getZkConnectionString");
+				zkConnection = (String) zkMethod.invoke(cluster);
+			} catch (Exception e) {
+				log.fatal("Unable get zookeeper connection string", e);
+			}
+			
+			blurConfig.set("blur.zookeeper.connection", zkConnection);
 		}
 		zk = new ZookeeperClusterStatus(blurConfig.get("blur.zookeeper.connection"), blurConfig);
 		blurConnection = buildConnectionString();
@@ -78,7 +83,13 @@ public class Config {
 	
 	public static void shutdownMiniCluster() throws IOException {
 		if (cluster != null) {
-			cluster.shutdownBlurCluster();
+			try {
+				Method method = cluster.getClass().getMethod("shutdownBlurCluster");
+				method.invoke(cluster);
+			} catch (Exception e) {
+				log.fatal("Unable to stop mini cluster through reflection.", e);
+			}
+//			cluster.shutdownBlurCluster();
 			File file = new File(TMPDIR, "blur-cluster-test");
 			if (file.exists()) {
 				FileUtils.deleteDirectory(file);
@@ -87,26 +98,40 @@ public class Config {
 	}
 	
 	
+	@SuppressWarnings("unchecked")
 	public static void setupMiniCluster() throws IOException {
-		GCWatcher.init(0.60);
-	    LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
+//		GCWatcher.init(0.60);
+//	    LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
 	    File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
 	    testDirectory.mkdirs();
 
-	    Path directory = new Path(testDirectory.getPath());
-	    FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
-	    FsAction userAction = dirPermissions.getUserAction();
-	    FsAction groupAction = dirPermissions.getGroupAction();
-	    FsAction otherAction = dirPermissions.getOtherAction();
-
-	    StringBuilder builder = new StringBuilder();
-	    builder.append(userAction.ordinal());
-	    builder.append(groupAction.ordinal());
-	    builder.append(otherAction.ordinal());
-	    String dirPermissionNum = builder.toString();
-	    System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
+//	    Path directory = new Path(testDirectory.getPath());
+//	    FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
+//	    FsAction userAction = dirPermissions.getUserAction();
+//	    FsAction groupAction = dirPermissions.getGroupAction();
+//	    FsAction otherAction = dirPermissions.getOtherAction();
+//
+//	    StringBuilder builder = new StringBuilder();
+//	    builder.append(userAction.ordinal());
+//	    builder.append(groupAction.ordinal());
+//	    builder.append(otherAction.ordinal());
+//	    String dirPermissionNum = builder.toString();
+//	    System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
 	    testDirectory.delete();
-	    cluster = new MiniCluster();
-	    cluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3,
true);
+	    try {
+	    	Class clusterClass = Class.forName("org.apache.blur.MiniCluster", false, Config.class.getClassLoader());
+	    
+		    if (clusterClass != null) {
+		    	cluster = clusterClass.newInstance();
+		    	Method startBlurCluster = clusterClass.getDeclaredMethod("startBlurCluster", String.class,
int.class, int.class, boolean.class);
+		    	startBlurCluster.invoke(cluster, new File(testDirectory, "cluster").getAbsolutePath(),
2, 3, true);
+		    }
+	    } catch (Exception e) {
+	    	log.fatal("Unable to start in dev mode because MiniCluster isn't in classpath", e);
+	    	cluster = null;
+	    }
+//	    cluster = ConstructorUtils.in
+//	    cluster = new MiniCluster();
+//	    cluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2,
3, true);
 	}
 }


Mime
View raw message