Wednesday, November 5, 2014

When Configuring GZIP Interceptors

GZIPInInterceptor,

simple as creating instance and adding as in-Interceptor to service endpoint

GZIPOutInterceptor,

 simple as creating instance and adding as out-Interceptor to service endpoint, make sure to define threshold value when creating insance


        GZIPInInterceptor gzipInInterceptor = new GZIPInInterceptor();
        GZIPOutInterceptor gzipOutInterceptor = new GZIPOutInterceptor(0);
        server.getEndpoint().getInInterceptors().add(gzipInInterceptor);
        server.getEndpoint().getOutInterceptors().add(gzipOutInterceptor);

Monday, November 3, 2014

How to configure custom check style plugin

Mainly there are 3 files to configure

  1. checks.xml
  2. checkstyle-suppressions
  3. pom.xml
sample pom file to correctly define maven check-style plug in,

            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.10</version>
                <dependencies>
                    <dependency>
                        <groupId>com.intel.ase.osg</groupId>
                        <artifactId>com.intel.ase.osg.governance</artifactId>
                        <version>${ase.osg.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <configLocation>../com.intel.ase.osg.governance/src/main/resources/governance/osg_checks.xml</configLocation>
                            <suppressionsLocation>../com.intel.ase.osg.governance/src/main/resources/governance/checkstyle-suppressions.xml</suppressionsLocation>
                            <!--<headerLocation>governance/header.txt</headerLocation>-->
                            <propertyExpansion>config_loc=../com.intel.ase.osg.governance/src/main/resources/governance</propertyExpansion>
                            <consoleOutput>true</consoleOutput>
                            <failOnViolation>true</failOnViolation>
                            <includeTestSourceDirectory>false</includeTestSourceDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


  • How to suppress check-style validation for particular class
  1. Using SuppressionCommentFilter
we have to use "SuppressionCommentFilter"  see reference http://checkstyle.sourceforge.net/config.html#Modules


Sample java code usage after configuration,

public class IdentityServiceException extends Exception {

    // CHECKSTYLE:OFF
    private IdentityError error;
    // CHECKSTYLE:ON

..................................
 

2. Using suppress expression

include below line to checkstyle-suppressions.xml
   
<suppress files="TheClassToIgnore\.java" checks="[a-zA-Z0-9]*"/>