Monday, June 15, 2015

Visa

JAX-RS?

Folder structure and control flow in details for spring application

How JAX-RS diff than Spring MVC  ?

What type of interceptor avaialble in Spring integration

What is outbound channel in Spring Integration ?


Diff  between apache camel and

Mongo command for search element and update element ?

What is shrading ?

Can we create index in mongo collection ?

JProfiler ?

Can we store map key as Object ?

What is hashing ? The idea of hashing is to distribute the entries (key/value pairs) across an array of buckets.

Find out memory leak in Java program ? JProfiler

Can we change the order for JSON marshalling ?

Can we remove not null element from JSON

How web service support both format JSON + XML ?

@component, @service , @controller,

API managemrnet

Spring REST security

Rest expose

WADL,

How to expose rest service to external service

Swagger

JSON Mapper for ignore properties

Specialization
Generalization
Composition
Encapsualtion

xjc.exe to generate JAXB classes for the given XSD:

Concurrency ...reentrant lock


When a request is sent to the Spring MVC Framework the following sequence of events happen.
-The “DispatcherServlet” first receives the request
-The “DispatcherServlet” consults the “HandlerMapping” and invokes the “Controller” associated with the request
-The “Controller” process the request by calling the appropriate service methods and returns a “ModeAndView” object to the “DispatcherServlet”. The “ModeAndView” object contains the model data and the view name
-The “DispatcherServlet” sends the view name to a “ViewResolver” to find the actual “View” to invoke
-The “DispatcherServlet” passes the model object to the “View” to render the result
-The “View” with the help of the model data renders the result and return it back to the user


http://java.dzone.com/articles/secure-rest-services-using


http://www.jpalace.org/document/36/spring-integration-tutorial


hashCode()

The hashCode() method of objects is used when you insert them into a HashTable, HashMap or HashSet.

If equal, then same hash codes too.
Same hash codes no guarantee of being equal.
================================================================================================================================

Spring Controller ---------------------------

@Controller
class AccountController {
    // RESTful method
    @RequestMapping(value="/accounts", produces={"application/xml", "application/json"})
    @ResponseStatus(HttpStatus.OK)
    public @ResponseBody List<Account> listWithMarshalling(Principal principal) {
        return accountManager.getAccounts(principal);
    }

    // View-based method
    @RequestMapping("/accounts")
    public String listWithView(Model model, Principal principal) {
        // Call RESTful method to avoid repeating account lookup logic
        model.addAttribute( listWithMarshalling(principal) );

        // Return the view to use for rendering the response
        return ¨accounts/list¨;
    }
}


=================================================================================================================================
@RequestBody and @ResposneBody

http://www.beabetterdeveloper.com/2013/07/spring-mvc-requestbody-and-responsebody.html

@RequestMapping
http://www.journaldev.com/3358/spring-mvc-requestmapping-annotation-example-with-controller-methods-headers-params-requestparam-pathvariable


Mongo Commands
http://www.mkyong.com/mongodb/mongodb-hello-world-example/

==================================================================================================================================

import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.message.GenericMessage;





Hibernate has few fetching strategies to optimize the Hibernate generated select statement, so that it can be as efficient as possible. The fetching strategy is declared in the mapping relationship to define how Hibernate fetch its related collections and entities.

Fetching Strategies
There are four fetching strategies

1. fetch-“join” = Disable the lazy loading, always load all the collections and entities.
2. fetch-“select” (default) = Lazy load all the collections and entities.
3. batch-size=”N” = Fetching up to ‘N’ collections or entities, *Not record*.
4. fetch-“subselect” = Group its collection into a sub select statement.

===================================================================================================================================================================================================

Adapter – Convert the interface of a class into another interface clients expect. / Adapter lets classes work together, that could not otherwise because of incompatible interfaces. Note that there are two types of adapter, one is class level adapter and other is object level adapter. Examples –

java.io.InputStreamReader(InputStream) (returns a Reader)
java.io.OutputStreamWriter(OutputStream) (returns a Writer)
javax.xml.bind.annotation.adapters.XmlAdapter#marshal() and #unmarshal()


Bridge – Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Examples –

JDBC-ODBC Bridge
It is quite difficult to understand from its definition So here are few links to refer –
Link 1 Link 2

Composite – Compose objects into tree structures to represent part-whole hierarchies. / Composite lets clients treat individual objects and compositions of objects uniformly. Examples –

Includes in JSP
java.util.Map#putAll(Map)
java.util.List#addAll(Collection)
java.util.Set#addAll(Collection)
java.nio.ByteBuffer#put(ByteBuffer) (also on CharBuffer, ShortBuffer, IntBuffer, LongBuffer, FloatBuffer and DoubleBuffer)
java.awt.Container#add(Component) (practically all over Swing thus)
A very detailed explanation about Composite pattern is Here

Decorator – add additional responsibilities dynamically to an object. Examples –

All subclasses of java.io.InputStream, OutputStream, Reader and Writer have a constructor taking an instance of same type.
Almost all implementations of java.util.List, Set and Map have a constructor taking an instance of same type.
java.util.Collections, the checkedXXX(), synchronizedXXX() and unmodifiableXXX() methods.
javax.servlet.http.HttpServletRequestWrapper and HttpServletResponseWrapper
Display tag custom tag library proved option to decorator for rendering of tables in JSP.
Any client side JavaScript library which has render-er or parser like Yahoo UI datatable, JQuery grid


Flyweight – use sharing to support a large number of objects that have part of their internal state in common where the other part of state can vary. Examples –

java.lang.Integer#valueOf(int) (also on Boolean, Byte, Character, Short, Long, Float and Double)
Java String creation. (Read about string creation in Java specification)
Swing borders


Proxy – provide a “Placeholder” for an object to control references to it. If you use spring framework, you should be very well acquainted with Proxy. Examples –

Java RMI
Spring AOP creates proxies for supplied objects
All libraries which use Java proxy , Reflection proxy and CGLIB proxy

Memento – capture the internal state of an object without violating encapsulation and thus providing a mean for restoring the object into initial state when needed.

java.util.Date (the setter methods do that, Date is internally represented by a long value)
All implementations of java.io.Serializable
All implementations of javax.faces.component.StateHolder


Types and Examples of NoSQL Databases

1. Key-Values Stores : Examples: Tokyo Cabinet/Tyrant, Redis, Voldemort, Oracle BDB, Amazon SimpleDB, Riak
2. Column Family Stores : Examples: Cassandra, HBase
3. Document Databases : Examples: CouchDB, MongoDb
4. Graph Databases : Examples: Neo4J, InfoGrid, Infinite Graph

If You Enjoyed This Post Please Take 5 Seconds To Share It.

0 comments:

Pages

Copyright by Alpesh. Powered by Blogger.