Updated Branches:
  refs/heads/api_refactoring 780eb9583 -> 5d998a616

api_refactor: move forgotten apis, uncomment and fix mappings

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5d998a61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5d998a61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5d998a61

Branch: refs/heads/api_refactoring
Commit: 5d998a616bdce93375794439e4a8171bf946b414
Parents: 089db9c
Author: Rohit Yadav <[email protected]>
Authored: Thu Dec 6 11:32:10 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Thu Dec 6 11:32:10 2012 -0800

----------------------------------------------------------------------
 api/src/com/cloud/api/commands/LockAccountCmd.java |   89 ----------
 api/src/com/cloud/api/commands/LockUserCmd.java    |   84 ----------
 .../api/commands/UpdatePortForwardingRuleCmd.java  |  129 ---------------
 .../api/admin/account/command/LockAccountCmd.java  |   89 ++++++++++
 .../api/admin/user/command/LockUserCmd.java        |   84 ++++++++++
 .../command/UpdatePortForwardingRuleCmd.java       |  129 +++++++++++++++
 client/tomcatconf/commands.properties.in           |    6 +-
 7 files changed, 305 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/com/cloud/api/commands/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LockAccountCmd.java 
b/api/src/com/cloud/api/commands/LockAccountCmd.java
deleted file mode 100644
index 9cb075f..0000000
--- a/api/src/com/cloud/api/commands/LockAccountCmd.java
+++ /dev/null
@@ -1,89 +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 com.cloud.api.response.AccountResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Locks an account", 
responseObject=AccountResponse.class)
-public class LockAccountCmd extends BaseCmd {
-    public static final Logger s_logger = 
Logger.getLogger(LockAccountCmd.class.getName());
-
-    private static final String s_name = "lockaccountresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
required=true, description="Locks the specified account.")
-    private String accountName;
-
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, 
required=true, description="Locks the specified account on this domain.")
-    private Long domainId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = 
_accountService.getActiveAccountByName(getAccountName(), getDomainId());
-        if (account != null) {
-            return account.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent 
this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute(){
-//        Account result = null;
-        //result = _accountService.lockAccount(this);
-//        if (result != null){
-//            AccountResponse response = 
_responseGenerator.createAccountResponse(result);
-//            response.setResponseName(getCommandName());
-//            this.setResponseObject(response);
-//        } else {
-//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
lock account");
-//        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/com/cloud/api/commands/LockUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LockUserCmd.java 
b/api/src/com/cloud/api/commands/LockUserCmd.java
deleted file mode 100644
index 7ce4efe..0000000
--- a/api/src/com/cloud/api/commands/LockUserCmd.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 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.UserResponse;
-import com.cloud.user.Account;
-import com.cloud.user.User;
-import com.cloud.user.UserAccount;
-
-@Implementation(description="Locks a user account", 
responseObject=UserResponse.class)
-public class LockUserCmd extends BaseCmd {
-    public static final Logger s_logger = 
Logger.getLogger(LockUserCmd.class.getName());
-
-    private static final String s_name = "lockuserresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="user")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="Locks user by user ID.")
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        User user = _entityMgr.findById(User.class, getId());
-        if (user != null) {
-            return user.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent 
this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute(){
-        UserAccount user = _accountService.lockUser(getId());
-        if (user != null){
-            UserResponse response = 
_responseGenerator.createUserResponse(user);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
lock user");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java 
b/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
deleted file mode 100644
index 5266897..0000000
--- a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
+++ /dev/null
@@ -1,129 +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.BaseAsyncCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.FirewallRuleResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.IpAddress;
-import com.cloud.user.Account;
-
-@Implementation(responseObject=FirewallRuleResponse.class, 
description="Updates a port forwarding rule.  Only the private port and the 
virtual machine can be updated.")
-public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = 
Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
-    private static final String s_name = "updateportforwardingruleresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.PRIVATE_IP, type=CommandType.STRING, 
description="the private IP address of the port forwarding rule")
-    private String privateIp;
-
-    @Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, 
required=true, description="the private port of the port forwarding rule")
-    private String privatePort;
-
-    @Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, 
required=true, description="the protocol for the port fowarding rule. Valid 
values are TCP or UDP.")
-    private String protocol;
-
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
required=true, description="the IP address id of the port forwarding rule")
-    private Long publicIpId;
-
-    @Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, 
required=true, description="the public port of the port forwarding rule")
-    private String publicPort;
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, 
description="the ID of the virtual machine for the port forwarding rule")
-    private Long virtualMachineId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getPrivateIp() {
-        return privateIp;
-    }
-
-    public String getPrivatePort() {
-        return privatePort;
-    }
-
-    public String getProtocol() {
-        return protocol;
-    }
-
-    public Long getPublicIpId() {
-        return publicIpId;
-    }
-
-    public String getPublicPort() {
-        return publicPort;
-    }
-
-    public Long getVirtualMachineId() {
-        return virtualMachineId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        IpAddress addr = _entityMgr.findById(IpAddress.class, getPublicIpId());
-        if (addr != null) {
-            return addr.getAccountId();
-        }
-
-        // bad address given, parent this command to SYSTEM so ERROR events 
are tracked
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_NET_RULE_MODIFY;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "updating port forwarding rule";
-    }
-
-    @Override
-    public void execute(){
-//FIXME:        PortForwardingRule result = 
_mgr.updatePortForwardingRule(this);
-//        if (result != null) {
-//            FirewallRuleResponse response = 
_responseGenerator.createFirewallRuleResponse(result);
-//            response.setResponseName(getName());
-//            this.setResponseObject(response);
-//        } else {
-//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
update port forwarding rule");
-//        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/org/apache/cloudstack/api/admin/account/command/LockAccountCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/admin/account/command/LockAccountCmd.java 
b/api/src/org/apache/cloudstack/api/admin/account/command/LockAccountCmd.java
new file mode 100644
index 0000000..a8a06f0
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/admin/account/command/LockAccountCmd.java
@@ -0,0 +1,89 @@
+// 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.account.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 com.cloud.api.response.AccountResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Locks an account", 
responseObject=AccountResponse.class)
+public class LockAccountCmd extends BaseCmd {
+    public static final Logger s_logger = 
Logger.getLogger(LockAccountCmd.class.getName());
+
+    private static final String s_name = "lockaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
required=true, description="Locks the specified account.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, 
required=true, description="Locks the specified account on this domain.")
+    private Long domainId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = 
_accountService.getActiveAccountByName(getAccountName(), getDomainId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent 
this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute(){
+//        Account result = null;
+        //result = _accountService.lockAccount(this);
+//        if (result != null){
+//            AccountResponse response = 
_responseGenerator.createAccountResponse(result);
+//            response.setResponseName(getCommandName());
+//            this.setResponseObject(response);
+//        } else {
+//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
lock account");
+//        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/org/apache/cloudstack/api/admin/user/command/LockUserCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/admin/user/command/LockUserCmd.java 
b/api/src/org/apache/cloudstack/api/admin/user/command/LockUserCmd.java
new file mode 100644
index 0000000..8215fd5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/user/command/LockUserCmd.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.user.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.UserResponse;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.user.UserAccount;
+
+@Implementation(description="Locks a user account", 
responseObject=UserResponse.class)
+public class LockUserCmd extends BaseCmd {
+    public static final Logger s_logger = 
Logger.getLogger(LockUserCmd.class.getName());
+
+    private static final String s_name = "lockuserresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="user")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="Locks user by user ID.")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        User user = _entityMgr.findById(User.class, getId());
+        if (user != null) {
+            return user.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent 
this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute(){
+        UserAccount user = _accountService.lockUser(getId());
+        if (user != null){
+            UserResponse response = 
_responseGenerator.createUserResponse(user);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
lock user");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/api/src/org/apache/cloudstack/api/user/firewall/command/UpdatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/user/firewall/command/UpdatePortForwardingRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/user/firewall/command/UpdatePortForwardingRuleCmd.java
new file mode 100644
index 0000000..654e6af
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/user/firewall/command/UpdatePortForwardingRuleCmd.java
@@ -0,0 +1,129 @@
+// 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.user.firewall.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.FirewallRuleResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.network.IpAddress;
+import com.cloud.user.Account;
+
+@Implementation(responseObject=FirewallRuleResponse.class, 
description="Updates a port forwarding rule.  Only the private port and the 
virtual machine can be updated.")
+public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = 
Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
+    private static final String s_name = "updateportforwardingruleresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.PRIVATE_IP, type=CommandType.STRING, 
description="the private IP address of the port forwarding rule")
+    private String privateIp;
+
+    @Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, 
required=true, description="the private port of the port forwarding rule")
+    private String privatePort;
+
+    @Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, 
required=true, description="the protocol for the port fowarding rule. Valid 
values are TCP or UDP.")
+    private String protocol;
+
+    @IdentityMapper(entityTableName="user_ip_address")
+    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
required=true, description="the IP address id of the port forwarding rule")
+    private Long publicIpId;
+
+    @Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, 
required=true, description="the public port of the port forwarding rule")
+    private String publicPort;
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, 
description="the ID of the virtual machine for the port forwarding rule")
+    private Long virtualMachineId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getPrivateIp() {
+        return privateIp;
+    }
+
+    public String getPrivatePort() {
+        return privatePort;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public Long getPublicIpId() {
+        return publicIpId;
+    }
+
+    public String getPublicPort() {
+        return publicPort;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        IpAddress addr = _entityMgr.findById(IpAddress.class, getPublicIpId());
+        if (addr != null) {
+            return addr.getAccountId();
+        }
+
+        // bad address given, parent this command to SYSTEM so ERROR events 
are tracked
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NET_RULE_MODIFY;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "updating port forwarding rule";
+    }
+
+    @Override
+    public void execute(){
+//FIXME:        PortForwardingRule result = 
_mgr.updatePortForwardingRule(this);
+//        if (result != null) {
+//            FirewallRuleResponse response = 
_responseGenerator.createFirewallRuleResponse(result);
+//            response.setResponseName(getName());
+//            this.setResponseObject(response);
+//        } else {
+//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
update port forwarding rule");
+//        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d998a61/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in 
b/client/tomcatconf/commands.properties.in
index db5a134..d03937f 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -24,7 +24,7 @@ 
deleteAccount=org.apache.cloudstack.api.admin.account.command.DeleteAccountCmd;3
 
updateAccount=org.apache.cloudstack.api.admin.account.command.UpdateAccountCmd;3
 
disableAccount=org.apache.cloudstack.api.admin.account.command.DisableAccountCmd;7
 
enableAccount=org.apache.cloudstack.api.admin.account.command.EnableAccountCmd;7
-###lockAccount=com.cloud.api.commands.LockAccountCmd;7
+lockAccount=org.apache.cloudstack.api.admin.account.command.LockAccountCmd;7
 listAccounts=org.apache.cloudstack.api.user.account.command.ListAccountsCmd;15
 
markDefaultZoneForAccount=org.apache.cloudstack.api.admin.zone.command.MarkDefaultZoneForAccountCmd;1
 
@@ -33,7 +33,7 @@ 
createUser=org.apache.cloudstack.api.admin.user.command.CreateUserCmd;3
 deleteUser=org.apache.cloudstack.api.admin.user.command.DeleteUserCmd;3
 updateUser=org.apache.cloudstack.api.admin.user.command.UpdateUserCmd;3
 listUsers=org.apache.cloudstack.api.admin.user.command.ListUsersCmd;7
-####lockUser=com.cloud.api.commands.LockUserCmd;7
+lockUser=org.apache.cloudstack.api.admin.user.command.LockUserCmd;7
 disableUser=org.apache.cloudstack.api.admin.user.command.DisableUserCmd;7
 enableUser=org.apache.cloudstack.api.admin.user.command.EnableUserCmd;7
 getUser=org.apache.cloudstack.api.admin.user.command.GetUserCmd;1
@@ -132,7 +132,7 @@ 
listPublicIpAddresses=org.apache.cloudstack.api.user.address.command.ListPublicI
 
listPortForwardingRules=org.apache.cloudstack.api.user.firewall.command.ListPortForwardingRulesCmd;15
 
createPortForwardingRule=org.apache.cloudstack.api.user.firewall.command.CreatePortForwardingRuleCmd;15
 
deletePortForwardingRule=org.apache.cloudstack.api.user.firewall.command.DeletePortForwardingRuleCmd;15
-#### 
updatePortForwardingRule=com.cloud.api.commands.UpdatePortForwardingRuleCmd;15
+updatePortForwardingRule=org.apache.cloudstack.api.user.firewall.command.UpdatePortForwardingRuleCmd;15
 
 #### NAT commands
 
enableStaticNat=org.apache.cloudstack.api.user.nat.command.EnableStaticNatCmd;15

Reply via email to