OMNI 3.0 Portal on Tomcat 7.x.x

Environment Setup

Prerequisite

In order to deploy OMNI on Tomcat 6.x.x and above, have to do the following steps

  1. Create sub-folder shared under CATALINA_HOME folder
  2. Create sub-folder lib under CATALINA_HOME\shared folder
  3. Create sub-folder Catalina under CATALINA_HOME\conf
  4. Open the file catalina.properties under CATALINA_HOME\conf and look for the line shared.loader. Replace that paricular line with shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/\*.jar

Its done. Now can do ant clean / ant install and deploy OMNI portal.

OMNI 3.0 Portal on TOMCAT 7 with Apache as webserver

Redirect Apache 2.x Request to Tomcat 7.x.x using mod_proxy Module

After installing Linux by default make Apache 2.x to run on port 80 and run Tomcat 7.x.x on port 8080

Now go to Apche2 installation folder\Apache2.2\conf folder. Open httpd.conf to Uncomment the following three lines,

  1. LoadModule proxy_module modules/mod_proxy.so
  2. LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
  3. LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

Look for the lineand uncomment it.

Add the following entry into the above section of httpd.conf file

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

<Location / >
Order allow,deny
Allow from all
</Location>

It’s Done. Now by typing http://localhost; tomcat default page will come up.

What is Proxy ?

Benefits of using Apache as Proxy

General SQL Statements

To get the list of Marital Status

SELECT PSK_STAT_KAHWIN, PSK_KTRGN_ST_KAHWIN FROM SN_KD_ST_KAHWIN

Staff related SQL Statements

To identify the staff’s PTJ
SELECT KODPTJ_POHON, PTJ_POHON FROM SN_VW_ATT_STAF WHERE NOGAJI_POHON = ‘XXXXXX’

To identify the staff’s JABATAN
SELECT KODJABATAN_POHON, JABATAN_POHON FROM SN_VW_ATT_STAF WHERE NOGAJI_POHON = ‘XXXXXX’

Enabling the PHP OCI8 Extension on Linux

  1. Install PHP and Apache. Check that PHP is working.
  2. Download the Basic and the SDK Instant Client packages from the OTN Instant Client page. Install the RPMs as the root user:
    rpm -Uvh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
    rpm -Uvh oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm
    The first RPM puts the Oracle libraries in /usr/lib/oracle/11.1/client/lib
    The second creates headers in /usr/include/oracle/11.1/client
  3. The latest OCI8 1.3 extension from PECL supercedes the default version in the PHP 5.2 source code. This can be downloaded manually and installed with:
    pecl install oci8-1.3.5.tgz
  4. This gives:
    downloading oci8-1.3.5.tgz …
    Starting to download oci8-1.3.5.tgz (137,987 bytes) …..done: 137,987 bytes
    10 source files, building running: phpize
    Configuring for:
    PHP Api Version:         20041225
    Zend Module Api No:      20060613
    Zend Extension Api No:   220060519
    Please provide the path to the ORACLE_HOME directory. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling with Oracle Instant Client : autodetect 1-1, ‘all’, ‘abort’, or Enter to continue:
  5. Since we have installed the Instant Client RPMs, hit Enter and PECL will automatically locate the RPMs and build and install an oci8.so shared library.
  6. In php.ini, enable the OCI8 extension with: extension=oci8.so
  7. Verifying the Extension is Installed
  8. To check the extension is configured, create a simple PHP script phpinfo.php in the Apache document root:
    <?php
    phpinfo();
    ?>
  9. Load the script into a browser using the appropriate URL, e.g. “http://localhost/phpinfo.php”. The browser page will contain an “oci8″ section saying “OCI8 Support enabled”. The OCI8 options that can be configured in your php.ini file are shown.

Backup to Local server

SSH Security

Step 1

Identify the server that initially contains the files (we will call this the SOURCE server), and the serverto which you want to transfer the files (we will call this the TARGET server). Confirm that you can log in to the SOURCE server, that you can log in to the TARGET server, and that while logged into the TARGET server, you can use ssh to login to the SOURCE server using your password.

Step 2

Log into the TARGET server. Execute the command

[mikeular@targethost~]$ ssh-keygen -t dsa

ssh-keygen will ask you where you want to save the key. Accept the default directory, which will be ~/.ssh/id_dsa . Next it will ask you for a passphrase, leave this entry blank.

Your private key file will be saved to ~/.ssh/id_dsa and your public key will be saved to ~/.ssh/id_dsa.pub. Careful! Anyone who obtains a copy of your id_dsa file will be able to login to the SOURCE server as you, without authenticating themselves. Make sure that it’s stored securely!

Step 3

Now you will configure the SOURCE server to accept the key. Once this step is complete, anyone with the id_dsa file will be able to log into the SOURCE server without providing a password. Log into the SOURCE server and create the ssh directory:

[mikeular@sourcehost~]$ mkdir ~/.ssh
[mikeular@sourcehost~]$ cd ~/.ssh

Using vi or another text editor, create a file in ~/.ssh named authorized_keys2 . Now switch over to the TARGET server and copy the contents of the file id_dsa.pub and paste them into authorized_keys2 on the SOURCE server. Save the text file.

Step 4

Make sure that the authorized_keys2 cannot be changed by other users on the SOURCE server:

[mikeular@sourcehost~]$ chmod 644 ~/.ssh/authorized_keys2

Step 5

Now you can test your setup. Go back to the TARGET server and connect to the source.

[mikeular@targethost~]$ ssh username@sourcehost.com
[mikeular@sourcehost~]

Your ssh connection is now working correctly.

Step 6

Test your rsync over ssh connection by copying a file from SOURCE to TARGET. Enter the following command all on one line, being sure to substitute in the correct pathnames, username, and hostname.

