org.eclipse.emf.ecp.emfstore.core.internal
Class EMFStoreProvider

java.lang.Object
  extended by org.eclipse.emf.ecp.internal.core.util.Element
      extended by org.eclipse.emf.ecp.spi.core.DefaultProvider
          extended by org.eclipse.emf.ecp.emfstore.core.internal.EMFStoreProvider
All Implemented Interfaces:
Comparable<ECPElement>, org.eclipse.core.runtime.IAdaptable, ECPProvider, ECPElement, ECPModelContextProvider, ECPProviderAware, InternalProvider, AdapterProvider, ECPDisposable, InternalRegistryElement

public final class EMFStoreProvider
extends DefaultProvider

This is the EMFStore Provider for ECP.

Author:
Eugen Neufeld

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.InternalProvider
InternalProvider.LifecycleEvent
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.util.ECPDisposable
ECPDisposable.DisposeListener
 
Field Summary
static EMFStoreProvider INSTANCE
          EMFStore Provider Singleton.
static String NAME
          This is the name of the EMFStore Provider.
static String PROP_CERTIFICATE
          Property constant for Repository Certificate.
static String PROP_PORT
          Property constant for Repository Port.
static String PROP_PROJECTSPACEID
          Property constant for ProjectSpaceID.
static String PROP_REPOSITORY_URL
          Property constant for Repository URL.
static String PROP_SERVERINFOID
          Property constant for ServerInfoID.
 
Fields inherited from interface org.eclipse.emf.ecp.spi.core.InternalProvider
EMF_ADAPTER_FACTORY
 
Fields inherited from interface org.eclipse.emf.ecp.core.ECPProvider
TYPE
 
Constructor Summary
EMFStoreProvider()
          Default constructor.
 
Method Summary
 void cloneProject(InternalProject projectToClone, InternalProject targetProject)
          This method clones a project.
 boolean contains(InternalProject project, Object object)
          Checks whether a specific project contains a specific object.
 org.eclipse.emf.edit.domain.EditingDomain createEditingDomain(InternalProject project)
          This method creates an editing domain each time it is called.
 void delete(InternalProject project, Collection<Object> objects)
          Deletes a collection of EObjects from the model.
 void doSave(InternalProject project)
          Convenient implementation where nothing happens.
 void fillChildren(ECPContainer context, Object parent, InternalChildrenList childrenList)
          Fills the elements of a certain parent object, depending on the context into the childrenList.
 org.eclipse.emf.common.util.EList<? extends Object> getElements(InternalProject project)
          This method returns an EList of the root elements.
 Iterator<org.eclipse.emf.ecore.EObject> getLinkElements(InternalProject project, org.eclipse.emf.ecore.EObject modelElement, org.eclipse.emf.ecore.EReference eReference)
          Convenient implementation of the DefaultProvider.getLinkElements(InternalProject, EObject, EReference) method to use the ItemPropertyDescriptor to get all object of an object.
 ECPContainer getModelContext(Object element)
          Returns the first ECPContainer that can be found for the provided Object.
 ECPProject getProject(org.eclipse.emf.emfstore.client.ESLocalProject projectSpace)
          This gets the ECPProject based on a ProjectSpace.
 org.eclipse.emf.emfstore.client.ESLocalProject getProjectSpace(InternalProject internalProject)
          This retrieves the ProjectSpace from an InternalProject.
 ECPRepository getRepository(org.eclipse.emf.emfstore.client.ESServer serverInfo)
          This gets the ECPRepository based on a ServerInfo.
 org.eclipse.emf.common.notify.Notifier getRoot(InternalProject project)
          Method checking whether an object is the root of the model container.
 org.eclipse.emf.emfstore.client.ESServer getServerInfo(InternalRepository internalRepository)
          This retrieves the ServerInfo from an InternalRepository.
 void handleLifecycle(ECPContainer context, InternalProvider.LifecycleEvent event)
          This method is called to handle a specific life cycle.
 boolean hasCreateProjectWithoutRepositorySupport()
          Convenient implementation that return false.
 boolean isDirty(InternalProject project)
          Convenient implementation where the provider saves changes of the project automatically, so a project never gets dirty.
 boolean isThreadSafe()
          Whether it is safe to modify the EList of model elements ot this provider.
 boolean modelExists(InternalProject project)
          Convenient implementation that return true during this check.
 
