Friday, 23 March 2012

Cron Trigger,Jobs and Expressions in Quartz Scheduler


Cron triggers in Quartz can be used to schedule a job based on an expression ( more like a reg-ex) defining when precisely the job execution is allowed. The cron trigger can be used to schedule a job only on specific days of month, or a definite time range for specific days etc. The cron expression is a string which comprises of 7 elements of which 6 are mandatory.
Cron expression involves 6 or 7 fields in a string separated by whitespace. The fields and their allowed values are (individually or as a range) –
Seconds -> 0-59
Minutes -> 0-59
Hours -> 0-23
Day of month -> 1-31
Month –> 1-12 or JAN-DEC
Day of week -> 1-7 or SUN-SAT
And the optional field of
Year -> 1970-2099
Along with the literal values for the fields, a cron expression also allows a few general and specific ( for particular fields ) wildcard entries to be used in the string. General wildcard entries include “*” signifying any value from the allowed range of values, “,” signifying combination of values for example 1,2,3 for day of month, the range specifier “-“, the “/” wildcard entry, which signifies increment. For example using 2/10 in the minutes field signifies that the job has to be fired every 10th minute starting from the second minute of the hour i.e., 2nd ,12th ,22nd ,32nd ,42nd ,52nd minute of the hour and the “?” literal which signifies that there is no specific value. The “?” literal is used especially in cases of day of week and day of month where one might influence the other. For example, to specify all weekdays of a month, the “?” literal can be used in the field day of month and MON-FRI in day of week field so that cron is fired on all weekdays irrespective of the date
Some of the special wildcard entries which are specific to “day of month” field are L and W –where L specifies the last day of the month and W signifies the weekday closest to the given day, for example 10W specifies the weekday after 10th if the 10th falls on a weekend else the day itself. Please note that the usage of W does not spill-over to the next month, in that, if, 30W is specified then, if 30 and 31 are weekend then, the job is not executed on 1st of the next month but, is executed on the weekday next to 30th of the coming month.
The other wildcard entries are L and # used in the “day of week” field. The “L” entry has the same meaning here, in that, it signifies the last day of the week (ie., 7 or SAT ) also, it can be additionally used with a value from 1-7 which makes it the last particular day of the month – for example, 5L specifies the last Thursday of the month. The # wildcard entry on the other hand is used to specify the nth day of the month – for example 3#2 means second Tuesday of the month ( 3 -> Tuesday and #2 -> position in the month )
Let us make a scheduler application, so that the job is scheduled only for the weekdays along with a break for Christmas –
Schedular.java
package com.opensourzesupport.schedule;
import com.opensourzesupport.schedule.jobs.MyJob;
import com.opensourzesupport.schedule.listeners.MyJobListener;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Properties;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.impl.calendar.AnnualCalendar;

/**
 *
 * @author prasobh
 */
public class Schedular {

    public Schedular(){
         try {
            //Create the annual calendar object - to add Christmas holiday to our Alarm Job fire exception

            AnnualCalendar holidays = new AnnualCalendar();

            Calendar christmas = new GregorianCalendar(2011, 11, 25);

            holidays.setDayExcluded(christmas, true);

            Properties prop = new Properties();

            prop.setProperty("org.quartz.jobStore.class", "org.quartz.simpl.RAMJobStore");

            prop.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");

            prop.setProperty("org.quartz.threadPool.threadCount", "4");

            SchedulerFactory schdFact = new StdSchedulerFactory(prop);

            Scheduler schd = schdFact.getScheduler();

            //add the Calendar object created to the scheduler with a string identifier to it

            schd.addCalendar("holidays", holidays, false, true);

            schd.start();

            JobDetail jobDetails = new JobDetail("myjob", Scheduler.DEFAULT_GROUP, MyJob.class);

            //Define a cron job such that the job executes every weekday at 06:00

            CronTrigger trigger = new CronTrigger("myjobtrigger", Scheduler.DEFAULT_GROUP, "0 0 6 ? * MON-FRI *");

            //set the calendar associated with the trigger

            trigger.setCalendarName("holidays");

            trigger.getJobDataMap().put("auth_name", "Prasobh");

            trigger.setStartTime(new Date());

            schd.addJobListener(new MyJobListener());

            jobDetails.addJobListener("My Job");

            schd.scheduleJob(jobDetails, trigger);

            System.out.println(schd.getSchedulerName());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Schedular();
    }
}

MyJob.java

package com.opensourzesupport.schedule.jobs;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 *
 * @author prasobh
 */
public class MyJob  implements Job{

    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {
        System.out.println("executing my my job");
    }
    
}

