You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/06 20:14:31 UTC
[1/14] git commit: api_refactor: swift,
ldap and vlan apis to admin pkg
Updated Branches:
refs/heads/api_refactoring b0ce8fd4f -> 780eb9583
api_refactor: swift, ldap and vlan apis to admin pkg
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/780eb958
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/780eb958
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/780eb958
Branch: refs/heads/api_refactoring
Commit: 780eb95830fd64424277d39d3934cfed69b66754
Parents: 2830590
Author: Rohit Yadav <bh...@apache.org>
Authored: Thu Dec 6 11:13:46 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Thu Dec 6 11:13:46 2012 -0800
----------------------------------------------------------------------
api/src/com/cloud/api/commands/AddSwiftCmd.java | 106 ---------
.../cloud/api/commands/CreateVlanIpRangeCmd.java | 180 ---------------
.../cloud/api/commands/DeleteVlanIpRangeCmd.java | 76 ------
api/src/com/cloud/api/commands/LDAPConfigCmd.java | 149 ------------
api/src/com/cloud/api/commands/LDAPRemoveCmd.java | 71 ------
api/src/com/cloud/api/commands/ListSwiftsCmd.java | 84 -------
.../cloud/api/commands/ListVlanIpRangesCmd.java | 149 ------------
.../cloud/configuration/ConfigurationService.java | 8 +-
api/src/com/cloud/resource/ResourceService.java | 4 +-
api/src/com/cloud/server/ManagementService.java | 2 +-
.../api/admin/ldap/command/LDAPConfigCmd.java | 149 ++++++++++++
.../api/admin/ldap/command/LDAPRemoveCmd.java | 71 ++++++
.../api/admin/swift/command/AddSwiftCmd.java | 106 +++++++++
.../api/admin/swift/command/ListSwiftsCmd.java | 84 +++++++
.../admin/vlan/command/CreateVlanIpRangeCmd.java | 180 +++++++++++++++
.../admin/vlan/command/DeleteVlanIpRangeCmd.java | 76 ++++++
.../admin/vlan/command/ListVlanIpRangesCmd.java | 149 ++++++++++++
.../cloud/api/commands/test/AddSwiftCmdTest.java | 2 +-
client/tomcatconf/commands.properties.in | 14 +-
.../configuration/ConfigurationManagerImpl.java | 8 +-
.../com/cloud/resource/ResourceManagerImpl.java | 4 +-
.../src/com/cloud/server/ManagementServerImpl.java | 2 +-
.../src/com/cloud/storage/swift/SwiftManager.java | 4 +-
.../com/cloud/storage/swift/SwiftManagerImpl.java | 4 +-
.../cloud/vpc/MockConfigurationManagerImpl.java | 8 +-
25 files changed, 845 insertions(+), 845 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/AddSwiftCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddSwiftCmd.java b/api/src/com/cloud/api/commands/AddSwiftCmd.java
deleted file mode 100644
index e0882c7..0000000
--- a/api/src/com/cloud/api/commands/AddSwiftCmd.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// 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.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.HostResponse;
-import com.cloud.api.response.SwiftResponse;
-import com.cloud.exception.DiscoveryException;
-import com.cloud.storage.Swift;
-import com.cloud.user.Account;
-
-@Implementation(description = "Adds Swift.", responseObject = HostResponse.class, since="3.0.0")
-public class AddSwiftCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName());
- private static final String s_name = "addswiftresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for swift")
- private String url;
-
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account for swift")
- private String account;
-
- @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username for swift")
- private String username;
-
- @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = " key for the user for swift")
- private String key;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getUrl() {
- return url;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- public String getAccount() {
- return account;
- }
-
- public String getUsername() {
- return username;
- }
-
- public String getKey() {
- return key;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- try {
- Swift result = _resourceService.discoverSwift(this);
- SwiftResponse swiftResponse = null;
- if (result != null) {
- swiftResponse = _responseGenerator.createSwiftResponse(result);
- swiftResponse.setResponseName(getCommandName());
- swiftResponse.setObjectName("swift");
- this.setResponseObject(swiftResponse);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift");
- }
- } catch (DiscoveryException ex) {
- String errMsg = "Failed to add Swift due to " + ex.toString();
- s_logger.warn(errMsg, ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java
deleted file mode 100644
index f1e9136..0000000
--- a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java
+++ /dev/null
@@ -1,180 +0,0 @@
-// 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.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.VlanIpRangeResponse;
-import com.cloud.dc.Vlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-
-@Implementation(description="Creates a VLAN IP range.", responseObject=VlanIpRangeResponse.class)
-public class CreateVlanIpRangeCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(CreateVlanIpRangeCmd.class.getName());
-
- private static final String s_name = "createvlaniprangeresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited")
- private String accountName;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited")
- private Long projectId;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a VLAN")
- private Long domainId;
-
- @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address in the VLAN IP range")
- private String endIp;
-
- @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
- private Boolean forVirtualNetwork;
-
- @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, description="the gateway of the VLAN IP range")
- private String gateway;
-
- @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask of the VLAN IP range")
- private String netmask;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="optional parameter. Have to be specified for Direct Untagged vlan only.")
- private Long podId;
-
- @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the VLAN IP range")
- private String startIp;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. If not specified," +
- " will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged")
- private String vlan;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the network id")
- private Long networkID;
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the physical network id")
- private Long physicalNetworkId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public String getEndIp() {
- return endIp;
- }
-
- public Boolean isForVirtualNetwork() {
- return forVirtualNetwork == null ? true : forVirtualNetwork;
- }
-
- public String getGateway() {
- return gateway;
- }
-
- public String getNetmask() {
- return netmask;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getStartIp() {
- return startIp;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getProjectId() {
- return projectId;
- }
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- public Long getNetworkID() {
- return networkID;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute() throws ResourceUnavailableException, ResourceAllocationException{
- try {
- Vlan result = _configService.createVlanAndPublicIpRange(this);
- if (result != null) {
- VlanIpRangeResponse response = _responseGenerator.createVlanIpRangeResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range");
- }
- } catch (ConcurrentOperationException ex) {
- s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
- } catch (InsufficientCapacityException ex) {
- s_logger.info(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
deleted file mode 100644
index 9f58e39..0000000
--- a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Creates a VLAN IP range.", responseObject=SuccessResponse.class)
-public class DeleteVlanIpRangeCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
-
- private static final String s_name = "deletevlaniprangeresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="vlan")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the VLAN IP range")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- boolean result = _configService.deleteVlanIpRange(this);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LDAPConfigCmd.java b/api/src/com/cloud/api/commands/LDAPConfigCmd.java
deleted file mode 100644
index 5b4572b..0000000
--- a/api/src/com/cloud/api/commands/LDAPConfigCmd.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// 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.api.commands;
-
-
-import javax.naming.NamingException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.LDAPConfigResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-
-@Implementation(description="Configure the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.0")
-public class LDAPConfigCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(LDAPConfigCmd.class.getName());
-
- private static final String s_name = "ldapconfigresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com")
- private String hostname;
-
- @Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.")
- private Integer port=0;
-
- @Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
- private Boolean useSSL;
-
- @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, required=true, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
- private String searchBase;
-
- @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, required=true, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
- private String queryFilter;
-
- @Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.")
- private String bindDN;
-
- @Parameter(name=ApiConstants.BIND_PASSWORD, type=CommandType.STRING, description="Enter the password.")
- private String bindPassword;
-
- @Parameter(name=ApiConstants.TRUST_STORE, type=CommandType.STRING, description="Enter the path to trust certificates store.")
- private String trustStore;
-
- @Parameter(name=ApiConstants.TRUST_STORE_PASSWORD, type=CommandType.STRING, description="Enter the password for trust store.")
- private String trustStorePassword;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getBindPassword() {
- return bindPassword;
- }
-
- public String getBindDN() {
- return bindDN;
- }
-
- public String getQueryFilter() {
- return queryFilter;
- }
-
- public String getSearchBase() {
- return searchBase;
- }
-
- public Boolean getUseSSL() {
- return useSSL == null ? Boolean.FALSE : Boolean.TRUE;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public Integer getPort() {
- return port <= 0 ? 389 : port;
- }
-
- public String getTrustStore() {
- return trustStore;
- }
-
-
- public String getTrustStorePassword() {
- return trustStorePassword;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
-
- @Override
- public void execute() throws ResourceUnavailableException,
- InsufficientCapacityException, ServerApiException,
- ConcurrentOperationException, ResourceAllocationException {
- try {
- boolean result = _configService.updateLDAP(this);
- if (result){
- LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
- lr.setResponseName(getCommandName());
- this.setResponseObject(lr);
- }
- }
- catch (NamingException ne){
- ne.printStackTrace();
- }
-
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LDAPRemoveCmd.java b/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
deleted file mode 100644
index f56c24d..0000000
--- a/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.api.commands;
-
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Implementation;
-import com.cloud.api.response.LDAPConfigResponse;
-import com.cloud.api.response.LDAPRemoveResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Remove the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.1")
-public class LDAPRemoveCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(LDAPRemoveCmd.class.getName());
-
- private static final String s_name = "ldapremoveresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
-
- @Override
- public void execute(){
- boolean result = _configService.removeLDAP(this);
- if (result){
- LDAPRemoveResponse lr = new LDAPRemoveResponse();
- lr.setObjectName("ldapremove");
- lr.setResponseName(getCommandName());
- this.setResponseObject(lr);
- }
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/ListSwiftsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSwiftsCmd.java b/api/src/com/cloud/api/commands/ListSwiftsCmd.java
deleted file mode 100644
index 5c4563a..0000000
--- a/api/src/com/cloud/api/commands/ListSwiftsCmd.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.HostResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.SwiftResponse;
-import com.cloud.storage.Swift;
-import com.cloud.user.Account;
-
-@Implementation(description = "List Swift.", responseObject = HostResponse.class, since="3.0.0")
-public class ListSwiftsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
- private static final String s_name = "listswiftsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the id of the swift")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- List<? extends Swift> result = _resourceService.listSwifts(this);
- ListResponse<SwiftResponse> response = new ListResponse<SwiftResponse>();
- List<SwiftResponse> swiftResponses = new ArrayList<SwiftResponse>();
-
- if (result != null) {
- SwiftResponse swiftResponse = null;
- for (Swift swift : result) {
- swiftResponse = _responseGenerator.createSwiftResponse(swift);
- swiftResponse.setResponseName(getCommandName());
- swiftResponse.setObjectName("swift");
- swiftResponses.add(swiftResponse);
- }
- }
- response.setResponses(swiftResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
deleted file mode 100644
index 0504471..0000000
--- a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// 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.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VlanIpRangeResponse;
-import com.cloud.dc.Vlan;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all VLAN IP ranges.", responseObject=VlanIpRangeResponse.class)
-public class ListVlanIpRangesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
-
- private static final String s_name = "listvlaniprangesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the VLAN IP range is associated. Must be used with the domainId parameter.")
- private String accountName;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN")
- private Long projectId;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.")
- private Long domainId;
-
- @IdentityMapper(entityTableName="vlan")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=false, description="the ID of the VLAN IP range")
- private Long id;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the VLAN IP range")
- private Long podId;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.")
- private String vlan;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range")
- private Long networkId;
-
- @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
- private Boolean forVirtualNetwork;
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="physical network id of the VLAN IP range")
- private Long physicalNetworkId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Long getId() {
- return id;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public Boolean getForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
- ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
- List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
- for (Vlan vlan : vlans.first()) {
- VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
- vlanResponse.setObjectName("vlaniprange");
- vlanResponses.add(vlanResponse);
- }
-
- response.setResponses(vlanResponses, vlans.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/configuration/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index 10138fa..56f036e 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -20,19 +20,19 @@ import java.util.List;
import javax.naming.NamingException;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPRemoveCmd;
import org.apache.cloudstack.api.admin.offering.command.*;
import org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.CreateServiceOfferingCmd;
-import com.cloud.api.commands.CreateVlanIpRangeCmd;
+import org.apache.cloudstack.api.admin.vlan.command.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.offering.command.CreateDiskOfferingCmd;
import org.apache.cloudstack.api.admin.pod.command.DeletePodCmd;
+import org.apache.cloudstack.api.admin.vlan.command.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.CreateZoneCmd;
import org.apache.cloudstack.api.admin.offering.command.DeleteDiskOfferingCmd;
import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
-import com.cloud.api.commands.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.DeleteZoneCmd;
-import com.cloud.api.commands.LDAPConfigCmd;
-import com.cloud.api.commands.LDAPRemoveCmd;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPConfigCmd;
import org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;
import org.apache.cloudstack.api.admin.config.command.UpdateCfgCmd;
import org.apache.cloudstack.api.admin.offering.command.UpdateDiskOfferingCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/resource/ResourceService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
index d342787..a7ee1de 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -22,9 +22,9 @@ import org.apache.cloudstack.api.admin.cluster.command.AddClusterCmd;
import org.apache.cloudstack.api.admin.cluster.command.DeleteClusterCmd;
import org.apache.cloudstack.api.admin.host.command.AddHostCmd;
import org.apache.cloudstack.api.admin.host.command.AddSecondaryStorageCmd;
-import com.cloud.api.commands.AddSwiftCmd;
+import org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;
import org.apache.cloudstack.api.admin.host.command.CancelMaintenanceCmd;
-import com.cloud.api.commands.ListSwiftsCmd;
+import org.apache.cloudstack.api.admin.swift.command.ListSwiftsCmd;
import org.apache.cloudstack.api.admin.host.command.PrepareForMaintenanceCmd;
import org.apache.cloudstack.api.admin.host.command.*;
import org.apache.cloudstack.api.admin.host.command.UpdateHostCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index ab8e5db..db5f8ba 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -52,7 +52,7 @@ import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
import org.apache.cloudstack.api.admin.storagepool.command.ListStoragePoolsCmd;
import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
-import com.cloud.api.commands.ListVlanIpRangesCmd;
+import org.apache.cloudstack.api.admin.vlan.command.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.user.zone.command.ListZonesByCmd;
import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPConfigCmd.java b/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPConfigCmd.java
new file mode 100644
index 0000000..763455c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPConfigCmd.java
@@ -0,0 +1,149 @@
+// 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 org.apache.cloudstack.api.admin.ldap.command;
+
+
+import javax.naming.NamingException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.LDAPConfigResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="Configure the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.0")
+public class LDAPConfigCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(LDAPConfigCmd.class.getName());
+
+ private static final String s_name = "ldapconfigresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com")
+ private String hostname;
+
+ @Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.")
+ private Integer port=0;
+
+ @Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
+ private Boolean useSSL;
+
+ @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, required=true, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
+ private String searchBase;
+
+ @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, required=true, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
+ private String queryFilter;
+
+ @Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.")
+ private String bindDN;
+
+ @Parameter(name=ApiConstants.BIND_PASSWORD, type=CommandType.STRING, description="Enter the password.")
+ private String bindPassword;
+
+ @Parameter(name=ApiConstants.TRUST_STORE, type=CommandType.STRING, description="Enter the path to trust certificates store.")
+ private String trustStore;
+
+ @Parameter(name=ApiConstants.TRUST_STORE_PASSWORD, type=CommandType.STRING, description="Enter the password for trust store.")
+ private String trustStorePassword;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getBindPassword() {
+ return bindPassword;
+ }
+
+ public String getBindDN() {
+ return bindDN;
+ }
+
+ public String getQueryFilter() {
+ return queryFilter;
+ }
+
+ public String getSearchBase() {
+ return searchBase;
+ }
+
+ public Boolean getUseSSL() {
+ return useSSL == null ? Boolean.FALSE : Boolean.TRUE;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public Integer getPort() {
+ return port <= 0 ? 389 : port;
+ }
+
+ public String getTrustStore() {
+ return trustStore;
+ }
+
+
+ public String getTrustStorePassword() {
+ return trustStorePassword;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException, ServerApiException,
+ ConcurrentOperationException, ResourceAllocationException {
+ try {
+ boolean result = _configService.updateLDAP(this);
+ if (result){
+ LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
+ lr.setResponseName(getCommandName());
+ this.setResponseObject(lr);
+ }
+ }
+ catch (NamingException ne){
+ ne.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPRemoveCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPRemoveCmd.java b/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPRemoveCmd.java
new file mode 100644
index 0000000..5c53deb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/ldap/command/LDAPRemoveCmd.java
@@ -0,0 +1,71 @@
+// 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 org.apache.cloudstack.api.admin.ldap.command;
+
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Implementation;
+import com.cloud.api.response.LDAPConfigResponse;
+import com.cloud.api.response.LDAPRemoveResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Remove the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.1")
+public class LDAPRemoveCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(LDAPRemoveCmd.class.getName());
+
+ private static final String s_name = "ldapremoveresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public void execute(){
+ boolean result = _configService.removeLDAP(this);
+ if (result){
+ LDAPRemoveResponse lr = new LDAPRemoveResponse();
+ lr.setObjectName("ldapremove");
+ lr.setResponseName(getCommandName());
+ this.setResponseObject(lr);
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/swift/command/AddSwiftCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/swift/command/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/admin/swift/command/AddSwiftCmd.java
new file mode 100644
index 0000000..1850240
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/swift/command/AddSwiftCmd.java
@@ -0,0 +1,106 @@
+// 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 org.apache.cloudstack.api.admin.swift.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.HostResponse;
+import com.cloud.api.response.SwiftResponse;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.storage.Swift;
+import com.cloud.user.Account;
+
+@Implementation(description = "Adds Swift.", responseObject = HostResponse.class, since="3.0.0")
+public class AddSwiftCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName());
+ private static final String s_name = "addswiftresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for swift")
+ private String url;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account for swift")
+ private String account;
+
+ @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username for swift")
+ private String username;
+
+ @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = " key for the user for swift")
+ private String key;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getUrl() {
+ return url;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccount() {
+ return account;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ try {
+ Swift result = _resourceService.discoverSwift(this);
+ SwiftResponse swiftResponse = null;
+ if (result != null) {
+ swiftResponse = _responseGenerator.createSwiftResponse(result);
+ swiftResponse.setResponseName(getCommandName());
+ swiftResponse.setObjectName("swift");
+ this.setResponseObject(swiftResponse);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift");
+ }
+ } catch (DiscoveryException ex) {
+ String errMsg = "Failed to add Swift due to " + ex.toString();
+ s_logger.warn(errMsg, ex);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/swift/command/ListSwiftsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/swift/command/ListSwiftsCmd.java b/api/src/org/apache/cloudstack/api/admin/swift/command/ListSwiftsCmd.java
new file mode 100644
index 0000000..3a2202a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/swift/command/ListSwiftsCmd.java
@@ -0,0 +1,84 @@
+// 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 org.apache.cloudstack.api.admin.swift.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.HostResponse;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.SwiftResponse;
+import com.cloud.storage.Swift;
+import com.cloud.user.Account;
+
+@Implementation(description = "List Swift.", responseObject = HostResponse.class, since="3.0.0")
+public class ListSwiftsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
+ private static final String s_name = "listswiftsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the id of the swift")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends Swift> result = _resourceService.listSwifts(this);
+ ListResponse<SwiftResponse> response = new ListResponse<SwiftResponse>();
+ List<SwiftResponse> swiftResponses = new ArrayList<SwiftResponse>();
+
+ if (result != null) {
+ SwiftResponse swiftResponse = null;
+ for (Swift swift : result) {
+ swiftResponse = _responseGenerator.createSwiftResponse(swift);
+ swiftResponse.setResponseName(getCommandName());
+ swiftResponse.setObjectName("swift");
+ swiftResponses.add(swiftResponse);
+ }
+ }
+ response.setResponses(swiftResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/vlan/command/CreateVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vlan/command/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/vlan/command/CreateVlanIpRangeCmd.java
new file mode 100644
index 0000000..27dd604
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/vlan/command/CreateVlanIpRangeCmd.java
@@ -0,0 +1,180 @@
+// 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 org.apache.cloudstack.api.admin.vlan.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.VlanIpRangeResponse;
+import com.cloud.dc.Vlan;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="Creates a VLAN IP range.", responseObject=VlanIpRangeResponse.class)
+public class CreateVlanIpRangeCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateVlanIpRangeCmd.class.getName());
+
+ private static final String s_name = "createvlaniprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited")
+ private String accountName;
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited")
+ private Long projectId;
+
+ @IdentityMapper(entityTableName="domain")
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a VLAN")
+ private Long domainId;
+
+ @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address in the VLAN IP range")
+ private String endIp;
+
+ @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
+ private Boolean forVirtualNetwork;
+
+ @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, description="the gateway of the VLAN IP range")
+ private String gateway;
+
+ @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask of the VLAN IP range")
+ private String netmask;
+
+ @IdentityMapper(entityTableName="host_pod_ref")
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="optional parameter. Have to be specified for Direct Untagged vlan only.")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the VLAN IP range")
+ private String startIp;
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. If not specified," +
+ " will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged")
+ private String vlan;
+
+ @IdentityMapper(entityTableName="data_center")
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
+ private Long zoneId;
+
+ @IdentityMapper(entityTableName="networks")
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the network id")
+ private Long networkID;
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the physical network id")
+ private Long physicalNetworkId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getEndIp() {
+ return endIp;
+ }
+
+ public Boolean isForVirtualNetwork() {
+ return forVirtualNetwork == null ? true : forVirtualNetwork;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getNetmask() {
+ return netmask;
+ }
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public String getStartIp() {
+ return startIp;
+ }
+
+ public String getVlan() {
+ return vlan;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getNetworkID() {
+ return networkID;
+ }
+
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, ResourceAllocationException{
+ try {
+ Vlan result = _configService.createVlanAndPublicIpRange(this);
+ if (result != null) {
+ VlanIpRangeResponse response = _responseGenerator.createVlanIpRangeResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range");
+ }
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ s_logger.info(ex);
+ throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/vlan/command/DeleteVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vlan/command/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/vlan/command/DeleteVlanIpRangeCmd.java
new file mode 100644
index 0000000..9ae10c6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/vlan/command/DeleteVlanIpRangeCmd.java
@@ -0,0 +1,76 @@
+// 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 org.apache.cloudstack.api.admin.vlan.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Creates a VLAN IP range.", responseObject=SuccessResponse.class)
+public class DeleteVlanIpRangeCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
+
+ private static final String s_name = "deletevlaniprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="vlan")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the VLAN IP range")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _configService.deleteVlanIpRange(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/src/org/apache/cloudstack/api/admin/vlan/command/ListVlanIpRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vlan/command/ListVlanIpRangesCmd.java b/api/src/org/apache/cloudstack/api/admin/vlan/command/ListVlanIpRangesCmd.java
new file mode 100644
index 0000000..7de9016
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/vlan/command/ListVlanIpRangesCmd.java
@@ -0,0 +1,149 @@
+// 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 org.apache.cloudstack.api.admin.vlan.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.VlanIpRangeResponse;
+import com.cloud.dc.Vlan;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists all VLAN IP ranges.", responseObject=VlanIpRangeResponse.class)
+public class ListVlanIpRangesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
+
+ private static final String s_name = "listvlaniprangesresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the VLAN IP range is associated. Must be used with the domainId parameter.")
+ private String accountName;
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN")
+ private Long projectId;
+
+ @IdentityMapper(entityTableName="domain")
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.")
+ private Long domainId;
+
+ @IdentityMapper(entityTableName="vlan")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=false, description="the ID of the VLAN IP range")
+ private Long id;
+
+ @IdentityMapper(entityTableName="host_pod_ref")
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the VLAN IP range")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.")
+ private String vlan;
+
+ @IdentityMapper(entityTableName="data_center")
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
+ private Long zoneId;
+
+ @IdentityMapper(entityTableName="networks")
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range")
+ private Long networkId;
+
+ @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
+ private Boolean forVirtualNetwork;
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="physical network id of the VLAN IP range")
+ private Long physicalNetworkId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public String getVlan() {
+ return vlan;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public Long getNetworkId() {
+ return networkId;
+ }
+
+ public Boolean getForVirtualNetwork() {
+ return forVirtualNetwork;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
+ ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
+ List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
+ for (Vlan vlan : vlans.first()) {
+ VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
+ vlanResponse.setObjectName("vlaniprange");
+ vlanResponses.add(vlanResponse);
+ }
+
+ response.setResponses(vlanResponses, vlans.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/api/test/src/com/cloud/api/commands/test/AddSwiftCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/api/commands/test/AddSwiftCmdTest.java b/api/test/src/com/cloud/api/commands/test/AddSwiftCmdTest.java
index fe553bb..59ffc39 100644
--- a/api/test/src/com/cloud/api/commands/test/AddSwiftCmdTest.java
+++ b/api/test/src/com/cloud/api/commands/test/AddSwiftCmdTest.java
@@ -19,6 +19,7 @@ package src.com.cloud.api.commands.test;
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -27,7 +28,6 @@ import org.mockito.Mockito;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.commands.AddSwiftCmd;
import com.cloud.api.response.SwiftResponse;
import com.cloud.exception.DiscoveryException;
import com.cloud.resource.ResourceService;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 48bd39c..d825505 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -119,9 +119,9 @@ deleteDiskOffering=org.apache.cloudstack.api.admin.offering.command.DeleteDiskOf
listDiskOfferings=org.apache.cloudstack.api.user.offering.command.ListDiskOfferingsCmd;15
#### vlan commands
-createVlanIpRange=com.cloud.api.commands.CreateVlanIpRangeCmd;1
-deleteVlanIpRange=com.cloud.api.commands.DeleteVlanIpRangeCmd;1
-listVlanIpRanges=com.cloud.api.commands.ListVlanIpRangesCmd;1
+createVlanIpRange=org.apache.cloudstack.api.admin.vlan.command.CreateVlanIpRangeCmd;1
+deleteVlanIpRange=org.apache.cloudstack.api.admin.vlan.command.DeleteVlanIpRangeCmd;1
+listVlanIpRanges=org.apache.cloudstack.api.admin.vlan.command.ListVlanIpRangesCmd;1
#### address commands
associateIpAddress=org.apache.cloudstack.api.user.address.command.AssociateIPAddrCmd;15
@@ -198,8 +198,8 @@ changeServiceForSystemVm=org.apache.cloudstack.api.admin.systemvm.command.Upgrad
#### configuration commands
updateConfiguration=org.apache.cloudstack.api.admin.config.command.UpdateCfgCmd;1
listConfigurations=org.apache.cloudstack.api.admin.config.command.ListCfgsByCmd;1
-ldapConfig=com.cloud.api.commands.LDAPConfigCmd;1
-ldapRemove=com.cloud.api.commands.LDAPRemoveCmd;1
+ldapConfig=org.apache.cloudstack.api.admin.ldap.command.LDAPConfigCmd;1
+ldapRemove=org.apache.cloudstack.api.admin.ldap.command.LDAPRemoveCmd;1
listCapabilities=org.apache.cloudstack.api.user.config.command.ListCapabilitiesCmd;15
#### pod commands
@@ -225,8 +225,8 @@ listAlerts=com.cloud.api.commands.ListAlertsCmd;3
listCapacity=com.cloud.api.commands.ListCapacityCmd;3
#### swift commands^M
-addSwift=com.cloud.api.commands.AddSwiftCmd;1
-listSwifts=com.cloud.api.commands.ListSwiftsCmd;1
+addSwift=org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;1
+listSwifts=org.apache.cloudstack.api.admin.swift.command.ListSwiftsCmd;1
#### host commands
addHost=org.apache.cloudstack.api.admin.host.command.AddHostCmd;3
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index eeff506..f5dea7e 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -39,12 +39,15 @@ import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import org.apache.cloudstack.api.admin.config.command.UpdateCfgCmd;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPConfigCmd;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPRemoveCmd;
import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.admin.network.command.UpdateNetworkOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.CreateDiskOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.CreateServiceOfferingCmd;
import org.apache.cloudstack.api.admin.pod.command.DeletePodCmd;
import org.apache.cloudstack.api.admin.pod.command.UpdatePodCmd;
+import org.apache.cloudstack.api.admin.vlan.command.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.CreateZoneCmd;
import org.apache.cloudstack.api.admin.zone.command.UpdateZoneCmd;
import org.apache.log4j.Logger;
@@ -54,13 +57,10 @@ import com.cloud.alert.AlertManager;
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import com.cloud.api.ApiDBUtils;
import org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;
-import com.cloud.api.commands.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.offering.command.DeleteDiskOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.DeleteServiceOfferingCmd;
-import com.cloud.api.commands.DeleteVlanIpRangeCmd;
+import org.apache.cloudstack.api.admin.vlan.command.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.DeleteZoneCmd;
-import com.cloud.api.commands.LDAPConfigCmd;
-import com.cloud.api.commands.LDAPRemoveCmd;
import org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;
import org.apache.cloudstack.api.admin.offering.command.UpdateDiskOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.UpdateServiceOfferingCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 7a4c3db..10f0ea9 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -32,6 +32,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.admin.cluster.command.AddClusterCmd;
import org.apache.cloudstack.api.admin.host.command.*;
+import org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
@@ -52,10 +53,9 @@ import org.apache.cloudstack.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import org.apache.cloudstack.api.admin.host.command.AddHostCmd;
import org.apache.cloudstack.api.admin.host.command.AddSecondaryStorageCmd;
-import com.cloud.api.commands.AddSwiftCmd;
import org.apache.cloudstack.api.admin.host.command.CancelMaintenanceCmd;
import org.apache.cloudstack.api.admin.cluster.command.DeleteClusterCmd;
-import com.cloud.api.commands.ListSwiftsCmd;
+import org.apache.cloudstack.api.admin.swift.command.ListSwiftsCmd;
import org.apache.cloudstack.api.admin.host.command.PrepareForMaintenanceCmd;
import org.apache.cloudstack.api.admin.host.command.UpdateHostCmd;
import com.cloud.capacity.Capacity;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 44458b1..1d7c486 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -87,7 +87,7 @@ import org.apache.cloudstack.api.user.address.command.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
import org.apache.cloudstack.api.admin.storagepool.command.ListStoragePoolsCmd;
import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
-import com.cloud.api.commands.ListVlanIpRangesCmd;
+import org.apache.cloudstack.api.admin.vlan.command.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
import org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;
import org.apache.cloudstack.api.admin.domain.command.UpdateDomainCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/src/com/cloud/storage/swift/SwiftManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/swift/SwiftManager.java b/server/src/com/cloud/storage/swift/SwiftManager.java
index a1bd42d..075c985 100644
--- a/server/src/com/cloud/storage/swift/SwiftManager.java
+++ b/server/src/com/cloud/storage/swift/SwiftManager.java
@@ -19,10 +19,10 @@ package com.cloud.storage.swift;
import java.util.List;
import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.api.commands.AddSwiftCmd;
+import org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;
+import org.apache.cloudstack.api.admin.swift.command.ListSwiftsCmd;
import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd;
import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd;
-import com.cloud.api.commands.ListSwiftsCmd;
import com.cloud.exception.DiscoveryException;
import com.cloud.storage.Swift;
import com.cloud.storage.SwiftVO;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/swift/SwiftManagerImpl.java b/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
index 1708193..e83d6cb 100644
--- a/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
+++ b/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
@@ -25,6 +25,7 @@ import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.api.admin.swift.command.ListSwiftsCmd;
import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd;
import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd;
import org.apache.log4j.Logger;
@@ -33,8 +34,7 @@ import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.DeleteObjectFromSwiftCommand;
import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.api.commands.AddSwiftCmd;
-import com.cloud.api.commands.ListSwiftsCmd;
+import org.apache.cloudstack.api.admin.swift.command.AddSwiftCmd;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenterVO;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780eb958/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 291d08e..c303cfb 100644
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -28,18 +28,18 @@ import org.apache.cloudstack.api.admin.offering.command.CreateDiskOfferingCmd;
import org.apache.cloudstack.api.admin.config.command.UpdateCfgCmd;
import org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.CreateServiceOfferingCmd;
-import com.cloud.api.commands.CreateVlanIpRangeCmd;
+import org.apache.cloudstack.api.admin.vlan.command.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.offering.command.DeleteDiskOfferingCmd;
import org.apache.cloudstack.api.admin.offering.command.UpdateServiceOfferingCmd;
import org.apache.cloudstack.api.admin.pod.command.UpdatePodCmd;
+import org.apache.cloudstack.api.admin.vlan.command.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.CreateZoneCmd;
import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.admin.pod.command.DeletePodCmd;
import org.apache.cloudstack.api.admin.offering.command.DeleteServiceOfferingCmd;
-import com.cloud.api.commands.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.admin.zone.command.DeleteZoneCmd;
-import com.cloud.api.commands.LDAPConfigCmd;
-import com.cloud.api.commands.LDAPRemoveCmd;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPConfigCmd;
+import org.apache.cloudstack.api.admin.ldap.command.LDAPRemoveCmd;
import org.apache.cloudstack.api.admin.zone.command.UpdateZoneCmd;
import org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;
import org.apache.cloudstack.api.admin.offering.command.UpdateDiskOfferingCmd;