Methods inherited from class org.eclipse.emf.ecp.spi.core.DefaultProvider
addDisposeListener, dispose, getAdapter, getAdapter, getDescription, getLabel, getOpenProjects, getProvider, getType, getUIProvider, getUnsupportedEPackages, hasCreateRepositorySupport, isDisposed, isSlow, removeDisposeListener, setDescription, setLabel, setUIProvider
 
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.Element
compareTo, equals, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.ecp.core.util.ECPElement
getName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NAME

public static final String NAME
This is the name of the EMFStore Provider.

See Also:
Constant Field Values

INSTANCE

public static EMFStoreProvider INSTANCE
EMFStore Provider Singleton.


PROP_REPOSITORY_URL

public static final String PROP_REPOSITORY_URL
Property constant for Repository URL.

See Also:
Constant Field Values

PROP_PORT

public static final String PROP_PORT
Property constant for Repository Port.

See Also:
Constant Field Values

PROP_CERTIFICATE

public static final String PROP_CERTIFICATE
Property constant for Repository Certificate.

See Also:
Constant Field Values

PROP_PROJECTSPACEID

public static final String PROP_PROJECTSPACEID
Property constant for ProjectSpaceID.

See Also:
Constant Field Values

PROP_SERVERINFOID

public static final String PROP_SERVERINFOID
Property constant for ServerInfoID.

See Also:
Constant Field Values
Constructor Detail

EMFStoreProvider

public EMFStoreProvider()
Default constructor.

Method Detail

createEditingDomain

public org.eclipse.emf.edit.domain.EditingDomain createEditingDomain(InternalProject project)
This method creates an editing domain each time it is called.

Specified by:
createEditingDomain in interface InternalProvider
Overrides:
createEditingDomain in class DefaultProvider
Parameters:
project - the InternalProject to create the domain for.
Returns:
the created EditingDomain

fillChildren

public void fillChildren(ECPContainer context,
                         Object parent,
                         InternalChildrenList childrenList)
Fills the elements of a certain parent object, depending on the context into the childrenList.

Specified by:
fillChildren in interface InternalProvider
Overrides:
fillChildren in class DefaultProvider
Parameters:
context - the context to use
parent - the parent to read the children from
childrenList - the list to fill

hasCreateProjectWithoutRepositorySupport

public boolean hasCreateProjectWithoutRepositorySupport()
Description copied from class: DefaultProvider
Convenient implementation that return false.

Specified by:
hasCreateProjectWithoutRepositorySupport in interface ECPProvider
Overrides:
hasCreateProjectWithoutRepositorySupport in class DefaultProvider
Returns:
false

getElements

public org.eclipse.emf.common.util.EList<? extends Object> getElements(InternalProject project)
This method returns an EList of the root elements.

Parameters:
project - the project to get the root elements for
Returns:
list of root elements of this project

handleLifecycle

public void handleLifecycle(ECPContainer context,
                            InternalProvider.LifecycleEvent event)
This method is called to handle a specific life cycle.

Specified by:
handleLifecycle in interface InternalProvider
Overrides:
handleLifecycle in class DefaultProvider
Parameters:
context - the context to handle the lifecycle for
event - the lifecycle event to handle

getLinkElements

public Iterator<org.eclipse.emf.ecore.EObject> getLinkElements(InternalProject project,
                                                               org.eclipse.emf.ecore.EObject modelElement,
                                                               org.eclipse.emf.ecore.EReference eReference)
Convenient implementation of the DefaultProvider.getLinkElements(InternalProject, EObject, EReference) method to use the ItemPropertyDescriptor to get all object of an object.

Specified by:
getLinkElements in interface InternalProvider
Overrides:
getLinkElements in class DefaultProvider
Parameters:
project - the project the call is from
modelElement - EObject to add the EReference to
eReference - the EReference to add
Returns:
Iterator of EObject that can be linked

