Skip to content

Commit 6a112bd

Browse files
committed
api: Rename Validator to Validate, cosmetic fixes
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent b00ed17 commit 6a112bd

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎api/src/com/cloud/acl/APIAccessChecker.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
* APIAccessChecker checks the ownership and access control to API requests
2828
*/
2929
public interface APIAccessChecker extends Adapter {
30-
// Interface for checking access to an API for a user
30+
// Interface for checking access to an API for an user
3131
boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException;
3232
}

api/src/org/apache/cloudstack/api/Validator.java renamed to api/src/org/apache/cloudstack/api/Validate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
@Retention(RetentionPolicy.RUNTIME)
2626
@Target({ FIELD })
27-
public @interface Validator {
27+
public @interface Validate {
2828
Class<?>[] validators() default Object.class;
2929
String description() default "";
3030
}

‎server/src/com/cloud/api/ApiDispatcher.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,19 @@ public static void setupParameters(BaseCmd cmd, Map<String, String> params, List
396396
}
397397

398398
for (Field field : fields) {
399-
//plug Services
399+
400400
PlugService plugServiceAnnotation = field.getAnnotation(PlugService.class);
401401
if(plugServiceAnnotation != null){
402402
plugService(field, cmd);
403403
}
404-
//APITODO: change the checking here
404+
405405
Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
406406
if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
407407
continue;
408408
}
409409

410-
//ACL checkAccess = field.getAnnotation(ACL.class);
411-
412-
Validator validators = field.getAnnotation(Validator.class);
410+
//TODO: Annotate @Validate on API Cmd classes, FIXME how to process Validate
411+
Validate validateAnnotation = field.getAnnotation(Validate.class);
413412
Object paramObj = unpackedParams.get(parameterAnnotation.name());
414413
if (paramObj == null) {
415414
if (parameterAnnotation.required()) {
@@ -530,7 +529,7 @@ public static void setupParameters(BaseCmd cmd, Map<String, String> params, List
530529

531530
}
532531

533-
//check access on the entities.
532+
//check access on the enstities.
534533
}
535534

536535
private static Long translateUuidToInternalId(String uuid, Parameter annotation)

0 commit comments

Comments
 (0)