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