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

org.objectweb.fractal.juliac.scala.Scala Maven / Gradle / Ivy

The newest version!
/***
 * Juliac
 * Copyright (C) 2015 Inria, Univ. Lille 1
 *
 * This library 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 2 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: [email protected]
 *
 * Author: Lionel Seinturier
 */

package org.objectweb.fractal.juliac.scala;

import java.io.IOException;

import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.api.CfgLoaderItf;
import org.objectweb.fractal.juliac.api.JuliacModuleItf;
import org.objectweb.fractal.juliac.conf.CfgLoader;
import org.objectweb.fractal.juliac.conf.InterceptorSourceCodeGeneratorMap;
import org.objectweb.fractal.juliac.conf.JuliacConfig;
import org.objectweb.fractal.juliac.proxy.LifeCycleNFASourceCodeGenerator;

/**
 * This module sets the configuration for dealing with Scala-implemented control
 * membranes.
 * 
 * @author Lionel Seinturier 
 * @since 2.6
 */
public class Scala implements JuliacModuleItf {

	public static final String SCALA_LIFECYCLE_CODE_GENERATOR =
		"org.objectweb.fractal.julia.control.lifecycle.ScalaLifeCycleCodeGenerator";
	
	public static final String CONFIGURATION = "juliac-scala.cfg";
	
	public void init( Juliac jc ) throws IOException {
		
		JuliacConfig jconf = jc.getJuliacConfig();
		
		/*
		 * Register the lifecycle source generator that generates method calls
		 * for updating lifecycle counters instead of directly accessing the
		 * corresponding fields.
		 */
		InterceptorSourceCodeGeneratorMap iscgs =
			jconf.interceptorSourceCodeGenerators();
		iscgs.put(
			SCALA_LIFECYCLE_CODE_GENERATOR,
            new LifeCycleNFASourceCodeGenerator() );
		
		/*
		 * Load the configuration file that defines the membranes for Scala.
		 */
		CfgLoaderItf jloader =
			jconf.loadModuleIfNew(
				CfgLoader.class.getName(), CfgLoaderItf.class );
		jloader.loadConfigFile(CONFIGURATION);
	}

	public void close( Juliac jc ) throws IOException {
		// Indeed nothing
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy