incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [7/10] git commit: api_refactor: move vpn related apis to user.vpn
Date Wed, 05 Dec 2012 23:01:15 GMT
api_refactor: move vpn related apis to user.vpn

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


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

Branch: refs/heads/api_refactoring
Commit: 55364478e5e26a33951172a7bc69c3454e047548
Parents: 8d8285a
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Wed Dec 5 14:24:26 2012 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Wed Dec 5 14:24:26 2012 -0800

----------------------------------------------------------------------
 .../cloud/network/vpn/RemoteAccessVpnService.java  |    2 +-
 .../api/user/user/command/AddVpnUserCmd.java       |  150 +++++++++++++++
 .../api/user/user/command/ListVpnUsersCmd.java     |   85 ++++++++
 .../api/user/user/command/RemoveVpnUserCmd.java    |  122 ++++++++++++
 .../api/user/vpn/command/AddVpnUserCmd.java        |  150 ---------------
 .../api/user/vpn/command/ListVpnUsersCmd.java      |   85 --------
 .../api/user/vpn/command/RemoveVpnUserCmd.java     |  122 ------------
 .../cloud/api/commands/test/AddVpnUserCmdTest.java |    2 +-
 client/tomcatconf/commands.properties.in           |    6 +-
 .../network/vpn/RemoteAccessVpnManagerImpl.java    |    2 +-
 10 files changed, 363 insertions(+), 363 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index 80a23e9..6f6a817 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -19,7 +19,7 @@ package com.cloud.network.vpn;
 import java.util.List;
 
 import org.apache.cloudstack.api.user.vpn.command.ListRemoteAccessVpnsCmd;
-import org.apache.cloudstack.api.user.vpn.command.ListVpnUsersCmd;
+import org.apache.cloudstack.api.user.user.command.ListVpnUsersCmd;
 import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.RemoteAccessVpn;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/user/command/AddVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/user/command/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/user/user/command/AddVpnUserCmd.java
