Showing posts with label Spring Framework. Show all posts
Showing posts with label Spring Framework. Show all posts
Spring XD is a unified, distributed, and extensible system for data ingestion, real time analytics, batch processing, and data export.

Much of the complexity in building real-world big data applications is related to integrating many disparate systems into one cohesive solution across a range of use-cases. Common use-cases encountered in creating a comprehensive big data solution are
  • High throughput distributed data ingestion from a variety of input sources into big data store such as HDFS or Splunk
  • Real-time analytics at ingestion time, e.g. gathering metrics and counting values.
  • Workflow management via batch jobs. The jobs combine interactions with standard enterprise systems (e.g. RDBMS) as well as Hadoop operations (e.g. MapReduce, HDFS, Pig, Hive or Cascading).
  • High throughput data export, e.g. from HDFS to a RDBMS or NoSQL database.
The Spring XD project aims to provide a one stop shop solution for these use-cases.

Features of Spring XD.  

  • Unified platform - Stream Processing and Batch Jobs
    • Off-Hadoop Batch Jobs
    • Hadoop Batch workflow orchestration
    • NoSQL Analytics
    • Scoring of Machine Learning algorithms
  • Runtime that provides critical non-functional requirements
    • Scalable, distributed, Fault-Tolerant
    • Portable. On prem DIY cluster, YARN, EC2.
  • Easy to use
  • Easy to extend and integrate other technologies
Minimum requirements: System should have a minimum Java JDK 6 or newer installed. Java JDK 7 is recommended.
To download the current release, you can download the distribution spring-xd-1.0.0.RELEASE-dist.zip.

iBatis is an object-relational mapping tool (ORM) that simplifies access to database. This article details the steps needed for integrating iBatis with Spring. Through such an integration, objects that are specific to iBatis can utilise all the benefits given by Spring's IOC Container. This is not an introductory article for both Spring and iBatis Frameworks. First-time readers are encouraged to read the Introductory article for Spring in javabeat Introduction to Spring Web Framework to know the preliminary concepts related to Spring.

2) Step-by-Step Procedure for Integration

2.1) Introduction

We are going to create a sample table in the MySql Database and going to access the data within it using Spring-iBatis Integration. The required bundles needed to build and run the sample program are listed below.

  • Spring Distribution
  • MySql Database
  • MySql Database Driver
2.2) Creating tables

Create a table called Jsr which contains relevant information for holding information like name, id, description andspecification lead for a Java Specification Request (JSR). Issue the following command in the MySql Client command prompt to create the table,


create table Jsr (JsrId varchar(10), JsrName varchar(50), JsrDescription, varchar(500), SpecLead varchar(100));


2.3) Creating the Java Equivalent


Now let us create a equivalent Java class for the Jsr table. This class, will contain properties that will map to the column names in the Jsr table. Given here is the complete code listing for the Jsr Java class,



Jsr.java




package javabeat.net.articles.spring.ibatis;

public class Jsr
{
private String id;
private String name;
private String description;
private String specLead;

public String getId()
{
return id;
}

public void setId(String id)
{
this.id = id;
}

public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}

public String getDescription()
{
return description;
}

public void setDescription(String description)
{
this.description = description;
}

public String getSpecLead()
{
return specLead;
}

public void setSpecLead(String specLead)
{
this.specLead = specLead;
}

public String toString()
{
return "Id = " + id + ", Name = " + name +
", Description = " + description + ", Lead = " + specLead;
}
}


2.4) JsrDao Class


Then, we need to get into the client-facing Dao interface design. This is the interface that clients will be depending on, to perform various database operations like selection of rows, insertion, deletion, updating data etc.



JsrDao.java




package javabeat.net.articles.spring.ibatis;

import java.util.List;

public interface JsrDao
{

public List<Jsr> selectAllJsrs();
public Jsr selectJsrById(String jsrID);

public void insertJsr(Jsr insertJsr);
public void deleteJsr(String jsrId);
public void updateJsr(Jsr jsrWithNewValues);

}


2.5) iBatis Mapping File


Jsr.xml




<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap>

<typeAlias type = "javabeat.net.articles.spring.ibatis.Jsr" alias = "jsr"/>

<resultMap class = "jsr" id = "result">
<result property = "id" column = "JsrId"/>
<result property = "name" column = "JsrName"/>
<result property = "description" column = "JsrDescription"/>
<result property = "specLead" column = "SpecLead"/>
</resultMap>

<select id = "selectAllJsrs" resultMap = "result">
select * from Jsr
</select>

<select id = "selectJsrById" resultMap = "result" parameterClass = "string">
select * from Jsr where JsrId = #value#
</select>

