Enterprise Technology Tips & Solution
Built on J2EE and SOA using opensource
Showing posts with label Enterprise. Show all posts
Showing posts with label Enterprise. Show all posts

This is a repost from my technology trends blog here

I have been putting together solutions in IT enterprise space for quite a while now. Some of the frameworks used over the years, for example are

While TOGAF is a really a promising and an Agile way of doing things, I need to get more handle on this though.
One of the things, which amazes me while designing a solution or replying to an RFP, is heavy use of architectural and deign patterns. Using Patterns is not bad, but over the years i have found sometimes a simple solution become quit complex and bloated. I have burned my fingers in the past with this and have stared using some antipatterns approach as well. For those who are interested, I'm linking some of the architectural antipatterns here, I do refer them from time to time for my solutions.

What do you guys do, any thoughts?
Continue Reading...

Background:
In today's enterprise applications their is a big requirement for dynamic generation of PDF documents. These applications range from telecom companies generating phone bills, airlines producing e-tickets, banks generating customer statements for e-mail delivery to readers, book sellers selling books in pdf format.

What is PDF:
The Portable Document Format (PDF) is the file format created by Adobe Systems in 1993 for document exchange. PDF is used for representing two-dimensional documents in a device-independent and display resolution-independent fixed-layout document format. Each PDF file encapsulates a complete description of a 2-D document (and, with Acrobat 3-D, embedded 3-D documents) that includes the text, fonts, images, and 2-D vector graphics that compose the document.

Why PDF:
PDF is an open standard, unlike Microsoft Word, supported by all operating systems, ie; as long as you have an adobe reader you can read a pdf file on any system like Linux, Mac, Solaris, Windows. On virus front, it’s very hard that a PDF file will have some virus. It is is now being prepared for submission as an ISO standard.


Dynamic PDF Generation in Enterprise Application Development :
As mentioned above, in digital age everything is digitized so that end user can access it from anywhere, anytime. As a result new enterprise applications are generating lot of data in pdf formant which can be used by end user.
In Enterprise (Java or J2EE, JEE) application development generating pdf documents on the fly (dynamically) has become a trivial thing, courtesy of lot of third party tools, APIs available. The list of these tools/API's is endless. In this article, we will use the iText Java library to generate PDF documents by merging GIF files. I'll go through an example to show how this is done.

iText :
iText is an open-source Java library that provides API to generate PDF files on the fly. It also supports the generation of HTML, RTF, and XML documents, in addition to generating PDFs. It's available for free under a multiple license: MPL and LGPL.

iText API :

The com.lowagie.text.Document is the main class for PDF document generation. This is the first class to be instantiated. Once the document is created, we would require a writer to write into it. The com.lowagie.text.pdf.PdfWriter is a PDF writer. Other classes which are often used:

com.lowagie.text.Paragraph - represents an indented paragraph. com.lowagie.text.Chapter - represents a chapter in the PDF document. It is created using a Paragraph as title and an int as chapter number. com.lowagie.text.Font - contains all specifications of a font, such as family of font, size, style, and color. Various fonts are declared as static constants in this class. com.lowagie.text.List - represents a list, which, in turn, contains a number of ListItems. com.lowagie.text.Table - represents a table that contains cells, ordered in a matrix.

Example of converting multiple GIF files into PDF :


Pre-requisites :
Download iText and include itext-version.jar into your application or yr classpath.

Code Snippet :
The following code snippet demonstrates how to convert an array (collection) of gif files into a single pdf,
{code}

FileOutputStream fos = null;

