public class LogicResourceImpl extends org.eclipse.emf.common.notify.impl.NotifierImpl implements LogicResource, java.lang.Cloneable
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList
org.eclipse.emf.ecore.resource.Resource.Diagnostic, org.eclipse.emf.ecore.resource.Resource.Factory, org.eclipse.emf.ecore.resource.Resource.Internal, org.eclipse.emf.ecore.resource.Resource.IOWrappedException
Modifier and Type | Field and Description |
---|---|
static java.util.concurrent.atomic.AtomicBoolean |
applyHorribleHack
Enable duplicate resource loading to handle issue with profile resolution for custom profiles
Must be enabled only once
|
protected ClosureUtils.IClosureIOHelper |
closureIOHelper
Helper to load closure files
|
protected java.util.Map |
defaultLoadOptions
The storage for the default load options.
|
protected java.util.Map |
defaultSaveOptions
The storage for the default save options.
|
protected java.util.Map |
intrinsicIDToEObjectMap
A map to retrieve the EObject based on the value of its ID feature.
|
protected boolean |
isClosureRoot
Determinse if this logic resource is closure root or not
|
protected boolean |
isLoaded
The loaded flag.
|
protected boolean |
isLoading
The loading flag.
|
protected boolean |
isModified
The modified flag.
|
protected org.eclipse.emf.common.notify.Adapter |
modificationTrackingAdapter
The modification tracking adapter.
|
protected org.eclipse.emf.ecore.resource.ResourceSet |
pResourceSet
Resource set associated with this logical resource.
|
protected java.util.List<org.eclipse.emf.ecore.resource.Resource> |
subUnits
A list of subunits associated with this logical resource
|
protected org.eclipse.emf.common.util.URI |
uri
The URI.
|
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
OPTION_CIPHER, OPTION_LINE_DELIMITER, OPTION_LINE_DELIMITER_UNSPECIFIED, OPTION_SAVE_ONLY_IF_CHANGED, OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER, OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__TIME_STAMP, RESOURCE__URI, RESOURCE__WARNINGS
Constructor and Description |
---|
LogicResourceImpl(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) |
LogicResourceImpl(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
boolean loadAdapters)
Constructor
|
LogicResourceImpl(org.eclipse.emf.common.util.URI uri,
org.eclipse.emf.ecore.resource.ResourceSet pResourceSet)
Creates an instance with the given URI and resource set.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubunit(org.eclipse.emf.ecore.resource.Resource resource)
Add a subunit resource to this logical resource.
|
java.lang.Object |
clone() |
boolean |
containSubunit(org.eclipse.emf.common.util.URI uri)
Determine if this logical resource contains
a subunit with the given uri
|
static byte[] |
copy(java.io.InputStream in) |
org.eclipse.emf.ecore.resource.Resource |
createSubunit(org.eclipse.emf.common.util.URI uri)
Create a subunit with the given URI
|
void |
delete(java.util.Map options) |
org.eclipse.emf.common.util.TreeIterator |
getAllContents() |
org.eclipse.emf.common.util.EList |
getContents()
Get a list of resouce level object excluding cross-containment
reference root.
|
protected static org.eclipse.emf.ecore.resource.URIConverter |
getDefaultURIConverter()
Returns the default URI converter that's used when there is no resource
set.
|
org.eclipse.emf.ecore.EObject |
getEObject(java.lang.String uriFragment) |
org.eclipse.emf.common.util.EList |
getErrors() |
org.eclipse.emf.common.util.EList |
getFullContents()
Get a list of resouce level object including cross-containment
reference root.
|
java.lang.Object |
getProperty(java.lang.String prop,
java.lang.Object defaultValue)
Returns user's property
Returns defaultValue if property is not defined
|
org.eclipse.emf.ecore.resource.ResourceSet |
getResourceSet() |
org.eclipse.emf.ecore.EObject |
getRootElement()
Get the root of this logical model.
|
org.eclipse.emf.ecore.resource.Resource |
getRootResource()
Get the root physical resource of this logical resource
|
org.eclipse.emf.ecore.resource.Resource |
getSubunit(org.eclipse.emf.common.util.URI uri,
boolean loadOnDemand)
Get the subunit associated with the given uri.
|
java.util.List |
getSubunits()
Get all the subunits belong to this logical model
|
long |
getTimeStamp() |
org.eclipse.emf.common.util.URI |
getURI() |
protected org.eclipse.emf.ecore.resource.URIConverter |
getURIConverter()
Returns the URI converter.
|
java.lang.String |
getURIFragment(org.eclipse.emf.ecore.EObject eObject) |
org.eclipse.emf.common.util.EList |
getWarnings() |
protected void |
init(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
boolean loadAdapters) |
boolean |
isLoaded() |
boolean |
isModified() |
boolean |
isRootElement(java.lang.Object object)
Returns true if object is a root element of LogicResource
NOTE: We can't use comparison getRootElement() == object because in closure mode
LogicResource has mutliple roots
|
boolean |
isTrackingModification() |
void |
load(java.io.InputStream inputStream,
java.util.Map options) |
void |
load(java.util.Map options) |
protected void |
loadClosure(java.util.Map options) |
boolean |
remove(org.eclipse.emf.ecore.resource.Resource physicalResource,
int index) |
void |
removeContentAdapter() |
void |
resolveAll(org.eclipse.emf.ecore.resource.Resource resource)
Visits all proxies in the resource and tries to resolve them.
|
void |
save_old(java.lang.String toPath)
Deprecated.
|
void |
save(java.util.Map options) |
void |
save(java.io.OutputStream outputStream,
java.util.Map options)
Saves the resource to the output stream using the specified options.
|
void |
save(java.lang.String toPath)
Save this logical resouce into the destination path.
|
void |
setLoaded(boolean isLoaded)
Set whether this logical resource has been loaded.
|
void |
setModified(boolean isModified) |
void |
setProperty(java.lang.String prop,
java.lang.Object value)
Set user's property for resource
|
void |
setRootElement(org.eclipse.emf.ecore.EObject root)
This method should only be used with care.
|
void |
setRootResource(org.eclipse.emf.ecore.resource.Resource resource)
This method should only be used with care.
|
void |
setTimeStamp(long newTimeStamp) |
void |
setTrackingModification(boolean isTrackingModification) |
void |
setURI(org.eclipse.emf.common.util.URI uri) |
void |
unload() |
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
protected java.util.Map defaultSaveOptions
protected java.util.Map defaultLoadOptions
protected org.eclipse.emf.common.util.URI uri
getURI()
protected boolean isModified
isModified
protected boolean isLoaded
isLoaded
protected boolean isLoading
isLoading
protected org.eclipse.emf.common.notify.Adapter modificationTrackingAdapter
isTrackingModification()
protected java.util.Map intrinsicIDToEObjectMap
protected org.eclipse.emf.ecore.resource.ResourceSet pResourceSet
protected java.util.List<org.eclipse.emf.ecore.resource.Resource> subUnits
protected boolean isClosureRoot
protected ClosureUtils.IClosureIOHelper closureIOHelper
public static final java.util.concurrent.atomic.AtomicBoolean applyHorribleHack
public LogicResourceImpl(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
public LogicResourceImpl(org.eclipse.emf.common.util.URI uri, org.eclipse.emf.ecore.resource.ResourceSet pResourceSet)
uri
- the URI.public LogicResourceImpl(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, boolean loadAdapters)
resourceSet
- given resource setloadAdapters
- whether register listener to resourceset as such any subunit
proxy resolution will cause subunit to be added to subunit
list of this logical resource.protected static org.eclipse.emf.ecore.resource.URIConverter getDefaultURIConverter()
getURIConverter()
protected void init(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, boolean loadAdapters)
public void removeContentAdapter()
removeContentAdapter
in interface LogicResource
public org.eclipse.emf.ecore.resource.Resource getRootResource()
LogicResource
getRootResource
in interface LogicResource
public void setRootResource(org.eclipse.emf.ecore.resource.Resource resource)
LogicResource
setRootResource
in interface LogicResource
resource
- root resource.public org.eclipse.emf.ecore.EObject getRootElement()
LogicResource
getRootElement
in interface LogicResource
public void setRootElement(org.eclipse.emf.ecore.EObject root)
LogicResource
setRootElement
in interface LogicResource
root
- new root of this logical modelpublic void addSubunit(org.eclipse.emf.ecore.resource.Resource resource)
LogicResource
addSubunit
in interface LogicResource
resource
- given subunit resource.public org.eclipse.emf.ecore.resource.Resource createSubunit(org.eclipse.emf.common.util.URI uri)
LogicResource
createSubunit
in interface LogicResource
uri
- given URIpublic boolean containSubunit(org.eclipse.emf.common.util.URI uri)
LogicResource
containSubunit
in interface LogicResource
uri
- given uripublic java.util.List getSubunits()
LogicResource
getSubunits
in interface LogicResource
public org.eclipse.emf.ecore.resource.Resource getSubunit(org.eclipse.emf.common.util.URI uri, boolean loadOnDemand)
LogicResource
getSubunit
in interface LogicResource
uri
- given uriloadOnDemand
- whether to load on demandpublic org.eclipse.emf.common.util.EList getContents()
getContents
in interface org.eclipse.emf.ecore.resource.Resource
Resource.getContents()
public org.eclipse.emf.common.util.EList getFullContents()
LogicResource
getFullContents
in interface LogicResource
public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
getResourceSet
in interface org.eclipse.emf.ecore.resource.Resource
public org.eclipse.emf.common.util.TreeIterator getAllContents()
getAllContents
in interface org.eclipse.emf.ecore.resource.Resource
public java.lang.String getURIFragment(org.eclipse.emf.ecore.EObject eObject)
getURIFragment
in interface org.eclipse.emf.ecore.resource.Resource
public org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
getEObject
in interface org.eclipse.emf.ecore.resource.Resource
public boolean isModified()
isModified
in interface org.eclipse.emf.ecore.resource.Resource
public void setModified(boolean isModified)
setModified
in interface org.eclipse.emf.ecore.resource.Resource
public org.eclipse.emf.common.util.URI getURI()
getURI
in interface org.eclipse.emf.ecore.resource.Resource
public void setURI(org.eclipse.emf.common.util.URI uri)
setURI
in interface org.eclipse.emf.ecore.resource.Resource
public boolean remove(org.eclipse.emf.ecore.resource.Resource physicalResource, int index)
public org.eclipse.emf.common.util.EList getErrors()
getErrors
in interface org.eclipse.emf.ecore.resource.Resource
public org.eclipse.emf.common.util.EList getWarnings()
getWarnings
in interface org.eclipse.emf.ecore.resource.Resource
protected org.eclipse.emf.ecore.resource.URIConverter getURIConverter()
converter
from the
containing
resource set, but it calls
getDefaultURIConverter()
when there is no containing resource set.public void save(java.util.Map options) throws java.io.IOException
save
in interface org.eclipse.emf.ecore.resource.Resource
java.io.IOException
public void load(java.util.Map options) throws java.io.IOException
load
in interface org.eclipse.emf.ecore.resource.Resource
java.io.IOException
protected void loadClosure(java.util.Map options) throws java.io.IOException
java.io.IOException
public void save(java.io.OutputStream outputStream, java.util.Map options) throws java.io.IOException
save
in interface org.eclipse.emf.ecore.resource.Resource
options
- the save options.java.io.IOException
save(Map)
,
load(InputStream, Map)
public static byte[] copy(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public final void load(java.io.InputStream inputStream, java.util.Map options) throws java.io.IOException
load
in interface org.eclipse.emf.ecore.resource.Resource
java.io.IOException
public void resolveAll(org.eclipse.emf.ecore.resource.Resource resource)
resource
- the objects to visit.public boolean isLoaded()
isLoaded
in interface org.eclipse.emf.ecore.resource.Resource
public final void unload()
unload
in interface org.eclipse.emf.ecore.resource.Resource
public boolean isTrackingModification()
isTrackingModification
in interface org.eclipse.emf.ecore.resource.Resource
public void setTrackingModification(boolean isTrackingModification)
setTrackingModification
in interface org.eclipse.emf.ecore.resource.Resource
public void save(java.lang.String toPath) throws java.io.IOException
LogicResource
save
in interface LogicResource
toPath
- destination pathjava.io.IOException
@Deprecated public void save_old(java.lang.String toPath)
toPath
- public void setLoaded(boolean isLoaded)
LogicResource
setLoaded
in interface LogicResource
isLoaded
- the isLoaded to setpublic void delete(java.util.Map options) throws java.io.IOException
delete
in interface org.eclipse.emf.ecore.resource.Resource
java.io.IOException
public long getTimeStamp()
getTimeStamp
in interface org.eclipse.emf.ecore.resource.Resource
public void setTimeStamp(long newTimeStamp)
setTimeStamp
in interface org.eclipse.emf.ecore.resource.Resource
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void setProperty(java.lang.String prop, java.lang.Object value)
LogicResource
setProperty
in interface LogicResource
public java.lang.Object getProperty(java.lang.String prop, java.lang.Object defaultValue)
LogicResource
getProperty
in interface LogicResource
public boolean isRootElement(java.lang.Object object)
LogicResource
isRootElement
in interface LogicResource