<insert id = "insertJsr" parameterClass="jsr">
insert into Jsr (JsrId, JsrName, JsrDescription, SpecLead) values (#id#, #name#, #description#, #specLead#)
</insert>

<delete id = "deleteJsr" parameterClass="string">
delete from Jsr where JsrId = #value#
</delete>

<update id = "updateJsr" parameterClass="jsr">
update Jsr set JsrName = #name#, JsrDescription = #description#, SpecLead = #specLead#
where JsrId = #id#
</update>

</sqlMap>


iBatis mapping file contains the mapping information between a Java class and its corresponding table in the database. Not only does it contain this mapping information, but also it contains many definitions for Named Queries. A Named Query is just a query defined with some name so that it can be reused across multiple modules.



The above Xml file starts with an element called 'typeAlias' which is just a short-name for'javabeat.net.articles.spring.ibatis.Jsr'. Instead of referencing the fully-qualified name of the Jsr class, now it can be shortly referred as 'jsr' in the other sections of the Xml file. Next comes the mapping information specified in the form of 'resultMap' element where the associations between the Java properties for the corresponding column names are made.



Then, the Named Queries section follows. A query called 'selectAllJsrs' has been defined which is actually a select query. The query string value is manifested in the form of 'select * from Jsr'. By having such a query definition, it can be used elsewhere in the Application just by referring the query identifier. Now, let us choose a query definition that illustrates passing parameters to it. The query identifier 'selectJsrById' needs the JsrId as a parameter using which it can filter the number of rows fetched. This can be represented by using the attribute'parameterClass'. Here 'string' stands for java.lang.String which means that the parameter is of type String. Similarly there are values like 'int', 'float', etc for java.lang.Integer and java.lang.Float respectively. Inside the query definition, we have the following query string,




select * from Jsr where JsrId = #value#


In the above query string, we have defined a new symbol called 'value'. This is the default symbol name for the parameter and since we have only one parameter it would not cause any problem. The expression '#value#' will be substituted with the values specified at the run-time. (Later we will see how the value gets substituted to the above expression).



Now, let us see a query definition that accepts multiple parameters. In the query definition 'insertJsr', we want the jsr id, jsr name, jsr description and spec lead values to get inserted and we have defined the query string as follows,




insert into Jsr (JsrId, JsrName, JsrDescription, SpecLead) values (
#id#, #name#, #description#, #specLead#)


In the query definition, the value of the parameter value is pointing to 'jsr', which means that during run-time the query string will get translated as follows,




insert into Jsr (JsrId, JsrName, JsrDescription, SpecLead) values (
jsr.getId(), jsr.getName(),jsr.getDescription(), jsr.getSpecLead())



Technorati Tags: ,



LiveJournal Tags: ,

1) What is Spring?

Spring is a lightweight inversion of control and aspect-oriented container framework.

2) Explain Spring?

  • Lightweight : Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
  • Inversion of control (IoC) : Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.
  • Aspect oriented (AOP) : Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.
  • Container : Spring contains and manages the life cycle and configuration of application objects.
  • Framework : Spring provides most of the intra functionality leaving rest of the coding to the developer.

3) What are the different modules in Spring framework?

  • The Core container module
  • Application context module
  • AOP module (Aspect Oriented Programming)
  • JDBC abstraction and DAO module
  • O/R mapping integration module (Object/Relational)
  • Web module
  • MVC framework module

4) What is the structure of Spring framework?


5) What is the Core container module?

This module is provides the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the top of this module. This module makes the Spring container.

6) What is Application context module?

The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application lifecycle events, and validation. This module also supplies many enterprise services such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework.

7) What is AOP module?

The AOP module is used for developing aspects for our Spring-enabled application. Much of the support has been provided by the AOP Alliance in order to ensure the interoperability between Spring and other AOP frameworks. This module also introduces metadata programming to Spring. Using Spring’s metadata support, we will be able to addannotations to our source code that instruct Spring on where and how to apply aspects.

8) What is JDBC abstraction and DAO module?

Using this module we can keep up the database code clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module uses Spring’s AOP module to provide transaction management services for objects in a Spring application.

9) What are object/relational mapping integration module?

Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Spring’s transaction management supports each of these ORM frameworks as well as JDBC.

10) What is web module?

This module is built on the application context module, providing a context that is appropriate for web-based applications. This module also contains support for several web-oriented tasks such as transparently handling multipart requests for file uploads and programmatic binding of request parameters to your business objects. It also contains integration support with Jakarta Struts.

LiveJournal Tags: ,

