View Javadoc

1   /***
2    Copyright (C) 2005 The Java Community
3   
4    This program is free software; you can redistribute it and/or modify  it under
5    the terms of the GNU General Public License as published by  the Free Software
6    Foundation; either version 2 of the License, or  (at your option) any later
7    version.
8   
9    This program is distributed in the hope that it will be useful,  but WITHOUT
10   ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the  GNU General Public License for more details.
12  
13   You should have received a copy of the GNU General Public License  along with
14   this program; if not, write to the Free Software  Foundation, Inc., 59 Temple
15   Place, Suite 330, Boston, MA 02111-1307 USA.
16   */
17  package org.bejug.javacareers.feeder.parser;
18  
19  import org.apache.commons.logging.Log;
20  import org.apache.commons.logging.LogFactory;
21  import org.bejug.javacareers.feeder.FeederException;
22  import org.bejug.javacareers.feeder.model.Feed;
23  import org.bejug.javacareers.feeder.model.JobList;
24  import org.bejug.javacareers.feeder.model.RssFeed;
25  
26  /***
27   * Delegates parse task to a suitable parser
28   *
29   * @author Bavo (last modified by $Author: shally $
30   * @version $Revision: 1.2 $ - $Date: 2005/12/09 10:46:55 $
31   */
32  public class JobParser {
33      /***
34       * logger
35       */
36      private static final Log LOG = LogFactory.getLog(JobParser.class);
37      
38      /***
39       * @param feed feed of jobs to parse
40       * @return List of JobEntry elements
41       * @throws FeederException if an error
42       */
43      public JobList parse (Feed feed) throws FeederException {
44          JobList list = null;
45  
46          if (feed instanceof RssFeed) {
47              try {
48                  list = parseFeed((RssFeed) feed);
49              }
50              catch (FeederException e) {
51                 LOG.error(e);
52                  throw e;
53              }
54  
55          } else {
56              throw new IllegalArgumentException("Not yet supported");
57          }
58          return list;
59      }
60  
61      /***
62       * @param feed RssFeed to parse
63       * @return List of entries
64       *  @throws FeederException in an error
65       */
66      private JobList parseFeed(RssFeed feed) throws FeederException {
67          FeedParser parser = new RssFeedParser();
68          return parser.parseFeed(feed);
69      }
70  }
71  
72  /***
73   * $Log: JobParser.java,v $
74   * Revision 1.2  2005/12/09 10:46:55  shally
75   * Opkuis voor checkstyle en PMD
76   *
77   * Revision 1.1  2005/08/26 07:58:29  ge0ffrey
78   * split up the sources in service, serviceimpl and webclient
79   *
80   * Revision 1.6  2005/08/16 09:09:19  bavo_jcs
81   * Replaced Log4j usage with Commons Logging
82   *
83   * Revision 1.5  2005/08/16 06:34:17  bme_jcs
84   * changed the logger... we use the commons-logger, not the log4j-logger
85   *
86   * Revision 1.4  2005/08/09 12:59:54  bavo_jcs
87   * Optimized imports
88   *
89   * Revision 1.3  2005/06/14 12:05:52  schauwvliege
90   * CheckStyle and fixing tests
91   *
92   * Revision 1.2  2005/06/09 08:18:43  bejug_cc
93   * Fix initial import
94   *
95   * Revision 1.3  2005/06/03 09:44:09  bbr
96   * admin feed panel work
97   *
98   * Revision 1.2  2005/05/24 11:52:39  bbr
99   * Using spring sheduling
100  *
101  * Revision 1.1  2005/05/23 17:04:57  sja
102  * Moved to org.bejug.javacareers.feeder package.
103  *
104  * Revision 1.1  2005/05/23 08:46:33  PSONG09
105  * added feeder source files to project
106  *
107  * Revision 1.3  2005/05/23 07:10:54  stephan_janssen
108  * Code cleanup.
109  *
110  * Revision 1.2  2005/05/11 11:53:25  bavo_jcs
111  * refactored
112  * - conform to conventions
113  * - some javadoc
114  * - Added FeederTask design
115  *
116  * Revision 1.1  2005/05/10 16:03:58  bavo_jcs
117  * cleanup
118  *
119  * Revision 1.4  2005/05/10 11:32:49  bavo_jcs
120  * integrated with services from JavaCareers Web
121  *
122  * Revision 1.3  2005/05/03 07:28:50  bavo_jcs
123  * Added Javadocs
124  *
125  * Revision 1.2  2005/05/02 15:37:38  bavo_jcs
126  * Added Javadocs
127  *
128  * Revision 1.1.1.1  2005/04/26 14:13:50  stephan_janssen
129  * Initial import
130  *
131  * Revision 1.1.1.1  2005/04/26 12:58:32  sja
132  * Initial Release
133  *
134  * Revision 1.1.1.1  2005/04/26 12:51:28  sja
135  * Initial Release
136  *
137  */