1. Miguel Ángel García
  2. distribot

Commits

Miguel Ángel García  committed 500443c

added the core module

  • Participants
  • Parent commits 345b72a
  • Branches master

Comments (0)

Files changed (6)

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

View file
  • Ignore whitespace
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 module Distribot {
-    struct JobDefinition {
+    class JobDefinition {
         string id;
         string name;
     };

File distribot-core/pom.xml

View file
  • Ignore whitespace
+
+<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>
+
+    <groupId>org.magmax.distribot</groupId>
+    <artifactId>distribot-core</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <name>distribot-core</name>
+    <url>http://maven.apache.org</url>
+
+    <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>com.zeroc</groupId>
+			<artifactId>freeze</artifactId>
+			<version>3.4.2</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.worker.Main.class</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

File distribot-core/src/main/java/org/magmax/distribot/core/CoreI.java

View file
  • Ignore whitespace
+/*
+ * 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.core;
+
+import Distribot.JobDefinition;
+import Distribot.TaskDefinition;
+import Ice.Current;
+
+/**
+ *
+ * @author Miguel Angel Garcia <miguelangel.garcia@gmail.com>
+ */
+public class CoreI extends Distribot._WorkerDisp{
+
+    public boolean check(Current crnt) {
+        return true;
+    }
+
+    public void execute(TaskDefinition td, Current crnt) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+}

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

View file
  • Ignore whitespace
+/*
+ * 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.core;
+
+import Distribot.Core;
+
+/**
+ *
+ * @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("DistribotCoreAdapter", "default -p 10000");
+            Ice.Object object = new CoreI();
+            adapter.add(object, ic.stringToIdentity("DistribotCore"));
+            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 distribot-worker/src/main/java/org/magmax/distribot/worker/Main.java

View file
  • Ignore whitespace
         try {
             ic = Ice.Util.initialize(args);
             Ice.ObjectAdapter adapter =
-                    ic.createObjectAdapterWithEndpoints("DistribotExecutorAdapter", "default -p 10000");
+                    ic.createObjectAdapterWithEndpoints("DistribotWorkerAdapter", "default -p 10000");
             Ice.Object object = new Worker();
-            adapter.add(object, ic.stringToIdentity("DistribotExecutor"));
+            adapter.add(object, ic.stringToIdentity("DistribotWorker"));
             adapter.activate();
             ic.waitForShutdown();
         } catch (Ice.LocalException e) {

File pom.xml

View file
  • Ignore whitespace
 	
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-                <netbeans.hint.license>gpl30</netbeans.hint.license>
+		<netbeans.hint.license>gpl30</netbeans.hint.license>
 		<resource.encoding>UTF-8</resource.encoding>
 		<jdk.version>1.6</jdk.version>
 	</properties>
 
 	<modules>
 		<module>distribot-comms</module>
-                <module>distribot-executor</module>
-                <module>distribot-worker</module>
+		<module>distribot-core</module>
+		<module>distribot-executor</module>
+		<module>distribot-worker</module>
 	</modules>
 
 	<dependencies>