org.eclipse.ocl.examples.modelregistry.model
Class ProjectRegistry

java.lang.Object
  extended by org.eclipse.ocl.examples.modelregistry.model.ProjectRegistry

public class ProjectRegistry
extends java.lang.Object

A ProjectRegistry instance forms the root of a model registry. It provides the in-memory form of the org.eclipse.ocl.modelregistry model read from and updated in the project .settings folder. The ProjectRegistry contains a FileHandleRegistry for each file handle for which models are registered. The FileHandleRegistry in turn contains an AccessorRegistry for each Accessor class and the AccessorRegistry contains the model Registrations.


Field Summary
static java.lang.String DEFAULT_SERIALISATION_NAME
           
 
Constructor Summary
ProjectRegistry(ProjectHandle projectHandle)
           
 
Method Summary
 FileHandleRegistry add(FileHandle fileHandle)
           
<A extends Accessor<A>>
Registration<A>
add(Registration<A> registration)
           
 FileHandleRegistry get(FileHandle fileHandle)
           
 FileHandleRegistry getOrCreate(FileHandle fileHandle)
           
 ProjectHandle getProject()
           
<A extends Accessor<A>>
Registration<A>
getRegistration(FileHandle fileHandle, A accessor)
          Return the registration applicable to accessor in the context of fileHandle
<A extends Accessor<A>>
java.util.Collection<Registration<A>>
getRegistrations(FileHandle fileHandle, Accessor.Namespace<A> namespace)
          Return all registrations applicable to accessorClass in the context of fileHandle, typically to treat all such registrations as a look-up path.
<A extends Accessor<A>>
org.eclipse.emf.common.util.URI
getResolvedURI(FileHandle fileHandle, A accessor)
          Return the URI that resolves accessor within the context of fileHandle after resolution against the URI of the project.
 org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
          Return the ResourceSet that contains the model registry.
<A extends Accessor<A>>
org.eclipse.emf.common.util.URI
getURI(FileHandle fileHandle, A accessor)
          Return the URI that resolves accessor within the context of fileHandle.
 boolean loadModel()
           
<A extends Accessor<A>>
Registration<A>
remove(Registration<A> registration)
           
 org.eclipse.emf.common.util.URI resolveURI(org.eclipse.emf.common.util.URI uri)
          Return the URI after resolution against the project file handle URI.
 boolean saveModel()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SERIALISATION_NAME

public static final java.lang.String DEFAULT_SERIALISATION_NAME
See Also:
Constant Field Values
Constructor Detail

ProjectRegistry

public ProjectRegistry(ProjectHandle projectHandle)
Method Detail

add

public FileHandleRegistry add(FileHandle fileHandle)

add

public <A extends Accessor<A>> Registration<A> add(Registration<A> registration)

get

public FileHandleRegistry get(FileHandle fileHandle)

getOrCreate

public FileHandleRegistry getOrCreate(FileHandle fileHandle)

getProject

public ProjectHandle getProject()

getRegistration

public <A extends Accessor<A>> Registration<A> getRegistration(FileHandle fileHandle,
                                                               A accessor)
Return the registration applicable to accessor in the context of fileHandle

Type Parameters:
A - kind of accessor
Parameters:
fileHandle - defining look-up context
accessor - name of accessor
Returns:
the registration

getRegistrations

public <A extends Accessor<A>> java.util.Collection<Registration<A>> getRegistrations(FileHandle fileHandle,
                                                                                      Accessor.Namespace<A> namespace)
Return all registrations applicable to accessorClass in the context of fileHandle, typically to treat all such registrations as a look-up path.

Parameters:
fileHandle - defining look-up context
namespace - name of accessor
Returns:
the registrations

getResolvedURI

public <A extends Accessor<A>> org.eclipse.emf.common.util.URI getResolvedURI(FileHandle fileHandle,
                                                                              A accessor)
Return the URI that resolves accessor within the context of fileHandle after resolution against the URI of the project.

Parameters:
fileHandle - defining look-up context
accessor - name and kind of accessor
Returns:
the resolved URI

getResourceSet

public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Return the ResourceSet that contains the model registry.


getURI

public <A extends Accessor<A>> org.eclipse.emf.common.util.URI getURI(FileHandle fileHandle,
                                                                      A accessor)
Return the URI that resolves accessor within the context of fileHandle.

Parameters:
fileHandle - defining look-up context
accessor - name and kind of accessor
Returns:
the URI

loadModel

public boolean loadModel()

remove

public <A extends Accessor<A>> Registration<A> remove(Registration<A> registration)

resolveURI

public org.eclipse.emf.common.util.URI resolveURI(org.eclipse.emf.common.util.URI uri)
Return the URI after resolution against the project file handle URI.

Parameters:
uri - uri to resolve
Returns:
the resolved URI

saveModel

public boolean saveModel()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object