aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-27 23:08:06 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-27 23:08:06 -0800
commit15f0744893304a3f2a77d36734cdc2a2706286dd (patch)
tree5dee934a55b6e1f699390a5cda56af60fee84313 /src
parent08754125ed5d152efe29926728033da3658c69fc (diff)
downloadtrackermap-server-15f0744893304a3f2a77d36734cdc2a2706286dd.tar.gz
trackermap-server-15f0744893304a3f2a77d36734cdc2a2706286dd.tar.bz2
trackermap-server-15f0744893304a3f2a77d36734cdc2a2706286dd.zip
Minor refactoring
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/BasePipelineFactory.java4
-rw-r--r--src/org/traccar/MainModule.java7
-rw-r--r--src/org/traccar/handler/events/AlertEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/BaseEventHandler.java (renamed from src/org/traccar/BaseEventHandler.java)4
-rw-r--r--src/org/traccar/handler/events/CommandResultEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/DriverEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/FuelDropEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/GeofenceEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/IgnitionEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/MaintenanceEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/MotionEventHandler.java1
-rw-r--r--src/org/traccar/handler/events/OverspeedEventHandler.java1
-rw-r--r--src/org/traccar/sms/smpp/ClientSmppSessionHandler.java1
-rw-r--r--src/org/traccar/sms/smpp/TextMessageEventHandler.java (renamed from src/org/traccar/handler/events/TextMessageEventHandler.java)2
14 files changed, 12 insertions, 15 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java
index e9f786792..1366850c0 100644
--- a/src/org/traccar/BasePipelineFactory.java
+++ b/src/org/traccar/BasePipelineFactory.java
@@ -58,7 +58,6 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> {
private boolean eventsEnabled;
private int timeout;
- private CommandResultEventHandler commandResultEventHandler;
private OverspeedEventHandler overspeedEventHandler;
private FuelDropEventHandler fuelDropEventHandler;
private MotionEventHandler motionEventHandler;
@@ -77,7 +76,6 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> {
}
if (eventsEnabled) {
- commandResultEventHandler = new CommandResultEventHandler();
overspeedEventHandler = Context.getOverspeedEventHandler();
fuelDropEventHandler = new FuelDropEventHandler();
motionEventHandler = Context.getMotionEventHandler();
@@ -162,7 +160,7 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> {
if (eventsEnabled) {
addHandlers(
pipeline,
- commandResultEventHandler,
+ Main.getInjector().getInstance(CommandResultEventHandler.class),
overspeedEventHandler,
fuelDropEventHandler,
motionEventHandler,
diff --git a/src/org/traccar/MainModule.java b/src/org/traccar/MainModule.java
index f784a1a71..cfd280c9f 100644
--- a/src/org/traccar/MainModule.java
+++ b/src/org/traccar/MainModule.java
@@ -54,6 +54,7 @@ import org.traccar.handler.GeolocationHandler;
import org.traccar.handler.HemisphereHandler;
import org.traccar.handler.MotionHandler;
import org.traccar.handler.RemoteAddressHandler;
+import org.traccar.handler.events.CommandResultEventHandler;
import org.traccar.reports.model.TripsConfig;
import javax.annotation.Nullable;
@@ -264,6 +265,12 @@ public class MainModule extends AbstractModule {
return null;
}
+ @Singleton
+ @Provides
+ public static CommandResultEventHandler provideCommandResultEventHandler() {
+ return new CommandResultEventHandler();
+ }
+
@Override
protected void configure() {
binder().requireExplicitBindings();
diff --git a/src/org/traccar/handler/events/AlertEventHandler.java b/src/org/traccar/handler/events/AlertEventHandler.java
index c6d61538b..09a6e2b6b 100644
--- a/src/org/traccar/handler/events/AlertEventHandler.java
+++ b/src/org/traccar/handler/events/AlertEventHandler.java
@@ -19,7 +19,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Position;
diff --git a/src/org/traccar/BaseEventHandler.java b/src/org/traccar/handler/events/BaseEventHandler.java
index 50bbbefa2..41f677f6c 100644
--- a/src/org/traccar/BaseEventHandler.java
+++ b/src/org/traccar/handler/events/BaseEventHandler.java
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.traccar;
+package org.traccar.handler.events;
import java.util.Map;
+import org.traccar.BaseDataHandler;
+import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Position;
diff --git a/src/org/traccar/handler/events/CommandResultEventHandler.java b/src/org/traccar/handler/events/CommandResultEventHandler.java
index 3acddc1b9..cfe676653 100644
--- a/src/org/traccar/handler/events/CommandResultEventHandler.java
+++ b/src/org/traccar/handler/events/CommandResultEventHandler.java
@@ -19,7 +19,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.model.Event;
import org.traccar.model.Position;
diff --git a/src/org/traccar/handler/events/DriverEventHandler.java b/src/org/traccar/handler/events/DriverEventHandler.java
index ef73d6d2d..dbb980c89 100644
--- a/src/org/traccar/handler/events/DriverEventHandler.java
+++ b/src/org/traccar/handler/events/DriverEventHandler.java
@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Position;
diff --git a/src/org/traccar/handler/events/FuelDropEventHandler.java b/src/org/traccar/handler/events/FuelDropEventHandler.java
index 7de3930ca..f13b8c7bb 100644
--- a/src/org/traccar/handler/events/FuelDropEventHandler.java
+++ b/src/org/traccar/handler/events/FuelDropEventHandler.java
@@ -16,7 +16,6 @@
package org.traccar.handler.events;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Device;
import org.traccar.model.Event;
diff --git a/src/org/traccar/handler/events/GeofenceEventHandler.java b/src/org/traccar/handler/events/GeofenceEventHandler.java
index 3bddfe7a4..878331c84 100644
--- a/src/org/traccar/handler/events/GeofenceEventHandler.java
+++ b/src/org/traccar/handler/events/GeofenceEventHandler.java
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.database.GeofenceManager;
import org.traccar.model.Calendar;
diff --git a/src/org/traccar/handler/events/IgnitionEventHandler.java b/src/org/traccar/handler/events/IgnitionEventHandler.java
index 4930ef901..7a83f45b7 100644
--- a/src/org/traccar/handler/events/IgnitionEventHandler.java
+++ b/src/org/traccar/handler/events/IgnitionEventHandler.java
@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Device;
import org.traccar.model.Event;
diff --git a/src/org/traccar/handler/events/MaintenanceEventHandler.java b/src/org/traccar/handler/events/MaintenanceEventHandler.java
index e7f641431..80d9c0d91 100644
--- a/src/org/traccar/handler/events/MaintenanceEventHandler.java
+++ b/src/org/traccar/handler/events/MaintenanceEventHandler.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Maintenance;
diff --git a/src/org/traccar/handler/events/MotionEventHandler.java b/src/org/traccar/handler/events/MotionEventHandler.java
index c03b394e5..5e88d34b5 100644
--- a/src/org/traccar/handler/events/MotionEventHandler.java
+++ b/src/org/traccar/handler/events/MotionEventHandler.java
@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Device;
import org.traccar.model.DeviceState;
diff --git a/src/org/traccar/handler/events/OverspeedEventHandler.java b/src/org/traccar/handler/events/OverspeedEventHandler.java
index 567758de5..34344fb47 100644
--- a/src/org/traccar/handler/events/OverspeedEventHandler.java
+++ b/src/org/traccar/handler/events/OverspeedEventHandler.java
@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.Map;
import io.netty.channel.ChannelHandler;
-import org.traccar.BaseEventHandler;
import org.traccar.Context;
import org.traccar.model.Device;
import org.traccar.model.DeviceState;
diff --git a/src/org/traccar/sms/smpp/ClientSmppSessionHandler.java b/src/org/traccar/sms/smpp/ClientSmppSessionHandler.java
index 4fdbbd212..6b9de3107 100644
--- a/src/org/traccar/sms/smpp/ClientSmppSessionHandler.java
+++ b/src/org/traccar/sms/smpp/ClientSmppSessionHandler.java
@@ -18,7 +18,6 @@ package org.traccar.sms.smpp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.traccar.handler.events.TextMessageEventHandler;
import com.cloudhopper.commons.charset.CharsetUtil;
import com.cloudhopper.smpp.SmppConstants;
diff --git a/src/org/traccar/handler/events/TextMessageEventHandler.java b/src/org/traccar/sms/smpp/TextMessageEventHandler.java
index b5e2c72b0..37c29972d 100644
--- a/src/org/traccar/handler/events/TextMessageEventHandler.java
+++ b/src/org/traccar/sms/smpp/TextMessageEventHandler.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.traccar.handler.events;
+package org.traccar.sms.smpp;
import org.traccar.Context;
import org.traccar.model.Device;