View Javadoc

1   package fr.in2p3.jsaga.adaptor.language.abstracts;
2   
3   import fr.in2p3.jsaga.Base;
4   import fr.in2p3.jsaga.adaptor.language.LanguageAdaptor;
5   import fr.in2p3.jsaga.helpers.XMLFileParser;
6   import org.ogf.saga.error.BadParameterException;
7   import org.w3c.dom.Document;
8   
9   import java.io.File;
10  import java.io.InputStream;
11  
12  /* ***************************************************
13  * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
14  * ***             http://cc.in2p3.fr/             ***
15  * ***************************************************
16  * File:   AbstractLanguageAdaptorXML
17  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
18  * Date:   16 avr. 2007
19  * ***************************************************
20  * Description:                                      */
21  /**
22   *
23   */
24  public abstract class AbstractLanguageAdaptorXML implements LanguageAdaptor {
25      private XMLFileParser m_parser;
26  
27      protected void _initParser(String[] schemaResourcePaths) throws Exception {
28          m_parser = new XMLFileParser(schemaResourcePaths);
29      }
30  
31      public Document parseJobDescription(InputStream jobDescStream) throws BadParameterException {
32          try {
33              File debugFile = new File(new File(Base.JSAGA_VAR, "debug"), "parsed-job-description.xml");
34              return m_parser.parse(jobDescStream, debugFile);
35          } catch (Exception e) {
36              throw new BadParameterException(e);
37          }
38      }
39  }