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

org.objectweb.fractal.bf.adl.binder.FractalBinderBuilder Maven / Gradle / Ivy

There is a newer version: 0.9
Show newest version
package org.objectweb.fractal.bf.adl.binder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.bf.BindingFactory;
import org.objectweb.fractal.bf.BindingFactoryException;
import org.objectweb.fractal.bf.BindingFactoryHelper;
import org.objectweb.fractal.bf.ExportMode;
import org.objectweb.fractal.bf.adl.common.Parameter;

/**
 * A binder builder that uses Fractal API to build the binder.
 */
public class FractalBinderBuilder implements BinderBuilder {

	Logger log = Logger.getLogger(StaticBinderBuilder.class.getCanonicalName());

	/**
	 * @see org.objectweb.fractal.bf.adl.binder.BinderBuilder#bind(java.lang.String,
	 *      java.lang.Object, java.util.List, java.lang.String, Object)
	 */
	public void bind(String itfName, Object c, List parameters,
			String type, Object context) throws BindingFactoryException {
		Map bindHints = new HashMap();
		/* fill the export hints map */
		for (Parameter p : parameters)
			bindHints.put(p.getName(), p.getValue());

		bindHints.put(ExportMode.EXPORT_MODE, type);

		log.finest("Remote binding to be established: [itf," + itfName
				+ "],[params:" + bindHints.toString() + "]");

		BindingFactory bf = BindingFactoryHelper.getBindingFactory();
		Component component = (Component) c;
		bf.bind(component, itfName, bindHints);

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy