CLOUDSTACK-6530: Make more networking entities implement Displayable interface.

This commit is contained in:
Nitin Mehta 2014-05-09 10:12:56 -07:00
parent ebc2b8b94d
commit 1e300b0d12
22 changed files with 137 additions and 28 deletions

View File

@ -19,6 +19,7 @@ package com.cloud.network;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -35,7 +36,7 @@ import com.cloud.utils.net.Ip;
* - DomainId = domain of the account owner.
* - Allocated = time it was allocated.
*/
public interface IpAddress extends ControlledEntity, Identity, InternalIdentity {
public interface IpAddress extends ControlledEntity, Identity, InternalIdentity, Displayable {
enum State {
Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
Allocated, // The IP address is in used.
@ -85,6 +86,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
Long getNetworkId();
@Override
boolean isDisplay();
}

View File

@ -17,10 +17,11 @@
package com.cloud.network;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Identity {
public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Identity, Displayable {
enum State {
Added, Running, Removed
}
@ -39,5 +40,6 @@ public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Ide
State getState();
@Override
boolean isDisplay();
}

View File

@ -19,9 +19,10 @@ package com.cloud.network;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.InternalIdentity;
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity {
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable {
enum State {
Pending, Connected, Disconnected, Error,
}
@ -43,5 +44,6 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdenti
public boolean isPassive();
@Override
boolean isDisplay();
}

View File

@ -19,16 +19,18 @@ package com.cloud.network;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface Site2SiteVpnGateway extends ControlledEntity, Identity, InternalIdentity {
public interface Site2SiteVpnGateway extends ControlledEntity, Identity, InternalIdentity, Displayable {
public long getAddrId();
public long getVpcId();
public Date getRemoved();
@Override
boolean isDisplay();
}

View File

@ -20,9 +20,10 @@ package com.cloud.network.as;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.InternalIdentity;
public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity, Displayable {
String State_New = "new";
String State_Revoke = "revoke";
@ -53,6 +54,7 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
String getUuid();
@Override
boolean isDisplay();
}

View File

@ -20,6 +20,7 @@ package com.cloud.network.as;
import java.util.List;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.utils.Pair;
@ -27,7 +28,7 @@ import com.cloud.utils.Pair;
/**
* AutoScaleVmProfile
*/
public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity {
public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity, Displayable {
@Override
public long getId();
@ -48,6 +49,7 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity {
public long getAutoScaleUserId();
@Override
boolean isDisplay();
}

View File

@ -16,12 +16,13 @@
// under the License.
package com.cloud.network.rules;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
/**
*/
public interface HealthCheckPolicy extends InternalIdentity, Identity {
public interface HealthCheckPolicy extends InternalIdentity, Identity, Displayable {
public long getLoadBalancerId();
@ -39,9 +40,7 @@ public interface HealthCheckPolicy extends InternalIdentity, Identity {
public boolean isRevoke();
/**
* @return
*/
@Override
boolean isDisplay();
}

View File

@ -18,6 +18,7 @@ package com.cloud.network.rules;
import java.util.List;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -25,7 +26,7 @@ import com.cloud.utils.Pair;
/**
*/
public interface StickinessPolicy extends InternalIdentity, Identity {
public interface StickinessPolicy extends InternalIdentity, Identity, Displayable {
public long getLoadBalancerId();
@ -39,9 +40,7 @@ public interface StickinessPolicy extends InternalIdentity, Identity {
public List<Pair<String, String>> getParams(); /* get params in Map <string,String> format */
/**
* @return
*/
@Override
boolean isDisplay();
}

View File

@ -17,9 +17,10 @@
package com.cloud.network.vpc;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.InternalIdentity;
public interface NetworkACL extends InternalIdentity {
public interface NetworkACL extends InternalIdentity, Displayable {
public static final long DEFAULT_DENY = 1;
public static final long DEFAULT_ALLOW = 2;
@ -34,5 +35,6 @@ public interface NetworkACL extends InternalIdentity {
String getName();
@Override
boolean isDisplay();
}

View File

@ -18,9 +18,10 @@ package com.cloud.network.vpc;
import java.util.List;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.InternalIdentity;
public interface NetworkACLItem extends InternalIdentity {
public interface NetworkACLItem extends InternalIdentity, Displayable {
String getUuid();
@ -73,6 +74,7 @@ public interface NetworkACLItem extends InternalIdentity {
*/
TrafficType getTrafficType();
@Override
boolean isDisplay();
}

View File

@ -202,10 +202,19 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
}
}
@Deprecated
public Boolean getDisplayIp() {
return display;
}
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
@Override
public long getEntityOwnerId() {
Account caller = CallContext.current().getCallingAccount();

View File

@ -184,10 +184,19 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
return ApiCommandJobType.AutoScaleVmGroup;
}
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
@Override
public void create() throws ResourceAllocationException {
AutoScaleVmGroup result = _autoScaleService.createAutoScaleVmGroup(this);

View File

@ -131,10 +131,19 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
return templateId;
}
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
public Map getCounterParamList() {
return counterParamList;
}

View File

@ -97,10 +97,19 @@ public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd {
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
public Long getLbRuleId() {
return lbRuleId;
}

View File

@ -82,10 +82,19 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
public Long getLbRuleId() {
return lbRuleId;
}

View File

@ -124,8 +124,13 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
public String getAlgorithm() {
@ -309,7 +314,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
try {
LoadBalancer result =
_lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(),
getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), getDisplay());
getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), isDisplay());
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {

View File

@ -103,10 +103,20 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
public String getProtocol() {
String p = protocol.trim();
// Deal with ICMP(protocol number 1) specially because it need to be paired with icmp type and code

View File

@ -77,8 +77,13 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
return vpcId;
}
public Boolean getDisplay() {
return display;
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
// ///////////////////////////////////////////////////
@ -92,7 +97,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
@Override
public void create() {
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), getDisplay());
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), isDisplay());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
}

View File

@ -88,8 +88,14 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
public Long getId() {
@ -172,7 +178,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
CallContext.current().setEventDetails("Rule Id: " + getId());
NetworkACLItem aclItem =
_networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(),
getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.getDisplay());
getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.isDisplay());
if (aclItem == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
}

View File

@ -145,7 +145,7 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
@Override
public void create() {
try {
RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), getDisplay());
RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), isDisplay());
if (vpn != null) {
setEntityId(vpn.getServerAddressId());
// find uuid for server ip address
@ -198,7 +198,11 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
return ip;
}
public Boolean getDisplay() {
return display;
@Override
public boolean isDisplay() {
if(display == null)
return true;
else
return display;
}
}

View File

@ -87,10 +87,20 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
return passive;
}
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -60,10 +60,20 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd {
return vpcId;
}
@Deprecated
public Boolean getDisplay() {
return display;
}
@Override
public boolean isDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////