Sunday, March 31, 2013

Upgrading JBoss 7.1.1 to JSF 2.2

Following changes need to be done for upgrading JBoss AS 7.1.1 to JSF 2.2 :

(
You can find jars with associated module.xml file at URL: https://docs.google.com/file/d/0B251cC2F0UHzd2N1TEhIZFF4RlE/edit?usp=sharing
https://docs.google.com/file/d/0B251cC2F0UHzVGY0Umdya3A0amM/edit?usp=sharing
)


1.  servlet- api:
    a.  Backup existing files in <jboss_home>/modules/javax/servlet/api/main directory into some other directory (e.g, old-main)
    b.  Copy javax.servlet-api-3.0.1.jar into <jboss_home>/modules/javax/servlet/api/main directory
    c.  Create module.xml file inside <jboss_home>/modules/javax/servlet/api/main directory with the following contents:

2.   Jstl-api:
    a.  Backup existing files in <jboss_home>modules/javax/servlet/jstl/api/main directory into some other directory (e.g, old-main)
    b.  Copy javax.servlet.jsp.jstl-api-1.2.1.jar into <jboss_home>/modules/javax/servlet/jstl/api/main directory
    c.  Create module.xml file inside <jboss_home>/modules/javax/servlet/jstl/api/main directory with the following contents:

3.  jsf-api:
    a.  Backup existing files in <jboss_home>/modules/javax/faces/api/main directory into some other directory (e.g, old-main)
    b.  Copy jsf-api-2.2.1.jar into <jboss_home>/modules/javax/faces/api/main directory
    c.  Create module.xml file inside <jboss_home>/modules/javax/faces/api/main directory with the following contents:

4.  jsf-impl:
    a.  Backup existing files in <jboss_home>/modules/com/sun/jsf-impl/main directory into some other directory (e.g, old-main)
    b.  Copy jsf-api-2.2.1.jar into <jboss_home>/modules/com/sun/jsf-impl/main directory
    c.  Create module.xml file inside <jboss_home>/modules/com/sun/jsf-impl/main directory with the following contents:

5.   faces-config:
    Replace starting tag of faces-config file with the following one:

<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd" version="2.2">

6. You can find recent jsf-2.2.x jars from https://maven.java.net/index.html#view-repositories;public~browsestorage


Visit https://community.jboss.org/message/756575 for more information. Thanks.

Sunday, May 1, 2011

Reference Software Application Architecture

1. Introduction

Software structure of a system is depicted as logical and physical architectures. Logical architecture explains the system services and the capabilities offered by each of the service. It has different views. Some of them are logical view, service view, process view, and information model. Finalization of this architecture is followed with a project plan that explains the subsequent milestones and timeframes for each. These include detailed design, test plan, implementation and testing. Physical architecture explains the deployment of the services once they have been developed. A number of deployment options are possible and are driven by factors such as number of users, expected traffic, redundancy requirements and failover requirements. This document provides reference logical architecture that can be adopted for any application.

2. Logical Architecture

This section covers the key responsibilities to be handled by the application architecture. These responsibilities are to be fulfilled by following the guidelines and standards outlined within the next sub-section. The Logical view presents the different application layers and highlights the services contained within each layer. This is followed by a description of each service in more detail, including its responsibilities and interfaces in the application context. These will be flushed out in the detailed design phase that will follow. The major workflow processes are explained after that. The section concludes with the information model which shows the major object relationships.



2.1. Architectural Objectives

The architecture is formulated using the following objectives as a guideline:
• Proposed architecture needs to be scalable and easily replicable
• Addition or modification of one component or service should not affect the rest of the system
• The information model format and exchange should follow open standards
• Language support and internationalization should be seamless
• Integration with external databases should be seamless and not affect the business layer functionality
• Multiple clients should be supported from a single deployment
• Data for one customer should be secure from other customers deployed within the same setup
• Open source technologies should be utilized wherever application
• Technology reuse should be exploited to the maximum


2.2. Logical View

The Logical architecture is developed using the Requirements Specifications Document as a guideline. Some of the layers are listed below:
1. Presentation Layer. This layer provides the user interface services and is the user’s gateway into the system.
2. Business Layer. This layer implements the business logic and workflows that provide the core functionality for the application.
3. Data Access Layer. This layer handles all the persistent data requests for different modules of the application.
4. Infrastructure Layer. This layer implements some cross cutting concerns (i.e. general services) that are necessary for the overall system but do not deal with the direct business functionality of the application.
5. Integration Layer. This layer interfaces with the external databases and systems.