 In the above program, the line
CronTrigger t = new CronTrigger("alarmtrigger", Scheduler.DEFAULT_GROUP, "0 0 6 ? * MON-FRI *"); 

creates a new cron-trigger that is scheduled for every weekday at 0600 hrs. The string “0 0 6 ? * MON-FRI *” specifies -
0 – 0th second
0 – 0th minute
6 – 6 AM hours
? – no specific day of the month
“*” – all months
MON-FRI – only weekdays
“*” – any year

 Note:- While create a schedule JobDetail name and JobDetails Group should be uniqueCronTriggername and  CronTrigger  Group should be unique 


Tuesday, 13 March 2012

JDBCJobStore in Quartz Scheduler

JDBCJobStore is a way of maintaining the quartz job details over a database via the JDBC. While the use of RAMJobStore indicates volatile storage of the quartz job details, a JDBCJobStore ensures that the information on the quartz jobs, triggers, calendars etc are available any time in case the system has a downtime and then can be rescheduled once the system is up.
A JDBCJobStore requires some database tables to be present in the data source defined for use of quartz. The sql queries for creating and populating the required tables is available under the docs/dbTables folder of the quartz distribution. The following example uses the MySQL database to schedule a job using the JDBCJobStore.
The file quartz.properties is used by the program to define the quartz properties -
Sample Program – file quartz.properties

#Skip Update Check
#Quartz contains an "update check" feature that connects to a server to
#check if there is a new version of Quartz available
org.quartz.scheduler.skipUpdateCheck: true

org.quartz.scheduler.instanceName =OZS_SCHEDULAR
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 4
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.threadPool.threadPriority = 5


#specify the jobstore used
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false

#specify the TerracottaJobStore
#org.quartz.jobStore.class = org.terracotta.quartz.TerracottaJobStore
#org.quartz.jobStore.tcConfigUrl = localhost:9510


#The datasource for the jobstore that is to be used
org.quartz.jobStore.dataSource = myDS

#quartz table prefixes in the database
org.quartz.jobStore.tablePrefix = qrtz_
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.isClustered = false

#The details of the datasource specified previously
org.quartz.dataSource.myDS.driver =com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL =jdbc:mysql://localhost:3306/test
org.quartz.dataSource.myDS.user =root
org.quartz.dataSource.myDS.password =
org.quartz.dataSource.myDS.maxConnections = 20

#Clustering
#clustering currently only works with the JDBC-Jobstore (JobStoreTX
#or JobStoreCMT). Features include load-balancing and job fail-over
#(if the JobDetail's "request recovery" flag is set to true). It is important to note that
# When using clustering on separate machines, make sure that their clocks are synchronized
#using some form of time-sync service (clocks must be within a second of each other).
#See http://www.boulder.nist.gov/timefreq/service/its.htm.
# Never fire-up a non-clustered instance against the same set of tables that any
#other instance is running against.
# Each instance in the cluster should use the same copy of the quartz.properties file.

org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000

#Each server must have the same copy of the configuration file.
#auto-generate instance ids.
org.quartz.scheduler.instanceId = AUTO

#Note :
#If a job throws an exception, Quartz will typically immediately
#re-execute it (and it will likely throw the same exception again).
#It's better if the job catches all exception it may encounter, handle them,
#and reschedule itself, or other jobs. to work around the issue.


