org.eclipse.ocl.examples.pivot.resource
Class AbstractASResourceFactory

java.lang.Object
  extended by org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl
      extended by org.eclipse.ocl.examples.pivot.resource.AbstractASResourceFactory
All Implemented Interfaces:
org.eclipse.emf.ecore.resource.Resource.Factory, ASResourceFactory
Direct Known Subclasses:
CompleteOCLASResourceFactory, EcoreASResourceFactory, EssentialOCLASResourceFactory, OCLASResourceFactory, OCLinEcoreASResourceFactory, OCLstdlibASResourceFactory, UMLASResourceFactory

public abstract class AbstractASResourceFactory
extends org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl
implements ASResourceFactory

AbstractASResourceFactory provides the abstract functionality for creating and maintaining OCL Abstract Syntax Resources.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.Resource.Factory
org.eclipse.emf.ecore.resource.Resource.Factory.Descriptor, org.eclipse.emf.ecore.resource.Resource.Factory.Registry
 
Field Summary
protected  java.lang.String contentType
           
protected  java.lang.String fileExtension
           
 
Fields inherited from interface org.eclipse.ocl.examples.pivot.resource.ASResourceFactory
CAN_HANDLE, CANNOT_HANDLE, MAY_HANDLE
 
Constructor Summary
protected AbstractASResourceFactory(java.lang.String contentType, java.lang.String fileExtension)
           
 
Method Summary
 void configure(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Configure the MetaModelManager's external ResourceSet.
protected  void configureResource(ASResource asResource)
           
 AS2MonikerVisitor createAS2MonikerVisitor(AS2Moniker as2moniker)
          Create a visitor to compute a structural descriptor for an element.
 AS2XMIidVisitor createAS2XMIidVisitor(AS2XMIid as2id)
          Create a visitor to compute the xmi:id value of an element.
 ASSaverLocateVisitor createASSaverLocateVisitor(ASSaver saver)
          Create a visitor to locate orphan specializations.
 ASSaverNormalizeVisitor createASSaverNormalizeVisitor(ASSaver saver)
          Create a visitor to normalize content.
 ASSaverResolveVisitor createASSaverResolveVisitor(ASSaver saver)
          Create a visitor to resolve orphan specializations.
 PrettyPrintVisitor createPrettyPrintVisitor(PrettyPrinter prettyPrinter)
          Create a visitor to provide a pretty printed representation of one or more elements in the resource.
 org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI uri)
          Creates an instance of the resource.
 ToStringVisitor createToStringVisitor(java.lang.StringBuilder s)
          Create a visitor to provide a debug representation of one or more elements in the resource.
<T extends Element>
T
getASElement(MetaModelManager metaModelManager, java.lang.Class<T> pivotClass, org.eclipse.emf.ecore.EObject eObject)
          Return the OCL AS element corresponding to eObject using metaModelManager to supervise the correspondence and ensuring that the result is of asClass.
 java.lang.String getContentType()
          Return the Content Type Identifier supported by this ASResourceFactory.
 org.eclipse.emf.ecore.EOperation getEOperation(ASResource asResource, org.eclipse.emf.ecore.EObject eObject)
          Return an EOperation for a pivot Operation if one is available.
 org.eclipse.emf.ecore.EReference getEReference(ASResource asResource, org.eclipse.emf.ecore.EObject eObject)
           
 int getHandlerPriority(org.eclipse.emf.ecore.EObject eObject)
          Return a positive handler priority if this factory can handle creation of an OCL AS type from the available object, negative if it cannot.
 int getHandlerPriority(org.eclipse.emf.ecore.resource.Resource resource)
          Return a positive handler priority if this factory can handle creation of an OCL AS resource from the available resource, negative if it cannot.
 int getHandlerPriority(org.eclipse.emf.common.util.URI uri)
          Return a positive handler priority if this factory can handle creation of an OCL AS resource from the available URI, negative if it cannot.
 java.lang.String getMetamodelNsURI(org.eclipse.emf.ecore.EPackage ePackage)
          Return a specific metamodel NsURI if ePackage has particular requirements as is the case for UML.
 org.eclipse.emf.common.util.URI getPackageURI(org.eclipse.emf.ecore.EObject eObject)
          Return the URI of an eObject if it can be treated as a Package.
 Element importFromResource(MetaModelManager metaModelManager, org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.common.util.URI uri)
          Return the root element in the Pivot resource resulting from import of the available resource.
