Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » XML Discoverer - standalone
XML Discoverer - standalone [message #1728477] Mon, 04 April 2016 16:30
valerio c. is currently offline valerio c.Friend
Messages: 5
Registered: October 2010
Junior Member
Hello,

I'd like to wrap the MoDisco XML discoverer in a jar, in order to use it outside Eclipse. I've tried two possible solutions, but both fail.
Below, the details.

In the Java application I added the following plugins:
org.eclipse.core.jobs
org.eclipse.core.resources
org.eclipse.core.runtime
org.eclipse.emf
org.eclipse.emf.common
org.eclipse.emf.ecore
org.eclipse.emf.ecore.xmi
org.eclipse.equinox.common
org.eclipse.gmt.modisco.infra.discoverymanager
org.eclipse.gmt.modisco.xml
org.eclipse.gmt.modisco.xml.discoverer
org.eclipse.modisco.infra.discovery
org.eclipse.modisco.infra.discovery.core
org.eclipse.modisco.infra.discovery.ui
org.eclipse.modisco.xml.discoverer
org.eclipse.osgi
org.eclipse.ui.workbench


first solution:
public void generateModelXML(String inputPath) {
	try {
		XMLModelDiscoverer discoverer = new XMLModelDiscoverer();
		discoverer.discoverElement(new File(inputPath), new NullProgressMonitor());
		Resource xmlResource = discoverer.getTargetModel();
	}
	catch (Exception e) {
		e.printStackTrace();
	}
}


In this case, I get a NullPointerException (details below), but I don't know how to set the DiscovererDescription.
Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.eclipse.modisco.infra.discovery.core.internal.DiscoveryManager.getDiscovererDescription(DiscoveryManager.java:122)
	at org.eclipse.modisco.infra.discovery.core.AbstractDiscoverer.checkParameterValues(AbstractDiscoverer.java:187)
	at org.eclipse.modisco.xml.discoverer.XMLModelDiscoverer.discoverElement(XMLModelDiscoverer.java:113)
	at ModelDiscovererModisco.discoverXMLmodel(ModelDiscovererModisco.java:21)
	at ModelDiscovererModisco.main(ModelDiscovererModisco.java:44)
Caused by: java.lang.NullPointerException
	at org.eclipse.modisco.infra.discovery.core.internal.catalog.DiscovererRegistry.getDiscoverersResourceURI(DiscovererRegistry.java:167)
	at org.eclipse.modisco.infra.discovery.core.internal.catalog.DiscovererRegistry.initRegisteredDiscoverers(DiscovererRegistry.java:97)
	at org.eclipse.modisco.infra.discovery.core.internal.catalog.DiscovererRegistry.<init>(DiscovererRegistry.java:56)
	at org.eclipse.modisco.infra.discovery.core.internal.catalog.DiscovererRegistry.<clinit>(DiscovererRegistry.java:53)
	... 5 more



second solution:
public void generateModelXML(File source) {

		XMLModelDiscoverer discoverer = new XMLModelDiscoverer(); 
		Map xmlDiscoveryParameters = new HashMap();
		xmlDiscoveryParameters.put(XMLModelDiscoverer.PARAMETER_SILENT_MODE, true);
		xmlDiscoveryParameters.put(XMLModelDiscoverer.PARAMETER_SERIALIZE_XMI, true);
		
		discoverer.discoverElement(source, xmlDiscoveryParameters);
		
	}


In this case, I don't get anything (no error and no output model)

Any help is welcomed.

Cheers,
Valerio

Previous Topic:Converting Java POJOs to EMF model
Next Topic:Some 'calls' are lost
Goto Forum:
  


Current Time: Tue Jan 23 02:22:31 GMT 2018

Powered by FUDForum. Page generated in 0.02110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software