2.2.1. Infrastructure Services Layer
The infrastructure layer provides certain reusable services that support the business services. It can be used by presentation, business and data access layers. The layer will contain the following services.
2.2.1.1 Security service
The security service will provide authentication and authorization services for all the other services. It will provide the mechanism needed for access control of actions, as well as content.
2.2.1.2 Logging and Reporting
This service will implement a high performance logging interface that will be used by the other services for tracking important events. This raw data will be available for creating reports for different system users particularly system administrators.
2.2.1.3 Notification and Alerting
This service will implement messaging and notification capabilities. Notification implementations may include dashboard updates, email, SMS, fax etc.

2.2.2. Integration Layer
This layer will handle the data import/export service and communication with the external services. Currently this will include:
2.2.2.1 Connection Facade
This will handle connections for different external systems.
2.2.2.2 Data Import Engine
This will handle the data access operations for legacy systems. For example importing data from old database to the new one.

2.3. Service View
This section elaborates the services outlined earlier with respect to encapsulated responsibilities. Each of the services will publish an interface that will allow inbound, outbound or bi-directional communication. Each of the sub-sections below explains one such service’s responsibilities and its interface capabilities.

2.4. Process View
This section reviews the main workflow processes to be implemented by the system. The processes are explained using activity diagrams.

2.5. Information Model
This section provides a high level information model for the system. This model outlines the relationships between the different objects within the system and will evolve to the definition of the system schema.

Opening urls from a text file in browser tabs (Java Code)

import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;

import javax.swing.JFileChooser;

public class UrlsOpener {

public static void main(String[] args) {
openAllURLs();
}

private static void openAllURLs() {
try {
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(null);

if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();

if (file != null && file.exists()) {
FileReader frd = new FileReader(file);
BufferedReader brd = new BufferedReader(frd);

String url = null;
while ((url = brd.readLine()) != null) {
openURL(url);
}
brd.close();
frd.close();
}
}

} catch (Exception ex) {
ex.printStackTrace();
}
}