static void installContentHandler(int priority, org.eclipse.emf.ecore.resource.ContentHandler contentHandler)
           
 boolean isCompatibleResource(org.eclipse.emf.ecore.resource.Resource newResource, org.eclipse.emf.ecore.resource.Resource oldResource)
          Return true if newResource can be ignored in favour of an already loaded oldResource.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contentType

@NonNull
protected final java.lang.String contentType

fileExtension

@Nullable
protected final java.lang.String fileExtension
Constructor Detail

AbstractASResourceFactory

protected AbstractASResourceFactory(@NonNull
                                    java.lang.String contentType,
                                    @Nullable
                                    java.lang.String fileExtension)
Method Detail

installContentHandler

public static void installContentHandler(int priority,
                                         @NonNull
                                         org.eclipse.emf.ecore.resource.ContentHandler contentHandler)

configure

public void configure(@NonNull
                      org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Description copied from interface: ASResourceFactory
Configure the MetaModelManager's external ResourceSet. Implementations may install any required extension or content to factory mappings in the resource factory registry.

Specified by:
configure in interface ASResourceFactory

configureResource

protected void configureResource(@NonNull
                                 ASResource asResource)

createAS2MonikerVisitor

@NonNull
public AS2MonikerVisitor createAS2MonikerVisitor(@NonNull
                                                         AS2Moniker as2moniker)
Description copied from interface: ASResourceFactory
Create a visitor to compute a structural descriptor for an element.

Specified by:
createAS2MonikerVisitor in interface ASResourceFactory

createAS2XMIidVisitor

@NonNull
public AS2XMIidVisitor createAS2XMIidVisitor(@NonNull
                                                     AS2XMIid as2id)
Description copied from interface: ASResourceFactory
Create a visitor to compute the xmi:id value of an element.

Specified by:
createAS2XMIidVisitor in interface ASResourceFactory

createASSaverLocateVisitor

@NonNull
public ASSaverLocateVisitor createASSaverLocateVisitor(@NonNull
                                                               ASSaver saver)
Description copied from interface: ASResourceFactory
Create a visitor to locate orphan specializations.

Specified by:
createASSaverLocateVisitor in interface ASResourceFactory

createASSaverNormalizeVisitor

@NonNull
public ASSaverNormalizeVisitor createASSaverNormalizeVisitor(@NonNull
                                                                     ASSaver saver)
Description copied from interface: ASResourceFactory
Create a visitor to normalize content.

Specified by:
createASSaverNormalizeVisitor in interface ASResourceFactory

createASSaverResolveVisitor

@NonNull
public ASSaverResolveVisitor createASSaverResolveVisitor(@NonNull
                                                                 ASSaver saver)
Description copied from interface: ASResourceFactory
Create a visitor to resolve orphan specializations.

Specified by:
createASSaverResolveVisitor in interface ASResourceFactory

createPrettyPrintVisitor

@NonNull
public PrettyPrintVisitor createPrettyPrintVisitor(@NonNull
                                                           PrettyPrinter prettyPrinter)
Description copied from interface: ASResourceFactory
Create a visitor to provide a pretty printed representation of one or more elements in the resource.

Specified by:
createPrettyPrintVisitor in interface ASResourceFactory

createToStringVisitor

@NonNull
public ToStringVisitor createToStringVisitor(@NonNull
                                                     java.lang.StringBuilder s)
Description copied from interface: ASResourceFactory
Create a visitor to provide a debug representation of one or more elements in the resource.

Specified by:
createToStringVisitor in interface ASResourceFactory

createResource

public org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI uri)
Creates an instance of the resource.

Specified by:
createResource in interface org.eclipse.emf.ecore.resource.Resource.Factory
Overrides:
createResource in class org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl

getASElement

@Nullable
public <T extends Element> T getASElement(@NonNull
                                                   MetaModelManager metaModelManager,
                                                   @NonNull
                                                   java.lang.Class<T> pivotClass,
                                                   @NonNull
                                                   org.eclipse.emf.ecore.EObject eObject)
                               throws ParserException