[mikeular@targethost~]$ rsync -avz -e/usr/bin/ssh username@sourcehost.com:/home/username/testfile /home/mikeular/

This should copy the file “testfile” from your home directory on sourcehost to your home directory on targethost.

Step 7

All that’s left is to setup your cron job. Plenty of documentation is available online.

Hot Air Balloon in Melaka, Malaysia

Come fly with us in Melaka, the world heritage city. Now at Dataran Pahlawan, Melaka, Malaysia.

http://www.aeronazballoons.com

Now Aeronaz Balloons is using OMNI, a JSR168 compliant Portal.

Malaysian Hindu Temple Directory – myhindutemples.com

Listing of Hindu Worship Places  in Malaysia – A Database Project
 
 After 52 years of Independence, the actual number of Hindu places of worship (temples, shrines, etc) in Malaysia are not known. Different groups, from politicians to NGOs, offer different figures ranging from 10,000 to 20,000; researchers from State governments, MIC, MHS and other NGOs have undertaken data-collection projects at various times for this purpose, but there is still no composite available.Without availability of such data, it has proven difficult to develop strategies on the future of Hindu places of worship in Malaysia, especially on matters related to the defending against demolitions of Hindu places of worship.As such, the Temple Committee of the Malaysia Hindu Sangam (MHS), as the committee under the national Hindu body that coordinates the interests and activities of temples in the context of looking out for the needs of Hindus in Malaysia has now initiated a community-based nationwide project to collect data on Hindu places of worship in the country.  To develop a truly comprehensive database, we invite ALL Hindus in Malaysia, (including NGOs) to participate in this initiative ? all one would have to do is to visit this website: www.myhindutemples.com and complete a survey online after interviewing the person in charge at the temple that is to be included in the database. We believe that a web-based platform will be able to achieve what previous initiatives could not, particularly so due to the renewed strength many of us have gained from recent events.

This is how we seek your assistance, if you wish to volunteer :

1.      Volunteer intending to complete the survey goes to the website and places the cursor on the Temple Database tab.

2.      Placing the cursor on the tab releases a drop-down menu, from which the volunteer is to select Registration Form ? Hardcopy.

3.      This should bring the volunteer to a page where the form is available for download. Following the instructions on the page, the volunteer can download the form, print it, and visit the temple at the appropriate time to interview the person-in-charge. Considering the value of this project, it would be both practical and understandable to request a little verification on the spot for some of the information requested.

4.      Upon getting the complete details, the volunteer can then return to the computer and select the Registration Form ? Online option to key in the details online immediately. The volunteer may wish to download and read the Guide to Completing the Form before doing so.

5.      Once these details are keyed in, please give us 3 -5 working days before checking the Approved Temples Listing to confirm whether the record keyed in has accepted by the system. Get back to the website again.

We thank you once again for your kindness, support and participation. AUM.

Adding resources to a portlet meaning

First step is creating a POJO that has the following fields

Resouce file name – The values for this field will be “test.txt, baby.jpg, video.flv”. This field is compulsory, meaning you must validate.
Resource descrption – The values for this field will be “nice pic”. This field is optional, meaning no need to validate. User may leave it blank
Resource type – This field is used by the developer in the programming. When the user upload a resource the program identifies its type and update this field automatically. The values for this field will be 

  • “Image” if the file type is jpeg, jpg, png, gif
  • “Audio” if the file type is mp3
  • “video” if the file type is flv
  • “Document” if the file type is txt, zip and all other

Second step is creating the services

Third step is creating the portlets

And the final step is creating the View Manager Portlet. While doing the view manager portlet retrieve the resources and display them, order by Resource Types. Meaning all Images listed first, followed by Audio files, then Video Files and finally other Documents.

First step – Persistence in OMNI Portal

Every application requires lookup(s). In computing terms “Lookup” is an array of data, eventually that will be used by most of the applications. One good example is list of Countries. Let us create necessary POJI and POJO classes. A simple country object requires country id and country name. Country Id is normally used a primary key to identify and pick the specific country. Let us create our Country POJI.

package com.omni.services.country;
public interface Country {
     public String getCountryId();
     public void setCountryId(String countryId);
     public String getCountryName();
     public void setCountryName(String countryName);
}

Let us start creating Country POJO which is the implementation of Country POJI

package com.omni.services.country.impl;
import com.omni.services.country.Country;
import java.io.*;
public class CountryImpl implements Country, Serializable {
         private String countryId = “”;
         private String countryName = “”;
         public String getCountryId() {
                   return countryId;
         }
         public void setCountryId(String countryId) {
                   this.countryId = countryId;
         }
         public String getCountryName() {
                  return countryName;
         }
         public void setCountryName_en(String countryName_en) {
                 this.countryName_en = countryName_en;
         }
}

This POJO needs to be mapped with a hibernate mapping file. Following code represents Hibernate mapping file.

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE hibernate-mapping PUBLIC “-//Hibernate/Hibernate Mapping DTD 2.0//EN”  “http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd“>
<hibernate-mapping>
     <class name=”com.omni.services.country.impl.CountryImpl” table=”CountryImpl”>
     <id name=”countryId” column = “countryId” type=”java.lang.String” length=”32″>
                 <generator class=”uuid.hex”/>
     </id>
     <property name=”countryShortDesc” type=”string” column=”countryShortDesc”/>
     <property name=”countryLongDesc” type=”string” column=”countryLongDesc”/>
     </class>
</hibernate-mapping> 

Hibernate mapping documents are straight forward. The <class> element maps a table with corresponding class. The <id> element represents the primary key column, and its associated attribute in the domain object. The <property> elements represent all other attributes available in the domain object

Follow

Get every new post delivered to your Inbox.