  MyJob .java
package com.opensourzesupport.schedule.jobs;
 
import org.quartz.Job;

import org.quartz.JobExecutionContext;

import org.quartz.JobExecutionException;


/**

 *

 * @author prasobh

 */


public class MyJob  implements Job{


    @Override

    public void execute(JobExecutionContext jec) throws JobExecutionException {

        System.out.println("executing my my job");

    }   

}



Schedule.java
package com.opensourzesupport.schedule;

import com.opensourzesupport.schedule.jobs.MyJob;
import com.opensourzesupport.schedule.listeners.MyJobListener;
import java.util.Date;

import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;

/**
 *
 * @author prasobh
 */
public class Schedular {

    public Schedular() {
        try {
            SchedulerFactory schdFact = new StdSchedulerFactory("quartz.properties");
            Scheduler schd = schdFact.getScheduler();
            schd.start();

            JobDetail jd = new JobDetail("alarmjob", Scheduler.DEFAULT_GROUP, MyJob.class);
            Trigger t = TriggerUtils.makeDailyTrigger("alarmtrigger", 06, 00);
            t.getJobDataMap().put("auth_name", "Vageesh");
            t.setStartTime(new Date());
            schd.addJobListener(new MyJobListener());
            jd.addJobListener("Alarm gone");
            schd.scheduleJob(jd, t);
            schd.start();
            System.out.println(schd.getSchedulerName());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Schedular();
    }
}


On successful fire of job, it can be observed that the job details and 
data blob details are updated in the tables of the database
 

Rescheduling Job

Rescheduler.java


package com.opensourzesupport.schedule;


import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.impl.StdSchedulerFactory;

/**
 *
 * @author prasobh
 */
public class Reschedular {

