use of org.eclipse.emf.ecore.xmi.XMLResource in project jbpm by kiegroup.
the class DroolsResourceFactoryImpl method createResource.
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Resource createResource(URI uri) {
XMLResource result = new DroolsResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
return result;
}
use of org.eclipse.emf.ecore.xmi.XMLResource in project jbpm by kiegroup.
the class ColorResourceFactoryImpl method createResource.
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Resource createResource(URI uri) {
XMLResource result = new ColorResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
return result;
}
use of org.eclipse.emf.ecore.xmi.XMLResource in project jbpm by kiegroup.
the class BpsimResourceFactoryImpl method createResource.
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Resource createResource(URI uri) {
XMLResource result = new BpsimResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
return result;
}
use of org.eclipse.emf.ecore.xmi.XMLResource in project InformationSystem by ObeoNetwork.
the class SoaMigrationHelper method removeDtoRegistry.
private void removeDtoRegistry(Namespace dtoRegistry) {
System system = (System) dtoRegistry.eContainer();
if (!dtoRegistry.getOwnedNamespaces().isEmpty()) {
// Store XMI IDs
Map<EObject, String> eObjectToIds = new HashMap<EObject, String>();
TreeIterator<EObject> eAllContents = dtoRegistry.eAllContents();
while (eAllContents.hasNext()) {
EObject child = eAllContents.next();
String xmiId = child.eResource().getURIFragment(child);
eObjectToIds.put(child, xmiId);
}
// Change parent of children
Collection<Namespace> children = new ArrayList<Namespace>(dtoRegistry.getOwnedNamespaces());
for (Namespace child : children) {
system.getOwnedNamespaces().add(child);
}
// Restore XMI IDs
for (Entry<EObject, String> eObjectToIdEntry : eObjectToIds.entrySet()) {
EObject object = eObjectToIdEntry.getKey();
String id = eObjectToIdEntry.getValue();
((XMLResource) object.eResource()).setID(object, id);
}
}
// Delete old DTO registry
EcoreUtil.delete(dtoRegistry, false);
}
use of org.eclipse.emf.ecore.xmi.XMLResource in project InformationSystem by ObeoNetwork.
the class AbstractDatabaseCompareTest method serialize.
protected String serialize(EObject root) throws IOException {
if (root == null)
return "";
// Copies the root to avoid modifying it
final EObject copyRoot = EcoreUtil.copy(root);
// $NON-NLS-1$
attachResource(URI.createFileURI("resource.xml"), copyRoot);
final StringWriter writer = new StringWriter();
final Map<String, String> options = new HashMap<String, String>();
options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
// Should not throw ClassCast since uri calls for an xml resource
((XMLResource) copyRoot.eResource()).save(writer, options);
final String result = writer.toString();
writer.flush();
return result;
}
Aggregations