All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.st.p2012.mind.idl.IDLBackendFactory Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2009 STMicroelectronics
 *
 * This file is part of "Mind Compiler" is free software: you can redistribute
 * it and/or modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see .
 *
 * Contact: [email protected]
 *
 * Authors: Matthieu Leclercq
 * Contributors:
 */

package com.st.p2012.mind.idl;

import org.objectweb.fractal.adl.xml.XMLNodeFactory;
import org.objectweb.fractal.adl.xml.XMLNodeFactoryImpl;
import org.objectweb.fractal.mind.BasicInputResourceLocator;
import org.objectweb.fractal.mind.InputResourceLocator;
import org.objectweb.fractal.mind.idl.IDLLoader;
import org.objectweb.fractal.mind.idl.IDLVisitor;
import org.objectweb.fractal.mind.io.BasicOutputFileLocator;
import org.objectweb.fractal.mind.io.OutputFileLocator;
import org.objectweb.fractal.mind.st.StringTemplateComponentLoader;
import org.objectweb.fractal.mind.st.templates.parser.StringTemplateLoader;

public final class IDLBackendFactory {
  private IDLBackendFactory() {
  }

  public static IDLVisitor newIDLCompiler() {
    final IDLLoader idlLoader = IDLLoaderChainFactory.newLoader();
    final BasicInputResourceLocator inputResourceLocator = new BasicInputResourceLocator();
    final BasicOutputFileLocator outputFileLocator = new BasicOutputFileLocator();

    final StringTemplateComponentLoader stcLoader = new StringTemplateComponentLoader();
    final StringTemplateLoader templateLoader = new StringTemplateLoader();
    final XMLNodeFactory nodeFactory = new XMLNodeFactoryImpl();

    templateLoader.nodeFactoryItf = nodeFactory;
    stcLoader.loaderItf = templateLoader;

    return newIDLCompiler(idlLoader, inputResourceLocator, outputFileLocator,
        stcLoader);
  }

  public static IDLVisitor newIDLCompiler(final IDLLoader idlLoader,
      final InputResourceLocator inputResourceLocator,
      final OutputFileLocator outputFileLocator,
      final StringTemplateComponentLoader stcLoader) {
    final IDLTemplateProcessor idg = new IDLTemplateProcessor();

    idg.templateGroupLoaderItf = stcLoader;

    idg.inputResourceLocatorItf = inputResourceLocator;
    idg.outputFileLocatorItf = outputFileLocator;

    return idg;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy