diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCSupport.java | 3 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java | 26 |
2 files changed, 21 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCSupport.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCSupport.java index 304c816..7c212cc 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCSupport.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCSupport.java @@ -34,6 +34,9 @@ import com.amazon.carbonado.gen.MasterSupport; public interface JDBCSupport<S extends Storable> extends MasterSupport<S> {
public JDBCRepository getJDBCRepository();
+ // FIXME: Lob convert methods need to take Storable and property name. With
+ // this, the optional Lob adapting trigger must be invoked.
+
/**
* @param loader used to reload Blob outside original transaction
*/
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java index c2d1844..03874aa 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java @@ -684,9 +684,14 @@ abstract class BDBStorage<Txn, S extends Storable> implements Storage<S>, Storag return database;
}
- Blob getBlob(long locator) throws FetchException {
+ Blob getBlob(S storable, String name, long locator) throws FetchException {
try {
- return mRepository.getLobEngine().getBlobValue(locator);
+ Blob blob = mRepository.getLobEngine().getBlobValue(locator);
+ Trigger<? super S> trigger = mTriggerManager.getAdaptLobTrigger();
+ if (trigger != null) {
+ blob = trigger.adaptBlob(storable, name, blob);
+ }
+ return blob;
} catch (RepositoryException e) {
throw e.toFetchException();
}
@@ -702,9 +707,14 @@ abstract class BDBStorage<Txn, S extends Storable> implements Storage<S>, Storag }
}
- Clob getClob(long locator) throws FetchException {
+ Clob getClob(S storable, String name, long locator) throws FetchException {
try {
- return mRepository.getLobEngine().getClobValue(locator);
+ Clob clob = mRepository.getLobEngine().getClobValue(locator);
+ Trigger<? super S> trigger = mTriggerManager.getAdaptLobTrigger();
+ if (trigger != null) {
+ clob = trigger.adaptClob(storable, name, clob);
+ }
+ return clob;
} catch (RepositoryException e) {
throw e.toFetchException();
}
@@ -1075,16 +1085,16 @@ abstract class BDBStorage<Txn, S extends Storable> implements Storage<S>, Storag }
}
- public Blob getBlob(long locator) throws FetchException {
- return mStorage.getBlob(locator);
+ public Blob getBlob(S storable, String name, long locator) throws FetchException {
+ return mStorage.getBlob(storable, name, locator);
}
public long getLocator(Blob blob) throws PersistException {
return mStorage.getLocator(blob);
}
- public Clob getClob(long locator) throws FetchException {
- return mStorage.getClob(locator);
+ public Clob getClob(S storable, String name, long locator) throws FetchException {
+ return mStorage.getClob(storable, name, locator);
}
public long getLocator(Clob clob) throws PersistException {
|