summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-08-26 01:26:13 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-08-26 01:26:13 +0000
commit6d231091ddf24f5c05e51b8c48e455b09dab47c8 (patch)
tree97de303c86c2aa238b1e1b22c918f5d6f9593081 /src/main/java/com
parent00adea5bc6916b717132c72768ab3fea1b2a1a22 (diff)
Removed Trigger lob adapting methods.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/Trigger.java35
-rw-r--r--src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java14
-rw-r--r--src/main/java/com/amazon/carbonado/spi/TriggerManager.java85
3 files changed, 3 insertions, 131 deletions
diff --git a/src/main/java/com/amazon/carbonado/Trigger.java b/src/main/java/com/amazon/carbonado/Trigger.java
index 4b6041c..d974313 100644
--- a/src/main/java/com/amazon/carbonado/Trigger.java
+++ b/src/main/java/com/amazon/carbonado/Trigger.java
@@ -18,9 +18,6 @@
package com.amazon.carbonado;
-import com.amazon.carbonado.lob.Blob;
-import com.amazon.carbonado.lob.Clob;
-
/**
* Callback mechanism to allow custom code to run when a storable is
* persisted. By default, the methods defined in this class do
@@ -297,38 +294,6 @@ public abstract class Trigger<S> {
}
/**
- * Called after a Blob is loaded. Override to return an adapted Blob which
- * can listen for changes. By default, the original Blob is returned
- * unmodified.
- *
- * @param storable storable which contains Blob property
- * @param name property name of Blob
- * @param blob non-null Blob property instance
- * @return adapted Blob
- * @since 1.2
- * @deprecated use afterLoad instead to adapt Blobs
- */
- public Blob adaptBlob(S storable, String name, Blob blob) {
- return blob;
- }
-
- /**
- * Called after a Clob is loaded. Override to return an adapted Clob which
- * can listen for changes. By default, the original Clob is returned
- * unmodified.
- *
- * @param storable storable which contains Clob property
- * @param name property name of Clob
- * @param clob non-null Clob property instance
- * @return adapted Clob
- * @since 1.2
- * @deprecated use afterLoad instead to adapt Clobs
- */
- public Clob adaptClob(S storable, String name, Clob clob) {
- return clob;
- }
-
- /**
* Call to quickly abort a "try" operation, returning false to the
* caller. This method should not be called by a non-try trigger method,
* since the caller gets thrown an exception with an incomplete stack trace.
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 1f14c4f..0b9f53c 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java
@@ -686,12 +686,7 @@ abstract class BDBStorage<Txn, S extends Storable> implements Storage<S>, Storag
Blob getBlob(S storable, String name, long locator) throws FetchException {
try {
- Blob blob = mRepository.getLobEngine().getBlobValue(locator);
- Trigger<? super S> trigger = mTriggerManager.getAdaptLobTrigger();
- if (trigger != null) {
- blob = trigger.adaptBlob(storable, name, blob);
- }
- return blob;
+ return mRepository.getLobEngine().getBlobValue(locator);
} catch (RepositoryException e) {
throw e.toFetchException();
}
@@ -709,12 +704,7 @@ abstract class BDBStorage<Txn, S extends Storable> implements Storage<S>, Storag
Clob getClob(S storable, String name, long locator) throws FetchException {
try {
- Clob clob = mRepository.getLobEngine().getClobValue(locator);
- Trigger<? super S> trigger = mTriggerManager.getAdaptLobTrigger();
- if (trigger != null) {
- clob = trigger.adaptClob(storable, name, clob);
- }
- return clob;
+ return mRepository.getLobEngine().getClobValue(locator);
} catch (RepositoryException e) {
throw e.toFetchException();
}
diff --git a/src/main/java/com/amazon/carbonado/spi/TriggerManager.java b/src/main/java/com/amazon/carbonado/spi/TriggerManager.java
index e7b653c..46747ea 100644
--- a/src/main/java/com/amazon/carbonado/spi/TriggerManager.java
+++ b/src/main/java/com/amazon/carbonado/spi/TriggerManager.java
@@ -33,9 +33,6 @@ import com.amazon.carbonado.Storable;
import com.amazon.carbonado.Trigger;
import com.amazon.carbonado.TriggerFactory;
-import com.amazon.carbonado.lob.Blob;
-import com.amazon.carbonado.lob.Clob;
-
/**
* Used by Storage implementations to manage triggers and consolidate them into
* single logical triggers. This class is thread-safe and ensures that changes
@@ -49,7 +46,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
private static final int FOR_UPDATE = 2;
private static final int FOR_DELETE = 4;
private static final int FOR_LOAD = 8;
- private static final int FOR_ADAPT_LOB = 16;
private static final Method
BEFORE_INSERT_METHOD,
@@ -70,10 +66,7 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
AFTER_TRY_DELETE_METHOD,
FAILED_DELETE_METHOD,
- AFTER_LOAD_METHOD,
-
- ADAPT_BLOB_METHOD,
- ADAPT_CLOB_METHOD;
+ AFTER_LOAD_METHOD;
static {
Class<?> triggerClass = Trigger.class;
@@ -100,11 +93,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
FAILED_DELETE_METHOD = triggerClass.getMethod("failedDelete", TWO_PARAMS);
AFTER_LOAD_METHOD = triggerClass.getMethod("afterLoad", ONE_PARAM);
-
- ADAPT_BLOB_METHOD = triggerClass
- .getMethod("adaptBlob", Object.class, String.class, Blob.class);
- ADAPT_CLOB_METHOD = triggerClass
- .getMethod("adaptClob", Object.class, String.class, Clob.class);
} catch (NoSuchMethodException e) {
Error error = new NoSuchMethodError();
error.initCause(e);
@@ -116,7 +104,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
private final ForUpdate<S> mForUpdate = new ForUpdate<S>();
private final ForDelete<S> mForDelete = new ForDelete<S>();
private final ForLoad<S> mForLoad = new ForLoad<S>();
- private final ForAdaptLob<S> mForAdaptLob = new ForAdaptLob<S>();
public TriggerManager() {
}
@@ -175,18 +162,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
return forLoad.isEmpty() ? null : forLoad;
}
- /**
- * Returns a consolidated trigger to call for adapt LOB operations, or null
- * if none. If not null, the consolidated trigger is not a snapshot -- it
- * will change as the set of triggers in this manager changes.
- *
- * @since 1.2
- */
- public Trigger<? super S> getAdaptLobTrigger() {
- ForAdaptLob<S> forAdaptLob = mForAdaptLob;
- return forAdaptLob.isEmpty() ? null : forAdaptLob;
- }
-
public boolean addTrigger(Trigger<? super S> trigger) {
if (trigger == null) {
throw new IllegalArgumentException();
@@ -208,9 +183,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
if ((types & FOR_LOAD) != 0) {
retValue |= mForLoad.add(trigger);
}
- if ((types & FOR_ADAPT_LOB) != 0) {
- retValue |= mForAdaptLob.add(trigger);
- }
return retValue;
}
@@ -236,9 +208,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
if ((types & FOR_LOAD) != 0) {
retValue |= mForLoad.remove(trigger);
}
- if ((types & FOR_ADAPT_LOB) != 0) {
- retValue |= mForAdaptLob.remove(trigger);
- }
return retValue;
}
@@ -422,16 +391,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
mForLoad.afterLoad(storable);
}
- @Override
- public Blob adaptBlob(S storable, String name, Blob blob) {
- return mForAdaptLob.adaptBlob(storable, name, blob);
- }
-
- @Override
- public Clob adaptClob(S storable, String name, Clob clob) {
- return mForAdaptLob.adaptClob(storable, name, clob);
- }
-
/**
* Determines which operations the given trigger overrides.
*/
@@ -471,12 +430,6 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
types |= FOR_LOAD;
}
- if (overridesMethod(triggerClass, ADAPT_BLOB_METHOD) ||
- overridesMethod(triggerClass, ADAPT_CLOB_METHOD))
- {
- types |= FOR_ADAPT_LOB;
- }
-
return types;
}
@@ -1057,40 +1010,4 @@ public class TriggerManager<S extends Storable> extends Trigger<S> {
}
}
}
-
- private static class ForAdaptLob<S> extends ManagedTrigger<S> {
- @Override
- public Blob adaptBlob(S storable, String name, Blob blob) {
- if (isLocallyDisabled()) {
- return blob;
- }
-
- Trigger<? super S>[] triggers = mTriggers;
-
- int length = triggers.length;
-
- for (int i=0; i<length; i++) {
- blob = triggers[i].adaptBlob(storable, name, blob);
- }
-
- return blob;
- }
-
- @Override
- public Clob adaptClob(S storable, String name, Clob clob) {
- if (isLocallyDisabled()) {
- return clob;
- }
-
- Trigger<? super S>[] triggers = mTriggers;
-
- int length = triggers.length;
-
- for (int i=0; i<length; i++) {
- clob = triggers[i].adaptClob(storable, name, clob);
- }
-
- return clob;
- }
- }
}