Saturday 31 March 2018

Liberty profile in IBM WAS

What is Liberty profile in IBM WAS

Liberty Profile is part of IBM WebSphere Application Server V8.5.5.5. It is very lightweight profile of WebSphere Application Server. Liberty profile is a flexible and dynamic profile of WAS which enables the WAS server to deploy only required custom features instead of deploying a big set of available JEE components. Developers can choose required features based on business requirement and push it to app server.
WAS Liberty profile is best suited for developers working on mission critical enterprise applications. It could be even used for production deployment. Current version of IBM WAS Liberty profile is Java EE 6 complaint and works well for applications using this Java EE 6 certified web profile. 
Liberty profile is also known as light weight, down sized version of WAS starting from 8.5. We can choose to use the same for application development if we have limited and well defined set of server components.

iberty is a highly composable, fast to start, dynamic application server runtime environment.
You can install the server as described in Installing Liberty by using downloaded archives.
Because Liberty does not include a Java™ runtime environment (JRE), you must install a compliant Java implementation (JRE or SDK) beforehand. For more information about supported Java environments and where to get them, see Minimum supported Java levels.
This server supports two models of application deployment:
  • Deploy an application by dropping it into the dropins directory.
  • Deploy an application by adding it to the server configuration file.
Liberty supports a subset of the following parts of the full WebSphere® Application Server programming model:
  • Web applications
  • OSGi applications
  • Enterprise JavaBeans (EJB) applications
Associated services such as transactions and security are available to these application types.
Features are the units of functionality by which you control the pieces of the runtime environment that are loaded into a particular server. For a list of the main Liberty features, see Liberty featuresYou can also create your own features, as described in Extending Liberty.
You can work with the runtime environment directly, or use the WebSphere Application Server Developer Tools for Eclipse. Further, you can use Admin Center to administer Liberty servers and applications and other resources from a web browser. See Administering Liberty.
On distributed platforms, Liberty provides both a development and an operational environment. On Mac OS, it provides a development environment.
For z/OS platforms On z/OS systems, Liberty provides an operations environment. You can work natively with this environment by using the MVS™ console. For application development, consider using the Eclipse-based developer tools on a separate distributed system, or on Mac OS.
You can organize Liberty servers into collectives to support clustering, administration, and other operations that act on multiple Libertyservers at a time in order to efficiently and accurately deliver application services to your organization. See Collective architecture for more information.

WAS Liberty profile Architecture

Below is the high level architecture of Liberty profile
Architecture Component Description
  • Liberty Kernel:  It is the core server profile component.
  • Java EE 6+ :  Standard Java EE6 API
  • Features: JSP, JSF, Web App Security, Servlet, JMS etc.
  • Applications: Web applications, Enterprise applications
  • OSGi Framework Runtime: In-built run time bundles

How WAS Liberty Profile works 

  1. If web-application requires only a servlet engine, then rather than starting all other components liberty profile only starts the WAS kernel, the HTTP transport and the web container so that developers can quickly start and deploy the applications.
  1. If an application needs persistence feature in their application and would like to use JPA Provider component to access relational data (RDBMS), developer just need to add JPA configuration in XML and Liberty profile will make it available persistence in the application.
  1. The set of features which we will define in <featureManager> tag describes the concrete profile for the configured server specific instance and then those lists of features are tailored for the application deployed to the application server. Internally, these features are a discrete set of JARs which is nothing but the OSGi bundles which are initialized and started as soon as they are added to the server configuration file (e.g. server.xml ). <feature> tag is use to define app specific JEE features.
  1. The Liberty profile works on a dynamic runtime environment known as OSGi runtime. OSGi services are used to manage JEE based component lifecycles, and the injection of dependencies and their runtime configuration. After this step server process and comprises a single JVM, known as the Liberty kernel, and any number of optional features required by the applications. After that configured feature code and most of the kernel code both runs as independent OSGi bundles or OSGi modules within an OSGi framework (Open System Gateway).
The Liberty profile supports a subset of the full WebSphere Application Server programming model. It supports below types-
  • Web applications
  • OSGi applications
  • Enterprise JavaBeans (EJB) applications
OSGi Framework Lifecycle 
OSGi framework follows OSGi Lifecycle for their Bundles. Below is the typical lifecycle of OSGi 
How to Install WAS Liberty profile?
There are two ways to download and install the Liberty profile runtime
  1. From within your Eclipse IDE.
  2. As a standalone JAR file that you install from the command line.
Please refer below URLs for download
 
"Liberty profile" is a part of IBM WAS Product and it is shipped as an in-buit core feature of the WebSphere Application Server. Liberty profile is not at all a separate product. It is a runtime environment for application server (WAS)  with a rich feature set that varies by WebSphere Application Server muledition.
Why should I use WAS Liberty Profile?
There are some key benifits of using Liberty profile runtime which is listed below:
WAS Liberty profile Simple configuration
Liberty profile makes it really easy to configure our server in a  very simple and efficient way using XML file. For example, default server.xml configuration file may look like below :
<server description="test server">

     <!—Enable features which you would like to use -->
    <featureManager>
        <feature>jsp-2.2</feature>
    </featureManager>

    <httpEndpoint id="appHttpEndpoint" host="localhost" httpPort="9080" httpsPort="9443" />
