From 54c54703d66e8991472c1f7476ba4acb424b27d9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 30 Jun 2015 09:41:41 +1200 Subject: Move commands related classes --- src/org/traccar/http/CommandsServlet.java | 4 +-- src/org/traccar/http/commands/CommandType.java | 28 ---------------- src/org/traccar/http/commands/Duration.java | 38 ---------------------- .../http/commands/FixPositioningCommand.java | 25 -------------- src/org/traccar/http/commands/GpsCommand.java | 27 --------------- .../traccar/http/commands/NoParameterCommand.java | 11 ------- 6 files changed, 2 insertions(+), 131 deletions(-) delete mode 100644 src/org/traccar/http/commands/CommandType.java delete mode 100644 src/org/traccar/http/commands/Duration.java delete mode 100644 src/org/traccar/http/commands/FixPositioningCommand.java delete mode 100644 src/org/traccar/http/commands/GpsCommand.java delete mode 100644 src/org/traccar/http/commands/NoParameterCommand.java (limited to 'src/org/traccar/http') diff --git a/src/org/traccar/http/CommandsServlet.java b/src/org/traccar/http/CommandsServlet.java index 3e3ab9086..f68a7a74e 100644 --- a/src/org/traccar/http/CommandsServlet.java +++ b/src/org/traccar/http/CommandsServlet.java @@ -2,8 +2,8 @@ package org.traccar.http; import org.traccar.Context; import org.traccar.database.ActiveDevice; -import org.traccar.http.commands.CommandType; -import org.traccar.http.commands.GpsCommand; +import org.traccar.command.CommandType; +import org.traccar.command.GpsCommand; import javax.json.Json; import javax.json.JsonObject; diff --git a/src/org/traccar/http/commands/CommandType.java b/src/org/traccar/http/commands/CommandType.java deleted file mode 100644 index 12610dbcc..000000000 --- a/src/org/traccar/http/commands/CommandType.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.traccar.http.commands; - -import org.traccar.model.Factory; - -public enum CommandType implements Factory { - STOP_POSITIONING(NoParameterCommand.class), - FIX_POSITIONING(FixPositioningCommand.class), - STOP_ENGINE(NoParameterCommand.class), - RESUME_ENGINE(NoParameterCommand.class); - - - private Class commandClass; - - CommandType(Class commandClass) { - this.commandClass = commandClass; - } - - @Override - public Object create() { - try { - return commandClass.newInstance(); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/org/traccar/http/commands/Duration.java b/src/org/traccar/http/commands/Duration.java deleted file mode 100644 index e50f0c23e..000000000 --- a/src/org/traccar/http/commands/Duration.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.traccar.http.commands; - -public class Duration { - - public enum TimeUnit { - SECOND("s"), MINUTE("m"), HOUR("h"); - - private final String commandFormat; - - TimeUnit(String commandFormat) { - this.commandFormat = commandFormat; - } - - public String getCommandFormat() { - return commandFormat; - } - } - - - private TimeUnit unit; - private int value; - - public TimeUnit getUnit() { - return unit; - } - - public void setUnit(TimeUnit unit) { - this.unit = unit; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } -} diff --git a/src/org/traccar/http/commands/FixPositioningCommand.java b/src/org/traccar/http/commands/FixPositioningCommand.java deleted file mode 100644 index f3b25acbc..000000000 --- a/src/org/traccar/http/commands/FixPositioningCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.traccar.http.commands; - -import java.util.HashMap; -import java.util.Map; - -public class FixPositioningCommand extends GpsCommand { - public static final String FREQUENCY = "frequency"; - - private Duration data; - - @Override - public Map getReplacements() { - Map replacements = new HashMap(); - replacements.put(FREQUENCY, data); - return replacements; - } - - public Duration getData() { - return data; - } - - public void setData(Duration data) { - this.data = data; - } -} diff --git a/src/org/traccar/http/commands/GpsCommand.java b/src/org/traccar/http/commands/GpsCommand.java deleted file mode 100644 index 604bf832f..000000000 --- a/src/org/traccar/http/commands/GpsCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.traccar.http.commands; - -import java.util.Map; - -public abstract class GpsCommand { - public static final String UNIQUE_ID = "uniqueId"; - private String uniqueId; - private CommandType type; - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public CommandType getType() { - return type; - } - - public void setType(CommandType type) { - this.type = type; - } - - public abstract Map getReplacements(); -} diff --git a/src/org/traccar/http/commands/NoParameterCommand.java b/src/org/traccar/http/commands/NoParameterCommand.java deleted file mode 100644 index fee3c8097..000000000 --- a/src/org/traccar/http/commands/NoParameterCommand.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.traccar.http.commands; - -import java.util.HashMap; -import java.util.Map; - -public class NoParameterCommand extends GpsCommand { - @Override - public Map getReplacements() { - return new HashMap(); - } -} -- cgit v1.2.3