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;
    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.xml.sax.SAXException;
    20
    21  /***
    22   * @author takeshi
    23   */
    24  public class ModelLoaderImpl implements ModelLoader {
    25
    26      /***
    27       *
    28       */
    29      public ModelLoaderImpl(DatabasesLoader databasesLoader, Rdb2JavaBuilder builder) {
    30          super();
    31          this.databasesLoader = databasesLoader;
    32          this.builder = builder;
    33      }
    34
    35      final Rdb2JavaBuilder builder;
    36
    37      final DatabasesLoader databasesLoader;
    38
    39      /***
    40       * @param filesets
    41       * @param project
    42       * @return
    43       * @throws SAXException
    44       * @throws IOException
    45       */
    46      public Databases loadDatabaseModels(List filesets, Project project) throws IOException, SAXException {
    47          final Databases result = databasesLoader.load(filesets, project);
    48          return result;
    49      }
    50
    51      /***
    52       * @param databases
    53       * @param project
    54       * @return
    55       */
    56      public AppDomain loadAppDomainModel(Databases databases, Project project) {
    57          builder.setProperties(Collections.unmodifiableMap(project.getProperties()));
    58          final AppDomain domain = builder.execute(databases);
    59          return domain;
    60      }
    61
    62      /***
    63       * @return
    64       */
    65      public Map getRdb2Java() {
    66          return builder.getRdb2Java();
    67      }
    68
    69  }