From 5d0bacea7ebdd169d55c7da0f7d6f3ae1ecf372f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 30 Dec 2020 11:18:41 -0800 Subject: Add lookup context classes --- src/main/java/org/traccar/config/Keys.java | 6 +-- .../java/org/traccar/config/LookupContext.java | 51 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/traccar/config/LookupContext.java diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 52f1894cd..5f8b36c6d 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -19,6 +19,9 @@ import java.util.Collections; public final class Keys { + private Keys() { + } + /** * Network interface for a the protocol. If not specified, server will bind all interfaces. */ @@ -1204,7 +1207,4 @@ public final class Keys { Collections.singletonList(KeyType.GLOBAL), "time,position,speed,course,accuracy,result"); - private Keys() { - } - } diff --git a/src/main/java/org/traccar/config/LookupContext.java b/src/main/java/org/traccar/config/LookupContext.java new file mode 100644 index 000000000..e73e5a35e --- /dev/null +++ b/src/main/java/org/traccar/config/LookupContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.config; + +public interface LookupContext { + + class Global implements LookupContext { + } + + class User implements LookupContext { + + private final long userId; + + public long getUserId() { + return userId; + } + + public User(long userId) { + this.userId = userId; + } + + } + + class Device implements LookupContext { + + private final long deviceId; + + public long getDeviceId() { + return deviceId; + } + + public Device(long deviceId) { + this.deviceId = deviceId; + } + + } + +} -- cgit v1.2.3