</server>
As per above default server.xml configuration basically enables the JSP 2.2 feature, which depends on the Servlet 3.0 feature; hence the Servlet feature is automatically enabled. We need not to call and define it explictly in WAS server.xml configuration file.
WAS Liberty profile configuration "Code Snippets"
Below are some code snippet to configure WAS Libertry Profile. We can use the same as and when required in the application development. 
<server>
  <featureManager>

               <feature>servlet-3.0</feature>
               <feature>mylocalConnector-1.x</feature>

  </featureManager>
</server>
above code will enable servlet-3.0 API and myLocalConnector-1.x for the configured application in the IBM Webspahere Server 
<server description= "Dev Server DV 33-04">
      <featureManager>
            <feature>servlet-3.x</feature>
      </featureManager>

 <application id="TestWebApp" location="WebApps/Test.war" name="TestWebApp" type="war"



</server>
above code will enable servlet-3.0 API and a dependent WAR file named as Test.WAR under web application TestWebApp. 
<server description="My Test server">
  <featureManager>
<!--enable jndi api for datasource lookups -->
    <feature>jndi-1.0</feature>
</featureManager>
</server>

above code will enable jndi-1.0 version for application 

<client>
    <featureManager>
        <feature>javaeeClient-7.x</feature>
    <featureManager>
 <application id="CLIENT_APP_ID_VALUE" name="CLIENT_APP_TYPE" type="ear" location="clientAppType.ear"/>
</client>

above code will enable java client api v7 and apply this to when deploy as an EAR file.

datasource configuration snippet 
<?xml version="1.0" encoding="UTF-8"?>

<server description="My Test DB server"> 
    <!-- Enable features -->
    <featureManager>
        <feature>jdbc-4.x</feature>
    </featureManager>
  <datasource databaseName="${was.server.dir}/CustomerDB" id="datasource_id" jndiName="data/jndi/lookup/Bank/CustomerDB" 

 </server>
above code will enable jdbc-4.0 API and enable configured database name based on jndi lookup.
Standard JEE specification in WAS Liberty profile
Below Oracle JEE/J2EE/JSR specifications are available in stable IBM WAS Liberty profile. Developers can configure any features using above code snippets based on application requirement.
  • CDI 1.2
  • JSP 2.3 and EL 3.0
  • Application client 1.0
  • JASPIC 1.1
  • JACC 1.5
  • SIP Servlets 1.1 and tools
  • SPNEGO support
  • OSGi App integration
  • JDBC 4.1
  • OSGi & Web 3.1 facet configuration for OSGi bundles
  • JAX-RS 2.0 client wizard
  • Support for remote development
  • Auto-scaling and dynamic routing
  • Real-Time Communications (WebRTC) and CouchDB
  • JAX-RS 2.0, Java Batch
  • JMS 2.0, JPA 2.1
  • Bean validation 1.1
  • JSON-P 1.0
  • EJB 3.2 Lite
  • Concurrent-1.0
  • Servlet 3.1
  • OpenID Connect
  • Java 8 toleration
  • WebSockets
Challanges  
  1. The Liberty Profile is free to use which is good but only in development environment not in production environment. If we want to move to production with the Liberty Profile we will anyways need to pay the usual IBM WAS Licensing cost which does not sounds good.
  1. There are other Lightweight servers out there today in the market which is free even for Production environment so choosing Liberty profile over those options still need to be evaluated.
  1. The Liberty Profile does not provide any UI like administrative console to perform server specific useful configuration actions like updating the server config or installing/uninstalling applications etc. so we have to rely on Eclipse/RAD/netbeans  editor to update the server.xml file or we have to manually modify it which does not look a feasible option for developers.
  1. Application developers compare this server to Tomcat and Glassfish which have already been around for many years so it could be one of the biggest challange for moving to liberty profile.
  1. In latest version liberty profile is coming up with lot of new features so it will be interesting to see how the Liberty Profile handles the increase functionality load with both footprint and size (approx 60MB). 
  2. For Lower IBM Websphere Server versions (5,6,7) it is not compitable which could be a challange for developers and applications using them. 
Summary 
In a nutshell we can say that Liberty Profile is one of the fastest changing and most interesting app servers to watch on the market today. So we should really focus on their upcoming releases. New Beta versions are coming up very quickly in the market with lot of new features which can use in our applications with just a simple configuration. IBM should really focus on building UI and some Migration Apps for Liberty Profile developers so that they can rapidly adopt it as compare to other major competitors like Tomcat, GlassFish, Jboss etc. It will be really interesting to see how the latest versions of Liberty Profile handles the increase functionality with both footprint and size which is the major plus with IBM WAS Liberty Profile.

Thursday 29 March 2018

ANSIBLE Modules

All modules