G:\KenAndJames\ap4j\src\com\popcornmonsters\ap4j\Ap4jTest.java

1    /** 
2     *  
3     * @author: $Author Ken Cochrane $ 
4     * @version: $Revision: 1.0 $ $Date: May 19, 2004 8:02:33 AM$ 
5     * 
6     * Ken Cochrane 
7     * Ken@PopcornMonsters.com 
8     * http://KenCochrane.net 
9     * http://PopcornMonsters.com 
10    * 
11    * ap4j - AllPosters.com for java 
12    * 
13    * $Log: Ap4jTest.java,v $ 
14    */ 
15    
16   package com.popcornmonsters.ap4j; 
17    
18   /** 
19    * This is just a test class to show you how to use ap4j and to test to see if it 
20    * is running correctly. To run this with no problems use the runTest.bat file 
21    */ 
22   public class Ap4jTest { 
23    public static void main(String [] args) throws Exception { 
24        System.out.println("In ap4j"); 
25        /* 
26          Get the search term that was passed in from the command line. If there isn't one use 
27          the default search term of Matrix. 
28        */ 
29        String searchTerm = null; 
30        if(args != null && args.length > 0){ 
31           searchTerm = args[0]; 
32        }else{ 
33           System.out.println("There was no search Argument so I am using the default"); 
34           searchTerm = "Matrix"; 
35        } 
36        System.out.println("Searching for : " + searchTerm); 
37    
38        /* Create the search bean and populate the searchterm */ 
39        SearchBean searchBean = new SearchBean(); 
40        searchBean.setSearchText(searchTerm); 
41        /* if you wanted to narrow down your search you can always set more 
42        search parameters in the searchBean */ 
43    
44        /* Pass in the searchBean to ap4j and get a resultVO object back */ 
45        ResultVO resultVO = Ap4j.searchForPosters(searchBean); 
46    
47        /* Now that we have results print them out. */ 
48        System.out.println("Results : \n" +resultVO); 
49        System.out.println("done"); 
50    } 
51   } 
52