com.bbn.swede.core.libraries
Class LibraryOWLDocument

java.lang.Object
  extended bycom.bbn.swede.core.resources.OWLElement
      extended bycom.bbn.swede.core.libraries.LibraryOWLDocument
All Implemented Interfaces:
ILibraryChangeListener, IOWLDocument, IOWLElement

public class LibraryOWLDocument
extends OWLElement
implements IOWLDocument, ILibraryChangeListener

Implementation of the IOWLDocument interface to allow SWeDE and Eclipse into thinking that entries that exist only in a library ZIP file are valid resources. This involves some trickery, including a reimplementation of Eclipse's IFile interface.

Author:
aperezlo

Field Summary
 
Fields inherited from class com.bbn.swede.core.resources.OWLElement
_elemParent, _info, _resource, _sElementName
 
Constructor Summary
LibraryOWLDocument(ILibraryEntryDescriptor entry, IOWLLibrary parent)
          Create a new LibraryOWLDocument.
 
Method Summary
 boolean contains(IResource resource)
          Checks if this element or one of its decendents is based on a particular Eclipse resource.
 IOWLElement getCorrespondingElement(IResource resource)
          Locates the OWL Element corresponding to a particular Eclipse resource.
 IResource getCorrespondingResource()
          Returns the resource that corresponds to this element.
 OWLDocumentInfo getDocumentInfo()
          Returns document-specific element information.
 String getElementName()
          Returns the name of this element.
 IFile getFile()
          Returns an IFile which is of the internal IFile implementation.
 IPath getGeneratedCodeLocation(String sGeneratorID)
          Returns null to indicate that code generators cannot be run against library entries.
 Map getGeneratedCodeMap()
          Returns null to indicate that code generators cannot be run against library entries.
 String getLocalURI()
          Returns a file: URI indicating the resource's location on the filesystem.
 IPath getPath()
          Returns null to indicate that library entries have no path.
 IResource getResource()
          Returns the innermost enclosing resource of this element.
 String getURI()
          Returns the URI that is the xml:base of the document.
 boolean isReadOnly()
          Returns true, as library entries are always read-only.
 void libraryChanged(LibraryChangeEvent lce)
          Called when by the library when changes are made.
 void setGeneratedCodeLocation(String sGeneratorID, IPath path)
          This method does nothing.
 void setURI(String uri)
          This operation is not allowed as these documents are read-only.
 
Methods inherited from class com.bbn.swede.core.resources.OWLElement
accept, getAdapter, getElementInfo, getParent, setElementName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.swede.core.IOWLElement
accept, getElementInfo, getParent, setParent
 

Constructor Detail

LibraryOWLDocument

public LibraryOWLDocument(ILibraryEntryDescriptor entry,
                          IOWLLibrary parent)
Create a new LibraryOWLDocument.

Parameters:
entry - the entry that holds the file this IOWLDocument represents
parent - the parent in the resource tree
Method Detail

libraryChanged

public void libraryChanged(LibraryChangeEvent lce)
Description copied from interface: ILibraryChangeListener
Called when by the library when changes are made.

Specified by:
libraryChanged in interface ILibraryChangeListener
Parameters:
lce -
See Also:
LibraryChangeEvent

getFile

public IFile getFile()
Returns an IFile which is of the internal IFile implementation.

Specified by:
getFile in interface IOWLDocument
Returns:
the document's inner IFile
See Also:
IOWLDocument.getFile()

getURI

public String getURI()
Description copied from interface: IOWLDocument
Returns the URI that is the xml:base of the document. If no URI has been explicitly set, a file: specifying its location on the filesystem is used.

Specified by:
getURI in interface IOWLDocument
Overrides:
getURI in class OWLElement

setURI

public void setURI(String uri)
            throws MalformedURIException
This operation is not allowed as these documents are read-only. If invoked, this method does nothing.

Specified by:
setURI in interface IOWLDocument
Parameters:
uri - The new base URI
Throws:
MalformedURIException
See Also:
IOWLDocument.setURI(java.lang.String)

getDocumentInfo

public OWLDocumentInfo getDocumentInfo()
Description copied from interface: IOWLDocument
Returns document-specific element information.

Specified by:
getDocumentInfo in interface IOWLDocument
Returns:
OWLDocumentInfo object that can be used to access the details of a document

getGeneratedCodeLocation

public IPath getGeneratedCodeLocation(String sGeneratorID)
Returns null to indicate that code generators cannot be run against library entries.

Specified by:
getGeneratedCodeLocation in interface IOWLDocument
Parameters:
sGeneratorID - The generator ID
Returns:
null
See Also:
IOWLDocument.getGeneratedCodeLocation(String)

getGeneratedCodeMap

public Map getGeneratedCodeMap()
Returns null to indicate that code generators cannot be run against library entries.

Specified by:
getGeneratedCodeMap in interface IOWLDocument
Returns:
null.
See Also:
IOWLDocument.getGeneratedCodeMap()

setGeneratedCodeLocation

public void setGeneratedCodeLocation(String sGeneratorID,
                                     IPath path)
This method does nothing.

Specified by:
setGeneratedCodeLocation in interface IOWLDocument
Parameters:
sGeneratorID - The generator to associate with the path
path - The path of the code generated by the specified generator. If null is provided as the path, the document will be disassociated from the code generator.
See Also:
com.bbn.swede.core.IOWLDocument#setGeneratedCodeLocation(java.lang.String, org.eclipse.core.runtime.IPath)

getPath

public IPath getPath()
Returns null to indicate that library entries have no path.

Specified by:
getPath in interface IOWLElement
Overrides:
getPath in class OWLElement
Returns:
null.
See Also:
IOWLElement.getPath()

getResource

public IResource getResource()
Description copied from interface: IOWLElement
Returns the innermost enclosing resource of this element. This may be a resource that corresponds directly to this element.

Specified by:
getResource in interface IOWLElement
Overrides:
getResource in class OWLElement

getCorrespondingResource

public IResource getCorrespondingResource()
Description copied from interface: IOWLElement
Returns the resource that corresponds to this element. Not all OWL elements have a corresponding resource.

Specified by:
getCorrespondingResource in interface IOWLElement
Overrides:
getCorrespondingResource in class OWLElement

getElementName

public String getElementName()
Description copied from interface: IOWLElement
Returns the name of this element.

Specified by:
getElementName in interface IOWLElement
Overrides:
getElementName in class OWLElement

isReadOnly

public boolean isReadOnly()
Returns true, as library entries are always read-only.

Specified by:
isReadOnly in interface IOWLElement
Overrides:
isReadOnly in class OWLElement
Returns:
true
See Also:
IOWLElement.isReadOnly()

getLocalURI

public String getLocalURI()
Description copied from interface: IOWLElement
Returns a file: URI indicating the resource's location on the filesystem.

Specified by:
getLocalURI in interface IOWLElement
Overrides:
getLocalURI in class OWLElement

contains

public boolean contains(IResource resource)
Description copied from interface: IOWLElement
Checks if this element or one of its decendents is based on a particular Eclipse resource.

Specified by:
contains in interface IOWLElement
Overrides:
contains in class OWLElement

getCorrespondingElement

public IOWLElement getCorrespondingElement(IResource resource)
Description copied from interface: IOWLElement
Locates the OWL Element corresponding to a particular Eclipse resource.

Specified by:
getCorrespondingElement in interface IOWLElement
Overrides:
getCorrespondingElement in class OWLElement


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.