Junos Space SDK > Developer Guides > Junos Space Application Developer Guide > Programming with the Junos Space SDK > Using the Junos Space SDK Plug-in > Validating the Application

Junos Space Custom Rules

The following table lists some of the PMD rules integrated in the Junos Space SDK. To see all the PMD rules for the JunosSpace SDK, go to PMD preference in Eclipse. These custom rules assist in validating a Junos Space application. The rules are listed in the "junos-space-ruleset.xml" file in the Eclipse directory.

RULE NAME RULE DESCRIPTION
MissingHttpMethodRule Verifies that Http Method annotation(@GET/@POST/@PUT/@DELETE) is present on every rest method that is annotated with @Path/@Produces/@Consumes annotation.
PathExistenceRule Verifies that @Path annotation is present on class/interface of every rest method.
MissingProducesRule Verifies that if the REST method is returning DTO, @Produces annotation is present either on REST method or on Interface/Class.
AvoidProducesRule Verifies that if the REST method is not returning anything (for example, return type is 'void'), @Produces annotation is not used on REST method .
MissingConsumesRule Verifies that if the REST method is expecting DTO as an input parameter, @Consumes annotation is present either on method or on Interface/Class.
AvoidConsumesFor NoParameterRule Verifies that if the REST method is not expecting input, @Consumes annotation is not used on REST method.
AvoidConsumesForAnnotation ParameterOnlyRule Verifies that if the REST method is expecting only @PathParam or/and @QueryParam as input parameter(s), @Consumes annotation is not used on REST method.
InvalidRESTMethodRule Verifies that the REST method does not have more than one DTO as an input parameter.
InvalidPathParamRule Verifies that if the REST method is expecting @PathParam as an input parameter, the attribute in @PathParam is present with in curly braces in @Path annotation of REST method or class.
InvalidPathRule Verifies that if the REST method is expecting @PathParam as input parameter, the attribute is not repeated in @Path annotation.
MissingPathParamRule Verifies that if the REST method is not expecting @PathParam as an input parameter, the attribute in @Path (on method or class) does not have path param identifier within curly braces.
CapabilityValidityRule Verifies that if the @RBAC annotation is defined with capability on REST method, that capability exists in module.xml.
MissingRBACRule Verifies that the @RBAC annotation is present on REST method.
InvalidMethodRule Verifies that if the REST method:
Starts with 'add...' Http method is POST
Starts with 'get...' Http method is GET
Starts with 'update...' Http method is PUT
Starts with 'delete...' Http method is DELETE .
InconsistentRBACRule Verifies that if the REST method:
Starts with 'add...', the type in @RBAC is CRUDEnum.CREATE
Starts with 'get...', the type in @RBAC is CRUDEnum.READ
Starts with 'update...', the type in @RBAC is CRUDEnum.UPDATE
Starts with 'delete...', the type in @RBAC is CRUDEnum.DELETE
ProducesMediaType ValidationRule Verifies that if @Produces annotation is defined on a REST method and the method is returning DTO, the media type in @Produces annotation should starts with 'application/'.
ConsumesMediaType ValidationRule Verifies that if @Consumes annotation is defined on a REST method and the method is expecting DTO as an input, the media type in @Consumes annotation starts with 'application/'.
MissingCharsetIn MediaTypeRule Verifies that if @Consumes annotation is defined on a REST method and the media type contains semicolon (;), the media type has ';charset=UTF-8'.
InvalidDTORule States that if the REST method is expects or returns DTO, DTO has @XmlRootElement annotation.
InvalidDeleteUsageRule Verifies that if the REST method has @DELETE annotation, REST method neither expects DTO nor has @Consumes annotation.
RestResourceNot Discoverable Verifies that web.xml in websvc project has InfoServiceInterceptor listener defined after RestEasyBootStrap listener and that value of resteasy.scan context parameter is true.
MoreThanOneHttp MethodRule Verifies that more than one HTTP method annotation is not present on a REST method.
InvalidXMLAccessor TypeUsageRule Verifies that for every REST method that is expects or returns DTO that is annotated with @XmlAccessorType(XmlAccessType.NONE) annotation, that DTO has at least one field or method with @XmlElement or @XmlAttribute annotation on it.
JxServiceLocatorRule Verifies that REST implementation has used JxServiceLocator.lookup code for initialization of bean.
MissingSortableFilterableUsageRule Verifies that if REST method supports Sorting/Filtering/Paging and method returns some DTO, that DTO has @Sortable or @Filterable annotation on any method or field.
MissingRootLevelSchemaRule Verifies that for each REST implementation that has @XmlRootElement annotation and REST interface with a root method, there is root level schema defined.