try {

fos = new FileOutputStream (
new File(pDestinationFolder + File.separator
+ pTargetFileNamePrefix + ".pdf")
);

// Create a document which is the container for all the elements of a PDF document.
Document doc = new Document();

// Line -1
PdfWriter writer = PdfWriter.getInstance(doc, fos);

doc.open();

for (File aFile : gifFiles) {

Image image = Image.getInstance(aFile.getAbsolutePath());

// Line -2
image.scaleToFit(doc.getPageSize().getWidth(), doc.getPageSize().getHeight());

// Line -3
image.setAlignment(Image.ALIGN_CENTER);
doc.add(image);
doc.newPage();
}

doc.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {

if (fos != null) {
try {
fos.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}

{code}

Code Demystified :
Line - 1 is important to create an instance of PdfWriter that associates a document object with the output stream. For our code snippet, we choose com.lowagie.text.pdf.PdfWriter. Other writers are HtmlWriter, RtfWriter, XmlWriter, and several others for obvious reasons. Line - 2 is very useful methods that will scale the current image to fit the width and height specified. Gif images can vary in sizes and this allows the method to scale down to the default size of the PDF page. Line-3 is to align the image so that it is located at the center of the page.

Other opensource libraries for generating pdf documents are :
FOP Gnujpdf JFreeReport JPedal jPod PDF Box PDFjet PJX
Continue Reading...

Continuing in series of What is Service Oriented Architecture or SOA

Requirements for a SOA Strategy


In order to realize the benefits of SOA there needs to be a balance struck between the long-term enterprise goals and the short-term, immediate, business requirements. Institutionalizing a series of operational, design, budgetary, operational, and provisioning practices in the initial stage of an SOA journey can assist in establishing and maintaining this balance. The deployment of cultural changing disciples must be performed in an incremental and iterative manner. This will allow for the required organizational learning curve. An SOA roadmap provides an iterative and incremental mechanism to continuously describe an organization’s journey as they progress. A path for the SOA journey has three critical characteristics:
Scope:
A SOA roadmap should be comprised of six distinct, but interrelated and interdependent, jurisdictions. The fundamental success of an SOA effort is directly related to the successful execution in each of these jurisdictions. An organization’s SOA roadmap should define and delineate the boundaries of the SOA effort as well as establishes a flexible timeline for achieving their SOA objectives. The SOA objectives of an organization should be divided into phases that are manageable and that can be iteratively and incrementally realized.

Quality:

A SOA roadmap will remain relevant for the life of the SOA effort by being iterative and incremental as well as through the application of a “Mature & Change” process at each major exit-point, milestone.

Maturity:
A SOA roadmap is an “organic document” that is continuously describes organizational experiences and lessons learned. As the SOA effort matures, along the SOA roadmap, it reaches higher levels of complexity and sophistication, but does so in a govern fashion. An SOA roadmap is created by first assessing the current capabilities and disciplines of an organization and their applicability to SOA.

Building a SOA Roadmap
Creating a SOA roadmap involves four phases: Planning, As-Is Assessment, End goal, and Definition.

Planning
A SOA effort is organized and defined in this phase. The SOA stakeholders are incorporated into the process through various communication avenues and briefing, and a mutually agreed upon priorities and constraints are established. The appropriate level of clear communication is essential in this phase due to the involvement of representation from across the organization. The outcomes of this phase include:

A defined scope for the SOA Establishment of boundaries and alignments with peer IT efforts An illustrated business case to justify the SOA effort Defined current and future business objective alignment

As-Is Assessment

The establishment of metrics and measures of the current state of affairs is conducted in the assessment phase. Current services and capabilities need to be identified as a potential “on-ramping” point for the SOA effort. Pilot projects need to be identified as well in this phase. By interviewing and questioning the SOA stakeholders an organization should examine the jurisdictions of concern. The “as-is” state of each of the jurisdictions of concern needs to be analyzed, base-lined, and validated. A mechanism needs to be devised to assemble the examination of the following:
Business Approach: Business strategies and processes are examined beginning at the top level of the organization and working downward into each level and area of the organization. Business Value: Summary of current cost and budgetary structures and cases of value add to the organization. Architecture: Examination of “as-is” architecture, policies, and standards SOA Legos: Investigation of existing services, technical processes, tools, and technologies Projects: Examination of existing systems, and on-going and forecasted projects Relationships and Outcome Management: Investigation of current governance and organizational relationships, policies, and processes.

End goal
The end goal phase involves the determination and definition of the “to-be” state of the organization, as it related to the SOA effort, and ensuring that there is cross-organizational agreement.
Business Approach: Relationship of the SOA end goal with business strategies and processes. Business Value: Definition of metric and measurement requirements. Architecture: Organizational guiding tenets, requirements, reference architecture, policies, and standards. SOA Legos: Ecosystem requirements for supporting shared services and tool standardization. Projects: Alignment of SOA effort with projects and applications Relationships and Outcome Management: Relationship, governance, and compliance structures and policies.

Definition
Organizations begin defining an SOA roadmap in this phase. As per the information findings from the previous phases, a complete gap analysis should be conducted for the organization’s SOA objectives and suitable timelines. The immediate events will be well defined and detailed with future events being more in flux and fluid in order to incorporate the lessons learned during progression.
Business Approach: Alignment of opportunities based on the value added to the business. Business Value: Roadmap of future metrics, cost and budgetary structures, and benefits cases. Architecture: Roadmap for the immediate, medium-, and long-term reference architecture. SOA Legos: Prioritization of shared services strategy and standardized processes. Projects: Impacts to projects and applications. Relationships and Outcome Management: Projected relationship and governance structures, policies, and processes.

An organization’s SOA roadmap must be treated as an “organic document” that continuously describes experiences and lessons learned of the organization. As the SOA effort matures, along the SOA roadmap, it reaches higher levels of complexity and sophistication, but does so in a govern fashion.

SOA Legos
One of the most crucial elements contributing to the success of an SOA journey is the institutionalization of a culture, throughout the enterprise, which cultivates the notion, and expectation, of reuse. The discrete, reusable services and architectural elements that can be combined to author composite applications and service ecosystem for the building blocks, like legos, of a SOA. The “SOA legos” form the basis of a catalog of enterprise capabilities over time and each is added to this catalog as it is implemented. The ROI of an enterprise is demonstrable and steadily increases as the number of capabilities in the catalog increases. This is due to the amount of new code development and service ecosystem needs for future projects are reduced. There are two categories of “SOA legos”: software legos and organizational legos. Software building blocks are such things as code, services, applications, data models, processes, and components. Organizational building blocks as things such as best practices, lessons learned, standards, tools (development, deployment, and management). By utilizing a collection of building blocks organizations can develop applications. The building blocks form the enterprise infrastructure and should be developed incrementally and refined iteratively and build-up the enterprise’s target architectures.
The ability to clearly define and implement a service at the proper level of granularity and with the appropriate level of coupling is essential to the success to the SOA journey. The implementation process must be consistent and repeatable process. At the center of any SOA is the notion of a service which is defined as “a mechanism to enable access to one or more capabilities, where the access is provided using a prescribed interface and is exercised consistent with constraints and policies as specified by the service description”2. A service can be illustrated by three components:
Interface: Provides a means for interacting with a service, which is standards-based, by users in order to access the service functionality according to the service contract. Contract: Is an agreement by two or more parties which specifies the conditions of use of a service including the service purpose, functionality, and constraints on the real world effect of the service. Implementation: Is composed of the actual code, application interface, or other technology asset exposing functionality through a service. Services are either exposed by creating new applications based upon services or from existing applications.
Exposing services can be accomplished either from existing applications or by developing new applications based on a service-centric paradigm. One of the initial technical questions, and probably the most difficult to resolve, is which services to implement first? When building the “SOA lego” baseline for the SOA journey, organizations typically begin with the simplest services at the core of the enterprise. These services should be business-unit, line-of-business agnostic and gradually migrate to business-unit specific capabilities. By following this type of progression will allow organizations to be comfortable with the process of constructing and reusing services without having to become mired in complexity. Some of the initial services organizations build are typically services that perform infrastructure functionality such as logging, monitoring, auditing, and error handling.
Services have both functional and non-functional characteristics. The main functional service characteristics are its execution model, exchange model, and level of complexity. A service’s execution model describes the manner in which a service is invoked and the communications exchanged: synchronous or asynchronous. The exchange model of a service describes the method, direction, of message exchanges: unidirectional or bi-directional. A service’s level of complexity refers to the granularity of a service.
Service granularity is the level of abstraction of a service. Services are either fine-grained or coarse grained. A fine-grained service is one provides specific capability, for example as standards-based of invoking an application programming interface (API) or manipulating an enterprise data object. Shared services that provide common business operations are also typically fine-grained services. Coarse-grained services are those services that provide a mechanism for accessing high-level, complex business capabilities, such as employee on-ramping and mission planning. Coarse-grained services are often long running and involve the coordination and collaboration of finer-grained service execution.
The non-functional characteristics of services involve things such as volume requirements, quality of service (QoS), and execution length. Portions of the service contract are comprised of these dynamics.
Service characteristics and functionality permit the categorization of services in layers of a service-oriented architecture. This categorization serves in the decision making regarding service utility and prioritization.
The IT disciplines required to realize SOA should also be considered as “SOA legos”. Such disciplines include a versioning strategy, service provisioning, testing, and verification and validation. It is essential that adherence to IT disciplines be strictly applied and enforced. One of the principal roles of SOA governance is to ensure the scope and enforcement of such standards.
A SOA ecosystem will be required to deliver the “SOA legos”. A common ecosystem component is a service registry. A service registry provides a mechanism for service consumers to discover available services and for service providers to broadcast the existence of services. One of the critical features of SOA is the ability to discover and reuse capabilities that conforms to a needed contract at the time it is needed. Several other ecosystem components for developing and provisioning services exist and are considered “SOA legos”:
SOA fabric or “Enterprise Service Bus (ESB)” which provide dynamic routing, mediation, and translation capabilities
Identity management and Enterprise Security frameworks that provide a security infrastructure
Configuration management for managing the deployable components and for configuration of hardware and services provisioning at runtime
Business Activity Management (BAM) for measuring SOA performance against defined contracts and SLAs
Portal technology for multi-user experience delivery
There are several technologies and platforms available for providing the necessary ecosystem components. The basis for SOA must be standards based which allows for a best-of-breed approach to acquiring the necessary components. It is best to deliver the “SOA legos” and ecosystem in an iterative manner.

Tomorrow : Projects

Other useful tips on Java, JEE/J2EE
Continue Reading...

Overview :
Service-Oriented Architecture (SOA) enables organizations to realize business and technology advantages by combining business process innovation, effective governance, and a service-centric technology approach.
SOA is a long term strategy that requires perpetual focus on transforming the IT (Information Technology) delivery mechanism, but it must also answer immediate business initiatives. The promises of SOA can only be realized by maintaining a balance between long-term enterprise goals and immediate, short-term, business requirements.

SOA: A Mindshift
In order to conquer the complex issues that IT faces in delivering solutions that provide success to the organization, a mind shift is required. SOA offers a mechanism to facilitate that change for both developers and architects. There are a few questions that organizations must consider:

What preparation is required for such a fundamental change? What is required for such a migration? How can an organization ensure that the migration is performed in the most cost-effective and impacts the organization the least?
SOA is more about a manner of thinking than about a technology. It is a reformation of the infrastructure supporting IT delivery and is a representation of the cultural and behavioral changes in how organizations employ technology and the internal organizations interrelate.

SOA Definition:
The OASIS Reference Model for Service-Oriented Architecture (SOA RM) defines SOA as “a paradigm for organizing and utilizing distributed capabilities that may be under the control of different ownership domains. It provides a uniform means to offer, discover, interact with and use capabilities to produce desired effects consistent with measurable preconditions and expectations.”
By organizing around distributed capabilities rather than applications, SOA provides key benefits:
Improved business and IT productivity, agility and speed Improved Time-To-Market schedules with increased alignment to the objectives of the organization Improved respond to change and delivery of optimal experience
Realizing SOA :
Many organizations have a difficulty on deciding where to begin the SOA journey. A prescription is needed to assist organizations in beginning an SOA journey.

1. Strategically focused, tactically implemented: Begin the journey by identifying a core process that spans multiple business organizations and realize that process with simple, agnostic services.
2. Top-down, bottom-up, middle-out analysis: Identify the services required to support the process, identify functionality in existing systems that can be exposed as services. The analysis must be goal driven and the goals most align with the strategic goals or the organization.
3. Consider core services: Identify any common, core, services and supporting functionality.
4. Travel slowly: Once an organization has successfully deployed initial projects, future technically challenging efforts can travel in parallel.
5. Construct an Enterprise Catalog: Once more and more projects are developed utilizing this new paradigm called SOA, begin to harvest and reuse services. This will begin to reduce cost over time.
6. Spotlight benefits: Undertake projects and efforts in an iterative fashion based upon, partially, the expected return on investment and/or assets (ROI).

Tomorrow : Effective Planning
NB : Image sourced from bea dev2dev site

Other useful tips on Java, JEE/J2EE
Continue Reading...

Background:
In computer science, a cache is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (due to slow access time) or to compute, relative to the cost of reading the cache. In other words, a cache is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, future use can be made by accessing the cached copy rather than re-fetching or recomputing the original data, so that the average access time is lower. Cache, therefore, helps expedites data access otherwise the CPU would need to fetch from main memory. Cache have proven to be extremely effective in many areas of computing because access patterns in typical computer applications have locality of reference.

Purpose :
The main purpose of the caching service is to improve server performance by managing static and non static data members. The performance gain is from reducing the number of trips to the database or other external sources of information, avoiding the cost of repeatedly recreating data (objects in java), sharing data between threads in a process and, when possible between processes, and efficient use of process resources.

Advantages:

In a multi-tiered (n-tier) application, data access is an expensive operation, compared to any other task. By keeping the frequently accessed data around and not releasing it after the first use, we can avoid the cost and time required for the reacquisition and release of the data. This results in greatly improved performance, since we won't be hitting the database every time we need the data. Scalability is another reason of using. Since cached data is accessed across multiple tiers, sessions, components, caching can become a big part of a scalable application design.

Disadvantages:
Synchronization complexity: Depending on the kind of data, complexity increases, because consistency between the state of the cached data and the original data in the data source needs to be ensured. Otherwise, the cached data can get out of sync with the actual data, which will lead to data inaccuracies. Durability: Changes to the cached data can be lost when the server crashes. This problem can be avoided if a synchronized cache is used. Memory size: JVM memory size can get unacceptably huge if there is lot of unused data in the cache and the data is not released from memory at regular intervals.

Opensource Caching solutions in Java:
There are lots of caching solution in Java, free and non free. This is a list of opensource caching solutions available in Java/J2EE/JEE domain for software development or developing enterprise applications.
Java, Cache, Hibernate, Jboss, J2EE, Software, Caching, opensource
Bamboo DHT - is a distributed hash table, or DHT, is a building block for peer-to-peer applications. At the most basic level, it allows a group of distributed hosts to collectively manage a mapping from keys to data values, without any fixed hierarchy, and with very little human assistance. This building block can then be used to ease the implementation of a diverse variety of peer-to-peer applications such as file sharing services, DNS replacements, web caches, etc.

cache4j - is a cache for Java objects with a simple API and fast implementation. It features in-memory caching, a design for a multi-threaded environment, both synchronized and blocking implementations, a choice of eviction algorithms (LFU, LRU, FIFO), and the choice of either hard or soft references for object storage.

FreePastry - is a modular, open source implementation of the Pastry p2p routing and location substrate. Pastry is a generic, scalable and efficient substrate for peer-to-peer applications. Pastry nodes form a decentralized, self-organizing and fault-tolerant overlay network within the Internet. Pastry provides efficient request routing, deterministic object location, and load balancing in an application-independent manner. Furthermore, Pastry provides mechanisms that support and facilitate application-specific object replication, caching, and fault recovery. The proponents of Pastry work for Microsoft, however they've made an excellent choice sticking with Java.

EHCache - is a pure Java, in-process cache. It started as a replacement for JCS. EHCache is faster than JCS. It has following features: Fast,Simple, pluggable cache for Hibernate, small foot print, minimal dependencies, fully documented and production tested.

Java Caching System (JCS) - is a distributed caching system written in java for server-side java applications. It is intended to speed up dynamic web applications by providing a means to manage cached data of various dynamic natures. Like any caching system, the JCS is most useful for high read, low put applications. Dynamic content and reporting systems can benefit most. However, any site that repeatedly constructs pages, drop downs, or common search results form a database that is updated at intervals (rather than across categories continuously) can improve performance and scalability by implementing caching. Latency times drop sharply and bottlenecks move away from the database in an effectively cached system.
It provides several important features, necessary for any Enterprise level caching system, features include Memory management, disk overflow, element grouping, quick nested categorical removal, data expiration, extensible framework, fully configurable run time parameters, remote synchronization, remote store recovery, non-blocking "zombie" pattern, optional lateral distribution of elements, remote server clustering and failover. These features provide a framework with no point of failure, allowing for full session failover including session data across up to 256 servers.

JBoss Cache - is a product designed to cache frequently accessed Java objects in order to dramatically improve the performance of e-business applications. By eliminating unnecessary database access, JBoss Cache decreases network traffic and increases the scalability of applications. But JBoss Cache is much more than a simple cache. JBoss Cache provides fully transactional features as well as a highly configurable set of options to deal with concurrent data access in the most efficient manner possible for your application. In addition, it is a clustered cache that replicates contents to other cache instances running on separate JVMs, servers or even entire networks, making JBoss Cache a highly efficient library used by application server developers to implement clustering features.
JBossCache consists of two modules
TreeCache - a replicated transactional tree-structured cache .
TreeCacheAop a subclass of TreeCache using AOP to dynamically replicate Plain Old Java Objects - POJO.

JCache - is an effort to make an Open Source version of JSR-107 JCache. Since the JSR-107 hasn't released any specs for years, This version still builds on the original functional specification. It is implemented by some geeks at ThoughtWorks.

Jofti - is a simple to use, high-performance object indexing and searching solution for Objects in a Caching layer or storage structure that supports the Map interface. The framework supports EHCache, JBossCache and OSCache and provides for transparent addition, removal and updating of objects in its index as well as simple to use query capabilities for searching. Features include type aware searching, configurable object property indexing, indexing/searching by interfaces as well as support for Dynamic Proxies, primitive attributes, Collections and Arrays

OceanStore - is a global persistent data store designed to scale to billions of users. It provides a consistent, highly-available, and durable storage utility atop an infrastructure comprised of untrusted servers. OceanStore caches data promiscuously; any server may create a local replica of any data object. These local replicas provide faster access and robustness to network partitions. They also reduce network congestion by localizing access traffic. Pond, the OceanStore prototype, is currently available for download.

Open Terracotta - is Open Source Clustering for Java. Features: HTTP Session Replication, Distributed Cache, POJO Clustering, Application Coordination across cluster's JVM's (made using code injection, so you don't need to modify your code)

OSCache - is a caching solution that includes a JSP tag library and set of classes to perform fine grained dynamic caching of JSP content, servlet responses or arbitrary objects. It provides both in memory and persistent on disk caches, and can allow your site to have graceful error tolerance (eg if an error occurs like your db goes down, you can serve the cached content so people can still surf the site almost without knowing). Take a look at the great features of OSCache.

ShiftOne - is a Java Object Cache library that implements several strict object caching policies, as well as a light framework for configuring cache behavior. It's strict in the sense that each cache enforces two limits in a very strict and predictable way.

SwarmCache - is a simple but effective distributed cache. It uses IP multicast to efficiently communicate with any number of hosts on a LAN. It is specifically designed for use by clustered, database-driven web applications. Such applications typically have many more read operations than write operations, which allows SwarmCache to deliver the greatest performance gains. SwarmCache uses JavaGroups internally to manage the membership and communications of its distributed cache. Wrappers have been written that allow SwarmCache to be used with the Hibernate and JPOX persistence engines.

WhirlyCache - is a fast, configurable in-memory object cache for Java. It can be used, for example, to speed up a website or an application by caching objects that would otherwise have to be created by querying a database or by another expensive procedure

NB: Image sourced from blogs.oracle.com/.../2007/09/21

Other useful tips on Java, JEE/J2EE
Continue Reading...

Background :
Spring is an open-source application framework, introduced and developed in 2004. The main ideas were suggested by an experienced J2EE architect, Rod Johnson. He had earlier, written a book titled J2EE Development without using EJB and had introduced the concept of Light-weight container. Primarily, his argument is that while EJB has its merits, it is not always necessary and suitable in all applications.
Just as Hibernate attacked CMP as primitive ORM technology, Spring attacked EJB as unduly complicated and not susceptible to unit-testing. Instead of EJB, Spring suggests that we make use of ordinary Java beans, with some slight modifications, to get all the supposed advantages of EJB environment. Thus, Spring is posed as an alternative to EJB essentially. However, as a concession to the existing EJB investments, Spring is designed to operate with EJB if required.

Much of the philosophy and approach of Spring framework, however, predates, the latest EJB-3. As we know now that EJB-3 has absorbed a number of new ideas suggested by Spring and some more, to answer the criticisms. Their is a debate going on in the Java community about Spring and EJB-3. Spring is not a Persistence technology but a framework which allows plug in of other such technologies. But EJB-3 is primarily focused on Persistence Technology and has now incorporated Hibernate, the best ORM to date.Talks are going on to incorporate another equally nice ORM Technology known as JDO, which provides for Object Database also. Moreover, EJB-3 's Attribute-Oriented Meta tags, help in vastly reducing the size of XML lines. Some have complained that Spring is still too dependent on XML files.
The main aim of Spring is to simplify the J2EE development and testing.

Spring Under The Hood :

Enterprise, Technlogy, Spring Framework, J2EE Development, Hibernate,without EJB
Spring is a great framework for development of Enterprise applications. It is a light-weight framework for the development of enterprise-ready applications. Spring can be used to configure declarative transaction management, remote access to your logic using RMI or web services, mailing facilities and various options in persisting your data to a database. It can be used in modular fashion, allows to use in parts and leave the other components which is not required by the application.

Main Features of Spring Framework:

Transaction Management: Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Spring's transaction support is not tied to J2EE environments and it can be also used in container less environments.

JDBC Exception Handling: The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling strategy

Integration with Hibernate, JDO, and iBATIS: Spring provides best Integration services with Hibernate, JDO and iBATIS.

AOP Framework: Spring is one of the best AOP framework

MVC Framework: Spring comes with MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText and POI.
But other frameworks can be easily used instead of Spring MVC Framework..

Spring Architecture :
Spring is well-organized architecture consisting of various modules. Modules in the Spring framework are:

1. Spring Aspect Oriented Programming (AOP)
AOP is used in Spring

a) To provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on Spring's transaction abstraction.

b) To allow users to implement custom aspects, complementing their use of OOP with AOP

2. Spring ORM
The ORM package is related to the database access. It provides integration layers for popular object-relational mapping APIs, including JDO, Hibernate and iBatis.

3. Spring Context
This package builds on the beans package to add support for message sources and for the Observer design pattern, and the ability for application objects to obtain resources using a consistent API.

4. Spring Web
The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts, JSF and webworks. The Web module also eases the tasks of handling multi part requests and binding request parameters to domain objects.

5. Spring DAO
The Spring's JDBC and DAO abstraction layer offers a meaningful exception hierarchy for managing the database connection, exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of code that we need to write, such as opening and closing connections. This module also provide transaction management services for objects in a spring application.

6. Spring Web MVC
The MVC framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles and the generation of PDF and Excel Files.

7. Spring Core
The Core package is the most import component of the Spring Framework.
This component provides the Dependency Injection features. The BeanFactory provides a factory pattern which separates the dependencies like initialization, creation and access of the objects from your actual program logic.
NB: Image sourced from Google Images

Other useful tips on J2EE

Continue Reading...

Continuing our Java/J2EE/JEE interview questions and answers series, today's questions are:

Q What is a final class and a final method ?

A class declared as final, it can never be sub classed. This is usually done for security or performance reasons.

public final class MyTest {
// ...
}

When a method is declared final, it can never be overridden in subclasses.
This is usually done for security or performance reasons, providing additional information to the Just In Time (JIT) compiler or HotSpot.

Note : Declaring methods final restricts later design decisions, so be careful while making this decision

Q Why java.lang package doesn't require import?

The classes in the java.lang package are basic building blocks of Java, that the compiler implicitly imports all the classes there. This ensures classes in the unnamed package are not accidentally used instead of the key classes and interfaces.

Q Can I override a method that doesn't throw exceptions with one that does?

Overriding methods cannot change the signature of the overridden method. All exceptions are included in the signature of the method except for RunTimeException and it's subclasses. So, the only exceptions you may add to an overriding method must be a (sub-class of) RunTimeException.

Q Can I restart a stopped thread and how do I have one thread wait for another thread to finish before continuing?

No you can not restart a thread one it is stopped. Keep in mind though that the use of the stop() method of Thread class is deprecated and should be avoided.

You can wait for a thread to finish by calling its join() method. For instance, in the following code, the current thread will wait until thread2 finishes before printing is finished.


threadTwo.start();
// do more stuff here
threadTwo.join();
System.out.println("ThreadTwo is finished");


Q What is the difference between the & and && operators?

It depends on the type of the arguments...
For integer arguments, the single ampersand ("&")is the "bit-wise AND" operator. The double ampersand ("&&") is not defined for anything but two boolean arguements.

For boolean arguments, the single ampersand constitutes the (unconditional) "logical AND" operator while the double ampersand ("&&") is the "conditional logical AND" operator. That is to say that the single ampersand always evaluates both arguments whereas the double ampersand will only evaluate the second argument if the first argument is true.
For all other argument types and combinations, a compile-time error will occur.

Previous Java J2EE Interview Questions can be read here.

Continue Reading...

Best Computer Books

Posted In: Books , Computer , Enterprise , J2EE , Java , Programming , Tips
By Vishal Sharma

Last year I compiled a list of best computer books which everyone software engineer should have. These books are listed below:

1. Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

2.Code Complete, Second Edition by Steve McConnell

3. The Mythical Man-Month: Essays on Software Engineering, 20th Anniversary Edition by Frederick P. Brooks

4. The Art of Computer Programming, Volumes 1-3 Boxed Set by Donald E. Knuth

5.The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt, David Thomas

6. Unix Network Programming, Vol. 1 and II: The Sockets Networking API, Third Edition by W. Richard Stevens, Bill Fenner, Andrew M. Rudoff, Richard W. Stevens

7. Advanced Programming in the UNIX(R) Environment (2nd Edition) by W. Richard Stevens, Stephen A. Rago

8. Algorithms in C, Parts 1-5 : Fundamentals, Data Structures, Sorting, Searching, and Graph Algorithms (3rd Edition)

9. Modern Operating Systems (2nd Edition) by Andrew Tanenbaum

10. The Protocols (TCP/IP Illustrated, Volume 1 by W. Richard Stevens

11. The Guru's Guide to Transact-SQL by Ken Henderson.

More detailed analysis can be read here.

Continue Reading...

Software development in last 30 years has seen various models of delivering the end product/software. Most of the organizations over the years have followed waterfall model for development and later on moved to Iterative development. Now within lat 4-5 years a new well-researched model suited for software development has come, named Agile Development. Agile is totally different from previous approaches and is being embraced by more and more organization who are in software development.

A recent global survey report, spanning 17,000 individual and 71 countries, on how agile development is being perceived is published by versionone.

Some key aspects of report are :

Main two reasons for adopting agile are Manage changing priorities and Accelerate
Time to Market
Two reasons concerning Agile development are Lack of up front planning (36%) and lack of documentation (30%)
Main barriers of further adoption of agile are General resistance to change (36%), personnel with agile experience (34%), Customer collaboration (21%)
81% are currently using osme form of agile development
90% finds increased productivity
85% finds reduced software costs
60% finds total cost reduction
75% of organizations with more than 20 employees are using this methodology
57% of Agile team are distributed
45% have people in 2-5 locations
Key agile practices are Iteration planning (65%), unit testing (60%), daily standup meetings (55%)
Scrum is the most used methodology

More on this report can be found here . Cross posted here.

Continue Reading...

Subscribe

Subscribe via RSSSubscribe via RSS! Or, subscribe via email:



Download Articles


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser