Apache Slings
The goal of Apache Sling is to expose content in the content repository as HTTP resources, fostering a RESTful style of application architecture.
Sling is different from a lot of other Web application frameworks in the sense that it truly focuses on the web aspect of the "web application" development and through its development paradigm suggests an intuitive RESTful development of a true web application. Other frameworks focus more on the application development and therefore are ideal extensions to Sling. .
The main purpose of Sling is to develop a content-centric Web Application framework for Java Content Repository (JCR) based data stores.
Sling is implemented - with the notable exception of JCR Node Type management - purely in terms of the JCR API and as such may use any JCR compliant repository. The default implementation for Apache Jackrabbit is provided out of the box.
Note:-
1- OSGi stands for “ Open Source Gateway Initiative “ :-
Sling is implemented as a series of OSGi Bundles and makes extensive use of the OSGi functionality, such as lifecycle management and the service layer. In addition, Sling requires several OSGi compendium services to be available, such as the Log Service, Http Service, Configuration Admin Service, Metatype Service, and Declarative Services.
2-Apache Felix :-
While Sling does not require a specific OSGi framework implementation to run in, Sling is being developed using Apache Felix as the OSGi framework implementation. It has not been tested yet, but it is expected that Sling also operates perfectly inside other OSGi frameworks such as Equinox and Knopflerfish.
Apache Slings Five Boolets Point :-
1-REST Based web framework
2- Content-driven, using a JCR content repository
3- Powered by OSGi
4- Scripting inside, multiple languages (JSP, server-side javascript, Scala, etc.)
5- Apache Open Source project (http://incubator.apache.org/sling)
REST Based web framework-
An architectural style for distributed systems. Application data and state is represented as a set of addressable resources which present a uniform interface that allows transfers of state (e.g. reading and updating of the resource's state). The (quasi-canonical) example of a RESTful architecture is the web, where "resources" have URIs and the "uniform interface" is HTTP.
Resource identification through URI: A RESTful web service exposes a set of resources that identify the targets of the interaction with its clients. Resources are identified by URIs, which provide a global addressing space for resource and service discovery.
Uniform interface: Resources are manipulated using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. PUT creates a new resource, which can be then deleted by using DELETE. GET retrieves the current state of a resource in some representation. POST transfers a new state onto a resource.
An HTTP
request consists of a path, a verb, and some headers. The "verbs" of
HTTP are the methods; GET is the simplest:
GET / HTTP/1.1
Host: localhost
This
fetches the resource and sends it back as the body of the HTTP response. GET, by
definition, should never change the state of the resource on the server.
A POST
request involves sending a request body along with the URI, and usually
involves a few headers that tell the server how to understand the request body.
POST /jenesys.cgi HTTP/1.1
Host: localhost
Content-type: application/x-www-form-urlencoded
Content-length: 30
name=Jeetendra&occupation=Job
It's up
to the server to figure out what that means, although the official definition
is something like "please stash these things as subordinates of /jenesys.cgi." POST is in practice used as the generic
method to use when a resource needs to change on the server.
POST is
not idempotent (the result of calling it more than once with the same
values may produce different results than calling it just once).
Most
browsers only support GET and POST as the "method" attribute on a
form tag, but there are at least two other commonly used methods out there.
PUT [uri] means "stash the body of this request at [uri] (whether or not there was something already
there).
PUT creates a new resource.
It's different from POST in that it is
idempotent. It's intended as a counterpart to GET.
DELETE [uri] means pzackly what it says.
The main contention of REST web framework is that for most cases, a framework like HTTP
(addressable resources + "verbs" + standard ways to transmit
metadata) is all you need to build a distributed application. Sling may be seen
as an attempt to provide some data for this contention, at least for the case
where the distributed application is a content repository.
Developing RESTful Web Services with JAX-RS
JAX-RS is
a Java programming language API designed to make it easy to develop
applications that use the REST architecture.
The
JAX-RS API uses Java programming language annotations to simplify the
development of RESTful web services.
JCR:-
A (Java-based) standard for content repositories; think
"filesystem with metadata" and you won't be too far off.
"Hierarchical object storage" maybe gets closer to the heart of the
matter.
JCR stores nodes which have
types and properties, and may in addition
have child nodes. Every node has at least one primary
type that define(s) the structure of the node's properties and
children.
3-OSGi
A
module system for Java that allows building applications as a set of reloadable
and strongly encapsulated services. Traditional Java application servers use a
fairly monolithic approach to application deployment. OSGi "bundles"
run inside an OSGi "container"
The
OSGi container manages relations among bundles, which
are simply JAR files that contain extra metadata indicating what services they
require and which they provide. See the OSGi
metadata overview from Spring for a friendly and implementation-neutral
introduction.
Multi-Module Project:
we
create a multi-module project that combines the two different project module
(e.g.
simple-weather and simple-webapp)
where in case of simple weather
,only the things about wheather of any places has been mentioned, while in case
of simple-webapp how to create
web-application has been mentioned.
In
Multi-module ,we combine both project module to etrieves and displays weather
forecast information on a web page.
For
this purpose, we mention both modules in
Super POM within module tag. E.g.
<modules>
<module>simple-weather</module>
<module>simple-webapp</module>
</modules>
These
modules are defined in the modules element, and each module element corresponds
to a subdirectory of the simple-parent/
directory. Maven knows to look in these directories for pom.xml files, and it will add
submodules to the list of Maven projects included in a build.
Using
POM inheritance allows you to add common dependencies for universal
dependencies like JUnit or Log4J.




0 comments:
Post a Comment