You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/24 03:07:07 UTC
[1/4] git commit: api: Finally get rid of IdentityMapper annotation
processing in ApiDispatcher
Updated Branches:
refs/heads/api_refactoring 1bd47d48a -> beb2fccf1
api: Finally get rid of IdentityMapper annotation processing in ApiDispatcher
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/beb2fccf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/beb2fccf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/beb2fccf
Branch: refs/heads/api_refactoring
Commit: beb2fccf1c8450d062bf1399416b185d9e77fe99
Parents: 042a8e7
Author: Rohit Yadav <bh...@apache.org>
Authored: Sun Dec 23 18:06:36 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Sun Dec 23 18:06:36 2012 -0800
----------------------------------------------------------------------
server/src/com/cloud/api/ApiDispatcher.java | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/beb2fccf/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 01b8363..a9d8af3 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -406,8 +406,6 @@ public class ApiDispatcher {
if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
continue;
}
- // APITODO Will remove this
- IdentityMapper identityMapper = field.getAnnotation(IdentityMapper.class);
//ACL checkAccess = field.getAnnotation(ACL.class);
@@ -423,7 +421,7 @@ public class ApiDispatcher {
// marshall the parameter into the correct type and set the field value
try {
- setFieldValue(field, cmd, paramObj, parameterAnnotation, identityMapper);
+ setFieldValue(field, cmd, paramObj, parameterAnnotation);
} catch (IllegalArgumentException argEx) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to execute API command " + cmd.getCommandName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name());
@@ -569,7 +567,7 @@ public class ApiDispatcher {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- private static void setFieldValue(Field field, BaseCmd cmdObj, Object paramObj, Parameter annotation, IdentityMapper identityMapper) throws IllegalArgumentException, ParseException {
+ private static void setFieldValue(Field field, BaseCmd cmdObj, Object paramObj, Parameter annotation) throws IllegalArgumentException, ParseException {
try {
field.setAccessible(true);
CommandType fieldType = annotation.type();
@@ -646,13 +644,7 @@ public class ApiDispatcher {
listParam.add(internalId);
break;
case LONG: {
- Long val = null;
- if (identityMapper != null)
- val = s_instance._identityDao.getIdentityId(identityMapper, token);
- else
- val = Long.valueOf(token);
-
- listParam.add(val);
+ listParam.add(Long.valueOf(token));
}
break;
case SHORT:
@@ -676,11 +668,7 @@ public class ApiDispatcher {
field.set(cmdObj, internalId);
break;
case LONG:
- // APITODO: Remove identityMapper, simply convert the over the wire param to Long
- if (identityMapper != null)
- field.set(cmdObj, s_instance._identityDao.getIdentityId(identityMapper, paramObj.toString()));
- else
- field.set(cmdObj, Long.valueOf(paramObj.toString()));
+ field.set(cmdObj, Long.valueOf(paramObj.toString()));
break;
case SHORT:
field.set(cmdObj, Short.valueOf(paramObj.toString()));