// Path: server/src/main/java/io/pne/veth/server/handlers/IJsonHandler.java
// public interface IJsonHandler<I,O> {
// 
//     O handle(I aRequest);
// 
//     Class<I> getRequestClass();
// }
// 
// Path: server/src/main/java/io/pne/veth/server/handlers/dao/IEndpointDao.java
// public interface IEndpointDao {
// 
//     void addEndpoint(TEndpoint aEndpoint);
// 
//     TEndpoint findEndPoint(String aEndpointId);
// 
//     void removeEndpoint(String aEndpointId);
// }
// 
// Path: server/src/main/java/io/pne/veth/server/handlers/dao/TEndpoint.java
// public class TEndpoint {
// 
//     public final String id;
//     public final String ipAddress;
//     public final String macAddress;
//     public final String device;
// 
//     public TEndpoint(String id, String ipAddress, String macAddress, String aDevice) {
//         this.id = id;
//         this.ipAddress = ipAddress;
//         this.macAddress = macAddress;
//         device = aDevice;
//     }
// }


import io.pne.veth.server.handlers.IJsonHandler;
import io.pne.veth.server.handlers.dao.IEndpointDao;
import io.pne.veth.server.handlers.dao.TEndpoint;
import io.pne.veth.server.handlers.model.*;
package io.pne.veth.server.handlers.location.networkdriver;


public class CreateEndPointHandler implements IJsonHandler<CreateEndpointRequest, CreateEndpointResponse> {

    final IEndpointDao endpointDao;

    public CreateEndPointHandler(IEndpointDao endpointDao) {
        this.endpointDao = endpointDao;
    }

    @Override
    public CreateEndpointResponse handle(CreateEndpointRequest aRequest) {
        /*
            "Interface": {
                "Address"    : "",
                "AddressIPv6": "",
                "MacAddress" : ""
            }
         */

        final EndpointInterface iface = aRequest.endpointInterface;
        if(iface == null) {
            throw new IllegalStateException("No section 'Interface': "+aRequest);
        }
// Path: server/src/main/java/io/pne/veth/server/handlers/IJsonHandler.java
// public interface IJsonHandler<I,O> {
// 
//     O handle(I aRequest);
// 
//     Class<I> getRequestClass();
// }
// 
// Path: server/src/main/java/io/pne/veth/server/handlers/dao/IEndpointDao.java
// public interface IEndpointDao {
// 
//     void addEndpoint(TEndpoint aEndpoint);
// 
//     TEndpoint findEndPoint(String aEndpointId);
// 
//     void removeEndpoint(String aEndpointId);
// }
// 
// Path: server/src/main/java/io/pne/veth/server/handlers/dao/TEndpoint.java
// public class TEndpoint {
// 
//     public final String id;
//     public final String ipAddress;
//     public final String macAddress;
//     public final String device;
// 
//     public TEndpoint(String id, String ipAddress, String macAddress, String aDevice) {
//         this.id = id;
//         this.ipAddress = ipAddress;
//         this.macAddress = macAddress;
//         device = aDevice;
//     }
// }


// Path: server/src/main/java/io/pne/veth/server/handlers/location/networkdriver/CreateEndPointHandler.java
import io.pne.veth.server.handlers.IJsonHandler;
import io.pne.veth.server.handlers.dao.IEndpointDao;
import io.pne.veth.server.handlers.dao.TEndpoint;
import io.pne.veth.server.handlers.model.*;

package io.pne.veth.server.handlers.location.networkdriver;


public class CreateEndPointHandler implements IJsonHandler<CreateEndpointRequest, CreateEndpointResponse> {

    final IEndpointDao endpointDao;

    public CreateEndPointHandler(IEndpointDao endpointDao) {
        this.endpointDao = endpointDao;
    }

    @Override
    public CreateEndpointResponse handle(CreateEndpointRequest aRequest) {
        /*
            "Interface": {
                "Address"    : "",
                "AddressIPv6": "",
                "MacAddress" : ""
            }
         */

        final EndpointInterface iface = aRequest.endpointInterface;
        if(iface == null) {
            throw new IllegalStateException("No section 'Interface': "+aRequest);
        }
        endpointDao.addEndpoint(new TEndpoint(