本文整理了Java中org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl.<init>()
方法的一些代码示例,展示了XMIResourceImpl.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMIResourceImpl.<init>()
方法的具体详情如下:
包路径:org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl
类名称:XMIResourceImpl
方法名:<init>
[英]Constructor for XMIResourceImpl.
[中]XMIResourceImpl的构造函数。
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore.xmi
@Override
public Resource createResource(URI uri)
{
return new XMIResourceImpl(uri);
}
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore.xmi
@Override
public Resource createResource(URI uri)
{
return new XMIResourceImpl(uri);
}
}
代码示例来源:origin: stackoverflow.com
XMIResource resource = new XMIResourceImpl(URI.create("file:/path/to/mymodel.xmi"));
resource.load(null);
System.out.println( resource.eContents().get(0) );
代码示例来源:origin: stackoverflow.com
XMIResourceImpl resource = new XMIResourceImpl();
File source = new File(fileName);
resource.load( new FileInputStream(source), new HashMap<Object,Object>());
Data data = (Data)resource.getContents().get(0);
代码示例来源:origin: stackoverflow.com
XMIResourceImpl resource = new XMIResourceImpl();
File source = new File(xmlName.xml);
resource.load( new FileInputStream(source), new HashMap<Object,Object>());
Data data = (Data)resource.getContents().get(0);
代码示例来源:origin: stackoverflow.com
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("arxml", new XMIResourceImpl());
URI uri = URI.createURI("http://example.myorganization.com/");
Resource res = resourceSet.createResource(uri);
// TODO add some content here
// res.getContents().add(...)
try{
resource.save(new FileOutputStream("D:/User/file.xml"));
java.lang.System.out.println("success");
} catch (IOException e){
java.lang.System.out.print("no");
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.da.server.component.parser.factory
@Override
protected Entry<ComponentFactory> createService ( final UserInformation userInformation, final String configurationId, final BundleContext context, final Map<String, String> parameters ) throws Exception
{
final ConfigurationDataHelper cfg = new ConfigurationDataHelper ( parameters );
final String xml = cfg.getStringNonEmpty ( "configuration" );
final XMIResource xmi = new XMIResourceImpl ();
final Map<?, ?> options = new HashMap<Object, Object> ();
final InputSource is = new InputSource ( new StringReader ( xml ) );
xmi.load ( is, options );
final Object c = EcoreUtil.getObjectByType ( xmi.getContents (), ParserPackage.Literals.COMPONENT );
if ( ! ( c instanceof Component ) )
{
throw new RuntimeException ( String.format ( "Configuration did not contain an object of type %s", Component.class.getName () ) );
}
final ComponentFactoryWrapper wrapper = new ComponentFactoryWrapper ( this.executor, (Component)c );
final Dictionary<String, ?> properties = new Hashtable<> ();
final ServiceRegistration<ComponentFactory> handle = context.registerService ( ComponentFactory.class, wrapper, properties );
return new Entry<ComponentFactory> ( configurationId, wrapper, handle );
}
代码示例来源:origin: org.eclipse/xtext
public Resource createResource(URI uri) {
XMIResourceImpl resource = new XMIResourceImpl(uri);
// make it a binary resource
resource.getDefaultLoadOptions().put(XMLResource.OPTION_BINARY, Boolean.TRUE);
resource.getDefaultSaveOptions().put(XMLResource.OPTION_BINARY, Boolean.TRUE);
// don't do any resolution, since the only external references point to Ecore elements from EPackages in the registry.
XMLResource.URIHandler uriHandler = new XMLResource.URIHandler() {
public void setBaseURI(URI uri) {
}
public URI resolve(URI uri) {
return uri;
}
public URI deresolve(URI uri) {
return uri;
}
};
resource.getDefaultLoadOptions().put(XMLResource.OPTION_URI_HANDLER, uriHandler);
resource.getDefaultSaveOptions().put(XMLResource.OPTION_URI_HANDLER, uriHandler);
return resource;
}
代码示例来源:origin: org.eclipse.emf.cdo.workspace/efs
@Override
public void close() throws IOException
{
byte[] bytes = toByteArray();
InputStream in = new ByteArrayInputStream(bytes);
XMIResource xmiResource = new XMIResourceImpl();
xmiResource.load(in, null);
String path = getPath();
getWorkspaceStore().setLastModified(path, System.currentTimeMillis());
SaveContext saveContext = getWorkspaceStore().getSaveContext();
saveContext.save(xmiResource, path);
}
};
内容来源于网络,如有侵权,请联系作者删除!