Description copied from interface: ASResourceFactory
Return the OCL AS element corresponding to eObject using metaModelManager to supervise the correspondence and ensuring that the result is of asClass.

Specified by:
getASElement in interface ASResourceFactory
Throws:
ParserException

getContentType

@NonNull
public java.lang.String getContentType()
Description copied from interface: ASResourceFactory
Return the Content Type Identifier supported by this ASResourceFactory.

Specified by:
getContentType in interface ASResourceFactory

getEOperation

@Nullable
public org.eclipse.emf.ecore.EOperation getEOperation(@NonNull
                                                               ASResource asResource,
                                                               @NonNull
                                                               org.eclipse.emf.ecore.EObject eObject)
Description copied from interface: ASResourceFactory
Return an EOperation for a pivot Operation if one is available.
For UML this locates the corresponding operation in the Eclipse namespace for the OMG namespace.

Specified by:
getEOperation in interface ASResourceFactory

getEReference

@Nullable
public org.eclipse.emf.ecore.EReference getEReference(@NonNull
                                                               ASResource asResource,
                                                               @NonNull
                                                               org.eclipse.emf.ecore.EObject eObject)
Specified by:
getEReference in interface ASResourceFactory

getHandlerPriority

public int getHandlerPriority(@NonNull
                              org.eclipse.emf.ecore.EObject eObject)
Description copied from interface: ASResourceFactory
Return a positive handler priority if this factory can handle creation of an OCL AS type from the available object, negative if it cannot. Generic handlers such as Ecore return a low priority.

Specified by:
getHandlerPriority in interface ASResourceFactory

getHandlerPriority

public int getHandlerPriority(@NonNull
                              org.eclipse.emf.ecore.resource.Resource resource)
Description copied from interface: ASResourceFactory
Return a positive handler priority if this factory can handle creation of an OCL AS resource from the available resource, negative if it cannot. Generic handlers such as Ecore return a low priority.

Specified by:
getHandlerPriority in interface ASResourceFactory

getHandlerPriority

public int getHandlerPriority(@NonNull
                              org.eclipse.emf.common.util.URI uri)
Description copied from interface: ASResourceFactory
Return a positive handler priority if this factory can handle creation of an OCL AS resource from the available URI, negative if it cannot. Generic handlers such as Ecore return a low priority.

Specified by:
getHandlerPriority in interface ASResourceFactory

getMetamodelNsURI

@Nullable
public java.lang.String getMetamodelNsURI(@NonNull
                                                   org.eclipse.emf.ecore.EPackage ePackage)
Description copied from interface: ASResourceFactory
Return a specific metamodel NsURI if ePackage has particular requirements as is the case for UML.

Specified by:
getMetamodelNsURI in interface ASResourceFactory

getPackageURI

@Nullable
public org.eclipse.emf.common.util.URI getPackageURI(@NonNull
                                                              org.eclipse.emf.ecore.EObject eObject)
Description copied from interface: ASResourceFactory
Return the URI of an eObject if it can be treated as a Package.

Specified by:
getPackageURI in interface ASResourceFactory

importFromResource

@Nullable
public Element importFromResource(@NonNull
                                           MetaModelManager metaModelManager,
                                           @NonNull
                                           org.eclipse.emf.ecore.resource.Resource resource,
                                           @Nullable
                                           org.eclipse.emf.common.util.URI uri)
                           throws ParserException
Description copied from interface: ASResourceFactory
Return the root element in the Pivot resource resulting from import of the available resource.

Specified by:
importFromResource in interface ASResourceFactory
Throws:
ParserException

isCompatibleResource

public boolean isCompatibleResource(@NonNull
                                    org.eclipse.emf.ecore.resource.Resource newResource,
                                    @NonNull
                                    org.eclipse.emf.ecore.resource.Resource oldResource)
Description copied from interface: ASResourceFactory
Return true if newResource can be ignored in favour of an already loaded oldResource. Return false if an error message is required

Specified by:
isCompatibleResource in interface ASResourceFactory

toString

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