org.topbraid.core.session
Class AbstractSession

java.lang.Object
  extended by org.topbraid.core.session.AbstractSession
All Implemented Interfaces:
IModelSelection, IResourceSelection, ISession
Direct Known Subclasses:
TBCSession

public abstract class AbstractSession
extends java.lang.Object
implements ISession

An abstract base implementation of ISession.

Author:
Holger Knublauch

Field Summary
protected  java.net.URI baseURI
           
 
Constructor Summary
AbstractSession()
           
 
Method Summary
 void addModelSelectionListener(IModelSelectionListener l)
          Adds an IModelSelectionListener to receive events whenever the session's global model selection changes.
 void addResourceSelectionListener(IResourceSelectionListener l)
          Adds an IResourceSelectionListener to receive events whenever the resource selection changes.
 com.hp.hpl.jena.rdf.model.RDFNode getNode(java.lang.String id)
           
 java.lang.String getNodeId(com.hp.hpl.jena.rdf.model.RDFNode node)
           
 NodeIdMap getNodeIdMap()
           
 java.net.URI getPreviouslySelectedBaseURI()
           
 com.hp.hpl.jena.rdf.model.Resource getPreviouslySelectedResource()
           
 com.hp.hpl.jena.rdf.model.Resource getResource(java.lang.String id)
           
 java.lang.Object getRuntimeObject(java.lang.String key)
          Gets a runtime object that has been attached to this session using setRuntimeObject().
 com.hp.hpl.jena.rdf.model.Model getSelectedBaseModel()
          Gets the currently selected base model.
 java.net.URI getSelectedBaseURI()
           
 com.hp.hpl.jena.ontology.OntModel getSelectedOntModel()
          Gets the currently selected OntModel.
 com.hp.hpl.jena.rdf.model.Resource getSelectedResource()
          Gets the currently selected Resource.
 boolean isFastModelSelected()
          Checks if the current model is a "fast" model with only memory access (unlike database mode).
 void notifyModelSelectionListeners()
           
 void removeModelSelectionListener(IModelSelectionListener l)
          Removes a previously added IModelSelectionListener.
 void removeResourceSelectionListener(IResourceSelectionListener l)
          Removes an IResourceSelectionListener that was previously added.
 void setRuntimeObject(java.lang.String key, java.lang.Object value)
          Sets a runtime object; an arbitrary name/value pair.
 void setSelectedBaseURI(java.net.URI baseURI)
          Switches the selection to a different base URI.
 void setSelectedBaseURI(java.net.URI baseURI, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  void setSelectedOntModel(java.net.URI baseURI, com.hp.hpl.jena.ontology.OntModel ontModel)
           
 void setSelectedResource(com.hp.hpl.jena.rdf.model.Resource resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.topbraid.core.session.ISession
ensureBaseModelExists, getBaseModel, getBaseModel, getChangeEngine, getOntModel, isDeletable, isEditable, isVisible
 

Field Detail

baseURI

protected java.net.URI baseURI
Constructor Detail

AbstractSession

public AbstractSession()
Method Detail

addModelSelectionListener

public void addModelSelectionListener(IModelSelectionListener l)
Description copied from interface: IModelSelection
Adds an IModelSelectionListener to receive events whenever the session's global model selection changes.

Specified by:
addModelSelectionListener in interface IModelSelection
Parameters:
l - the IModelSelectionListener to add

addResourceSelectionListener

public void addResourceSelectionListener(IResourceSelectionListener l)
Description copied from interface: IResourceSelection
Adds an IResourceSelectionListener to receive events whenever the resource selection changes.

Specified by:
addResourceSelectionListener in interface IResourceSelection
Parameters:
l - the listener to add

getNodeId

public java.lang.String getNodeId(com.hp.hpl.jena.rdf.model.RDFNode node)
Specified by:
getNodeId in interface ISession

getNode

public com.hp.hpl.jena.rdf.model.RDFNode getNode(java.lang.String id)

getNodeIdMap

public NodeIdMap getNodeIdMap()

getPreviouslySelectedBaseURI

public java.net.URI getPreviouslySelectedBaseURI()

getPreviouslySelectedResource

public com.hp.hpl.jena.rdf.model.Resource getPreviouslySelectedResource()
Specified by:
getPreviouslySelectedResource in interface IResourceSelection

getResource

public com.hp.hpl.jena.rdf.model.Resource getResource(java.lang.String id)

getRuntimeObject

public java.lang.Object getRuntimeObject(java.lang.String key)
Description copied from interface: ISession
Gets a runtime object that has been attached to this session using setRuntimeObject().

Specified by:
getRuntimeObject in interface ISession
Parameters:
key - the key to get the object for
Returns:
the runtime object or null

getSelectedBaseModel

public com.hp.hpl.jena.rdf.model.Model getSelectedBaseModel()
Description copied from interface: IModelSelection
Gets the currently selected base model. If an OntModel is selected, then this should be the base model of it.

Specified by:
getSelectedBaseModel in interface IModelSelection
Returns:
the base Model or null

getSelectedBaseURI

public java.net.URI getSelectedBaseURI()
Specified by:
getSelectedBaseURI in interface IModelSelection

getSelectedOntModel

public com.hp.hpl.jena.ontology.OntModel getSelectedOntModel()
Description copied from interface: IModelSelection
Gets the currently selected OntModel.

Specified by:
getSelectedOntModel in interface IModelSelection
Returns:
the OntModel or null

getSelectedResource

public com.hp.hpl.jena.rdf.model.Resource getSelectedResource()
Description copied from interface: IResourceSelection
Gets the currently selected Resource. This is typically the target (subject) of operations and usually displayed in the center of the screen. The Resource should have the selected OntModel as its associated model.

Specified by:
getSelectedResource in interface IResourceSelection
Returns:
the selected Resource or null

isFastModelSelected

public boolean isFastModelSelected()
Checks if the current model is a "fast" model with only memory access (unlike database mode).

Specified by:
isFastModelSelected in interface IModelSelection
Returns:
true if this is a fast model

notifyModelSelectionListeners

public void notifyModelSelectionListeners()

removeModelSelectionListener

public void removeModelSelectionListener(IModelSelectionListener l)
Description copied from interface: IModelSelection
Removes a previously added IModelSelectionListener.

Specified by:
removeModelSelectionListener in interface IModelSelection
Parameters:
l - the IModelSelectionListener to remove

removeResourceSelectionListener

public void removeResourceSelectionListener(IResourceSelectionListener l)
Description copied from interface: IResourceSelection
Removes an IResourceSelectionListener that was previously added.

Specified by:
removeResourceSelectionListener in interface IResourceSelection
Parameters:
l - the listener to remove

setRuntimeObject

public void setRuntimeObject(java.lang.String key,
                             java.lang.Object value)
Description copied from interface: ISession
Sets a runtime object; an arbitrary name/value pair.

Specified by:
setRuntimeObject in interface ISession
Parameters:
key - the key to set the object for
value - the value to set or null to delete an existing value

setSelectedBaseURI

public void setSelectedBaseURI(java.net.URI baseURI)
Switches the selection to a different base URI. Note that this is typically handled by the user interface and should not be called by plug-ins.

Specified by:
setSelectedBaseURI in interface IModelSelection
Parameters:
baseURI - the new base URI

setSelectedBaseURI

public void setSelectedBaseURI(java.net.URI baseURI,
                               org.eclipse.core.runtime.IProgressMonitor monitor)

setSelectedOntModel

protected void setSelectedOntModel(java.net.URI baseURI,
                                   com.hp.hpl.jena.ontology.OntModel ontModel)

setSelectedResource

public void setSelectedResource(com.hp.hpl.jena.rdf.model.Resource resource)
Specified by:
setSelectedResource in interface IResourceSelection