Include a type field in all json configuration objects

This commit is contained in:
Hugo Trippaers 2014-07-29 17:56:51 +02:00 committed by wilderrodrigues
parent 0db157e58f
commit 183b248c4e
3 changed files with 109 additions and 2 deletions

View File

@ -0,0 +1,14 @@
package com.cloud.agent.resource.virtualnetwork.model;
public abstract class ConfigBase {
private String type = "unknown";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -19,7 +19,7 @@
package com.cloud.agent.resource.virtualnetwork.model;
public class GuestNetwork {
public class GuestNetwork extends ConfigBase {
private boolean add;
private String macAddress;
private String device;
@ -32,11 +32,12 @@ public class GuestNetwork {
public GuestNetwork() {
// Empty constructor for (de)serialization
setType("guestnetwork");
}
public GuestNetwork(boolean add, String macAddress, String device, String routerGuestIp, String routerGuestNetmask, String routerGuestGateway, String cidr, String dns,
String domainName) {
super();
setType("guestnetwork");
this.add = add;
this.macAddress = macAddress;
this.device = device;

View File

@ -0,0 +1,92 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 com.cloud.agent.resource.virtualnetwork.model;
public class NetworkACL extends ConfigBase {
private String device;
private String macAddress;
private boolean privateGatewayAcl;
private String nicIp;
private String nicNetmask;
private String rule;
public NetworkACL() {
setType("networkacl");
}
public NetworkACL(String device, String macAddress, boolean privateGatewayAcl, String nicIp, String nicNetmask, String rule) {
setType("networkacl");
this.device = device;
this.macAddress = macAddress;
this.privateGatewayAcl = privateGatewayAcl;
this.nicIp = nicIp;
this.nicNetmask = nicNetmask;
this.rule = rule; //FIXME Split this in o
}
public String getDevice() {
return device;
}
public void setDevice(String device) {
this.device = device;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
public boolean isPrivateGatewayAcl() {
return privateGatewayAcl;
}
public void setPrivateGatewayAcl(boolean privateGatewayAcl) {
this.privateGatewayAcl = privateGatewayAcl;
}
public String getNicIp() {
return nicIp;
}
public void setNicIp(String nicIp) {
this.nicIp = nicIp;
}
public String getNicNetmask() {
return nicNetmask;
}
public void setNicNetmask(String nicNetmask) {
this.nicNetmask = nicNetmask;
}
public String getRule() {
return rule;
}
public void setRule(String rule) {
this.rule = rule;
}
}