Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Import XMI
Re: Import XMI [message #473878] Fri, 06 July 2007 15:07 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 28762
Registered: July 2009
Senior Member
Kevin,

Please use the UML2 newsgroup for questions about UML. I've added it to
the "to" list of the reply, so there's no need to repost the question.
I'm pretty sure they have migration documentation that describes how to
do this, so be sure to check out what's available:
http://wiki.eclipse.org/index.php/MDT-UML2



Kevin M wrote:
> I would like to import XMI to Eclipse, specifically RSA, however this
> error appears when attempting to load it via Java code.
>
> Package with uri 'http://schema.omg.org/spec/UML/2.1.1' not found
>
> I believe that the project being created via Java is a Java project,
> not the desired UML project.
>
> Please help me to specify that my Java code will specify that a UML
> model is to be created.
>
> Here's my code:
>
> /*
> * Main.java
> *
> * Created on July 5, 2007, 3:37 PM
> *
> * To change this template, choose Tools | Template Manager
> * and open the template in the editor.
> */
>
> package loadxmi;
> import java.io.File;
> import java.io.IOException;
> //import java.net.URI;
> import org.eclipse.emf.common.util.URI;
> import java.util.Collections;
> //import org.eclipse.emf.*;
> import org.eclipse.emf.ecore.resource.*;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> import org.eclipse.emf.ecore.EAttribute;
> import org.eclipse.emf.ecore.EClass;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EReference;
>
> /**
> *
> * @author mereditk
> */
> public class Main {
> /** Creates a new instance of Main */
> public Main() {
> }
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> // Create a resource set.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> // Register the default resource factory -- only needed for
> stand-alone!
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> Resource.Factory.Registry.DEFAULT_EXTENSION, new
> XMIResourceFactoryImpl());
>
> // Register the package -- only needed for stand-alone!
> //LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;
>
> // Get the URI of the model file.
> //URI fileURI = URI.createFileURI(new File("c:/documents and
> settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
> //URI fileURI = URI.createFileURI(new
> File("e:/tif/KevinMeredith/Samples/xmi/UPDM
> Example.xmi").getAbsolutePath());
> URI fileURI = URI.createFileURI(new File("C:/Documents and
> Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
> // Demand load the resource for this file.
> Resource resource = resourceSet.getResource(fileURI, true);
> // Print the contents of the resource to System.out.
> try
> {
> resource.save(System.out, Collections.EMPTY_MAP);
> }
> catch (IOException e) {}
> }
> }
>
Re: Import XMI [message #473879 is a reply to message #473878] Fri, 06 July 2007 15:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kevin.m.meredith.lmco.com

Mr. Merks,

I appreciate your swift replies, however I do not understand how the act
of importing an XMI file to Eclipse/Rational Software Architect does not
fall under Eclipse Modeling Framework.

Obviously your knowledge of Eclipse exceeds mine. Do you understand that
I'm attempting to import an XMI file to RSA using Java code? One recurring
error that I've encountered is, "Package with uri
'http://schema.omg.org/spec/UML/2.1.1' not found." I respectfully state so
because I am attempting a very simple task, so I hope that you're not
misinterpreting my simple objective and convoluting it.

I know that the XMI file can be imported to RSA, since I just did so
manually in RSA after I created a UML project, then used the Import
command for an XMI file.

Please help me to rephrase my question in the UML forum so that I can be
fully helped.

I continue to appreciate your help!

Thanks,
Kevin
Re: Import XMI [message #473881 is a reply to message #473879] Fri, 06 July 2007 15:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 28762
Registered: July 2009
Senior Member
Kevin,

It seemed pretty clear you were trying to read an instance of a UML2
model given the package not found error involving the UML namespace. In
general, to read an XMI file you need an Ecore model for the type of
data in the file. I suspect you should be registering
XMI2UMLResource.Factory.INSTANCE...


Kevin M wrote:
> Mr. Merks,
>
> I appreciate your swift replies, however I do not understand how the
> act of importing an XMI file to Eclipse/Rational Software Architect
> does not fall under Eclipse Modeling Framework.
>
> Obviously your knowledge of Eclipse exceeds mine. Do you understand
> that I'm attempting to import an XMI file to RSA using Java code? One
> recurring error that I've encountered is, "Package with uri
> 'http://schema.omg.org/spec/UML/2.1.1' not found." I respectfully
> state so because I am attempting a very simple task, so I hope that
> you're not misinterpreting my simple objective and convoluting it.
>
> I know that the XMI file can be imported to RSA, since I just did so
> manually in RSA after I created a UML project, then used the Import
> command for an XMI file.
>
> Please help me to rephrase my question in the UML forum so that I can
> be fully helped.
>
> I continue to appreciate your help!
>
> Thanks,
> Kevin
>
Re: Import XMI [message #473884 is a reply to message #473881] Fri, 06 July 2007 17:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kevin.m.meredith.lmco.com

Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered with
respect to this code?

Should the XMIResource class be used? Please give a code snippet.

/*
* Main.java
*
* Created on July 5, 2007, 3:37 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package loadxmi;
import java.io.File;
import java.io.IOException;
//import java.net.URI;
import org.eclipse.emf.common.util.URI;
import java.util.Collections;
//import org.eclipse.emf.*;
import org.eclipse.emf.ecore.resource.*;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

/**
*
* @author mereditk
*/
public class Main {

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

// Create a resource set.
ResourceSet resourceSet = new ResourceSetImpl();

// Register the default resource factory -- only needed for
stand-alone!

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
Resource.Factory.Registry.DEFAULT_EXTENSION, new
XMIResourceFactoryImpl());

// Register the package -- only needed for stand-alone!
//LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;

// Get the URI of the model file.
//URI fileURI = URI.createFileURI(new File("c:/documents and
settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
//URI fileURI = URI.createFileURI(new
File("e:/tif/KevinMeredith/Samples/xmi/UPDM
Example.xmi").getAbsolutePath());
URI fileURI = URI.createFileURI(new File("C:/Documents and
Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
// Demand load the resource for this file.
Resource resource = resourceSet.getResource(fileURI, true);

// Print the contents of the resource to System.out.
try
{
resource.save(System.out, Collections.EMPTY_MAP);
}
catch (IOException e) {}
}

}

Thanks!
Kevin
Re: Import XMI [message #473885 is a reply to message #473884] Fri, 06 July 2007 18:05 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 28762
Registered: July 2009
Senior Member
Kevin,

I'm not expert at how to use UML2, but I assume you'd use
XMI2UMLResource.Factory.INSTANCE in place of "new
XMIResourceFactoryImpl()". There might be other setup things you need
to do, so best to look for documentation or wait until Kenn or James
provides more details.


Kevin M wrote:
> Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered
> with respect to this code?
>
> Should the XMIResource class be used? Please give a code snippet.
> /*
> * Main.java
> *
> * Created on July 5, 2007, 3:37 PM
> *
> * To change this template, choose Tools | Template Manager
> * and open the template in the editor.
> */
>
> package loadxmi;
> import java.io.File;
> import java.io.IOException;
> //import java.net.URI;
> import org.eclipse.emf.common.util.URI;
> import java.util.Collections;
> //import org.eclipse.emf.*;
> import org.eclipse.emf.ecore.resource.*;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> import org.eclipse.emf.ecore.EAttribute;
> import org.eclipse.emf.ecore.EClass;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EReference;
>
> /**
> *
> * @author mereditk
> */
> public class Main {
> /** Creates a new instance of Main */
> public Main() {
> }
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> // Create a resource set.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> // Register the default resource factory -- only needed for
> stand-alone!
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> Resource.Factory.Registry.DEFAULT_EXTENSION, new
> XMIResourceFactoryImpl());
>
> // Register the package -- only needed for stand-alone!
> //LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;
>
> // Get the URI of the model file.
> //URI fileURI = URI.createFileURI(new File("c:/documents and
> settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
> //URI fileURI = URI.createFileURI(new
> File("e:/tif/KevinMeredith/Samples/xmi/UPDM
> Example.xmi").getAbsolutePath());
> URI fileURI = URI.createFileURI(new File("C:/Documents and
> Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
> // Demand load the resource for this file.
> Resource resource = resourceSet.getResource(fileURI, true);
> // Print the contents of the resource to System.out.
> try
> {
> resource.save(System.out, Collections.EMPTY_MAP);
> }
> catch (IOException e) {}
> }
> }
>
> Thanks!
> Kevin
>
Re: Import XMI [message #473895 is a reply to message #473885] Mon, 09 July 2007 15:54 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Kevin,

I'm not sure if you had a look at the migration guide as Ed suggested?
There is some sample code there to load models ( look toward the end of the
document ).
It shows how to set up registration of extensions and packages.

You should be able to add an entry to registerExtensions() to do something
like ...
extensionFactoryMap.put(XMI2UMLResource.FILE_EXTENSION,
XMI2UMLResource.Factory.INSTANCE).

Have you tried that? Let me know if that works. If you are still having
issues, please post a sample xmi model and I'll give it a try.

- James.


"Ed Merks" <merks@ca.ibm.com> wrote in message
news:f6m098$ivr$1@build.eclipse.org...
> Kevin,
>
> I'm not expert at how to use UML2, but I assume you'd use
> XMI2UMLResource.Factory.INSTANCE in place of "new
> XMIResourceFactoryImpl()". There might be other setup things you need
> to do, so best to look for documentation or wait until Kenn or James
> provides more details.
>
>
> Kevin M wrote:
> > Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered
> > with respect to this code?
> >
> > Should the XMIResource class be used? Please give a code snippet.
> > /*
> > * Main.java
> > *
> > * Created on July 5, 2007, 3:37 PM
> > *
> > * To change this template, choose Tools | Template Manager
> > * and open the template in the editor.
> > */
> >
> > package loadxmi;
> > import java.io.File;
> > import java.io.IOException;
> > //import java.net.URI;
> > import org.eclipse.emf.common.util.URI;
> > import java.util.Collections;
> > //import org.eclipse.emf.*;
> > import org.eclipse.emf.ecore.resource.*;
> > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> > import org.eclipse.emf.ecore.EAttribute;
> > import org.eclipse.emf.ecore.EClass;
> > import org.eclipse.emf.ecore.EPackage;
> > import org.eclipse.emf.ecore.EReference;
> >
> > /**
> > *
> > * @author mereditk
> > */
> > public class Main {
> > /** Creates a new instance of Main */
> > public Main() {
> > }
> > /**
> > * @param args the command line arguments
> > */
> > public static void main(String[] args) {
> > // Create a resource set.
> > ResourceSet resourceSet = new ResourceSetImpl();
> >
> > // Register the default resource factory -- only needed for
> > stand-alone!
> >
> > resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> > Resource.Factory.Registry.DEFAULT_EXTENSION, new
> > XMIResourceFactoryImpl());
> >
> > // Register the package -- only needed for stand-alone!
> > //LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;
> >
> > // Get the URI of the model file.
> > //URI fileURI = URI.createFileURI(new File("c:/documents and
> > settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
> > //URI fileURI = URI.createFileURI(new
> > File("e:/tif/KevinMeredith/Samples/xmi/UPDM
> > Example.xmi").getAbsolutePath());
> > URI fileURI = URI.createFileURI(new File("C:/Documents and
> > Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
> > // Demand load the resource for this file.
> > Resource resource = resourceSet.getResource(fileURI, true);
> > // Print the contents of the resource to System.out.
> > try
> > {
> > resource.save(System.out, Collections.EMPTY_MAP);
> > }
> > catch (IOException e) {}
> > }
> > }
> >
> > Thanks!
> > Kevin
> >
Re: Import XMI [message #622858 is a reply to message #473878] Fri, 06 July 2007 15:13 Go to previous message
Eclipse UserFriend
Originally posted by: kevin.m.meredith.lmco.com

Mr. Merks,

I appreciate your swift replies, however I do not understand how the act
of importing an XMI file to Eclipse/Rational Software Architect does not
fall under Eclipse Modeling Framework.

Obviously your knowledge of Eclipse exceeds mine. Do you understand that
I'm attempting to import an XMI file to RSA using Java code? One recurring
error that I've encountered is, "Package with uri
'http://schema.omg.org/spec/UML/2.1.1' not found." I respectfully state so
because I am attempting a very simple task, so I hope that you're not
misinterpreting my simple objective and convoluting it.

I know that the XMI file can be imported to RSA, since I just did so
manually in RSA after I created a UML project, then used the Import
command for an XMI file.

Please help me to rephrase my question in the UML forum so that I can be
fully helped.

I continue to appreciate your help!

Thanks,
Kevin
Re: Import XMI [message #623288 is a reply to message #473879] Fri, 06 July 2007 15:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 28762
Registered: July 2009
Senior Member
Kevin,

It seemed pretty clear you were trying to read an instance of a UML2
model given the package not found error involving the UML namespace. In
general, to read an XMI file you need an Ecore model for the type of
data in the file. I suspect you should be registering
XMI2UMLResource.Factory.INSTANCE...


Kevin M wrote:
> Mr. Merks,
>
> I appreciate your swift replies, however I do not understand how the
> act of importing an XMI file to Eclipse/Rational Software Architect
> does not fall under Eclipse Modeling Framework.
>
> Obviously your knowledge of Eclipse exceeds mine. Do you understand
> that I'm attempting to import an XMI file to RSA using Java code? One
> recurring error that I've encountered is, "Package with uri
> 'http://schema.omg.org/spec/UML/2.1.1' not found." I respectfully
> state so because I am attempting a very simple task, so I hope that
> you're not misinterpreting my simple objective and convoluting it.
>
> I know that the XMI file can be imported to RSA, since I just did so
> manually in RSA after I created a UML project, then used the Import
> command for an XMI file.
>
> Please help me to rephrase my question in the UML forum so that I can
> be fully helped.
>
> I continue to appreciate your help!
>
> Thanks,
> Kevin
>
Re: Import XMI [message #623295 is a reply to message #473881] Fri, 06 July 2007 17:52 Go to previous message
Eclipse UserFriend
Originally posted by: kevin.m.meredith.lmco.com

Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered with
respect to this code?

Should the XMIResource class be used? Please give a code snippet.

/*
* Main.java
*
* Created on July 5, 2007, 3:37 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package loadxmi;
import java.io.File;
import java.io.IOException;
//import java.net.URI;
import org.eclipse.emf.common.util.URI;
import java.util.Collections;
//import org.eclipse.emf.*;
import org.eclipse.emf.ecore.resource.*;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

/**
*
* @author mereditk
*/
public class Main {

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

// Create a resource set.
ResourceSet resourceSet = new ResourceSetImpl();

// Register the default resource factory -- only needed for
stand-alone!

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
Resource.Factory.Registry.DEFAULT_EXTENSION, new
XMIResourceFactoryImpl());

// Register the package -- only needed for stand-alone!
//LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;

// Get the URI of the model file.
//URI fileURI = URI.createFileURI(new File("c:/documents and
settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
//URI fileURI = URI.createFileURI(new
File("e:/tif/KevinMeredith/Samples/xmi/UPDM
Example.xmi").getAbsolutePath());
URI fileURI = URI.createFileURI(new File("C:/Documents and
Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
// Demand load the resource for this file.
Resource resource = resourceSet.getResource(fileURI, true);

// Print the contents of the resource to System.out.
try
{
resource.save(System.out, Collections.EMPTY_MAP);
}
catch (IOException e) {}
}

}

Thanks!
Kevin
Re: Import XMI [message #623297 is a reply to message #473884] Fri, 06 July 2007 18:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 28762
Registered: July 2009
Senior Member
Kevin,

I'm not expert at how to use UML2, but I assume you'd use
XMI2UMLResource.Factory.INSTANCE in place of "new
XMIResourceFactoryImpl()". There might be other setup things you need
to do, so best to look for documentation or wait until Kenn or James
provides more details.


Kevin M wrote:
> Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered
> with respect to this code?
>
> Should the XMIResource class be used? Please give a code snippet.
> /*
> * Main.java
> *
> * Created on July 5, 2007, 3:37 PM
> *
> * To change this template, choose Tools | Template Manager
> * and open the template in the editor.
> */
>
> package loadxmi;
> import java.io.File;
> import java.io.IOException;
> //import java.net.URI;
> import org.eclipse.emf.common.util.URI;
> import java.util.Collections;
> //import org.eclipse.emf.*;
> import org.eclipse.emf.ecore.resource.*;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> import org.eclipse.emf.ecore.EAttribute;
> import org.eclipse.emf.ecore.EClass;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EReference;
>
> /**
> *
> * @author mereditk
> */
> public class Main {
> /** Creates a new instance of Main */
> public Main() {
> }
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> // Create a resource set.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> // Register the default resource factory -- only needed for
> stand-alone!
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> Resource.Factory.Registry.DEFAULT_EXTENSION, new
> XMIResourceFactoryImpl());
>
> // Register the package -- only needed for stand-alone!
> //LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;
>
> // Get the URI of the model file.
> //URI fileURI = URI.createFileURI(new File("c:/documents and
> settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
> //URI fileURI = URI.createFileURI(new
> File("e:/tif/KevinMeredith/Samples/xmi/UPDM
> Example.xmi").getAbsolutePath());
> URI fileURI = URI.createFileURI(new File("C:/Documents and
> Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
> // Demand load the resource for this file.
> Resource resource = resourceSet.getResource(fileURI, true);
> // Print the contents of the resource to System.out.
> try
> {
> resource.save(System.out, Collections.EMPTY_MAP);
> }
> catch (IOException e) {}
> }
> }
>
> Thanks!
> Kevin
>
Re: Import XMI [message #623308 is a reply to message #473885] Mon, 09 July 2007 15:54 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Kevin,

I'm not sure if you had a look at the migration guide as Ed suggested?
There is some sample code there to load models ( look toward the end of the
document ).
It shows how to set up registration of extensions and packages.

You should be able to add an entry to registerExtensions() to do something
like ...
extensionFactoryMap.put(XMI2UMLResource.FILE_EXTENSION,
XMI2UMLResource.Factory.INSTANCE).

Have you tried that? Let me know if that works. If you are still having
issues, please post a sample xmi model and I'll give it a try.

- James.


"Ed Merks" <merks@ca.ibm.com> wrote in message
news:f6m098$ivr$1@build.eclipse.org...
> Kevin,
>
> I'm not expert at how to use UML2, but I assume you'd use
> XMI2UMLResource.Factory.INSTANCE in place of "new
> XMIResourceFactoryImpl()". There might be other setup things you need
> to do, so best to look for documentation or wait until Kenn or James
> provides more details.
>
>
> Kevin M wrote:
> > Mr. Merks, how would XMI2UMLResource.Factory.INSTANCE be registered
> > with respect to this code?
> >
> > Should the XMIResource class be used? Please give a code snippet.
> > /*
> > * Main.java
> > *
> > * Created on July 5, 2007, 3:37 PM
> > *
> > * To change this template, choose Tools | Template Manager
> > * and open the template in the editor.
> > */
> >
> > package loadxmi;
> > import java.io.File;
> > import java.io.IOException;
> > //import java.net.URI;
> > import org.eclipse.emf.common.util.URI;
> > import java.util.Collections;
> > //import org.eclipse.emf.*;
> > import org.eclipse.emf.ecore.resource.*;
> > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> > import org.eclipse.emf.ecore.EAttribute;
> > import org.eclipse.emf.ecore.EClass;
> > import org.eclipse.emf.ecore.EPackage;
> > import org.eclipse.emf.ecore.EReference;
> >
> > /**
> > *
> > * @author mereditk
> > */
> > public class Main {
> > /** Creates a new instance of Main */
> > public Main() {
> > }
> > /**
> > * @param args the command line arguments
> > */
> > public static void main(String[] args) {
> > // Create a resource set.
> > ResourceSet resourceSet = new ResourceSetImpl();
> >
> > // Register the default resource factory -- only needed for
> > stand-alone!
> >
> > resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> > Resource.Factory.Registry.DEFAULT_EXTENSION, new
> > XMIResourceFactoryImpl());
> >
> > // Register the package -- only needed for stand-alone!
> > //LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;
> >
> > // Get the URI of the model file.
> > //URI fileURI = URI.createFileURI(new File("c:/documents and
> > settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
> > //URI fileURI = URI.createFileURI(new
> > File("e:/tif/KevinMeredith/Samples/xmi/UPDM
> > Example.xmi").getAbsolutePath());
> > URI fileURI = URI.createFileURI(new File("C:/Documents and
> > Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
> > // Demand load the resource for this file.
> > Resource resource = resourceSet.getResource(fileURI, true);
> > // Print the contents of the resource to System.out.
> > try
> > {
> > resource.save(System.out, Collections.EMPTY_MAP);
> > }
> > catch (IOException e) {}
> > }
> > }
> >
> > Thanks!
> > Kevin
> >
Previous Topic:Problems with UML2::NamedElement::isDistinguishableFrom
Next Topic:Load and parse UML file
Goto Forum:
  


Current Time: Sat Sep 23 05:48:10 GMT 2017

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

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