ca.sqlpower.wabit
Class WabitDataSource

java.lang.Object
  extended by ca.sqlpower.object.AbstractSPObject
      extended by ca.sqlpower.wabit.AbstractWabitObject
          extended by ca.sqlpower.wabit.WabitDataSource
All Implemented Interfaces:
ca.sqlpower.object.SPObject, WabitObject

public class WabitDataSource
extends AbstractWabitObject

An implementation of WabitObject that wraps a data sources. This data source can be any implementation of SPDataSource.


Field Summary
 
Fields inherited from class ca.sqlpower.object.AbstractSPObject
uuid
 
Constructor Summary
WabitDataSource(ca.sqlpower.sql.SPDataSource ds)
          Creates a WabitDataSource wrapper for the given data source.
 
Method Summary
 boolean allowsChildren()
           
 int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)
           
 ca.sqlpower.object.CleanupExceptions cleanup()
          Default cleanup method that does nothing.
 boolean equals(java.lang.Object obj)
           
 java.util.List<java.lang.Class<? extends ca.sqlpower.object.SPObject>> getAllowedChildTypes()
           
 java.util.List<WabitObject> getChildren()
           
 java.util.List<WabitObject> getDependencies()
           
 ca.sqlpower.sql.SPDataSource getSPDataSource()
           
 java.lang.String getUUID()
          Gets the UUID associated with this instance's data source.
 int hashCode()
           
protected  boolean removeChildImpl(ca.sqlpower.object.SPObject child)
           
 void removeDependency(ca.sqlpower.object.SPObject dependency)
           
 void removeDependency(WabitObject dependency)
           
 void setUUID(java.lang.String uuid)
          Sets the UUID associated with this instance's data source.
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
commit, generateNewUUID, getParent, getSession, isForegroundThread, removeChild, rollback, runInBackground, runInForeground, toString
 
Methods inherited from class ca.sqlpower.object.AbstractSPObject
addChild, addChildImpl, addSPListener, begin, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, getChildren, getName, removeSPListener, setName, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.object.SPObject
addChild, addSPListener, begin, getChildren, getName, removeSPListener, setName, setParent
 

Constructor Detail

WabitDataSource

public WabitDataSource(@Nonnull
                       ca.sqlpower.sql.SPDataSource ds)
Creates a WabitDataSource wrapper for the given data source. The newly created WabitDataSource's name tracks changes to the underlying data source's name.

It is vitally important to call cleanup() on a WabitDataSource when you are done with it. If you attach the WabitDataSource to a workspace, cleanup will be done automatically the session is closed, but if the object you create does not get attached to a session, cleanup is your own responsibility.

Parameters:
ds - The data source to wrap. Must not be null.
Method Detail

cleanup

public ca.sqlpower.object.CleanupExceptions cleanup()
Description copied from class: AbstractWabitObject
Default cleanup method that does nothing. Override and implement this method if cleanup is necessary.

Specified by:
cleanup in interface ca.sqlpower.object.SPObject
Overrides:
cleanup in class AbstractWabitObject

getUUID

public java.lang.String getUUID()
Gets the UUID associated with this instance's data source. This class does not store its own UUID, as in implementation, these instances are instantiated and removed often, but the data source they are wrapping stays constant.

Specified by:
getUUID in interface ca.sqlpower.object.SPObject
Overrides:
getUUID in class ca.sqlpower.object.AbstractSPObject
Returns:
The UUID, a unique identifying string associated with this instance's data source.

setUUID

public void setUUID(java.lang.String uuid)
Sets the UUID associated with this instance's data source. This class does not store its own UUID, as in implementation, these instances are instantiated and removed often, but the data source they are wrapping stays constant.

Specified by:
setUUID in interface ca.sqlpower.object.SPObject
Overrides:
setUUID in class ca.sqlpower.object.AbstractSPObject
Parameters:
The - UUID, a unique identifying string associated with this instance's data source.

allowsChildren

public boolean allowsChildren()

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)

getChildren

public java.util.List<WabitObject> getChildren()

getSPDataSource

public ca.sqlpower.sql.SPDataSource getSPDataSource()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractWabitObject

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

removeDependency

public void removeDependency(WabitObject dependency)

getDependencies

public java.util.List<WabitObject> getDependencies()

removeChildImpl

protected boolean removeChildImpl(ca.sqlpower.object.SPObject child)
Specified by:
removeChildImpl in class ca.sqlpower.object.AbstractSPObject

removeDependency

public void removeDependency(ca.sqlpower.object.SPObject dependency)

getAllowedChildTypes

public java.util.List<java.lang.Class<? extends ca.sqlpower.object.SPObject>> getAllowedChildTypes()


Copyright © 2009. All Rights Reserved.