1. Miguel Ángel García
  2. distribot

Commits

Miguel Ángel García  committed fee1369

skeleton for the executor service

  • Participants
  • Parent commits 72f767a
  • Branches master

Comments (0)

Files changed (6)

File distribot-comms/pom.xml

View file
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+                <netbeans.hint.license>gpl30</netbeans.hint.license>
 		<resource.encoding>UTF-8</resource.encoding>
 		<jdk.version>1.6</jdk.version>
 	</properties>

File distribot-comms/src/main/resources/distribot.ice

View file
+/*
+ * Copyright (C) 2012 Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
 module Distribot {
-	struct JobDefinition {
-		string name;
-	};
+    struct JobDefinition {
+        string name;
+    };
 
-	interface Core {
-		bool check ();
-	};
+    interface Core {
+        bool check ();
+    };
+
+    interface Executor {
+        bool check ();
+        void execute ( JobDefinition jobdef);
+    };
 };

File distribot-executor/pom.xml

View file
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.magmax.distribot</groupId>
-		<artifactId>distribot</artifactId>
-		<version>1.0-SNAPSHOT</version>
-	</parent>
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.magmax.distribot</groupId>
+        <artifactId>distribot</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
 
-	<groupId>org.magmax.distribot</groupId>
-	<artifactId>distribot-executor</artifactId>
-	<version>1.0-SNAPSHOT</version>
-	<packaging>jar</packaging>
+    <groupId>org.magmax.distribot</groupId>
+    <artifactId>distribot-executor</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
 
-	<name>distribot-executor</name>
-	<url>http://maven.apache.org</url>
+    <name>distribot-executor</name>
+    <url>http://maven.apache.org</url>
 
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<resource.encoding>UTF-8</resource.encoding>
-		<jdk.version>1.6</jdk.version>
-	</properties>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <netbeans.hint.license>gpl30</netbeans.hint.license>
+        <resource.encoding>UTF-8</resource.encoding>
+        <jdk.version>1.6</jdk.version>
+    </properties>
 	
-	<dependencies>
-		<dependency>
-			<groupId>org.magmax.distribot</groupId>
-			<artifactId>distribot-comms</artifactId>
-			<version>1.0-SNAPSHOT</version>
-		</dependency>
-
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.10</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>org.magmax.distribot</groupId>
+            <artifactId>distribot-comms</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
 
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.10</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <mainClass>org.magmax.distribot.executor.Main.class</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

File distribot-executor/src/main/java/org/magmax/distribot/executor/Executor.java

View file
+/*
+ * Copyright (C) 2012 Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.magmax.distribot.executor;
+
+import Distribot.JobDefinition;
+import Ice.Current;
+
+/**
+ *
+ * @author Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ */
+public class Executor extends Distribot._ExecutorDisp{
+
+    public boolean check(Current crnt) {
+        return true;
+    }
+
+    public void execute(JobDefinition jd, Current crnt) {
+        // TODO
+    }
+    
+}

File distribot-executor/src/main/java/org/magmax/distribot/executor/Main.java

View file
+/*
+ * Copyright (C) 2012 Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.magmax.distribot.executor;
+
+/**
+ *
+ * @author Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ */
+public class Main {
+
+    public static void main(String[] args) {
+        int status = 0;
+        Ice.Communicator ic = null;
+        try {
+            ic = Ice.Util.initialize(args);
+            Ice.ObjectAdapter adapter =
+                    ic.createObjectAdapterWithEndpoints("DistribotExecutorAdapter", "default -p 10000");
+            Ice.Object object = new Executor();
+            adapter.add(object, ic.stringToIdentity("DistribotExecutor"));
+            adapter.activate();
+            ic.waitForShutdown();
+        } catch (Ice.LocalException e) {
+            e.printStackTrace();
+            status = 1;
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+            status = 1;
+        }
+        if (ic != null) {
+            try {
+                ic.destroy();
+            } catch (Exception e) {
+                System.err.println(e.getMessage());
+                status = 1;
+            }
+        }
+        System.exit(status);
+    }
+}

File pom.xml

View file
 	
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+                <netbeans.hint.license>gpl30</netbeans.hint.license>
 		<resource.encoding>UTF-8</resource.encoding>
 		<jdk.version>1.6</jdk.version>
 	</properties>