new file mode 100644
index 0000000..520db9d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/user/command/AddVpnUserCmd.java
@@ -0,0 +1,150 @@
+// 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.user.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+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.VpnUsersResponse;
+import com.cloud.domain.Domain;
+import com.cloud.event.EventTypes;
+import com.cloud.network.VpnUser;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Adds vpn users", responseObject=VpnUsersResponse.class)
+public class AddVpnUserCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(AddVpnUserCmd.class.getName());
+
+    private static final String s_name = "addvpnuserresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="username
for the vpn user")
+    private String userName;
+
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="password
for the username")
+    private String password;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional
account for the vpn user. Must be used with domainId.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="projects")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="add vpn
user to the specific project")
+    private Long projectId;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional
domainId for the vpn user. If the account parameter is used, domainId must also be used.")
+    private Long domainId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+        if (accountId == null) {
+            return UserContext.current().getCaller().getId();
+        }
+
+        return accountId;
+    }
+
+    public String getEntityTable() {
+        return "vpn_users";
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Add Remote Access VPN user for account " + getEntityOwnerId() + " username=
" + getUserName();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VPN_USER_ADD;
+    }
+
+    @Override
+    public void execute(){
+            VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
+            Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
+            if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
+                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
+            }
+
+            VpnUsersResponse vpnResponse = new VpnUsersResponse();
+            vpnResponse.setId(vpnUser.getId());
+            vpnResponse.setUserName(vpnUser.getUsername());
+            vpnResponse.setAccountName(account.getAccountName());
+
+            vpnResponse.setDomainId(account.getDomainId());
+            vpnResponse.setDomainName(_entityMgr.findById(Domain.class, account.getDomainId()).getName());
+
+            vpnResponse.setResponseName(getCommandName());
+            vpnResponse.setObjectName("vpnuser");
+            this.setResponseObject(vpnResponse);
+    }
+
+    @Override
+    public void create() {
+        Account owner = _accountService.getAccount(getEntityOwnerId());
+
+        VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
+        if (vpnUser == null) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
+        }
+        setEntityId(vpnUser.getId());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/user/command/ListVpnUsersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/user/command/ListVpnUsersCmd.java b/api/src/org/apache/cloudstack/api/user/user/command/ListVpnUsersCmd.java
new file mode 100644
index 0000000..1b1bcbb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/user/command/ListVpnUsersCmd.java
@@ -0,0 +1,85 @@
+// 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.user.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.VpnUsersResponse;
+import com.cloud.network.VpnUser;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists vpn users", responseObject=VpnUsersResponse.class)
+public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger (ListVpnUsersCmd.class.getName());
+
+    private static final String s_name = "listvpnusersresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="vpn_users")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the vpn
user")
+    private Long id;
+
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username
of the vpn user.")
+    private String userName;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getUsername() {
+        return userName;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute(){
+        Pair<List<? extends VpnUser>, Integer> vpnUsers = _ravService.searchForVpnUsers(this);
+
+        ListResponse<VpnUsersResponse> response = new ListResponse<VpnUsersResponse>();
+        List<VpnUsersResponse> vpnResponses = new ArrayList<VpnUsersResponse>();
+        for (VpnUser vpnUser : vpnUsers.first()) {
+            vpnResponses.add(_responseGenerator.createVpnUserResponse(vpnUser));
+        }
+
+        response.setResponses(vpnResponses, vpnUsers.second());
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/user/command/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/user/command/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/user/user/command/RemoveVpnUserCmd.java
new file mode 100644
index 0000000..51d44fe
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/user/command/RemoveVpnUserCmd.java
@@ -0,0 +1,122 @@
+// 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.user.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Removes vpn user", responseObject=SuccessResponse.class)
+public class RemoveVpnUserCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RemoveVpnUserCmd.class.getName());
+
+    private static final String s_name = "removevpnuserresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="username
for the vpn user")
+    private String userName;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional
account for the vpn user. Must be used with domainId.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="projects")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="remove vpn
user from the project")
+    private Long projectId;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional
domainId for the vpn user. If the account parameter is used, domainId must also be used.")
+    private Long domainId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public Long getProjecId() {
+        return projectId;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+        if (accountId == null) {
+            return UserContext.current().getCaller().getId();
+        }
+
+        return accountId;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username=
" + getUserName();
+    }
+
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VPN_USER_REMOVE;
+    }
+
+    @Override
+    public void execute(){
+        Account owner = _accountService.getAccount(getEntityOwnerId());
+        boolean result = _ravService.removeVpnUser(owner.getId(), userName, UserContext.current().getCaller());
+        if (!result) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
+        }
+
+        if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user
removal");
+        }
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/vpn/command/AddVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/AddVpnUserCmd.java
deleted file mode 100644
index 537356b..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/AddVpnUserCmd.java
+++ /dev/null
@@ -1,150 +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 org.apache.cloudstack.api.user.vpn.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-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.VpnUsersResponse;
-import com.cloud.domain.Domain;
-import com.cloud.event.EventTypes;
-import com.cloud.network.VpnUser;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Adds vpn users", responseObject=VpnUsersResponse.class)
-public class AddVpnUserCmd extends BaseAsyncCreateCmd {
-    public static final Logger s_logger = Logger.getLogger(AddVpnUserCmd.class.getName());
-
-    private static final String s_name = "addvpnuserresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="username
for the vpn user")
-    private String userName;
-
-    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="password
for the username")
-    private String password;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional
account for the vpn user. Must be used with domainId.")
-    private String accountName;
-
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="add vpn
user to the specific project")
-    private Long projectId;
-
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional
domainId for the vpn user. If the account parameter is used, domainId must also be used.")
-    private Long domainId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public Long getProjectId() {
-        return projectId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
-        if (accountId == null) {
-            return UserContext.current().getCaller().getId();
-        }
-
-        return accountId;
-    }
-
-    public String getEntityTable() {
-        return "vpn_users";
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Add Remote Access VPN user for account " + getEntityOwnerId() + " username=
" + getUserName();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPN_USER_ADD;
-    }
-
-    @Override
-    public void execute(){
-            VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
-            Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
-            if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
-            }
-
-            VpnUsersResponse vpnResponse = new VpnUsersResponse();
-            vpnResponse.setId(vpnUser.getId());
-            vpnResponse.setUserName(vpnUser.getUsername());
-            vpnResponse.setAccountName(account.getAccountName());
-
-            vpnResponse.setDomainId(account.getDomainId());
-            vpnResponse.setDomainName(_entityMgr.findById(Domain.class, account.getDomainId()).getName());
-
-            vpnResponse.setResponseName(getCommandName());
-            vpnResponse.setObjectName("vpnuser");
-            this.setResponseObject(vpnResponse);
-    }
-
-    @Override
-    public void create() {
-        Account owner = _accountService.getAccount(getEntityOwnerId());
-
-        VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
-        if (vpnUser == null) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
-        }
-        setEntityId(vpnUser.getId());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/vpn/command/ListVpnUsersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/ListVpnUsersCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/ListVpnUsersCmd.java
deleted file mode 100644
index 72b3ec1..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/ListVpnUsersCmd.java
+++ /dev/null
@@ -1,85 +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 org.apache.cloudstack.api.user.vpn.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VpnUsersResponse;
-import com.cloud.network.VpnUser;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists vpn users", responseObject=VpnUsersResponse.class)
-public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd {
-    public static final Logger s_logger = Logger.getLogger (ListVpnUsersCmd.class.getName());
-
-    private static final String s_name = "listvpnusersresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="vpn_users")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the vpn
user")
-    private Long id;
-
-    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username
of the vpn user.")
-    private String userName;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getUsername() {
-        return userName;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public void execute(){
-        Pair<List<? extends VpnUser>, Integer> vpnUsers = _ravService.searchForVpnUsers(this);
-
-        ListResponse<VpnUsersResponse> response = new ListResponse<VpnUsersResponse>();
-        List<VpnUsersResponse> vpnResponses = new ArrayList<VpnUsersResponse>();
-        for (VpnUser vpnUser : vpnUsers.first()) {
-            vpnResponses.add(_responseGenerator.createVpnUserResponse(vpnUser));
-        }
-
-        response.setResponses(vpnResponses, vpnUsers.second());
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/src/org/apache/cloudstack/api/user/vpn/command/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/RemoveVpnUserCmd.java
deleted file mode 100644
index ee23087..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/RemoveVpnUserCmd.java
+++ /dev/null
@@ -1,122 +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 org.apache.cloudstack.api.user.vpn.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Removes vpn user", responseObject=SuccessResponse.class)
-public class RemoveVpnUserCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(RemoveVpnUserCmd.class.getName());
-
-    private static final String s_name = "removevpnuserresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="username
for the vpn user")
-    private String userName;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional
account for the vpn user. Must be used with domainId.")
-    private String accountName;
-
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="remove vpn
user from the project")
-    private Long projectId;
-
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional
domainId for the vpn user. If the account parameter is used, domainId must also be used.")
-    private Long domainId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public Long getProjecId() {
-        return projectId;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
-        if (accountId == null) {
-            return UserContext.current().getCaller().getId();
-        }
-
-        return accountId;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username=
" + getUserName();
-    }
-
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPN_USER_REMOVE;
-    }
-
-    @Override
-    public void execute(){
-        Account owner = _accountService.getAccount(getEntityOwnerId());
-        boolean result = _ravService.removeVpnUser(owner.getId(), userName, UserContext.current().getCaller());
-        if (!result) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
-        }
-
-        if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user
removal");
-        }
-        SuccessResponse response = new SuccessResponse(getCommandName());
-        setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/api/test/src/com/cloud/api/commands/test/AddVpnUserCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/api/commands/test/AddVpnUserCmdTest.java b/api/test/src/com/cloud/api/commands/test/AddVpnUserCmdTest.java
index 0d2945d..ce5d4f2 100644
--- a/api/test/src/com/cloud/api/commands/test/AddVpnUserCmdTest.java
+++ b/api/test/src/com/cloud/api/commands/test/AddVpnUserCmdTest.java
@@ -19,7 +19,7 @@ package src.com.cloud.api.commands.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.cloudstack.api.user.vpn.command.AddVpnUserCmd;
+import org.apache.cloudstack.api.user.user.command.AddVpnUserCmd;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index cb3f078..de7cc2a 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -297,9 +297,9 @@ createRemoteAccessVpn=org.apache.cloudstack.api.user.vpn.command.CreateRemoteAcc
 deleteRemoteAccessVpn=org.apache.cloudstack.api.user.vpn.command.DeleteRemoteAccessVpnCmd;15
 listRemoteAccessVpns=org.apache.cloudstack.api.user.vpn.command.ListRemoteAccessVpnsCmd;15
 
-addVpnUser=org.apache.cloudstack.api.user.vpn.command.AddVpnUserCmd;15
-removeVpnUser=org.apache.cloudstack.api.user.vpn.command.RemoveVpnUserCmd;15
-listVpnUsers=org.apache.cloudstack.api.user.vpn.command.ListVpnUsersCmd;15
+addVpnUser=org.apache.cloudstack.api.user.user.command.AddVpnUserCmd;15
+removeVpnUser=org.apache.cloudstack.api.user.user.command.RemoveVpnUserCmd;15
+listVpnUsers=org.apache.cloudstack.api.user.user.command.ListVpnUsersCmd;15
 
 #### network offering commands
 createNetworkOffering=org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;1

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/55364478/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 5ccccf0..1c60251 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -23,7 +23,7 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.api.user.vpn.command.ListVpnUsersCmd;
+import org.apache.cloudstack.api.user.user.command.ListVpnUsersCmd;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.user.vpn.command.ListRemoteAccessVpnsCmd;


Mime
View raw message