    public 
Reschedular() {

        String[] triggerGrps;
        String[] triggers;
        try {

            SchedulerFactory sf = new StdSchedulerFactory("quartz.properties");
            Scheduler sd = sf.getScheduler();
            sd.start();
            triggerGrps = sd.getTriggerGroupNames();
            for (String stTriggerGrp : triggerGrps) {
                triggers = sd.getTriggerNames(stTriggerGrp);
                for (String stTrigger : triggers) {
                    Trigger quartzTrigger = sd.getTrigger(stTrigger, stTriggerGrp);
                    System.out.println("Trigger Name : " + stTrigger);
                    System.out.println("Trigger Group Name: " + stTriggerGrp);
                    sd.rescheduleJob(stTrigger, stTriggerGrp, quartzTrigger);
                }
            }
          
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Reschedular();
    }
}

 

 

 

Thursday, 1 March 2012

High Level Requirements Gathering Questions for New Development Projects

Determine Business Objectives
    1.    What are your goals in developing this system?
    2.    Who are the key stakeholders and users? Do their goals differ? If so, how?
    3.    How do the system goals map to business goals?
    4.    What is the most important business goal of the system?
    5.    Will the system change the way you are doing things now?
    6.    Will the system help you be more efficient?  How?
    7.    What are the system deliverables? 
    8.    What will the new system accomplish that is not currently accomplished manually or with other systems?
    9.    What will the new system do?

Determine Future Needs
    1.    What business requirements will this system address?
    2.    What information do you need from this system that you don’t have now? 
    3.    Is any of this data currently captured in any other corporate system?
    4.    How would you like to see this information?  
    5.    What functionality do you need from the system?
6.        Is the data and/or functionality shared by other (many) business areas?  If so, which?
7.        If the reports were dynamic, what would they do differently?
8.        How much historical information is required?

Determine Current Problems
    1.    What are the current problems facing without the system today?
    2.    What problems should this system solve?
    3.    Do you have to do things manually that you would like to automate?
    4.    Do you have performance problems that need to change?
    5.    Do you have functional limitations that you’d like to change?
6.        Are you using packages that force you to constrain your business functionality to the boundaries of the package?
7.        Which reports do you currently use?  What data on the report is important?  How do you use the information?
8.        Are there specific bottlenecks to getting at information?
9.        How do you analyze the information you currently receive?  What type of data is used?  How do you currently get the data?  How often do you get new data?
10.    What type of ad hoc analysis do you typically perform?  Who requests ad hoc information?  What do you do with the information?

Determine System Users
   1.    Who will be using the system?
   2.    What are the titles and roles of the people who will use the system?
   3.    What are their levels of expertise?

Determine Criteria for Success
   1.    What is most important for success of the application?
   2.    What do we need to accomplish to make this project successful?
   3.    What do we need to change to make this project successful?
   4.    What buy-in do we need?
   5.    Are we lacking any critical elements such as budget, resource allocation, or support?
   6.    What are training considerations for developers and users?

Assumptions
    1.    List assumptions

Issues
    1.    List open issues, responsible parties and resolution date

Saturday, 25 February 2012

JDK 7 Cool Features


try-with-resources

In Java, normally we open a file in a try block, and close the file in the finally block, see following :
try{
  //open file or resources
}catch(IOException){
  //handle exception
}finally{
  //close file or resources
}




Since JDK 7, a new “try-with-resources” approach is introduced. When a try block is end, it will close or release your opened file automatically.
try(open file or resource here){
 //...
}
//after try block, file will close automatically.

finally is no longer required. The file will be closed automatically after try block.
package com.opensourzesupport;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Example2 {
 public static void main(String[] args) {
 
  try (BufferedReader br = new BufferedReader(new FileReader("C:\\testing.txt")))
  {
 
   String line;
 
   while ((line = br.readLine()) != null) {
    System.out.println(line);
   }
 
  } catch (IOException e) {
   e.printStackTrace();
  } 
 
 }
String in Switch 
public static void tradingOptionChooser(String day) {
 switch (trading) {
  case "Monday":
       System.out.println("You selected Monday");
       break;
  case "Sunday":
       System.out.println(" You selected Sunday");
       break; 
 default:
       throw new IllegalArgumentException();
 }
}



Friday, 24 February 2012

Maven Tutorial

Apache Maven, is an innovative software project management tool, provides new concept of a project object model (POM) file to manage project’s build, dependency and documentation. The most powerful feature is able to download the project dependency libraries automatically.


Maven Repository


Maven is having local, central and remote repository

Maven local repository

Maven local repository is used to store all your projects’ dependency libraries (plugin jars and other files which downloaded by Maven), . In simple, when you use Maven to build your project, it will automatically download all dependency libraries into your Maven local repository.
Maven local repository is default to home directory :
  1. Unix/Mac OS X – ~/.m2 on
  2. Windows – C:\Documents and Settings\username\.m2 on Windows
Often times, you need to change the default location for maintainability purpose, after all, the .m2 is not a meaningful name.


1. Maven configuration file
Maven local repository is defined in the Maven’s configuration file, for example, {M2_HOME}\conf\setting.xml.

2. Edit it “setting.xml”

Find the following “localRepository” pattern, and define your new Maven local repository inside the “<localRepository>” element like this :
<settings>
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
 
<localRepository>D:/maven_repo</localRepository>

3. Saved it

Done, your new Maven local repository is now changed to D:/maven_repo, all the future project’s dependency libraries or related files will be downloaded into this folder.

Maven central repository 

While building a Maven’s project, Maven will check your pom.xml file to download the entire project dependency libraries automatically.
If Maven can’t find the defined dependency libraries in your Maven local repository, it will try to download it from the default Maven central repository, which is http://repo1.maven.org/maven2/.
The maven center repository is revamp, if you visit above site via web browser, it will redirect tohttp://search.maven.org/ automatically.



Maven remote repository

According to Apache Maven :
Downloading in Maven is triggered by a project declaring a dependency that is not present in the local repository (or for a SNAPSHOT, when the remote repository contains one that is newer). By default, Maven will download from the central repository.
In Maven, when you need some libraries that are NOT EXITS the Maven center repository, the process will stopped and output error messages to your Maven console.
Example
The org.jvnet.localizer library is not available at Maven central repository, but Maven remote repository, which is http://download.java.net/maven/2/.
    <dependency>
      <groupId>org.jvnet.localizer</groupId>
      <artifactId>localizer</artifactId>
      <version>1.8</version>
    </dependency>
To tell Maven to go to Maven remote repository like java.net, you need to declared a “remote repository” in your Maven’s pom.xml file like this :
  <repositories>
    <repository>
      <id>java.net</id>
      <url>http://download.java.net/maven/2</url>
    </repository>
  </repositories>
Now, Maven’s dependency libraries look-up sequences is changed to :
  1. Search in Maven local repository, if not found, continue step 2, else exit.
  2. Search in Maven central repository, if not found, continue step 3, else exit.
  3. Search in java.net Maven remote repository – , if not found, prompt error message, else exit.
Maven’s dependency mechanism will download all the necessary dependency libraries automatically, and maintain the version upgrade as well.
Assume you want to use Log4J as your project logging mechanism (actually i more prefer SLF4J). Here is what you do…

 In traditional way

  1. Visit http://logging.apache.org/log4j/
  2. Download the Log4j jar library
  3. Manually include it into your project dependency
  4. All manage by yourself, you need to do everything


If there is Log4j version upgrade, you need to repeat above steps again.

In Maven way
  1. You need to know the log4j “Maven coordinates“, for example
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.14</version>
  1. It will download the log4j version 1.2.14 library automatically. If the “version” tag is ignore, it will upgrade the library automatically when there is a newer version.
    
    
  2. Include “Maven coordinates” into “pom.xml” file, under “<dependencies>” tag
    <dependencies>
        <dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.14</version>
        </dependency>
    </dependencies>
  3. While Maven is compiling or building, the log4j will download automatically and put it into your Maven local repository.
  4. All manage by Maven… automatically.




When you use Maven to build your project, “pom.xml” will be parsed, and the Maven search the log4j library in this order :
  1. Search log4j in Maven local repository.
  2. Search log4j in Maven central repository.
  3. Search log4j in Maven remote repository (if define in pom.xml).




include library manually into maven local repository

There are still many Java libraries that are not support for Maven, or may be you want to create a custom library which is required to include it into your Maven local repository.
Fortunately, Maven comes with command to let you include your “non-maven-support” library into your Maven local repository easily.
For example, “kaptcha” is a third party library which is used to generate “captcha” image to stop spamming, but it did not support Maven.
Here’s a guide to show you how to install the “kaptcha” jar into your Maven’s local repository.

1. Install library – mvn install

Download the “kaptcha” jar file and put it into your “C:” drive, and issue following Maven’s command :
mvn install:install-file -Dfile=c:\kaptcha-2.3.jar -DgroupId=com.google.code 
-DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar
Result :
D:\>mvn install:install-file -Dfile=c:\kaptcha-2.3.jar -DgroupId=com.google.code 
-DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] Installing c:\kaptcha-2.3.jar to 
D:\maven_repo\com\google\code\kaptcha\2.3\kaptcha-2.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue May 12 13:41:42 SGT 2009
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------
Now, the “kaptcha” jar library is included into your Maven local repository.

2. Modify pom.xml file

After installed, you can add the custom library details into your “pom.xml” file like this
<dependency>
      <groupId>com.google.code</groupId>
      <artifactId>kaptcha</artifactId>
      <version>2.3</version>
</dependency>

3. Done

Build it, now the “kaptcha” jar is able to retrieve from your Maven local repository.
Please refer Maven install file documentation for more info.


Including  jar from Project lib/ any folder


