Home » Modeling » ATL » Plugin ATL
Plugin ATL [message #1059551] |
Mon, 20 May 2013 12:32 |
|
Hi everybody,
I created an ATL PROJECT which runs successfully.Now I would like to do the transformation by using the a project which its type is "Plugin ATL".
I created it and and I chose the ATL launch configuration the one related to the first ATL project.The CREATION of the ATL plugin is done sccessfully.My problem now is in tha java class generated by the plugin.it is like this:
/*******************************************************************************
* Copyright (c) 2010, 2012 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.m2m.atl.Project.files;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.m2m.atl.common.ATLExecutionException;
import org.eclipse.m2m.atl.core.ATLCoreException;
import org.eclipse.m2m.atl.core.IExtractor;
import org.eclipse.m2m.atl.core.IInjector;
import org.eclipse.m2m.atl.core.IModel;
import org.eclipse.m2m.atl.core.IReferenceModel;
import org.eclipse.m2m.atl.core.ModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFExtractor;
import org.eclipse.m2m.atl.core.emf.EMFInjector;
import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
import org.eclipse.m2m.atl.core.launch.ILauncher;
import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;
/**
* Entry point of the 'Tpf3' transformation module.
*/
public class Families2Persons {
/**
* The property file. Stores module list, the metamodel and library locations.
* @generated
*/
private Properties properties;
/**
* The IN model.
* @generated
*/
protected IModel inModel;
/**
* The OUT model.
* @generated
*/
protected IModel outModel;
/**
* The main method.
*
* @param args
* are the arguments
* @generated
*/
public static void main(String[] args) {
try {
// if (args.length < 2) {
// System.out.println("Arguments not valid : {IN_model_path, OUT_model_path}.");
//} else {
Families2Persons runner = new Families2Persons();
//runner.loadModels(args[0]);
runner.loadModels("sample-Families.xmi");
runner.doFamilies2Persons(new NullProgressMonitor());
//runner.saveModels(args[1]);
runner.saveModels("sample-Persons.xmi");
//}
} catch (ATLCoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ATLExecutionException e) {
e.printStackTrace();
}
}
/**
* Constructor.
*
* @generated
*/
public Families2Persons() throws IOException {
properties = new Properties();
properties.load(getFileURL("Families2Persons.properties").openStream());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
//System.out.println(properties);
}
/**
* Load the input and input/output models, initialize output models.
*
* @param inModelPath
* the IN model path
* @throws ATLCoreException
* if a problem occurs while loading models
*
* @generated
*/
public void loadModels(String inModelPath) throws ATLCoreException {
ModelFactory factory = new EMFModelFactory();
IInjector injector = new EMFInjector();
IReferenceModel sourceMetamodel = factory.newReferenceModel();
injector.inject(sourceMetamodel, getMetamodelUri("Families.ecore"));
IReferenceModel targetMetamodel = factory.newReferenceModel();
injector.inject(targetMetamodel, getMetamodelUri("Persons.ecore"));
this.inModel = factory.newModel(sourceMetamodel);
injector.inject(inModel, inModelPath);
this.outModel = factory.newModel(targetMetamodel);
}
/**
* Save the output and input/output models.
*
* @param outModelPath
* the OUT model path
* @throws ATLCoreException
* if a problem occurs while saving models
*
* @generated
*/
public void saveModels(String outModelPath) throws ATLCoreException {
IExtractor extractor = new EMFExtractor();
extractor.extract(outModel, "/org.eclipse.m2m.atl.Project/sample-Persons.xmi");
}
/**
* Transform the models.
*
* @param monitor
* the progress monitor
* @throws ATLCoreException
* if an error occurs during models handling
* @throws IOException
* if a module cannot be read
* @throws ATLExecutionException
* if an error occurs during the execution
*
* @generated
*/
public Object doFamilies2Persons(IProgressMonitor monitor) throws ATLCoreException, IOException, ATLExecutionException {
ILauncher launcher = new EMFVMLauncher();
Map<String, Object> launcherOptions = getOptions();
launcher.initialize(launcherOptions);
launcher.addInModel(inModel, "IN", "source");
launcher.addOutModel(outModel, "OUT", "target");
return launcher.launch("run", monitor, launcherOptions, (Object[]) getModulesList());
}
/**
* Returns an Array of the module input streams, parameterized by the
* property file.
*
* @return an Array of the module input streams
* @throws IOException
* if a module cannot be read
*
* @generated
*/
protected InputStream[] getModulesList() throws IOException {
InputStream[] modules = null;
String modulesList = properties.getProperty("Families2Persons.modules");
if (modulesList != null) {
String[] moduleNames = modulesList.split(",");
modules = new InputStream[moduleNames.length];
for (int i = 0; i < moduleNames.length; i++) {
String asmModulePath = new Path(moduleNames[i].trim()).removeFileExtension().addFileExtension("asm").toString();
modules[i] = getFileURL(asmModulePath).openStream();
}
}
return modules;
}
/**
* Returns the URI of the given metamodel, parameterized from the property file.
*
* @param metamodelName
* the metamodel name
* @return the metamodel URI
*
* @generated
*/
protected String getMetamodelUri(String metamodelName) {
return properties.getProperty("Families2Persons.metamodels." + metamodelName);
}
/**
* Returns the file name of the given library, parameterized from the property file.
*
* @param libraryName
* the library name
* @return the library file name
*
* @generated
*/
protected InputStream getLibraryAsStream(String libraryName) throws IOException {
return getFileURL(properties.getProperty("Families2Persons.libraries." + libraryName)).openStream();
}
/**
* Returns the options map, parameterized from the property file.
*
* @return the options map
*
* @generated
*/
protected Map<String, Object> getOptions() {
Map<String, Object> options = new HashMap<String, Object>();
for (Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey().toString().startsWith("Families2Persons.options.")) {
options.put(entry.getKey().toString().replaceFirst("Families2Persons.options.", ""),
entry.getValue().toString());
}
}
return options;
}
/**
* Finds the file in the plug-in. Returns the file URL.
*
* @param fileName
* the file name
* @return the file URL
* @throws IOException
* if the file doesn't exist
*
* @generated
*/
protected static URL getFileURL(String fileName) throws IOException {
final URL fileURL;
if (isEclipseRunning()) {
URL resourceURL = Families2Persons.class.getResource(fileName);
if (resourceURL != null) {
fileURL = FileLocator.toFileURL(resourceURL);
} else {
fileURL = null;
}
} else {
fileURL = Families2Persons.class.getResource(fileName);
}
if (fileURL == null) {
throw new IOException("'" + fileName + "' not found");
} else {
return fileURL;
}
}
/**
* Tests if eclipse is running.
*
* @return <code>true</code> if eclipse is running
*
* @generated
*/
public static boolean isEclipseRunning() {
try {
return Platform.isRunning();
} catch (Throwable exception) {
// Assume that we aren't running.
}
return false;
}
}
The console seems like this:
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:58)
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:84)
at org.eclipse.m2m.atl.Project.files.Families2Persons.loadModels(Families2Persons.java:118)
at org.eclipse.m2m.atl.Project.files.Families2Persons.main(Families2Persons.java:78)
My question is where can I place the metamodels(in format "ecore")and the models (in format .xmi).I mean their path because I place them in the plugin.What are my errors.
Please help me and I will be thankful very much
|
|
| | |
Re: Plugin ATL [message #1059716 is a reply to message #1059691] |
Tue, 21 May 2013 10:43 |
|
Thank you but the action of loading doesn't work.I place my models "sample-Families.xmi" which is not empty and "sample-Persons.xmi" which is empty in the same project "org.eclipse.m2m.atl.Families2Persons".
/*******************************************************************************
* Copyright (c) 2010, 2012 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.m2m.atl.Families2Persons.files;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.m2m.atl.common.ATLExecutionException;
import org.eclipse.m2m.atl.core.ATLCoreException;
import org.eclipse.m2m.atl.core.IExtractor;
import org.eclipse.m2m.atl.core.IInjector;
import org.eclipse.m2m.atl.core.IModel;
import org.eclipse.m2m.atl.core.IReferenceModel;
import org.eclipse.m2m.atl.core.ModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFExtractor;
import org.eclipse.m2m.atl.core.emf.EMFInjector;
import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
import org.eclipse.m2m.atl.core.launch.ILauncher;
import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;
/**
* Entry point of the 'Families2Persons' transformation module.
*/
public class Families2Persons {
/**
* The property file. Stores module list, the metamodel and library locations.
* @generated
*/
private Properties properties;
/**
* The IN model.
* @generated
*/
protected IModel inModel;
/**
* The OUT model.
* @generated
*/
protected IModel outModel;
/**
* The main method.
*
* @param args
* are the arguments
* @generated
*/
public static void main(String[] args) {
try {
//if (args.length < 2) {
// System.out.println("Arguments not valid : {IN_model_path, OUT_model_path}.");
//} else {
Families2Persons runner = new Families2Persons();
//System.out.println("bj");
runner.loadModels("sample-Families.xmi");
//System.out.println("xx");
runner.doFamilies2Persons(new NullProgressMonitor());
runner.saveModels("sample-Persons.xmi");
//}
} catch (ATLCoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ATLExecutionException e) {
e.printStackTrace();
}
}
/**
* Constructor.
*
* @generated
*/
public Families2Persons() throws IOException {
properties = new Properties();
properties.load(getFileURL("Families2Persons.properties").openStream());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
//System.out.println("Bsr");
}
/**
* Load the input and input/output models, initialize output models.
*
* @param inModelPath
* the IN model path
* @throws ATLCoreException
* if a problem occurs while loading models
*
* @generated
*/
public void loadModels(String inModelPath) throws ATLCoreException {
ModelFactory factory = new EMFModelFactory();
IInjector injector = new EMFInjector();
IReferenceModel familiesMetamodel = factory.newReferenceModel();
injector.inject(familiesMetamodel, getMetamodelUri("families"));
IReferenceModel personsMetamodel = factory.newReferenceModel();
injector.inject(personsMetamodel, getMetamodelUri("persons"));
this.inModel = factory.newModel(familiesMetamodel);
injector.inject(inModel,inModelPath);
this.outModel = factory.newModel(personsMetamodel);
}
/**
* Save the output and input/output models.
*
* @param outModelPath
* the OUT model path
* @throws ATLCoreException
* if a problem occurs while saving models
*
* @generated
*/
public void saveModels(String outModelPath) throws ATLCoreException {
IExtractor extractor = new EMFExtractor();
extractor.extract(outModel,outModelPath);
}
/**
* Transform the models.
*
* @param monitor
* the progress monitor
* @throws ATLCoreException
* if an error occurs during models handling
* @throws IOException
* if a module cannot be read
* @throws ATLExecutionException
* if an error occurs during the execution
*
* @generated
*/
public Object doFamilies2Persons(IProgressMonitor monitor) throws ATLCoreException, IOException, ATLExecutionException {
ILauncher launcher = new EMFVMLauncher();
Map<String, Object> launcherOptions = getOptions();
launcher.initialize(launcherOptions);
launcher.addInModel(inModel, "IN", "Families");
launcher.addOutModel(outModel, "OUT", "Persons");
return launcher.launch("run", monitor, launcherOptions, (Object[]) getModulesList());
}
/**
* Returns an Array of the module input streams, parameterized by the
* property file.
*
* @return an Array of the module input streams
* @throws IOException
* if a module cannot be read
*
* @generated
*/
protected InputStream[] getModulesList() throws IOException {
InputStream[] modules = null;
String modulesList = properties.getProperty("Families2Persons.modules");
if (modulesList != null) {
String[] moduleNames = modulesList.split(",");
modules = new InputStream[moduleNames.length];
for (int i = 0; i < moduleNames.length; i++) {
String asmModulePath = new Path(moduleNames[i].trim()).removeFileExtension().addFileExtension("asm").toString();
modules[i] = getFileURL(asmModulePath).openStream();
}
}
return modules;
}
/**
* Returns the URI of the given metamodel, parameterized from the property file.
*
* @param metamodelName
* the metamodel name
* @return the metamodel URI
*
* @generated
*/
protected String getMetamodelUri(String metamodelName) {
return properties.getProperty("Families2Persons.metamodels." + metamodelName);
}
/**
* Returns the file name of the given library, parameterized from the property file.
*
* @param libraryName
* the library name
* @return the library file name
*
* @generated
*/
protected InputStream getLibraryAsStream(String libraryName) throws IOException {
return getFileURL(properties.getProperty("Families2Persons.libraries." + libraryName)).openStream();
}
/**
* Returns the options map, parameterized from the property file.
*
* @return the options map
*
* @generated
*/
protected Map<String, Object> getOptions() {
Map<String, Object> options = new HashMap<String, Object>();
for (Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey().toString().startsWith("Families2Persons.options.")) {
options.put(entry.getKey().toString().replaceFirst("Families2Persons.options.", ""),
entry.getValue().toString());
}
}
return options;
}
/**
* Finds the file in the plug-in. Returns the file URL.
*
* @param fileName
* the file name
* @return the file URL
* @throws IOException
* if the file doesn't exist
*
* @generated
*/
protected static URL getFileURL(String fileName) throws IOException {
final URL fileURL;
if (isEclipseRunning()) {
URL resourceURL = Families2Persons.class.getResource(fileName);
if (resourceURL != null) {
fileURL = FileLocator.toFileURL(resourceURL);
} else {
fileURL = null;
}
} else {
fileURL = Families2Persons.class.getResource(fileName);
}
if (fileURL == null) {
throw new IOException("'" + fileName + "' not found");
} else {
return fileURL;
}
}
/**
* Tests if eclipse is running.
*
* @return <code>true</code> if eclipse is running
*
* @generated
*/
public static boolean isEclipseRunning() {
try {
return Platform.isRunning();
} catch (Throwable exception) {
// Assume that we aren't running.
}
return false;
}
}
the file of Families2Persons.properties seems like this:
# ==============================================================================
# Families2Persons properties
# ==============================================================================
# ATL modules: if several, by order of superimposition (the latter ones overrides the former ones)
Families2Persons.modules = Families2Persons.atl
# Metamodels paths or nsUris
Families2Persons.metamodels.Families = /Families2Persons/Families.ecore
Families2Persons.metamodels.Persons = /Families2Persons/Persons.ecore
# Libraries paths
# ATL Launching options
==>I need to find a solution the loading of models doesn't work.Can body tell me how can I do to solve the problem of loading.My program doesn't work and the console seems like this:
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:58)
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:84)
at org.eclipse.m2m.atl.Families2Persons.files.Families2Persons.loadModels(Families2Persons.java:118)
at org.eclipse.m2m.atl.Families2Persons.files.Families2Persons.main(Families2Persons.java:78)
|
|
| |
Re: Plugin ATL [message #1059725 is a reply to message #1059722] |
Tue, 21 May 2013 12:08 |
|
Please Mr.Hugo help me more:as the file "Families2Persons.properties" the Paths of both metamodels are:
Families2Persons.metamodels.Families = /Families2Persons/Families.ecore
Families2Persons.metamodels.Persons = /Families2Persons/Persons.ecore
The path of the inModel is "/org.eclipse.m2m.atl.Families2Persons/src/sample-Families.xmi"
Could you show me where exactly can me place the paths in the code and thank you so much
|
|
| | |
Re: Plugin ATL [message #1220137 is a reply to message #1059551] |
Tue, 10 December 2013 03:57 |
michel souza Messages: 18 Registered: December 2013 |
Junior Member |
|
|
I'm still having problems with Plugin ATL.. I'm using exactly the same example Families2Persons. It works fine without the programmatically way of trying.
My Class:
/*******************************************************************************
* Copyright (c) 2010, 2012 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.m2m.atl.Families2Persons.files;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.m2m.atl.common.ATLExecutionException;
import org.eclipse.m2m.atl.core.ATLCoreException;
import org.eclipse.m2m.atl.core.IExtractor;
import org.eclipse.m2m.atl.core.IInjector;
import org.eclipse.m2m.atl.core.IModel;
import org.eclipse.m2m.atl.core.IReferenceModel;
import org.eclipse.m2m.atl.core.ModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFExtractor;
import org.eclipse.m2m.atl.core.emf.EMFInjector;
import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
import org.eclipse.m2m.atl.core.launch.ILauncher;
import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;
/**
* Entry point of the 'Families2Persons' transformation module.
*/
public class Families2Persons {
/**
* The property file. Stores module list, the metamodel and library locations.
* @generated
*/
private Properties properties;
/**
* The IN model.
* @generated
*/
protected IModel inModel;
/**
* The OUT model.
* @generated
*/
protected IModel outModel;
/**
* The main method.
*
* @param args
* are the arguments
* @generated
*/
public static void main(String[] args) {
try {
// if (args.length < 2) {
// System.out.println("Arguments not valid : {IN_model_path, OUT_model_path}.");
// } else {
Families2Persons runner = new Families2Persons();
runner.loadModels("/org.eclipse.m2m.atl.Families2Persons/src/sample-Families.xmi");
runner.doFamilies2Persons(new NullProgressMonitor());
runner.saveModels("/org.eclipse.m2m.atl.Families2Persons/src/sample-Families.xmi");
// }
} catch (ATLCoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ATLExecutionException e) {
e.printStackTrace();
}
}
/**
* Constructor.
*
* @generated
*/
public Families2Persons() throws IOException {
properties = new Properties();
properties.load(getFileURL("Families2Persons.properties").openStream());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
}
/**
* Load the input and input/output models, initialize output models.
*
* @param inModelPath
* the IN model path
* @throws ATLCoreException
* if a problem occurs while loading models
*
* @generated
*/
public void loadModels(String inModelPath) throws ATLCoreException {
ModelFactory factory = new EMFModelFactory();
IInjector injector = new EMFInjector();
IReferenceModel familiesMetamodel = factory.newReferenceModel();
injector.inject(familiesMetamodel, getMetamodelUri("Families"));
IReferenceModel personsMetamodel = factory.newReferenceModel();
injector.inject(personsMetamodel, getMetamodelUri("Persons"));
this.inModel = factory.newModel(familiesMetamodel);
injector.inject(inModel, inModelPath);
this.outModel = factory.newModel(personsMetamodel);
}
/**
* Save the output and input/output models.
*
* @param outModelPath
* the OUT model path
* @throws ATLCoreException
* if a problem occurs while saving models
*
* @generated
*/
public void saveModels(String outModelPath) throws ATLCoreException {
IExtractor extractor = new EMFExtractor();
extractor.extract(outModel, outModelPath);
}
/**
* Transform the models.
*
* @param monitor
* the progress monitor
* @throws ATLCoreException
* if an error occurs during models handling
* @throws IOException
* if a module cannot be read
* @throws ATLExecutionException
* if an error occurs during the execution
*
* @generated
*/
public Object doFamilies2Persons(IProgressMonitor monitor) throws ATLCoreException, IOException, ATLExecutionException {
ILauncher launcher = new EMFVMLauncher();
Map<String, Object> launcherOptions = getOptions();
launcher.initialize(launcherOptions);
launcher.addInModel(inModel, "IN", "Families");
launcher.addOutModel(outModel, "OUT", "Persons");
return launcher.launch("run", monitor, launcherOptions, (Object[]) getModulesList());
}
/**
* Returns an Array of the module input streams, parameterized by the
* property file.
*
* @return an Array of the module input streams
* @throws IOException
* if a module cannot be read
*
* @generated
*/
protected InputStream[] getModulesList() throws IOException {
InputStream[] modules = null;
String modulesList = properties.getProperty("Families2Persons.modules");
if (modulesList != null) {
String[] moduleNames = modulesList.split(",");
modules = new InputStream[moduleNames.length];
for (int i = 0; i < moduleNames.length; i++) {
String asmModulePath = new Path(moduleNames[i].trim()).removeFileExtension().addFileExtension("asm").toString();
modules[i] = getFileURL(asmModulePath).openStream();
}
}
return modules;
}
/**
* Returns the URI of the given metamodel, parameterized from the property file.
*
* @param metamodelName
* the metamodel name
* @return the metamodel URI
*
* @generated
*/
protected String getMetamodelUri(String metamodelName) {
return properties.getProperty("Families2Persons.metamodels." + metamodelName);
}
/**
* Returns the file name of the given library, parameterized from the property file.
*
* @param libraryName
* the library name
* @return the library file name
*
* @generated
*/
protected InputStream getLibraryAsStream(String libraryName) throws IOException {
return getFileURL(properties.getProperty("Families2Persons.libraries." + libraryName)).openStream();
}
/**
* Returns the options map, parameterized from the property file.
*
* @return the options map
*
* @generated
*/
protected Map<String, Object> getOptions() {
Map<String, Object> options = new HashMap<String, Object>();
for (Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey().toString().startsWith("Families2Persons.options.")) {
options.put(entry.getKey().toString().replaceFirst("Families2Persons.options.", ""),
entry.getValue().toString());
}
}
return options;
}
/**
* Finds the file in the plug-in. Returns the file URL.
*
* @param fileName
* the file name
* @return the file URL
* @throws IOException
* if the file doesn't exist
*
* @generated
*/
protected static URL getFileURL(String fileName) throws IOException {
final URL fileURL;
if (isEclipseRunning()) {
URL resourceURL = Families2Persons.class.getResource(fileName);
if (resourceURL != null) {
fileURL = FileLocator.toFileURL(resourceURL);
} else {
fileURL = null;
}
} else {
fileURL = Families2Persons.class.getResource(fileName);
}
if (fileURL == null) {
throw new IOException("'" + fileName + "' not found");
} else {
return fileURL;
}
}
/**
* Tests if eclipse is running.
*
* @return <code>true</code> if eclipse is running
*
* @generated
*/
public static boolean isEclipseRunning() {
try {
return Platform.isRunning();
} catch (Throwable exception) {
// Assume that we aren't running.
}
return false;
}
}
Error Log:
org.eclipse.m2m.atl.core.ATLCoreException: Error loading /Families2Persons/Families.ecore: java.io.FileNotFoundException: \Families2Persons\Families.ecore (O sistema não pode encontrar o caminho especificado)
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:70)
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:84)
at org.eclipse.m2m.atl.Families2Persons.files.Families2Persons.loadModels(Families2Persons.java:115)
at org.eclipse.m2m.atl.Families2Persons.files.Families2Persons.main(Families2Persons.java:77)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: \Families2Persons\Families.ecore (O sistema não pode encontrar o caminho especificado)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:65)
... 3 more
Caused by: java.io.FileNotFoundException: \Families2Persons\Families.ecore (O sistema não pode encontrar o caminho especificado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.eclipse.emf.ecore.resource.impl.FileURIHandlerImpl.createInputStream(FileURIHandlerImpl.java:99)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 5 more
"O sistema não pode encontrar o caminhado especificado" means The system couldn't find the specified path.
The thing here is.. I'm having troubles to load even the metamodel. They are in another project.. but I checked the .properties files and the key/id is fine. I tried to copy the metamodels to my project called "org.eclipse.m2m.atl.Families2Persons" and change the .properties file to match but even like this.. not working.
Any Help please. Thanks in advance!
|
|
| |
Goto Forum:
Current Time: Thu Sep 26 01:39:46 GMT 2024
Powered by FUDForum. Page generated in 0.04745 seconds
|