You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2013/01/10 01:48:36 UTC
[37/52] [partial] Summary: Fixes for api_refactoring
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/GetUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/GetUserCmd.java b/api/src/com/cloud/api/commands/GetUserCmd.java
deleted file mode 100644
index 465e440..0000000
--- a/api/src/com/cloud/api/commands/GetUserCmd.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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.UserResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.user.UserAccount;
-
-@Implementation(description="Find user account by API key", responseObject=UserResponse.class)
-public class GetUserCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(GetUserCmd.class.getName());
-
- private static final String s_name = "getuserresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, required=true, description="API key of the user")
- private String apiKey;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getApiKey() {
- return apiKey;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return 0;
- }
-
- @Override
- public void execute(){
- UserAccount result = _accountService.getUserByApiKey(getApiKey());
- if(result != null){
- UserResponse response = _responseGenerator.createUserResponse(result);
- response.setResponseName(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new InvalidParameterValueException("User with specified API key does not exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/GetVMPasswordCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/GetVMPasswordCmd.java b/api/src/com/cloud/api/commands/GetVMPasswordCmd.java
deleted file mode 100644
index a6a3c6d..0000000
--- a/api/src/com/cloud/api/commands/GetVMPasswordCmd.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.security.InvalidParameterException;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.GetVMPasswordResponse;
-import com.cloud.user.Account;
-import com.cloud.uservm.UserVm;
-
-@Implementation(responseObject=GetVMPasswordResponse.class, description="Returns an encrypted password for the VM")
-public class GetVMPasswordCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(GetVMPasswordCmd.class.getName());
- private static final String s_name = "getvmpasswordresponse";
-
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine")
- private Long id;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() {
- String passwd = _mgr.getVMPassword(this);
- if (passwd == null || passwd.equals(""))
- throw new InvalidParameterException("No password for VM with id '" + getId() + "' found.");
-
- this.setResponseObject(new GetVMPasswordResponse(getCommandName(), passwd));
- }
-
- @Override
- public long getEntityOwnerId() {
- UserVm userVm = _entityMgr.findById(UserVm.class, getId());
- if (userVm != null) {
- return userVm.getAccountId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/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 d7ff5b5..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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.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/c4c9d2d8/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 43d9a0a..0000000
--- a/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
+++ /dev/null
@@ -1,81 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.BaseResponse;
-import com.cloud.api.response.LDAPConfigResponse;
-import com.cloud.api.response.LDAPRemoveResponse;
-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="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/c4c9d2d8/api/src/com/cloud/api/commands/ListAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAccountsCmd.java b/api/src/com/cloud/api/commands/ListAccountsCmd.java
deleted file mode 100755
index 6e0a524..0000000
--- a/api/src/com/cloud/api/commands/ListAccountsCmd.java
+++ /dev/null
@@ -1,108 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListDomainResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AccountResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
-public class ListAccountsCmd extends BaseListDomainResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
- private static final String s_name = "listaccountsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).")
- private Long accountType;
-
- @IdentityMapper(entityTableName="account")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list account by account ID")
- private Long id;
-
- @Parameter(name=ApiConstants.IS_CLEANUP_REQUIRED, type=CommandType.BOOLEAN, description="list accounts by cleanuprequred attribute (values are true or false)")
- private Boolean cleanupRequired;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list account by account name")
- private String searchName;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list accounts by state. Valid states are enabled, disabled, and locked.")
- private String state;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getAccountType() {
- return accountType;
- }
-
- public Long getId() {
- return id;
- }
-
- public Boolean isCleanupRequired() {
- return cleanupRequired;
- }
-
- public String getSearchName() {
- return searchName;
- }
-
- public String getState() {
- return state;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Account>, Integer> accounts = _accountService.searchForAccounts(this);
- ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
- List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
- for (Account account : accounts.first()) {
- AccountResponse acctResponse = _responseGenerator.createAccountResponse(account);
- acctResponse.setObjectName("account");
- accountResponses.add(acctResponse);
- }
- response.setResponses(accountResponses, accounts.second());
- response.setResponseName(getCommandName());
-
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListAlertsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAlertsCmd.java b/api/src/com/cloud/api/commands/ListAlertsCmd.java
deleted file mode 100644
index 1f6c7b3..0000000
--- a/api/src/com/cloud/api/commands/ListAlertsCmd.java
+++ /dev/null
@@ -1,93 +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 com.cloud.alert.Alert;
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AlertResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.utils.Pair;
-
-@Implementation(description = "Lists all alerts.", responseObject = AlertResponse.class)
-public class ListAlertsCmd extends BaseListCmd {
-
- public static final Logger s_logger = Logger.getLogger(ListAlertsCmd.class.getName());
-
- private static final String s_name = "listalertsresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="alert")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the alert")
- private Long id;
-
- @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "list by alert type")
- private String type;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getType() {
- return type;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- Pair<List<? extends Alert>, Integer> result = _mgr.searchForAlerts(this);
- ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
- List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();
- for (Alert alert : result.first()) {
- AlertResponse alertResponse = new AlertResponse();
- alertResponse.setId(alert.getId());
- alertResponse.setAlertType(alert.getType());
- alertResponse.setDescription(alert.getSubject());
- alertResponse.setLastSent(alert.getLastSent());
-
- alertResponse.setObjectName("alert");
- alertResponseList.add(alertResponse);
- }
-
- response.setResponses(alertResponseList, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java b/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java
deleted file mode 100644
index e0520cd..0000000
--- a/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java
+++ /dev/null
@@ -1,73 +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.Date;
-import java.util.List;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListAccountResourcesCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AsyncJobResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all pending asynchronous jobs for the account.", responseObject=AsyncJobResponse.class)
-public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd {
- private static final String s_name = "listasyncjobsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.START_DATE, type=CommandType.TZDATE, description="the start date of the async job")
- private Date startDate;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Date getStartDate() {
- return startDate;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends AsyncJob>, Integer> result = _mgr.searchForAsyncJobs(this);
- ListResponse<AsyncJobResponse> response = new ListResponse<AsyncJobResponse>();
- List<AsyncJobResponse> jobResponses = new ArrayList<AsyncJobResponse>();
- for (AsyncJob job : result.first()) {
- jobResponses.add(_responseGenerator.createAsyncJobResponse(job));
- }
-
- response.setResponses(jobResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java b/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
deleted file mode 100644
index edab908..0000000
--- a/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
+++ /dev/null
@@ -1,103 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AutoScalePolicyResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.as.AutoScalePolicy;
-
-@Implementation(description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class)
-public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListAutoScalePoliciesCmd.class.getName());
-
- private static final String s_name = "listautoscalepoliciesresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName = "autoscale_policies")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale policy")
- private Long id;
-
- @IdentityMapper(entityTableName = "conditions")
- @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.LONG, description = "the ID of the condition of the policy")
- private Long conditionId;
-
- @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "the action to be executed if all the conditions evaluate to true for the specified duration.")
- private String action;
-
- @IdentityMapper(entityTableName="autoscale_vmgroups")
- @Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.LONG, description = "the ID of the autoscale vm group")
- private Long vmGroupId;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getConditionId() {
- return conditionId;
- }
-
- public String getAction() {
- return action;
- }
-
- public Long getVmGroupId() {
- return vmGroupId;
- }
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- List<? extends AutoScalePolicy> autoScalePolicies = _autoScaleService.listAutoScalePolicies(this);
- ListResponse<AutoScalePolicyResponse> response = new ListResponse<AutoScalePolicyResponse>();
- List<AutoScalePolicyResponse> responses = new ArrayList<AutoScalePolicyResponse>();
- if (autoScalePolicies != null) {
- for (AutoScalePolicy autoScalePolicy : autoScalePolicies) {
- AutoScalePolicyResponse autoScalePolicyResponse = _responseGenerator.createAutoScalePolicyResponse(autoScalePolicy);
- autoScalePolicyResponse.setObjectName("autoscalepolicy");
- responses.add(autoScalePolicyResponse);
- }
- }
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListAutoScaleVmGroupsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAutoScaleVmGroupsCmd.java b/api/src/com/cloud/api/commands/ListAutoScaleVmGroupsCmd.java
deleted file mode 100644
index 0d1b2e0..0000000
--- a/api/src/com/cloud/api/commands/ListAutoScaleVmGroupsCmd.java
+++ /dev/null
@@ -1,115 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AutoScaleVmGroupResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.as.AutoScaleVmGroup;
-
-@Implementation(description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class)
-public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmGroupsCmd.class.getName());
-
- private static final String s_name = "listautoscalevmgroupsresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="autoscale_vmgroups")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale vm group")
- private Long id;
-
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name = ApiConstants.LBID, type = CommandType.LONG, description = "the ID of the loadbalancer")
- private Long loadBalancerId;
-
- @IdentityMapper(entityTableName="autoscale_vmprofiles")
- @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.LONG, description = "the ID of the profile")
- private Long profileId;
-
- @IdentityMapper(entityTableName="autoscale_policies")
- @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.LONG, description = "the ID of the policy")
- private Long policyId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the availability zone ID")
- private Long zoneId;
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getLoadBalancerId() {
- return loadBalancerId;
- }
-
-
- public Long getProfileId() {
- return profileId;
- }
-
- public Long getPolicyId() {
- return policyId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- if(id != null && (loadBalancerId != null || profileId != null || policyId != null))
- throw new InvalidParameterValueException("When id is specified other parameters need not be specified");
-
- List<? extends AutoScaleVmGroup> autoScaleGroups = _autoScaleService.listAutoScaleVmGroups(this);
- ListResponse<AutoScaleVmGroupResponse> response = new ListResponse<AutoScaleVmGroupResponse>();
- List<AutoScaleVmGroupResponse> responses = new ArrayList<AutoScaleVmGroupResponse>();
- if (autoScaleGroups != null) {
- for (AutoScaleVmGroup autoScaleVmGroup : autoScaleGroups) {
- AutoScaleVmGroupResponse autoScaleVmGroupResponse = _responseGenerator.createAutoScaleVmGroupResponse(autoScaleVmGroup);
- autoScaleVmGroupResponse.setObjectName("autoscalevmgroup");
- responses.add(autoScaleVmGroupResponse);
- }
- }
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListAutoScaleVmProfilesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAutoScaleVmProfilesCmd.java b/api/src/com/cloud/api/commands/ListAutoScaleVmProfilesCmd.java
deleted file mode 100644
index 8034800..0000000
--- a/api/src/com/cloud/api/commands/ListAutoScaleVmProfilesCmd.java
+++ /dev/null
@@ -1,95 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.AutoScaleVmProfileResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.as.AutoScaleVmProfile;
-
-@Implementation(description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class)
-public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmProfilesCmd.class.getName());
-
- private static final String s_name = "listautoscalevmprofilesresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="autoscale_vmprofiles")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale vm profile")
- private Long id;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.LONG, description="the templateid of the autoscale vm profile")
- private Long templateId;
-
- @Parameter(name=ApiConstants.OTHER_DEPLOY_PARAMS, type=CommandType.STRING, description="the otherdeployparameters of the autoscale vm profile")
- private String otherDeployParams;
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getTemplateId() {
- return templateId;
- }
-
- public String getOtherDeployParams() {
- return otherDeployParams;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- List<? extends AutoScaleVmProfile> autoScaleProfiles = _autoScaleService.listAutoScaleVmProfiles(this);
- ListResponse<AutoScaleVmProfileResponse> response = new ListResponse<AutoScaleVmProfileResponse>();
- List<AutoScaleVmProfileResponse> responses = new ArrayList<AutoScaleVmProfileResponse>();
- if (autoScaleProfiles != null) {
- for (AutoScaleVmProfile autoScaleVmProfile : autoScaleProfiles) {
- AutoScaleVmProfileResponse autoScaleVmProfileResponse = _responseGenerator.createAutoScaleVmProfileResponse(autoScaleVmProfile);
- autoScaleVmProfileResponse.setObjectName("autoscalevmprofile");
- responses.add(autoScaleVmProfileResponse);
- }
- }
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java b/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
deleted file mode 100644
index 108b268..0000000
--- a/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
+++ /dev/null
@@ -1,59 +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.Map;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.response.CapabilitiesResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Lists capabilities", responseObject=CapabilitiesResponse.class)
-public class ListCapabilitiesCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName());
-
- private static final String s_name = "listcapabilitiesresponse";
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Map<String, Object> capabilities = _mgr.listCapabilities(this);
- CapabilitiesResponse response = new CapabilitiesResponse();
- response.setSecurityGroupsEnabled((Boolean)capabilities.get("securityGroupsEnabled"));
- response.setCloudStackVersion((String)capabilities.get("cloudStackVersion"));
- response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
- response.setSupportELB((String)capabilities.get("supportELB"));
- response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
- response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
- response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
- response.setObjectName("capability");
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListCapacityCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCapacityCmd.java b/api/src/com/cloud/api/commands/ListCapacityCmd.java
deleted file mode 100755
index 5e3ca5e..0000000
--- a/api/src/com/cloud/api/commands/ListCapacityCmd.java
+++ /dev/null
@@ -1,138 +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.text.DecimalFormat;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.CapacityResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.capacity.Capacity;
-import com.cloud.exception.InvalidParameterValueException;
-
-@Implementation(description="Lists all the system wide capacities.", responseObject=CapacityResponse.class)
-public class ListCapacityCmd extends BaseListCmd {
-
- public static final Logger s_logger = Logger.getLogger(ListCapacityCmd.class.getName());
- private static final DecimalFormat s_percentFormat = new DecimalFormat("##.##");
-
- private static final String s_name = "listcapacityresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists capacity by the Zone ID")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists capacity by the Pod ID")
- private Long podId;
-
- @IdentityMapper(entityTableName="cluster")
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, since="3.0.0", description="lists capacity by the Cluster ID")
- private Long clusterId;
-
- @Parameter(name=ApiConstants.FETCH_LATEST, type=CommandType.BOOLEAN, since="3.0.0", description="recalculate capacities and fetch the latest")
- private Boolean fetchLatest;
-
- @Parameter(name=ApiConstants.TYPE, type=CommandType.INTEGER, description="lists capacity by type" +
- "* CAPACITY_TYPE_MEMORY = 0" +
- "* CAPACITY_TYPE_CPU = 1" +
- "* CAPACITY_TYPE_STORAGE = 2" +
- "* CAPACITY_TYPE_STORAGE_ALLOCATED = 3" +
- "* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4" +
- "* CAPACITY_TYPE_PRIVATE_IP = 5" +
- "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" +
- "* CAPACITY_TYPE_VLAN = 7" +
- "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" +
- "* CAPACITY_TYPE_LOCAL_STORAGE = 9.")
-
- private Integer type;
-
- @Parameter(name=ApiConstants.SORT_BY, type=CommandType.STRING, since="3.0.0", description="Sort the results. Available values: Usage")
- private String sortBy;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public Boolean getFetchLatest() {
- return fetchLatest;
- }
-
- public Integer getType() {
- return type;
- }
-
- public String getSortBy() {
- if (sortBy != null) {
- if (sortBy.equalsIgnoreCase("usage")) {
- return sortBy;
- } else {
- throw new InvalidParameterValueException("Only value supported for sortBy parameter is : usage");
- }
- }
-
- return null;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends Capacity> result = null;
- if (getSortBy() != null) {
- result = _mgr.listTopConsumedResources(this);
- } else {
- result = _mgr.listCapacities(this);
- }
-
- ListResponse<CapacityResponse> response = new ListResponse<CapacityResponse>();
- List<CapacityResponse> capacityResponses = _responseGenerator.createCapacityResponse(result, s_percentFormat);
- response.setResponses(capacityResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListCfgsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCfgsByCmd.java b/api/src/com/cloud/api/commands/ListCfgsByCmd.java
deleted file mode 100644
index 6e07ca9..0000000
--- a/api/src/com/cloud/api/commands/ListCfgsByCmd.java
+++ /dev/null
@@ -1,95 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ConfigurationResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.configuration.Configuration;
-import com.cloud.utils.Pair;
-
-@Implementation(description = "Lists all configurations.", responseObject = ConfigurationResponse.class)
-public class ListCfgsByCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName());
-
- private static final String s_name = "listconfigurationsresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.CATEGORY, type = CommandType.STRING, description = "lists configurations by category")
- private String category;
-
- @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name")
- private String configName;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public String getCategory() {
- return category;
- }
-
- public String getConfigName() {
- return configName;
- }
-
- @Override
- public Long getPageSizeVal() {
- Long pageSizeVal = 500L;
- Integer pageSize = getPageSize();
- if (pageSize != null) {
- pageSizeVal = pageSize.longValue();
- }
- return pageSizeVal;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- Pair<List<? extends Configuration>, Integer> result = _mgr.searchForConfigurations(this);
- ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
- List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();
- for (Configuration cfg : result.first()) {
- ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
- cfgResponse.setObjectName("configuration");
- configResponses.add(cfgResponse);
- }
-
- response.setResponses(configResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListClustersCmd.java b/api/src/com/cloud/api/commands/ListClustersCmd.java
deleted file mode 100755
index e571bf5..0000000
--- a/api/src/com/cloud/api/commands/ListClustersCmd.java
+++ /dev/null
@@ -1,144 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ClusterResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.org.Cluster;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists clusters.", responseObject=ClusterResponse.class)
-public class ListClustersCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
-
- private static final String s_name = "listclustersresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="cluster")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists clusters by the cluster ID")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists clusters by the cluster name")
- private String clusterName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists clusters by Pod ID")
- private Long podId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="lists clusters by hypervisor type")
- private String hypervisorType;
-
- @Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, description="lists clusters by cluster type")
- private String clusterType;
-
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="lists clusters by allocation state")
- private String allocationState;
-
- @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
- private String managedState;
-
- @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
- private Boolean showCapacities;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getClusterName() {
- return clusterName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getHypervisorType() {
- return hypervisorType;
- }
-
- public String getClusterType() {
- return clusterType;
- }
-
- public String getAllocationState() {
- return allocationState;
- }
-
-
- public String getManagedstate() {
- return managedState;
- }
-
- public void setManagedstate(String managedstate) {
- this.managedState = managedstate;
- }
-
-
- public Boolean getShowCapacities() {
- return showCapacities;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Cluster>, Integer> result = _mgr.searchForClusters(this);
- ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
- List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
- for (Cluster cluster : result.first()) {
- ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster,showCapacities);
- clusterResponse.setObjectName("cluster");
- clusterResponses.add(clusterResponse);
- }
-
- response.setResponses(clusterResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListConditionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListConditionsCmd.java b/api/src/com/cloud/api/commands/ListConditionsCmd.java
deleted file mode 100644
index 4d50b8b..0000000
--- a/api/src/com/cloud/api/commands/ListConditionsCmd.java
+++ /dev/null
@@ -1,96 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ConditionResponse;
-import com.cloud.api.response.CounterResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.as.Condition;
-
-@Implementation(description = "List Conditions for the specific user", responseObject = CounterResponse.class)
-public class ListConditionsCmd extends BaseListAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListConditionsCmd.class.getName());
- private static final String s_name = "listconditionsresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName = "conditions")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = false, description = "ID of the Condition.")
- private Long id;
-
- @IdentityMapper(entityTableName = "counter")
- @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.LONG, required = false, description = "Counter-id of the condition.")
- private Long counterId;
-
- @IdentityMapper(entityTableName="autoscale_policies")
- @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.LONG, description = "the ID of the policy")
- private Long policyId;
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public void execute() {
- List<? extends Condition> conditions = null;
- conditions = _autoScaleService.listConditions(this);
- ListResponse<ConditionResponse> response = new ListResponse<ConditionResponse>();
- List<ConditionResponse> cndnResponses = new ArrayList<ConditionResponse>();
- for (Condition cndn : conditions) {
- ConditionResponse cndnResponse = _responseGenerator.createConditionResponse(cndn);
- cndnResponses.add(cndnResponse);
- }
-
- response.setResponses(cndnResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- // /////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getCounterId() {
- return counterId;
- }
-
- public Long getPolicyId() {
- return policyId;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListCountersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCountersCmd.java b/api/src/com/cloud/api/commands/ListCountersCmd.java
deleted file mode 100644
index 60108ca..0000000
--- a/api/src/com/cloud/api/commands/ListCountersCmd.java
+++ /dev/null
@@ -1,99 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.CounterResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.as.Counter;
-import com.cloud.user.Account;
-
-@Implementation(description = "List the counters", responseObject = CounterResponse.class)
-public class ListCountersCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListCountersCmd.class.getName());
- private static final String s_name = "counterresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName = "counter")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "ID of the Counter.")
- private Long id;
-
- @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the counter.")
- private String name;
-
- @Parameter(name = ApiConstants.SOURCE, type = CommandType.STRING, description = "Source of the counter.")
- private String source;
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public void execute() {
- List<? extends Counter> counters = null;
- counters = _autoScaleService.listCounters(this);
- ListResponse<CounterResponse> response = new ListResponse<CounterResponse>();
- List<CounterResponse> ctrResponses = new ArrayList<CounterResponse>();
- for (Counter ctr : counters) {
- CounterResponse ctrResponse = _responseGenerator.createCounterResponse(ctr);
- ctrResponses.add(ctrResponse);
- }
-
- response.setResponses(ctrResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- // /////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSource() {
- return source;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java b/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java
deleted file mode 100644
index fbf655d..0000000
--- a/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java
+++ /dev/null
@@ -1,94 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.DiskOfferingResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.offering.DiskOffering;
-
-@Implementation(description="Lists all available disk offerings.", responseObject=DiskOfferingResponse.class)
-public class ListDiskOfferingsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListDiskOfferingsCmd.class.getName());
-
- private static final String s_name = "listdiskofferingsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain of the disk offering.")
- private Long domainId;
-
- @IdentityMapper(entityTableName="disk_offering")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the disk offering")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the disk offering")
- private String diskOfferingName;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getDiskOfferingName() {
- return diskOfferingName;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends DiskOffering> result = _mgr.searchForDiskOfferings(this);
- ListResponse<DiskOfferingResponse> response = new ListResponse<DiskOfferingResponse>();
- List<DiskOfferingResponse> diskOfferingResponses = new ArrayList<DiskOfferingResponse>();
- for (DiskOffering offering : result) {
- DiskOfferingResponse diskOffResp = _responseGenerator.createDiskOfferingResponse(offering);
- diskOffResp.setObjectName("diskoffering");
- diskOfferingResponses.add(diskOffResp);
- }
-
- response.setResponses(diskOfferingResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java b/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java
deleted file mode 100644
index bb0dd7f..0000000
--- a/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java
+++ /dev/null
@@ -1,101 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.DomainResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.domain.Domain;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all children domains belonging to a specified domain", responseObject=DomainResponse.class)
-public class ListDomainChildrenCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListDomainChildrenCmd.class.getName());
-
- private static final String s_name = "listdomainchildrenresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list children domain by parent domain ID.")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list children domains by name")
- private String domainName;
-
- @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".")
- private Boolean recursive;
-
- @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
- private Boolean listAll;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getDomainName() {
- return domainName;
- }
-
- public boolean listAll() {
- return listAll == null ? false : listAll;
- }
-
- public boolean isRecursive() {
- return recursive == null ? false : recursive;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Domain>, Integer> result = _domainService.searchForDomainChildren(this);
- ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
- List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
- for (Domain domain : result.first()) {
- DomainResponse domainResponse = _responseGenerator.createDomainResponse(domain);
- domainResponse.setObjectName("domain");
- domainResponses.add(domainResponse);
- }
-
- response.setResponses(domainResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListDomainsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListDomainsCmd.java b/api/src/com/cloud/api/commands/ListDomainsCmd.java
deleted file mode 100644
index 93d1570..0000000
--- a/api/src/com/cloud/api/commands/ListDomainsCmd.java
+++ /dev/null
@@ -1,101 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.DomainResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.domain.Domain;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists domains and provides detailed information for listed domains", responseObject=DomainResponse.class)
-public class ListDomainsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListDomainsCmd.class.getName());
-
- private static final String s_name = "listdomainsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List domain by domain ID.")
- private Long id;
-
- @Parameter(name=ApiConstants.LEVEL, type=CommandType.INTEGER, description="List domains by domain level.")
- private Integer level;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List domain by domain name.")
- private String domainName;
-
- @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
- private Boolean listAll;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Integer getLevel() {
- return level;
- }
-
- public String getDomainName() {
- return domainName;
- }
-
- public boolean listAll() {
- return listAll == null ? false : listAll;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Domain>, Integer> result = _domainService.searchForDomains(this);
- ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
- List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
- for (Domain domain : result.first()) {
- DomainResponse domainResponse = _responseGenerator.createDomainResponse(domain);
- domainResponse.setObjectName("domain");
- domainResponses.add(domainResponse);
- }
-
- response.setResponses(domainResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListEventTypesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListEventTypesCmd.java b/api/src/com/cloud/api/commands/ListEventTypesCmd.java
deleted file mode 100644
index cd1d129..0000000
--- a/api/src/com/cloud/api/commands/ListEventTypesCmd.java
+++ /dev/null
@@ -1,60 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.response.EventTypeResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.user.Account;
-
-@Implementation(description = "List Event Types", responseObject = EventTypeResponse.class)
-public class ListEventTypesCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(ListEventTypesCmd.class.getName());
- private static final String s_name = "listeventtypesresponse";
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute() {
- String[] result = _mgr.listEventTypes();
- ListResponse<EventTypeResponse> response = new ListResponse<EventTypeResponse>();
- ArrayList<EventTypeResponse> responses = new ArrayList<EventTypeResponse>();
- if (result != null) {
- for (String eventType : result) {
- EventTypeResponse eventTypeResponse = new EventTypeResponse();
- eventTypeResponse.setName(eventType);
- eventTypeResponse.setObjectName("eventtype");
- responses.add(eventTypeResponse);
- }
- }
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}