View Javadoc

    1   /*
    2    * joey-gen and its relative products are published under the terms
    3    * of the Apache Software License.
    4    *
    5    * Created on 2005/01/12 14:42:21
    6    */
    7   package org.asyrinx.joey.gen.task.impl;
    8
    9   import java.io.IOException;
    10  import java.util.Collections;
    11  import java.util.List;
    12  import java.util.Map;
    13
    14  import org.apache.tools.ant.Project;
    15  import org.asyrinx.joey.gen.command.rdb2java.Rdb2JavaBuilder;
    16  import org.asyrinx.joey.gen.model.java.AppDomain;
    17  import org.asyrinx.joey.gen.model.rdb.Databases;
    18  import org.asyrinx.joey.gen.model.rdb.xml.DatabasesLoader;
    19  import org.asyrinx.joey.gen.task.ModelLoader;
    20  import org.xml.sax.SAXException;
    21
    22  /***
    23   * @author takeshi
    24   */
    25  public class ModelLoaderImpl implements ModelLoader {
    26
    27      /***
    28       *
    29       */
    30      public ModelLoaderImpl(DatabasesLoader databasesLoader, Rdb2JavaBuilder builder) {
    31          super();
    32          this.databasesLoader = databasesLoader;
    33          this.builder = builder;
    34      }
    35
    36      final Rdb2JavaBuilder builder;
    37
    38      final DatabasesLoader databasesLoader;
    39
    40      /***
    41       * @param filesets
    42       * @param project
    43       * @return
    44       * @throws SAXException
    45       * @throws IOException
    46       */
    47      public Databases loadDatabaseModels(List filesets, Project project) throws IOException, SAXException {
    48          final Databases result = databasesLoader.load(filesets, project);
    49          return result;
    50      }
    51
    52      /***
    53       * @param databases
    54       * @param project
    55       * @return
    56       */
    57      public AppDomain loadAppDomainModel(Databases databases, Project project) {
    58          builder.setProperties(Collections.unmodifiableMap(project.getProperties()));
    59          final AppDomain domain = builder.execute(databases);
    60          return domain;
    61      }
    62
    63      /***
    64       * @return
    65       */
    66      public Map getRdb2Java() {
    67          return builder.getRdb2Java();
    68      }
    69
    70  }