Commit f05fc5b5 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added constructor for ServerSetting, server configuration (primary/secondary)...

Added constructor for ServerSetting, server configuration (primary/secondary) aren't foreignkeys anymore
parent 0a7f15e9
package com.frostnerd.dnsserver.database.entities.main;
import com.frostnerd.dnsserver.database.serializers.IPPortSerializer;
import com.frostnerd.dnsserver.server.DNSServer;
import com.frostnerd.utils.database.orm.Entity;
import com.frostnerd.utils.database.orm.annotations.Ignore;
import com.frostnerd.utils.database.orm.annotations.Named;
import com.frostnerd.utils.database.orm.annotations.NotNull;
import com.frostnerd.utils.database.orm.annotations.RowID;
import com.frostnerd.utils.database.orm.annotations.Serialized;
import com.frostnerd.utils.database.orm.annotations.Table;
......@@ -33,8 +35,10 @@ public class DNSServerSetting extends Entity implements Serializable{
private int serverTimeout;
@Named(name = "UpstreamPrimary")
@Serialized(using = IPPortSerializer.class)
private IPPortPair upstreamPrimary;
@Named(name = "UpstreamSecondary")
@Serialized(using = IPPortSerializer.class)
private IPPortPair upstreamSecondary;
@Named(name = "LogQueries")
private boolean logQueries;
......@@ -45,6 +49,22 @@ public class DNSServerSetting extends Entity implements Serializable{
@Named(name = "ResolveLocal")
private boolean resolveLocal;
public DNSServerSetting(){
public DNSServerSetting(String name, int port, int serverTimeout, IPPortPair upstreamPrimary, IPPortPair upstreamSecondary, boolean logQueries, boolean logQueryResponses, boolean upstreamUDP, boolean resolveLocal){ = name;
this.port = port;
this.serverTimeout = serverTimeout;
this.upstreamPrimary = upstreamPrimary;
this.upstreamSecondary = upstreamSecondary;
this.logQueries = logQueries;
this.logQueryResponses = logQueryResponses;
this.upstreamUDP = upstreamUDP;
this.resolveLocal = resolveLocal;
private DNSServer.ErrorListener errorListener;
package com.frostnerd.dnsserver.database.serializers;
import com.frostnerd.dnsserver.database.entities.main.IPPortPair;
import com.frostnerd.utils.database.orm.Serializer;
* Copyright Daniel Wolf 2017
* All rights reserved.
* Code may NOT be used without proper permission, neither in binary nor in source form.
* All redistributions of this software in source code must retain this copyright header
* All redistributions of this software in binary form must visibly inform users about usage of this software
* <p>
public class IPPortSerializer extends Serializer<IPPortPair> {
public String serialize(IPPortPair ipPortPair) {
return ipPortPair.toString();
public IPPortPair deserialize(String text) {
return IPPortPair.wrap(text);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment