SLING-1056 : Add static field to synthetic resource which can be set by adapter manager implementations and set this from our adapter manager.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@796226 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java b/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
index 8d3b844..7bca244 100644
--- a/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
+++ b/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
@@ -31,6 +31,7 @@
import org.apache.sling.api.SlingConstants;
import org.apache.sling.api.adapter.AdapterFactory;
import org.apache.sling.api.adapter.AdapterManager;
+import org.apache.sling.api.resource.SyntheticResource;
import org.apache.sling.commons.osgi.OsgiUtil;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
@@ -172,12 +173,14 @@
"Not setting Instance field: Set to another manager "
+ AdapterManagerImpl.INSTANCE, null);
}
+ SyntheticResource.setAdapterManager(this);
}
/**
* @param context Not used
*/
protected synchronized void deactivate(ComponentContext context) {
+ SyntheticResource.unsetAdapterManager(this);
// "disable" the manager by clearing the instance
// do not clear the field if not set to this instance
if (AdapterManagerImpl.INSTANCE == this) {