        <dependency>
            <groupId>org.opensourzesupport.web</groupId>
            <artifactId>jarFileName</artifactId>
            <version>version</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/LOCAL.jar</systemPath>
        </dependency>


Enable proxy setting in Maven

There are high chance your company is set up a firewall and force the developers to connect internet via using HTTP proxy. If you are using HTTP proxy, Maven may not able to download the dependency libraries outside. To bypass it, you have to enable the proxy setting in Maven configuration file “settings.xml“.

1. Maven configuration file

Find your Maven configuration file – e.g, {M2_HOME}/conf/settings.xml

2. Edit it “settings.xml”





Find the following pattern
<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
</proxies




Comment out the proxy setting and fill in your proxy information.
<proxies>
 
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.yourcompany.com</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
 
</proxies>

4. Saved it, Done.

Apache Maven is able to connect to Internet via proxy server now.




Sample MAVEN POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.opensourzesupport.web</groupId>
    <artifactId>MavenDemo</artifactId>
    <version>1.0.0</version> 
    <packaging>war</packaging>
    <name>MavenDemo</name>
    <url>http://maven.apache.org</url>
    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <netbeans.hint.deploy.server>JBoss4</netbeans.hint.deploy.server>
    </properties>
    <repositories>
       
        <repository>
            <id>java.net</id>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>jboss-public-repository-group</id>
            <name>JBoss Public Repository Group</name>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
        </repository>
        <repository>
            <id>repository.jboss.org-public</id>
            <name>JBoss.org Maven repository</name>
            <url>https://repository.jboss.org/nexus/content/groups/public</url>
        </repository> 
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.release</id>
            <name>EBR Spring Release Repository</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>EBR External Release Repository</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
       
