You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:55:36 UTC
[sling-org-apache-sling-models-impl] 06/24: SLING-3861 - adding
condition option for @Model annotation
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.models.impl-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git
commit 50603754d94388ef9141859fa683b0738a1c8e46
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Aug 20 16:02:38 2014 +0000
SLING-3861 - adding condition option for @Model annotation
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl@1619134 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/models/impl/ModelPackageBundleListener.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java b/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
index f15ba38..9e9c908 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
@@ -40,6 +40,11 @@ public class ModelPackageBundleListener implements BundleTrackerCustomizer {
private static final String HEADER = "Sling-Model-Packages";
+ /**
+ * Service registration property for the adapter condition.
+ */
+ private static final String PROP_ADAPTER_CONDITION = "adapter.condition";
+
private static final Logger log = LoggerFactory.getLogger(ModelPackageBundleListener.class);
private final BundleContext bundleContext;
@@ -87,6 +92,11 @@ public class ModelPackageBundleListener implements BundleTrackerCustomizer {
Dictionary<String, Object> registrationProps = new Hashtable<String, Object>();
registrationProps.put(AdapterFactory.ADAPTER_CLASSES, className);
registrationProps.put(AdapterFactory.ADAPTABLE_CLASSES, classNames);
+
+ String condition = annotation.condition();
+ if (StringUtils.isNotBlank(condition)) {
+ registrationProps.put(PROP_ADAPTER_CONDITION, condition);
+ }
ServiceRegistration reg = bundleContext.registerService(AdapterFactory.SERVICE_NAME,
factory, registrationProps);
regs.add(reg);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.