Technorati Tags: ,

Spring Web Services is a product of the Spring community focused on creating document-driven Web services. Spring Web Services aims to facilitate contract-first SOAP service development, allowing for the creation of flexible web services using one of the many ways to manipulate XML payloads. images

Key Features

  • Makes the Best Practice an Easy Practice: Spring Web Services makes enforcing best practices easier. This includes practices such as the WS-I basic profile, Contract-First development, and having a loose coupling between contract and implementation.
  • Powerful mappings: You can distribute incoming XML request to any object, depending on message payload, SOAP Action header, or an XPath expression.
  • XML API support: Incoming XML messages can be handled in standard JAXP APIs such as DOM, SAX, and StAX, but also JDOM, dom4j, XOM, or even marshalling technologies.
  • Flexible XML Marshalling: The Object/XML Mapping module in the Spring Web Services distribution supports JAXB 1 and 2, Castor, XMLBeans, JiBX, and XStream. And because it is a separate module, you can use it in non-Web services code as well.
  • Reuses your Spring expertise: Spring-WS uses Spring application contexts for all configuration, which should help Spring developers get up-to-speed nice and quickly. Also, the architecture of Spring-WS resembles that of Spring-MVC.
  • Supports WS-Security: WS-Security allows you to sign SOAP messages, encrypt and decrypt them, or authenticate against them.
  • Integrates with Acegi Security: The WS-Security implementation of Spring Web Services provides integration with Spring Security . This means you can use your existing configuration for your SOAP service as well.
  • Built by Maven: This assists you in effectively reusing the Spring Web Services artifacts in your own Maven-based projects.
  • Apache license. You can confidently use Spring-WS in your project.

Formerly the Acegi Security System for Spring, Spring Security provides powerful and flexible security solutions for enterprise applications developed using the Spring Framework. It is a stable and mature product - Acegi Security 1.0.0 was released in May 2006 after more than two and a half years of use in large production software projects and adopted as an official Spring sub-project on its release.

images

Spring Security 2.0.0 builds on Acegi Security's solid foundations, adding many new features:

  • Simplified namespace-based configuration syntax. Old configurations could require hundreds of lines of XML but our new convention over configuration approach ensures that many deployments will now require less than 10 lines.
  • OpenID integration, which is the web's emerging single sign on standard (supported by Google, IBM, Sun, Yahoo and others)
  • Windows NTLM support, providing easy enterprise-wide single sign on against Windows corporate networks
  • Support for JSR 250 ("EJB 3") security annotations, delivering a standards-based model for authorization metadata
  • AspectJ pointcut expression language support, allowing developers to apply cross-cutting security logic across their Spring managed objects
  • Substantial improvements to the high-performance domain object instance security ("ACL") capabilities
  • Comprehensive support for RESTful web request authorization, which works well with Spring 2.5's @MVC model for building RESTful systems
  • Long-requested support for groups, hierarchical roles and a user management API, which all combine to reduce development time and significantly improve system administration
  • An improved, database-backed "remember me" implementation
  • Support for portlet authentication out-of-the-box
  • Support for additional languages
  • Numerous other general improvements, documentation and new samples
  • New support for web state and flow transition authorization through the Spring Web Flow 2.0 release
  • New support for visualizing secured methods, plus configuration auto-completion support in Spring IDE
  • Enhanced WSS (formerly WS-Security) support through the Spring Web Services 1.5 release
  • Updated support for CAS single sign-on (CAS 3 is now supported).

Spring is a powerful Java application framework, used in a wide range of Java applications. It provides enterprise services to Plain Old Java Objects (POJOs).Spring uses dependency injection to achieve simplification and increasetestability. Spring beans, dependencies, and the services needed by beans are specified in configuration files, which are typically in an XML format. The XML configuration files, however, are verbose and unwieldy. They can become hard to read and manage when you are working on a large project where many Spring beans are defined. Spring’s another advantage that it gives more and more support to the other frameworks.Nowadays so many Projects are building on this powerful framework. Although Spring is basically using many Best Practices as well as Design patterns, I think the best way of use of this framework is also necessary for getting all its features and also to get a good performance.

The first version was written by Rod Johnson who released the framework with the publication of his book, Expert One-on-One J2EE Design and Development (Wrox Press, October 2002). Its milestone release, 1.0, was released in March 2004. The Spring 1.2.6 framework won a Jolt productivity award in 2006.[2] The current version is 2.5.6.

The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java Enterprise platform.

The company behind Spring Framework is SpringSource.com

Find Tutorials Introduction

Technorati Tags: ,,,
LiveJournal Tags: ,,,
+