    </repositories>
   
    <dependencies>
<!--          ant -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-script-ant</artifactId>
            <version>2.0.6</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
        </dependency>

<!--    Including our own jar files from system -->
        <dependency>
            <groupId>org.opensourzesupport.web</groupId>
            <artifactId>MYLocalDependencyjarFile</artifactId>
            <version>2.9.0.RC1</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/LOCAL.jar</systemPath>
        </dependency>
       
        <dependency>
            <groupId>com.sun.jmx</groupId>
            <artifactId>jmxri</artifactId>
            <version>1.2.1</version>
        </dependency>

<!--          Primefaces  -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>3.0.RC1</version> 
        </dependency> 
        <dependency> 
            <groupId>org.primefaces.themes</groupId> 
            <artifactId>black-tie</artifactId> 
            <version>1.0.2</version> 
        </dependency> 
        <dependency> 
            <groupId>org.primefaces.themes</groupId> 
            <artifactId>cupertino</artifactId> 
            <version>1.0.2</version> 
        </dependency> 
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>classes12</artifactId>
            <version>10.2.0.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.aopalliance</groupId>
            <artifactId>com.springsource.org.aopalliance</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
           
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.5.4</version>
        </dependency>
        <dependency>
            <groupId>com.ibm.icu</groupId>
            <artifactId>icu4j</artifactId>
            <version>3.4.4</version>
        </dependency>
        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt</artifactId>
            <version>1.7</version>
        </dependency> 
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.aop</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.asm</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.beans</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
       
        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>org.springframework.binding</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>       
       
        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>org.springframework.faces</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>org.springframework.webflow</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.context</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.context.support</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
       
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.core</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.expression</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
       
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.jdbc</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.transaction</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web.servlet</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>
<!--       SPRING  LDAP-->
        <dependency>
            <groupId>org.springframework.ldap</groupId>
            <artifactId>spring-ldap</artifactId>
            <version>1.3.1.RELEASE</version>
            <classifier>all</classifier>
        </dependency>     
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jdmk</groupId>
            <artifactId>jmxtools</artifactId>
            <version>1.2.1</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>MySampleMavenProject</finalName>       
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>6.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>