private static void openURL(String urlText) {
if (Desktop.isDesktopSupported()) {
URI uri = URI.create(urlText);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

Monday, January 10, 2011

Detecting Mobile Agents and Redirection to the mobile website in JSP

<%
String[] mobileAgents = { "iphone", "ipod", "ipad", "android", "blackberry", "palm", "lg", "mot", "nokia",
"samsung", "sonyericsson", "sie", "siemens" };

String userAgent = request.getHeader("User-Agent").toLowerCase();

boolean isMobileAgent = false;
for (String mobileAgent : mobileAgents) {
if (userAgent.contains(mobileAgent) && (!userAgent.contains("msie"))) {
isMobileAgent = true;
break;
}
}

String engineWebKit = "webkit";
String[] deviceExplorers = { "series60", "symbian", "android" };
if (!isMobileAgent && userAgent.contains(engineWebKit)) {
for (String deviceExplorer : deviceExplorers) {
if (userAgent.contains(deviceExplorer)) {
isMobileAgent = true;
break;
}
}
}

if (isMobileAgent) {
response.sendRedirect("your-mobile-website-url");
}
%>

Wednesday, December 29, 2010

jboss-6.0.0.Final client minimal libraries

The followings are the list of libraries for jboss-6.0.0.Final client application to work properly:

concurrent.jar
jbossall-client.jar
jboss-aop-client.jar
jboss-appclient.jar
jboss-aspect-jdk50-client.jar
jboss-client.jar
jboss-common-core.jar
jboss-ejb3-async-impl.jar
jboss-ejb3-async-spi.jar
jboss-ejb3-common-client.jar
jboss-ejb3-context-spi.jar
jboss-ejb3-core-client.jar
jboss-ejb3-proxy-impl-client.jar
jboss-ejb3-proxy-spi-client.jar
jboss-ejb3-security-client.jar
jboss-integration.jar
jbossjmx-ant.jar
jboss-logging.jar
jboss-metadata-ejb.jar
jboss-remoting.jar
jboss-security-spi.jar
jbosssx-client.jar
log4j.jar


Thanks

Wednesday, December 1, 2010

Handling Redirect Issue in Ajax Call

function ajaxCall(){
var formData = getLibImgCartFormElements();
var url = "/myapp/test.jsp";
var params = "";

new Ajax.Request(
url,
{
method: 'post',
parameters: params,
onSuccess: function(response) {
if(isLoginRedirect(response)){
return;
}
$('yourDivName').innerHTML = contents;
},
onFailure: function(response) {
window.location = window.location.href;
}
}
);
}

function isLoginRedirect(response){
var contents = response.responseText;
if(response.status == 0 || contents == null || contents == '' || isLoginFormContents(contents)){
window.location = window.location.href;
return true;
}else{
return false;
}
}

function isLoginFormContents(contents){
var flag = false;
/*
* if((contents != null) && (contents.indexOf("") > 0)){ return true; }else{ return false; }
*/
return flag;
}

Monday, November 29, 2010

Creating a project(trunk, branches, tags) on svn repository

svnadmin create myproject

svn mkdir -m "created trunk" svn://username#servername/svnroot/myproject/trunk
svn info svn://username#servername/svnroot/myproject/trunk


svn mkdir -m "created branches" svn://username#servername/svnroot/myproject/branches
svn info svn://username#servername/svnroot/myproject/branches

svn mkdir -m "created branches" svn://username#servername/svnroot/myproject/tags
svn info svn://username#servername/svnroot/myproject/tags


svn copy http://username@servername/svnroot/myproject/trunk http://username@servername/svnroot/myproject/branches/myproject
-m "Creating a private branch of myproject/trunk."

Monday, February 15, 2010

How to install VNC Server on Fedora 10 / Linux

1. Visit the following url for downloading:

http://www.realvnc.com/products/free/4.1/download.html

(vnc-4_1_3-x86_linux.tar.gz)

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp vnc-4_1_3-x86_linux.tar.gz /usr/local/

3. Change the current directory

cd /usr/local/

4. Unzip/untar the file

tar -zxvf ./vnc-4_1_3-x86_linux.tar.gz

How to install Skype on Fedora 10 / Linux

1. Visit the following url for downloading:

http://www.skype.com/intl/en/download/skype/linux/choose/

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp skype-2.1.0.47-fc10.i586.rpm /usr/local/

3. Change the current directory

cd /usr/local/

4. Install the file

rpm -ivh skype-2.1.0.47-fc10.i586.rpm

How to install DbVisualizer on Fedor 10 / Linux

1. Visit the following url for downloading:

http://www.minq.se/products/dbvis/download/index.jsp

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp dbvis_linux_6_5_10.rpm /usr/local/

3. Change the current directory

cd /usr/local/

4. Install the file

rpm -ivh dbvis_linux_6_5_10.rpm

Adding subclipse plugin to eclipse

1. Run eclipse

cd eclipse
./eclipse

2. Click on Window > Preferences

3. Go to Install/Update > Available Software Sites

4. Type subclipse in Name field and http://subclipse.tigris.org/update_1.6.x (or whatever latest version) in the Location field
and click on Ok button

5. Click Ok button on Preferences Dialog box

How to install Eclipse on Fedora 10

1. Visit the following url for downloading:

http://www.eclipse.org/downloads/

(eclipse-jee-galileo-SR1-linux-gtk-x86_64.tar.gz)

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp eclipse-jee-galileo-SR1-linux-gtk-x86_64.tar.gz /usr/local/

3. Change the current directory

cd /usr/local/

4. Unzip/untar the file

tar -zxvf eclipse-jee-galileo-SR1-linux-gtk-x86_64.tar.gz

4. Run eclipse

cd eclipse
./eclipse

mod_jk [Configuring mod_jk for Apache]

1. Visit the following url for downloading:

http://tomcat.apache.org/download-connectors.cgi

2. Change the current directory

cd /usr/local/

3. Unzip/untar the file

tar -zxvf ./tomcat-connectors-1.2.28-src.tar.gz

4. Configure/Build mod_jk

cd tomcat-connectors-1.2.28-src

cd native

./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI

cp ./root/modules/mod_jk.so $APACHE_HOME/libexec

5. Create workers.properties in $APACHE_HOME/conf/jk with the following contents:

workers.tomcat_home=$CATALINA_HOME
workers.java_home=$JAVA_HOME
ps=/
worker.list=worker0

worker.worker0.port=8009
worker.worker0.host=localhost
worker.worker0.type=ajp13
worker.worker0.lbfactor=1

6. For Apache 1.3.x, edit $APACHE_HOME/conf/httpd.conf and add the following to the LoadModules section:

LoadModule jk_module libexec/mod_jk.so

7. For Apache 2.0.x, edit $APACHE_HOME/conf/httpd.conf and add the following to the LoadModules section:

LoadModule jk_module modules/mod_jk.so

8. Edit $APACHE_HOME/conf/httpd.conf and add the following to the AddModules section (if you have it - Apache 2 and later versions of Apache 1.3.x don't):

AddModule mod_jk.c

9. Edit $APACHE_HOME/conf/httpd.conf and add the following before Section 3 in httpd.conf:

#
# Mod_jk settings
#

JkWorkersFile "conf/workers.properties"
JkLogFile "logs/mod_jk.log"

JkLogLevel error

JkMount /examples/jsp default
JkMount /examples/jsp/* default

# End of mod_jk settings

The location of the Jk workers.properties and log files are relative to $APACHE_HOME. If you prefer other locations, make sure you fully qualify the paths.

In this test, we are directing all URIs that begin with "/examples/jsp" to Tomcat. The name "worker0" corresponds to the JK worker that we defined in $APACHE_HOME/conf/workers.properties. We define two JK Mounts in order to match the URI of "/examples/jsp" as well as any that start with "/examples/jsp". In a real world situation, we might only direct JSPs or servlets to the JK worker.

10. Find the line in $APACHE_HOME/httpd.conf that starts with "Port" - make sure you have it pointing to a port that is not in use. Lately, Apache has been coming with the "Port" directive set to "8080", which is the same port that Tomcat will listen on. If you don't have any other web server running, you can set it to "80" instead.

11. Test httpd.conf by typing the following:

cd $APACHE_HOME/bin
apachectl configtest

How to install Tomcat on Fedora 10

1. Visit the following url for downloading:

http://tomcat.apache.org/download-60.cgi

(Currently, the latest is Tomcat 6.0.20)

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp apache-tomcat-6.0.20-src.tar.gz /usr/local/

3. Change the current directory

cd /usr/local/

4. Unzip/untar the file

tar -zxvf ./apache-tomcat-6.0.20-src.tar.gz

5. Edit the /etc/profile file

Open /etc/profile file by the following command

vim /etc/profile

Add the following entries at the end of /etc/profile file

CATALINA_HOME=/usr/local/apache-tomcat-6.0.20
export CATALINA_HOME


Save /etc/profile file by the following commands

Esc
Shift+ Collon
:qw
Enter

How to install Apache/httpd on Fedora 10

Note: If gcc, libtool, automake, autoconf and other related tools are missing then install those with yum like:
yum install toolname
For Example:
yum install libtool

1. Visit the following url for downloading:

http://httpd.apache.org/download.cgi

(currently, the latest is 2.2.14)

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp httpd-2.2.14.tar.gz /usr/local/

3. Change the current directory

cd /usr/local/

4. Unzip/untar the file

tar -zxvf httpd-2.2.14.tar.gz

5. Configure and build

cd httpd-2.2.14
./configure --with-layout=Apache --prefix=/usr/local/apache2 --enable-rule=SHARED_CORE --enable-module=so

make
make install

6. Edit the /etc/profile file

Open /etc/profile file by the following command

vim /etc/profile

Add the following entries at the end of /etc/profile file

APACHE_HOME=/usr/local/apache2
export APACHE_HOME


Save /etc/profile file by the following commands

Esc
Shift+ Collon
:qw
Enter

How to install smartsvn on Fedora 10

1. Visit the following url for downloading:

http://www.syntevo.com/smartsvn/download.html

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp smartsvn-generic-6_0_8.tar.gz /usr/local/

3. Change the current directory

cd /usr/local/

4. Unzip/untar the file

tar -zxvf nameof.tar.gz

5. Ensure, that the correct Java Runtime Environment is installed on your system

6. start the application by using the launcher script file smartsvn.sh in the bin directory

cd smartsvn-6_0_5/bin/
./smartsvn.sh

How to install JAVA on Fedora 10

1. Visit the following url for downloading:

http://java.sun.com/javase/downloads/index.jsp

2. Copy the downloaded file to /usr/local (or to into a directory or your choice)

cp jdk-6u16-linux-x64-rpm.bin /usr/local/

3. Change the current directory

cd /usr/local/

4. Change the permission of the file you downloaded to be executable. Type:

chmod a+x jdk-6u16-linux-x64-rpm.bin

5. Verify that you have permission to execute the file. Type:

ls -l

6. To start the installation process, type:

./jdk-6u16-linux-x64-rpm.bin

7. The installation file creates jdk-6u16-linux-amd64.rpm file in the current directory.

8. Run the RPM command at the terminal to install the packages. Type:

rpm -ivh jdk-6u16-linux-amd64.rpm

9. The JRE is installed in jre1.6.0_(version number) sub-directory under the current directory.
In this case, the JRE is installed in the /usr/java directory.
Verify that the jdk1.6.0_16 sub-directory is listed under /usr/java directory.

cd /usr/java/
ls

10. Delete the bin and rpm file if you want to save disk space.

cd /usr/local/

rm jdk-6u16-linux-x64-rpm.bin

rm jdk-6u16-linux-amd64.rpm

11. Edit the /etc/profile file

Open /etc/profile file by the following command

vim /etc/profile

Add the following entries at the end of /etc/profile file

JAVA_HOME=/usr/java/jdk1.6.0_16
export JAVA_HOME

JRE_HOME=/usr/java/jdk1.6.0_16/jre
export JRE_HOME

Save /etc/profile file by the following commands

Esc
Shift+ Collon
:qw
Enter