Thursday, September 25, 2014

Generate XML Schema from Java class in Eclipse IDE



To generate xml schema definition (xsd) from java objects just it required few steps

 1. create jaxb project in eclipse.
 2. copy/create java pojo classes under src which u want to create as xml schema definition.
 3. right click on folder src in eclipse go to other-> jaxb-> generate xsd from javaclasses .
 4. XSD will generate from java classes.

Below is the link for detailed referece with steps

http://theopentutorials.com/examples/java/jaxb/generate-xml-schema-from-java-class-in-eclipse-ide/

Wednesday, July 30, 2014

autocomplete with elasticsearch

step:1-> Index with analyzer settings

{
   "settings": {
      "analysis": {
         "filter": {
            "nGram_filter": {
               "type": "nGram",
               "min_gram": 2,
               "max_gram": 20,
               "token_chars": [
                  "letter",
                  "digit",
                  "punctuation",
                  "symbol"
               ]
            }
         },
         "analyzer": {
            "nGram_analyzer": {
               "type": "custom",
               "tokenizer": "whitespace",
               "filter": [
                  "lowercase",
                  "asciifolding",
                  "nGram_filter"
               ]
            },
            "whitespace_analyzer": {
               "type": "custom",
               "tokenizer": "whitespace",
               "filter": [
                  "lowercase",
                  "asciifolding"
               ]
            }
         }
      }
   },
   "mappings": {
   
           "movies": {
         "_all": {
            "index_analyzer": "nGram_analyzer",
            "search_analyzer": "whitespace_analyzer"
         },
         "properties": {
            "addToCartUrl": {
               "type": "string",
               "index": "no",
               "include_in_all": false
            },
            "format": {
               "type": "string",
               "index": "not_analyzed"
            },
            "genre": {
               "type": "string",
               "index": "not_analyzed"
            },
            "image": {
               "type": "string",
               "index": "no",
               "include_in_all": false
            },
            "mpaaRating": {
               "type": "string",
               "index": "not_analyzed",
               "include_in_all": false
            },
            "name": {
               "type": "string",
               "index": "not_analyzed"
            },
            "plot": {
               "type": "string",
               "index": "no",
               "include_in_all": false
            },
            "price": {
               "type": "double",
               "include_in_all": false
            },
            "quantityLimit": {
               "type": "integer",
               "include_in_all": false
            },
            "releaseDate": {
               "type": "date",
               "format": "yyyy-MM-dd"
            },
            "sku": {
               "type": "string",
               "index": "not_analyzed"
            },
            "studio": {
               "type": "string",
               "index": "not_analyzed"
            }
         }
      }
   }
   }
}



Step:2-> index document

{
   "studio":"annapurna studios",
   "genre":"Fantasy",
   "mpaaRating":"G",
   "image":"http://images.bestbuy.com/BestBuy_US/en_US/images/musicmoviegame//pdpimages/1008628.jpg",
   "format":"DVD",
   "sku":1008628,
   "plot":"hyderabad",
   "releaseDate":"2013-08-06",
   "quantityLimit":3,
   "name":"The Sword in the Stone (DVD)",
   "addToCartUrl":"http://www.bestbuy.com/site/olspage.jsp?id=pcmcat152200050035&type=category&cmp=RMX&ky=2f5IBQ5bGt0gS6BfPZApsjVfKmtgVmI14&qvsids=1008628",
   "salePrice":21.99
}

Step:3-> query

{
   "size": 10,
   "query": {
      "match": {
         "_all": {
            "query": "anna",
            "operator": "and"
         }
      }
   }
}


Tuesday, January 7, 2014

Adobe Launched Adobe Edge Code CC For WEB Developers



Edge Code is a lightweight code editor for web developers and designers working with HTML, CSS, and JavaScript. Edge Code is built to work with browsers, speeding up development time by displaying changes to the code directly on the screen.

To download below is the link
https://creative.adobe.com/products/code?promoid=KFKML


Logging apache cxf Soap request/response pay load.


Hi,

   In order to log SOAP request and response payload of apache cxf we need to follow below steps.
 
   1. create a  folder structure below under src or classes package
        --WEB-INF
                ---cxf
                 
   2. create a org.apache.cxf file with extension .Logger under cxf folder.
         like org.apache.cxf.Logger. Add a code snippet org.apache.cxf.common.logging.Log4jLogger
        under Logger file.
 
   3. Add below statement in your  log4j properties file.
          log4j.logger.org.apache.cxf=info

  After completing the above steps now the request and response payload will be write into log file.