Merge pull request #18 from justinliucs/master
Merge from base project.
This commit is contained in:
commit
e25593c61c
5
pom.xml
5
pom.xml
|
@ -76,6 +76,11 @@
|
||||||
<groupId>org.apache.hive</groupId>
|
<groupId>org.apache.hive</groupId>
|
||||||
<artifactId>hive-jdbc</artifactId>
|
<artifactId>hive-jdbc</artifactId>
|
||||||
<version>0.9.0</version>
|
<version>0.9.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -13,7 +14,7 @@ public class EndModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document generate(Map<String, String> configurations,
|
public Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs) {
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments) {
|
||||||
try {
|
try {
|
||||||
String name = configurations.get("name");
|
String name = configurations.get("name");
|
||||||
String xml = "<end name=\"" + name + "\"/>";
|
String xml = "<end name=\"" + name + "\"/>";
|
||||||
|
|
|
@ -2,6 +2,7 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -23,7 +24,7 @@ public class HiveModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document generate(Map<String, String> configurations,
|
public Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs) {
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments) {
|
||||||
try {
|
try {
|
||||||
String name = configurations.get("name");
|
String name = configurations.get("name");
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -26,7 +27,7 @@ public class JavaModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document generate(Map<String, String> configurations,
|
public Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs) {
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments) {
|
||||||
try {
|
try {
|
||||||
String name = configurations.get("name");
|
String name = configurations.get("name");
|
||||||
|
|
||||||
|
@ -36,12 +37,19 @@ public class JavaModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
String main_class = configurations.get(MAIN_CLASS);
|
String main_class = configurations.get(MAIN_CLASS);
|
||||||
// String java_opt = configurations.get(JAVA_OPT);
|
// String java_opt = configurations.get(JAVA_OPT);
|
||||||
String argument = configurations.get(ARG);
|
// String argument = configurations.get(ARG);
|
||||||
System.out.println("argument: " + argument);
|
// System.out.println("argument: " + argument);
|
||||||
|
|
||||||
String ok = outputs.get("ok").getName();
|
String ok = outputs.get("ok").getName();
|
||||||
String error = outputs.get("error").getName();
|
String error = outputs.get("error").getName();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if( arguments != null){
|
||||||
|
for(int i = 0; i < arguments.size(); i++){
|
||||||
|
sb.append("<arg>" + arguments.get(i) + "</arg>" + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String xml = "<action name=\"" + name + "\">" + "\n" + "<java>"
|
String xml = "<action name=\"" + name + "\">" + "\n" + "<java>"
|
||||||
+ "\n" + "<job-tracker>" + job_tracker + "</job-tracker>" + "\n"
|
+ "\n" + "<job-tracker>" + job_tracker + "</job-tracker>" + "\n"
|
||||||
+ "<name-node>" + name_node + "</name-node>" + "\n"
|
+ "<name-node>" + name_node + "</name-node>" + "\n"
|
||||||
|
@ -50,7 +58,8 @@ public class JavaModuleGenerator extends OozieXmlGenerator {
|
||||||
+ "<value>" + queue_name + "</value>" + "\n" + "</property>"
|
+ "<value>" + queue_name + "</value>" + "\n" + "</property>"
|
||||||
+ "\n" + "</configuration>" + "\n" + "<main-class>"
|
+ "\n" + "</configuration>" + "\n" + "<main-class>"
|
||||||
+ main_class + "</main-class>" + "\n"
|
+ main_class + "</main-class>" + "\n"
|
||||||
+ "<arg>" + argument + "</arg>" + "\n" + "</java>"
|
+ sb.toString()
|
||||||
|
+ "</java>"
|
||||||
+ "\n" + "<ok to=\"" + ok + "\"/>" + "\n"//ok
|
+ "\n" + "<ok to=\"" + ok + "\"/>" + "\n"//ok
|
||||||
+ "<error to=\"" +error + "\"/>" + "\n" + "</action>";
|
+ "<error to=\"" +error + "\"/>" + "\n" + "</action>";
|
||||||
return DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
return DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||||
|
|
|
@ -2,6 +2,7 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -13,7 +14,7 @@ public class KillModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document generate(Map<String, String> configurations,
|
public Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs) {
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments) {
|
||||||
try {
|
try {
|
||||||
String name = configurations.get("name");
|
String name = configurations.get("name");
|
||||||
String xml = "<kill name=\""
|
String xml = "<kill name=\""
|
||||||
|
|
|
@ -166,46 +166,46 @@ public class OozieEngine extends AbstractEngine {
|
||||||
boolean deloyedLocally = this.getFlowDeployService()
|
boolean deloyedLocally = this.getFlowDeployService()
|
||||||
.deployFlowLocal(localDeployPath, workflowXml,
|
.deployFlowLocal(localDeployPath, workflowXml,
|
||||||
getJarPaths(nodes, moduleClasses));
|
getJarPaths(nodes, moduleClasses));
|
||||||
// if (deloyedLocally) {
|
if (deloyedLocally) {
|
||||||
// messageBuilder.append(flowName
|
messageBuilder.append(flowName
|
||||||
// + " has been deployed locally!" + "\n");
|
+ " has been deployed locally!" + "\n");
|
||||||
//
|
|
||||||
// String hdfsDeployPath = this.getClusterConfiguration()
|
String hdfsDeployPath = this.getClusterConfiguration()
|
||||||
// .getProperty(
|
.getProperty(
|
||||||
// ClusterConfiguration.WORKSPACE_HDFS)
|
ClusterConfiguration.WORKSPACE_HDFS)
|
||||||
// + flowName;
|
+ flowName;
|
||||||
// boolean deleted = this.getHdfsService()
|
boolean deleted = this.getHdfsService()
|
||||||
// .deleteDirectory(hdfsDeployPath);
|
.deleteDirectory(hdfsDeployPath);
|
||||||
// if (deleted) {
|
if (deleted) {
|
||||||
// messageBuilder.append("Old folder deleted: "
|
messageBuilder.append("Old folder deleted: "
|
||||||
// + hdfsDeployPath + "\n");
|
+ hdfsDeployPath + "\n");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// boolean deployedToHdfs = this.getHdfsService()
|
boolean deployedToHdfs = this.getHdfsService()
|
||||||
// .uploadFile(localDeployPath, hdfsDeployPath);
|
.uploadFile(localDeployPath, hdfsDeployPath);
|
||||||
// if (deployedToHdfs) {
|
if (deployedToHdfs) {
|
||||||
// messageBuilder.append(flowName
|
messageBuilder.append(flowName
|
||||||
// + " has been uploaded to hdfs!" + "\n");
|
+ " has been uploaded to hdfs!" + "\n");
|
||||||
//
|
|
||||||
// String jobId = this.getOozieService().runJob(
|
String jobId = this.getOozieService().runJob(
|
||||||
// flowName);
|
flowName);
|
||||||
// if (jobId == null) {
|
if (jobId == null) {
|
||||||
// messageBuilder.append("Failed to commit job: "
|
messageBuilder.append("Failed to commit job: "
|
||||||
// + flowName + "\n");
|
+ flowName + "\n");
|
||||||
// } else {
|
} else {
|
||||||
// messageBuilder.append("Job commited! Job id : "
|
messageBuilder.append("Job commited! Job id : "
|
||||||
// + jobId + "\n");
|
+ jobId + "\n");
|
||||||
// model.setCommitted(true);
|
model.setCommitted(true);
|
||||||
// model.setJobId(jobId);
|
model.setJobId(jobId);
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// messageBuilder.append(flowName
|
messageBuilder.append(flowName
|
||||||
// + " failed to be uploaded to hdfs!" + "\n");
|
+ " failed to be uploaded to hdfs!" + "\n");
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// messageBuilder.append(flowName
|
messageBuilder.append(flowName
|
||||||
// + " failed to be deployed locally!" + "\n");
|
+ " failed to be deployed locally!" + "\n");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class OozieEngine extends AbstractEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
Module moduleProtype = moduleClass.getAnnotation(Module.class);
|
Module moduleProtype = moduleClass.getAnnotation(Module.class);
|
||||||
|
List<String> arguments = null;
|
||||||
OozieXmlGenerator gen = null;
|
OozieXmlGenerator gen = null;
|
||||||
switch (moduleProtype.type()) {
|
switch (moduleProtype.type()) {
|
||||||
case START:
|
case START:
|
||||||
|
@ -322,8 +322,9 @@ public class OozieEngine extends AbstractEngine {
|
||||||
AbstractJavaModule moduleInstance = (AbstractJavaModule) moduleClass
|
AbstractJavaModule moduleInstance = (AbstractJavaModule) moduleClass
|
||||||
.newInstance();
|
.newInstance();
|
||||||
configurations.put("main_class", moduleInstance.getMainClass());
|
configurations.put("main_class", moduleInstance.getMainClass());
|
||||||
configurations.put("arg",
|
// configurations.put("arg",
|
||||||
moduleInstance.getArguments(userConfs));
|
// moduleInstance.getArguments(userConfs));
|
||||||
|
arguments = moduleInstance.getArguments(userConfs);
|
||||||
gen = new JavaModuleGenerator();
|
gen = new JavaModuleGenerator();
|
||||||
break;
|
break;
|
||||||
case HIVE:
|
case HIVE:
|
||||||
|
@ -346,7 +347,7 @@ public class OozieEngine extends AbstractEngine {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (gen != null) {
|
if (gen != null) {
|
||||||
Document doc = gen.generate(configurations, null, outputs);
|
Document doc = gen.generate(configurations, null, outputs, arguments);
|
||||||
TransformerFactory transFactory = TransformerFactory
|
TransformerFactory transFactory = TransformerFactory
|
||||||
.newInstance();
|
.newInstance();
|
||||||
Transformer transformer;
|
Transformer transformer;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class OozieService {
|
||||||
Properties conf = wc.createConfiguration();
|
Properties conf = wc.createConfiguration();
|
||||||
// set the workflow application path
|
// set the workflow application path
|
||||||
conf.setProperty(OozieClient.APP_PATH,
|
conf.setProperty(OozieClient.APP_PATH,
|
||||||
"hdfs://m150:9000/user/root/examples/apps/z-java-module");
|
"hdfs://m150:9000/user/root/examples/apps/race_random_forest2");//z-java-module
|
||||||
|
|
||||||
// setting workflow parameters
|
// setting workflow parameters
|
||||||
conf.setProperty("nameNode", "hdfs://m150:9000");
|
conf.setProperty("nameNode", "hdfs://m150:9000");
|
||||||
|
|
|
@ -2,11 +2,12 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
public abstract class OozieXmlGenerator {
|
public abstract class OozieXmlGenerator {
|
||||||
public abstract Document generate(Map<String, String> configurations,
|
public abstract Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs);
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package haflow.engine.oozie;
|
||||||
|
|
||||||
import haflow.dto.entity.Node;
|
import haflow.dto.entity.Node;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -13,7 +14,7 @@ public class StartModuleGenerator extends OozieXmlGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document generate(Map<String, String> configurations,
|
public Document generate(Map<String, String> configurations,
|
||||||
Map<String, Node> inputs, Map<String, Node> outputs) {
|
Map<String, Node> inputs, Map<String, Node> outputs, List<String> arguments) {
|
||||||
System.out.println(outputs.size());
|
System.out.println(outputs.size());
|
||||||
try {
|
try {
|
||||||
String xml = "<start to=\"" + outputs.get("to").getName() + "\"/>";
|
String xml = "<start to=\"" + outputs.get("to").getName() + "\"/>";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package haflow.module;
|
package haflow.module;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,11 +8,12 @@ public abstract class AbstractJavaModule extends AbstractModule{
|
||||||
|
|
||||||
public abstract String getMainClass();
|
public abstract String getMainClass();
|
||||||
|
|
||||||
public String getArguments(Map<String, String> configurations){
|
public List<String> getArguments(Map<String, String> configurations){
|
||||||
StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
for(String key : configurations.keySet()){
|
// for(String key : configurations.keySet()){
|
||||||
sb.append("--" + key + " \"" + configurations.get(key) + "\" ");
|
// sb.append("--" + key + " \"" + configurations.get(key) + "\" ");
|
||||||
}
|
// }
|
||||||
return sb.toString();
|
// return sb.toString();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,11 @@ import haflow.module.ModuleConfigurationType;
|
||||||
import haflow.module.ModuleEndpoint;
|
import haflow.module.ModuleEndpoint;
|
||||||
import haflow.module.ModuleType;
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdac", name = "BuildForest", category = "datamining", type = ModuleType.JAVA,
|
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdac", name = "BuildForest", category = "DataMining-Mahout", type = ModuleType.JAVA,
|
||||||
configurations = {
|
configurations = {
|
||||||
@ModuleConfiguration(key = "data", displayName = "data: Data path", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "data", displayName = "data: Data path", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
@ModuleConfiguration(key = "dataset", displayName = "dataset: Dataset path",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "dataset", displayName = "dataset: Dataset path",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ -40,23 +42,26 @@ public class BuildForestModule extends AbstractJavaModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArguments(Map<String, String> configurations) {
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
Module module= BuildForestModule.class.getAnnotation(Module.class);
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
ModuleConfiguration[] confs = module.configurations();
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
List<String> result = new ArrayList<String>();
|
||||||
for (String key : configurations.keySet()) {
|
for (String key : configurations.keySet()) {
|
||||||
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
switch(confType){
|
switch(confType){
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
String boolValue = configurations.get(key);
|
String boolValue = configurations.get(key);
|
||||||
if( boolValue.equals("true"))
|
if( boolValue.equals("true")){
|
||||||
sb.append("--" + key + " ");
|
result.add("--" + key );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLAIN_TEXT:
|
case PLAIN_TEXT:
|
||||||
String textValue = configurations.get(key).trim();
|
String textValue = configurations.get(key).trim();
|
||||||
if( textValue.length() > 0)
|
if( textValue.length() > 0){
|
||||||
sb.append("--" + key + " \"" + configurations.get(key) + "\" ");
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
default:
|
default:
|
||||||
|
@ -64,7 +69,7 @@ public class BuildForestModule extends AbstractJavaModule {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package haflow.module.datamining;
|
||||||
|
|
||||||
|
import haflow.module.AbstractJavaModule;
|
||||||
|
import haflow.module.DataType;
|
||||||
|
import haflow.module.Module;
|
||||||
|
import haflow.module.ModuleConfiguration;
|
||||||
|
import haflow.module.ModuleConfigurationType;
|
||||||
|
import haflow.module.ModuleEndpoint;
|
||||||
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bd00", name = "CanopyCluster", category = "DataMining-Mahout", type = ModuleType.JAVA,
|
||||||
|
configurations = {
|
||||||
|
@ModuleConfiguration(key = "input", displayName = "input", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "output", displayName = "output",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "distanceMeasure", displayName = "distanceMeasure", pattern = "^(.*)$",type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "t1", displayName = "t1", pattern = "^(.*)$",type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "t2", displayName = "t2", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "t3", displayName = "t3", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "t4", displayName = "t4", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "clusterFilter", displayName = "clusterFilter", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "overwrite", displayName = "overwrite", pattern = "^(.*)$", type=ModuleConfigurationType.BOOLEAN),
|
||||||
|
@ModuleConfiguration(key = "outlierThreshold", displayName = "outlierThreshold", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT)},
|
||||||
|
inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
|
||||||
|
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),
|
||||||
|
@ModuleEndpoint(name = "error", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) })
|
||||||
|
public class CanopyClusterModule extends AbstractJavaModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validate(Map<String, String> configurations,
|
||||||
|
Map<String, String> inputs, Map<String, String> outputs) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainClass() {
|
||||||
|
return "org.apache.mahout.clustering.canopy.CanopyDriver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
for (String key : configurations.keySet()) {
|
||||||
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
|
switch(confType){
|
||||||
|
case BOOLEAN:
|
||||||
|
String boolValue = configurations.get(key);
|
||||||
|
if( boolValue.equals("true")){
|
||||||
|
result.add("--" + key );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAIN_TEXT:
|
||||||
|
String textValue = configurations.get(key).trim();
|
||||||
|
if( textValue.length() > 0){
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
System.out.println("Invalid Parameters!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
for( ModuleConfiguration conf : confs){
|
||||||
|
if( key.equals(conf.key()))
|
||||||
|
return conf.type();
|
||||||
|
}
|
||||||
|
return ModuleConfigurationType.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,9 +8,11 @@ import haflow.module.ModuleConfigurationType;
|
||||||
import haflow.module.ModuleEndpoint;
|
import haflow.module.ModuleEndpoint;
|
||||||
import haflow.module.ModuleType;
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdab", name = "Describe", category = "datamining", type = ModuleType.JAVA, configurations = {
|
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdab", name = "Describe", category = "DataMining-Mahout", type = ModuleType.JAVA, configurations = {
|
||||||
@ModuleConfiguration(key = "path", displayName = "path: Data path", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "path", displayName = "path: Data path", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
||||||
@ModuleConfiguration(key = "descriptor", displayName = "descriptor: Data descriptor", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "descriptor", displayName = "descriptor: Data descriptor", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
||||||
@ModuleConfiguration(key = "file", displayName = "file: Path to generated descriptor file", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "file", displayName = "file: Path to generated descriptor file", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ -32,23 +34,34 @@ public class DescribeModule extends AbstractJavaModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArguments(Map<String, String> configurations) {
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
Module module = DescribeModule.class.getAnnotation(Module.class);
|
Module module = this.getClass().getAnnotation(Module.class);
|
||||||
ModuleConfiguration[] confs = module.configurations();
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
List<String> result = new ArrayList<String>();
|
||||||
for (String key : configurations.keySet()) {
|
for (String key : configurations.keySet()) {
|
||||||
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
switch (confType) {
|
switch (confType) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
String boolValue = configurations.get(key);
|
String boolValue = configurations.get(key);
|
||||||
if( boolValue.equals("true"))
|
if( boolValue.equals("true")){
|
||||||
sb.append("--" + key + " ");
|
result.add("--" + key);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLAIN_TEXT:
|
case PLAIN_TEXT:
|
||||||
String textValue = configurations.get(key).trim();
|
String textValue = configurations.get(key).trim();
|
||||||
if( textValue.length() > 0)
|
if( textValue.length() > 0){
|
||||||
sb.append("--" + key + " \"" + configurations.get(key) + "\" ");
|
if(key.equals("descriptor")){
|
||||||
|
result.add("--" + key);
|
||||||
|
String[] descriptors = textValue.split(" ");
|
||||||
|
for(String desp : descriptors){
|
||||||
|
result.add(desp);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
default:
|
default:
|
||||||
|
@ -56,7 +69,7 @@ public class DescribeModule extends AbstractJavaModule {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleConfigurationType getConfigurationType(String key,
|
private ModuleConfigurationType getConfigurationType(String key,
|
||||||
|
|
|
@ -8,9 +8,11 @@ import haflow.module.ModuleConfigurationType;
|
||||||
import haflow.module.ModuleEndpoint;
|
import haflow.module.ModuleEndpoint;
|
||||||
import haflow.module.ModuleType;
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdad", name = "TestForest", category = "datamining", type = ModuleType.JAVA,
|
@Module(id = "ada600a8-aa63-968a-ca46-4356a0e0bdad", name = "TestForest", category = "DataMining-Mahout", type = ModuleType.JAVA,
|
||||||
configurations = {
|
configurations = {
|
||||||
@ModuleConfiguration(key = "input", displayName = "input : Path to job input directory.", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "input", displayName = "input : Path to job input directory.", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
@ModuleConfiguration(key = "dataset", displayName = "dataset : Dataset path",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
@ModuleConfiguration(key = "dataset", displayName = "dataset : Dataset path",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ -36,24 +38,26 @@ public class TestForestModule extends AbstractJavaModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArguments(Map<String, String> configurations) {
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
Module module= TestForestModule.class.getAnnotation(Module.class);
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
ModuleConfiguration[] confs = module.configurations();
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
List<String> result = new ArrayList<String>();
|
||||||
for (String key : configurations.keySet()) {
|
for (String key : configurations.keySet()) {
|
||||||
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
switch(confType){
|
switch(confType){
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
String boolValue = configurations.get(key);
|
String boolValue = configurations.get(key);
|
||||||
boolValue = boolValue.trim().toLowerCase();
|
if( boolValue.equals("true")){
|
||||||
if( boolValue.equals("true") || boolValue.equals("1"))
|
result.add("--" + key );
|
||||||
sb.append("--" + key + " ");
|
}
|
||||||
break;
|
break;
|
||||||
case PLAIN_TEXT:
|
case PLAIN_TEXT:
|
||||||
String textValue = configurations.get(key).trim();
|
String textValue = configurations.get(key).trim();
|
||||||
if( textValue.length() > 0)
|
if( textValue.length() > 0){
|
||||||
sb.append("--" + key + " \"" + configurations.get(key) + "\" ");
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
default:
|
default:
|
||||||
|
@ -61,7 +65,7 @@ public class TestForestModule extends AbstractJavaModule {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package haflow.module.dm.weka;
|
||||||
|
|
||||||
|
import haflow.module.AbstractJavaModule;
|
||||||
|
import haflow.module.DataType;
|
||||||
|
import haflow.module.Module;
|
||||||
|
import haflow.module.ModuleConfiguration;
|
||||||
|
import haflow.module.ModuleConfigurationType;
|
||||||
|
import haflow.module.ModuleEndpoint;
|
||||||
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Module(id = "ada600a8-aa63-968a-ca46-0156a0e0bdff", name = "Apriori", category = "DataMining-Weka", type = ModuleType.JAVA,
|
||||||
|
configurations = {
|
||||||
|
@ModuleConfiguration(key = "input", displayName = "input", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "output", displayName = "output",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT)},
|
||||||
|
inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
|
||||||
|
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),
|
||||||
|
@ModuleEndpoint(name = "error", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) })
|
||||||
|
public class WekaAssociationModule extends AbstractJavaModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validate(Map<String, String> configurations,
|
||||||
|
Map<String, String> inputs, Map<String, String> outputs) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainClass() {
|
||||||
|
return "org.apache.mahout.clustering.canopy.CanopyDriver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
for (String key : configurations.keySet()) {
|
||||||
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
|
switch(confType){
|
||||||
|
case BOOLEAN:
|
||||||
|
String boolValue = configurations.get(key);
|
||||||
|
if( boolValue.equals("true")){
|
||||||
|
result.add("--" + key );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAIN_TEXT:
|
||||||
|
String textValue = configurations.get(key).trim();
|
||||||
|
if( textValue.length() > 0){
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
System.out.println("Invalid Parameters!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
for( ModuleConfiguration conf : confs){
|
||||||
|
if( key.equals(conf.key()))
|
||||||
|
return conf.type();
|
||||||
|
}
|
||||||
|
return ModuleConfigurationType.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package haflow.module.dm.weka;
|
||||||
|
|
||||||
|
import haflow.module.AbstractJavaModule;
|
||||||
|
import haflow.module.DataType;
|
||||||
|
import haflow.module.Module;
|
||||||
|
import haflow.module.ModuleConfiguration;
|
||||||
|
import haflow.module.ModuleConfigurationType;
|
||||||
|
import haflow.module.ModuleEndpoint;
|
||||||
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Module(id = "ada600a8-aa63-968a-ca46-0056a0e0bdff", name = "KMeans", category = "DataMining-Weka", type = ModuleType.JAVA,
|
||||||
|
configurations = {
|
||||||
|
@ModuleConfiguration(key = "input", displayName = "input", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "output", displayName = "output",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT)},
|
||||||
|
inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
|
||||||
|
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),
|
||||||
|
@ModuleEndpoint(name = "error", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) })
|
||||||
|
public class WekaClassifierModule extends AbstractJavaModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validate(Map<String, String> configurations,
|
||||||
|
Map<String, String> inputs, Map<String, String> outputs) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainClass() {
|
||||||
|
return "org.apache.mahout.clustering.canopy.CanopyDriver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
for (String key : configurations.keySet()) {
|
||||||
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
|
switch(confType){
|
||||||
|
case BOOLEAN:
|
||||||
|
String boolValue = configurations.get(key);
|
||||||
|
if( boolValue.equals("true")){
|
||||||
|
result.add("--" + key );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAIN_TEXT:
|
||||||
|
String textValue = configurations.get(key).trim();
|
||||||
|
if( textValue.length() > 0){
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
System.out.println("Invalid Parameters!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
for( ModuleConfiguration conf : confs){
|
||||||
|
if( key.equals(conf.key()))
|
||||||
|
return conf.type();
|
||||||
|
}
|
||||||
|
return ModuleConfigurationType.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package haflow.module.dm.weka;
|
||||||
|
|
||||||
|
import haflow.module.AbstractJavaModule;
|
||||||
|
import haflow.module.DataType;
|
||||||
|
import haflow.module.Module;
|
||||||
|
import haflow.module.ModuleConfiguration;
|
||||||
|
import haflow.module.ModuleConfigurationType;
|
||||||
|
import haflow.module.ModuleEndpoint;
|
||||||
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Module(id = "ada600a8-aa63-968a-ca46-0256a0e0bdff", name = "ID3", category = "DataMining-Weka", type = ModuleType.JAVA,
|
||||||
|
configurations = {
|
||||||
|
@ModuleConfiguration(key = "input", displayName = "input", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "output", displayName = "output",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT)},
|
||||||
|
inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
|
||||||
|
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),
|
||||||
|
@ModuleEndpoint(name = "error", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) })
|
||||||
|
public class WekaClusterModule extends AbstractJavaModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validate(Map<String, String> configurations,
|
||||||
|
Map<String, String> inputs, Map<String, String> outputs) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainClass() {
|
||||||
|
return "org.apache.mahout.clustering.canopy.CanopyDriver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
for (String key : configurations.keySet()) {
|
||||||
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
|
switch(confType){
|
||||||
|
case BOOLEAN:
|
||||||
|
String boolValue = configurations.get(key);
|
||||||
|
if( boolValue.equals("true")){
|
||||||
|
result.add("--" + key );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAIN_TEXT:
|
||||||
|
String textValue = configurations.get(key).trim();
|
||||||
|
if( textValue.length() > 0){
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
System.out.println("Invalid Parameters!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
for( ModuleConfiguration conf : confs){
|
||||||
|
if( key.equals(conf.key()))
|
||||||
|
return conf.type();
|
||||||
|
}
|
||||||
|
return ModuleConfigurationType.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package haflow.module.statistics.R;
|
||||||
|
|
||||||
|
import haflow.module.AbstractJavaModule;
|
||||||
|
import haflow.module.DataType;
|
||||||
|
import haflow.module.Module;
|
||||||
|
import haflow.module.ModuleConfiguration;
|
||||||
|
import haflow.module.ModuleConfigurationType;
|
||||||
|
import haflow.module.ModuleEndpoint;
|
||||||
|
import haflow.module.ModuleType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Module(id = "ada600a8-aa63-968a-ca46-ff00a0e0bdff", name = "SVD", category = "Statistics-R", type = ModuleType.JAVA,
|
||||||
|
configurations = {
|
||||||
|
@ModuleConfiguration(key = "input", displayName = "input", pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT),
|
||||||
|
@ModuleConfiguration(key = "output", displayName = "output",pattern = "^(.*)$", type=ModuleConfigurationType.PLAIN_TEXT)},
|
||||||
|
inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
|
||||||
|
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),
|
||||||
|
@ModuleEndpoint(name = "error", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) })
|
||||||
|
public class RSVDModule extends AbstractJavaModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validate(Map<String, String> configurations,
|
||||||
|
Map<String, String> inputs, Map<String, String> outputs) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainClass() {
|
||||||
|
return "org.apache.mahout.clustering.canopy.CanopyDriver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getArguments(Map<String, String> configurations) {
|
||||||
|
Module module= this.getClass().getAnnotation(Module.class);
|
||||||
|
ModuleConfiguration[] confs = module.configurations();
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<String>();
|
||||||
|
for (String key : configurations.keySet()) {
|
||||||
|
ModuleConfigurationType confType = getConfigurationType(key, confs);
|
||||||
|
switch(confType){
|
||||||
|
case BOOLEAN:
|
||||||
|
String boolValue = configurations.get(key);
|
||||||
|
if( boolValue.equals("true")){
|
||||||
|
result.add("--" + key );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAIN_TEXT:
|
||||||
|
String textValue = configurations.get(key).trim();
|
||||||
|
if( textValue.length() > 0){
|
||||||
|
result.add("--" + key);
|
||||||
|
result.add(configurations.get(key));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
System.out.println("Invalid Parameters!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModuleConfigurationType getConfigurationType(String key, ModuleConfiguration[] confs){
|
||||||
|
for( ModuleConfiguration conf : confs){
|
||||||
|
if( key.equals(conf.key()))
|
||||||
|
return conf.type();
|
||||||
|
}
|
||||||
|
return ModuleConfigurationType.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,23 +16,24 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h1>基于Hadoop的大数据分析平台</h1>
|
<h1>大数据分析服务平台</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<img src="<%=basePath%>/images/logon.png" />
|
<img src="<%=basePath%>/images/logon.png" />
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<h2>登录</h2>
|
<!-- <h2>登录</h2> -->
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<span>用户名:</span><input type="text" />
|
<span style="float: left; width: 80px;">用户名:</span><input type="text" />
|
||||||
</div>
|
</div><br/>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<span>密码:</span><input type="password" />
|
<span style="float: left; width: 80px;">密码:</span><input type="password" />
|
||||||
</div>
|
</div><br/>
|
||||||
<div>
|
<div>
|
||||||
<button type="button" onclick="window.location.href='main'">登录</button>
|
<button style="width: 70px;height: 35px; font-family:Arial;font-size:14px;font-weight:bold;color:#333333;" type="button" onclick="window.location.href='main'">登录</button>
|
||||||
<button type="button" onclick="window.location.href='admin'">管理员登录</button>
|
|
||||||
|
<button style="width: 120px;height: 35px; font-family:Arial;font-size:14px;font-weight:normal;color:#333333;" type="button" onclick="window.location.href='admin'">管理员登录</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
Loading…
Reference in New Issue