// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ICspSolver.java
// public interface ICspSolver <ST> {  
// 
//   public boolean solveCSP(File srcFile, List<File> libs) throws ProcessingException;  
// 
//   public boolean solveCSP(File srcFile) throws ProcessingException;  
//   
//   public Object getResult();
// 
//   public ST getSolution();
// }
// 
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ProcessingException.java
// public class ProcessingException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	public ProcessingException(Throwable e) {
// 		super(e);
// 	}
// 
// 	public ProcessingException(String msg, Throwable th) {
// 		super(msg, th);
// 	}
// 
// 	public ProcessingException(String string) {
// 		super(string);
// 	}
// 
// }


import java.io.File;
import java.io.IOException;
import java.util.List;
import com.parctechnologies.eclipse.CompoundTerm;
import com.parctechnologies.eclipse.EclipseEngine;
import com.parctechnologies.eclipse.EclipseEngineOptions;
import com.parctechnologies.eclipse.EclipseException;
import com.parctechnologies.eclipse.Fail;
import com.parctechnologies.eclipse.OutOfProcessEclipse;
import com.parctechnologies.eclipse.Throw;
import fr.inria.atlanmod.emftocsp.ICspSolver;
import fr.inria.atlanmod.emftocsp.ProcessingException;
/*******************************************************************************
 * Copyright (c) 2011 INRIA Rennes Bretagne-Atlantique.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     INRIA Rennes Bretagne-Atlantique - initial API and implementation
 *******************************************************************************/
package fr.inria.atlanmod.emftocsp.eclipsecs;





/**
 * @author <a href="mailto:carlos.gonzalez@inria.fr">Carlos A. González</a>
 *
 */
public class EclipseSolver implements ICspSolver <CompoundTerm>{
  private String imgGeneratorPath = ""; //$NON-NLS-1$
  private File imgResult;
  private EclipseEngineOptions engineOptions = null;
  private EclipseEngine engine = null; 
  private CompoundTerm solution = null;
  
  @Override
  public CompoundTerm getSolution(){
	  return solution;
  }

  public EclipseSolver(String solverPath, String imgGeneratorPath) {
    this.imgGeneratorPath = imgGeneratorPath;
    engineOptions = new EclipseEngineOptions(new File(solverPath));
    engineOptions.setUseQueues(false);    
  }

  @Override
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ICspSolver.java
// public interface ICspSolver <ST> {  
// 
//   public boolean solveCSP(File srcFile, List<File> libs) throws ProcessingException;  
// 
//   public boolean solveCSP(File srcFile) throws ProcessingException;  
//   
//   public Object getResult();
// 
//   public ST getSolution();
// }
// 
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ProcessingException.java
// public class ProcessingException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	public ProcessingException(Throwable e) {
// 		super(e);
// 	}
// 
// 	public ProcessingException(String msg, Throwable th) {
// 		super(msg, th);
// 	}
// 
// 	public ProcessingException(String string) {
// 		super(string);
// 	}
// 
// }


// Path: plugins/fr.inria.atlanmod.emftocsp.eclipsecs/src/fr/inria/atlanmod/emftocsp/eclipsecs/EclipseSolver.java
import java.io.File;
import java.io.IOException;
import java.util.List;
import com.parctechnologies.eclipse.CompoundTerm;
import com.parctechnologies.eclipse.EclipseEngine;
import com.parctechnologies.eclipse.EclipseEngineOptions;
import com.parctechnologies.eclipse.EclipseException;
import com.parctechnologies.eclipse.Fail;
import com.parctechnologies.eclipse.OutOfProcessEclipse;
import com.parctechnologies.eclipse.Throw;
import fr.inria.atlanmod.emftocsp.ICspSolver;
import fr.inria.atlanmod.emftocsp.ProcessingException;

/*******************************************************************************
 * Copyright (c) 2011 INRIA Rennes Bretagne-Atlantique.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     INRIA Rennes Bretagne-Atlantique - initial API and implementation
 *******************************************************************************/
package fr.inria.atlanmod.emftocsp.eclipsecs;





/**
 * @author <a href="mailto:carlos.gonzalez@inria.fr">Carlos A. González</a>
 *
 */
public class EclipseSolver implements ICspSolver <CompoundTerm>{
  private String imgGeneratorPath = ""; //$NON-NLS-1$
  private File imgResult;
  private EclipseEngineOptions engineOptions = null;
  private EclipseEngine engine = null; 
  private CompoundTerm solution = null;
  
  @Override
  public CompoundTerm getSolution(){
	  return solution;
  }

  public EclipseSolver(String solverPath, String imgGeneratorPath) {
    this.imgGeneratorPath = imgGeneratorPath;
    engineOptions = new EclipseEngineOptions(new File(solverPath));
    engineOptions.setUseQueues(false);    
  }

  @Override
  public boolean solveCSP(File srcFile) throws ProcessingException {