doSave

public void doSave(InternalProject project)
Convenient implementation where nothing happens.

Specified by:
doSave in interface InternalProvider
Overrides:
doSave in class DefaultProvider
Parameters:
project - the project to save

isDirty

public boolean isDirty(InternalProject project)
Convenient implementation where the provider saves changes of the project automatically, so a project never gets dirty. Thus this returns false.

Specified by:
isDirty in interface InternalProvider
Overrides:
isDirty in class DefaultProvider
Parameters:
project - the project to check
Returns:
false

delete

public void delete(InternalProject project,
                   Collection<Object> objects)
Deletes a collection of EObjects from the model.

Parameters:
project - the project from where to delete
objects - the Collection if Objects to delete

cloneProject

public void cloneProject(InternalProject projectToClone,
                         InternalProject targetProject)
This method clones a project.

Parameters:
projectToClone - the project to be cloned
targetProject - the project to add the cloned data to

modelExists

public boolean modelExists(InternalProject project)
Convenient implementation that return true during this check.

Specified by:
modelExists in interface InternalProvider
Overrides:
modelExists in class DefaultProvider
Parameters:
project - the project to check
Returns:
true

getRoot

public org.eclipse.emf.common.notify.Notifier getRoot(InternalProject project)
Method checking whether an object is the root of the model container.

Parameters:
project - to check the root container for
Returns:
a Notifier that is the model root of this project

contains

public boolean contains(InternalProject project,
                        Object object)
Description copied from class: DefaultProvider
Checks whether a specific project contains a specific object.

Specified by:
contains in interface InternalProvider
Overrides:
contains in class DefaultProvider
Parameters:
project - the project to check
object - the object to check
Returns:
true if the project contains such an object, false otherwise

getModelContext

public ECPContainer getModelContext(Object element)
Description copied from class: DefaultProvider
Returns the first ECPContainer that can be found for the provided Object.

Specified by:
getModelContext in interface ECPModelContextProvider
Overrides:
getModelContext in class DefaultProvider
Parameters:
element - the element to search the ECPContainer for
Returns:
the ECPContainer of this element

getProjectSpace

public org.eclipse.emf.emfstore.client.ESLocalProject getProjectSpace(InternalProject internalProject)
This retrieves the ProjectSpace from an InternalProject. First it checks whether the InternalProject has a ProjectSpaceID attached. If an ID is attached, a ProjectSpace is searched with this ID. If no ID is attached or now ProjectSpace was found a LocalProject is created.

Parameters:
internalProject - the project to get the ProjectSpace for
Returns:
the corresponding ProjectSpace

getServerInfo

public org.eclipse.emf.emfstore.client.ESServer getServerInfo(InternalRepository internalRepository)
This retrieves the ServerInfo from an InternalRepository. First it checks whether the InternalRepository has a ServerInfoID attached. If an ID is attached, a ServerInfo is searched with this ID. If no ID is attached or now ServerInfo was found a default ServerInfo is created.

Parameters:
internalRepository - the repository to get the ServerInfo for
Returns:
the corresponding ServerInfo

getProject

public ECPProject getProject(org.eclipse.emf.emfstore.client.ESLocalProject projectSpace)
This gets the ECPProject based on a ProjectSpace.

Parameters:
projectSpace - the ProjectSpace to get the ECPProject for
Returns:
the ECPProject corresponding to this ProjectSpace or null if none found

getRepository

public ECPRepository getRepository(org.eclipse.emf.emfstore.client.ESServer serverInfo)
This gets the ECPRepository based on a ServerInfo.

Parameters:
serverInfo - the ESServer to get the ECPRepository for
Returns:
the ECPRepository corresponding to this ServerInfo or null if none found

isThreadSafe

public boolean isThreadSafe()
Whether it is safe to modify the EList of model elements ot this provider.

Returns:
true, if the provider is thread-safe, false otherwise
See Also:
InternalProvider.isThreadSafe()


Copyright © 2014. All Rights Reserved.