Permalink
Browse files

first running version - needs lots o' logging

  • Loading branch information...
0 parents commit dbb9d90a828f5477e3e5b024920e3d1b22b335fe Cory Cyr committed Mar 5, 2011
@@ -0,0 +1,2 @@
+build/*
+dist/*
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="HadooperPooper" default="default" basedir=".">
+ <description>Builds, tests, and runs the project HadooperPooper.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="HadooperPooper-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+
+</project>
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+

Large diffs are not rendered by default.

Oops, something went wrong.
No changes.
No changes.
No changes.
No changes.
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=75316eda
+build.xml.script.CRC32=2c423c31
+build.xml.stylesheet.CRC32=28e38971@1.38.3.45
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=75316eda
+nbproject/build-impl.xml.script.CRC32=474c3ab9
+nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45
No changes.
@@ -0,0 +1 @@
+application.args=deete-cluster pooper
@@ -0,0 +1 @@
+application.args=launch-cluster poop m1.large 3
@@ -0,0 +1 @@
+application.args=terminate-cluster pooper
@@ -0,0 +1 @@
+application.args=terminate-slaves pooper 1
@@ -0,0 +1,7 @@
+application.args=list-clusters
+compile.on.save=true
+do.depend=false
+do.jar=true
+javac.debug=true
+javadoc.preview=true
+user.properties.file=/Users/cory/.netbeans/6.9/build.properties
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
@@ -0,0 +1,76 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=HadooperPooper
+application.vendor=cory
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/HadooperPooper.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${libs.aws.classpath}:\
+ ${libs.commons-codec.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit_4.classpath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=com.lunabeat.pooper.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${build.classes.dir}/data
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=-Dpooper.config=/Users/cory/.ec2/pooper.properties
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}:\
+ ${build.classes.dir}/data
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.java.j2seproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+ <name>HadooperPooper</name>
+ <source-roots>
+ <root id="src.dir"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
@@ -0,0 +1,142 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.lunabeat.dooper;
+
+import com.amazonaws.auth.AWSCredentials;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ *
+ * @author cory
+ */
+public class ClusterConfig implements AWSCredentials {
+
+ private final Properties _properties = new Properties();
+ private final Properties _requiredFields = new Properties();
+ private final static String REQUIRED_FIELDS = "/com/lunabeat/dooper/RequiredConfigFields.properties";
+ public static final String SECRET_KEY_KEY = "AWS.SecretKey";
+ public static final String ACCESS_KEY_KEY = "AWS.AccessKey";
+ public static final String ACCOUNT_ID_KEY = "AWS.AccountId";
+ public static final String DEFAULT_AMI_KEY = "AMI.DefaultImage";
+ public static final String USER_DATA_PATH_KEY = "EC2.UserDataFile";
+ public static final String KEYPAIR_NAME_KEY = "EC2.KeypairName";
+ public static final String KEYPAIR_FILE_KEY = "EC2.KeypairFile";
+ public static final String MASTER_HOST_KEY = "Master.Host";
+ public static final List<String> INSTANCE_TYPES = initTypes();
+
+ private static List<String> initTypes(){
+ ArrayList<String> tmpList = new ArrayList<String>();
+ tmpList.add("t1.micro");
+ tmpList.add("m1.small");
+ tmpList.add("m1.large");
+ tmpList.add("m1.xlarge");
+ tmpList.add("m2.xlarge");
+ tmpList.add("m2.2xlarge");
+ tmpList.add("m2.4xlarge");
+ tmpList.add("c1.medium");
+ tmpList.add("c1.xlarge");
+ tmpList.add("cc1.4xlarge");
+ tmpList.add("cg1.4xlarge");
+ return Collections.unmodifiableList(tmpList);
+ }
+
+ /**
+ *
+ * @param src
+ * @throws IOException
+ * @throws com.lunabeat.dooper.ClusterConfig.ConfigException
+ */
+ public ClusterConfig(InputStream src) throws IOException, ConfigException {
+ _properties.load(src);
+ init();
+ }
+
+ /**
+ *
+ * @param resourcePath
+ * @throws IOException
+ * @throws com.lunabeat.dooper.ClusterConfig.ConfigException
+ */
+ public ClusterConfig(String path) throws IOException, ConfigException {
+ FileInputStream fis = new FileInputStream(path);
+ _properties.load(fis);
+ init();
+ }
+
+ private void testConfig() throws ConfigException {
+ ArrayList<String> errs = new ArrayList<String>();
+ for (String key : _requiredFields.stringPropertyNames()) {
+ String type = _requiredFields.getProperty(key);
+ String confValue = _properties.getProperty(key);
+ if (confValue == null) {
+ errs.add(key + " missing " + type + " value.");
+ }
+ }
+ if (errs.size() > 0) {
+ throw new ConfigException(errs.toString());
+ }
+
+ }
+
+ public String get(String name) {
+ return _properties.getProperty(name);
+ }
+
+ public String get(String name, String defaultVal) {
+ return _properties.getProperty(name, defaultVal);
+ }
+
+ /**
+ *
+ * @param name
+ * @return integer value of property or null
+ */
+ public Integer getInt(String name) {
+ Integer result = null;
+ try {
+ Integer.parseInt(_properties.getProperty(name));
+ } catch (NumberFormatException e) {
+ //log it, I guess
+ }
+ return result;
+ }
+
+ private void init() throws IOException, ConfigException {
+ _requiredFields.load(ClusterConfig.class.getResourceAsStream(REQUIRED_FIELDS));
+ testConfig();
+
+ }
+
+ public String getAWSAccessKeyId() {
+ return get(ACCESS_KEY_KEY);
+ }
+
+ public String getAWSSecretKey() {
+ return get(SECRET_KEY_KEY);
+ }
+
+ public static class ConfigException extends Exception {
+
+ ConfigException(String message) {
+ super(message);
+ }
+ }
+
+ public Map<String, String> getRequiredFields() {
+ HashMap<String, String> fields = new HashMap<String, String>();
+ for (String key : _requiredFields.stringPropertyNames()) {
+ fields.put(key, _requiredFields.getProperty(key));
+ }
+ return fields;
+ }
+}
@@ -0,0 +1,46 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.lunabeat.dooper;
+
+import com.amazonaws.services.ec2.model.Instance;
+import java.util.List;
+
+/**
+ *
+ * @author cory
+ */
+public class ClusterInstance {
+ private String _reservationId;
+ private List<String> _secGroups;
+ private Instance _instance;
+
+
+ public ClusterInstance(Instance instance,String reservationId,List<String> securityGroups){
+ _instance = instance;
+ _reservationId = reservationId;
+ _secGroups = securityGroups;
+ }
+
+ /**
+ * @return the _reservationId
+ */ public String getReservationId() {
+ return _reservationId;
+ }
+
+
+ /**
+ * @return the _secGroups
+ */ public List<String> getSecurityGroups() {
+ return _secGroups;
+ }
+
+
+ /**
+ * @return the _instance
+ */ public Instance getInstance() {
+ return _instance;
+ }
+}
Oops, something went wrong.

0 comments on commit dbb9d90

Please sign in to comment.