You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2012/01/22 21:16:25 UTC
git commit: DELTASPIKE-24 move artifacts to the spi package
Updated Branches:
refs/heads/master 42bf4daf8 -> a5ff2fa3f
DELTASPIKE-24 move artifacts to the spi package
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/a5ff2fa3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/a5ff2fa3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/a5ff2fa3
Branch: refs/heads/master
Commit: a5ff2fa3f1f0a168fd4188cba743a98b8c4cda7f
Parents: 42bf4da
Author: gpetracek <gp...@apache.org>
Authored: Sun Jan 22 21:16:02 2012 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Sun Jan 22 21:16:02 2012 +0100
----------------------------------------------------------------------
.../core/api/activation/ClassDeactivation.java | 175 --------------
.../core/api/activation/ClassDeactivator.java | 48 ----
.../core/api/activation/Deactivatable.java | 36 ---
.../core/spi/activation/ClassDeactivator.java | 48 ++++
.../core/spi/activation/Deactivatable.java | 36 +++
.../spi/activation/util/ClassDeactivation.java | 177 +++++++++++++++
.../core/impl/exclude/ExcludeExtension.java | 4 +-
.../test/core/impl/activation/ActivatedClass.java | 2 +-
.../core/impl/activation/DeactivatedClass.java | 2 +-
.../impl/activation/TestClassDeactivation.java | 4 +-
.../core/impl/activation/TestClassDeactivator.java | 10 +-
.../META-INF/apache-deltaspike.properties | 2 +-
12 files changed, 274 insertions(+), 270 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivation.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivation.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivation.java
deleted file mode 100644
index b9146d8..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivation.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.core.api.activation;
-
-import org.apache.deltaspike.core.api.config.ConfigResolver;
-import org.apache.deltaspike.core.api.util.ClassUtils;
-
-import javax.enterprise.inject.Typed;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Logger;
-
-/**
- * Helper methods for {@link ClassDeactivator}
- */
-@Typed()
-public final class ClassDeactivation
-{
- private static final Logger LOG = Logger.getLogger(ClassDeactivation.class.getName());
-
- /**
- * This Map holds the ClassLoader as first level to make it possible to have different configurations per
- * WebApplication in an EAR or other Multi-ClassLoader scenario.
- *
- * The Map then contains a List of {@link ClassDeactivator}s in order of their configured ordinal.
- */
- private static Map<ClassLoader, List<ClassDeactivator>> classDeactivatorMap
- = new ConcurrentHashMap<ClassLoader, List<ClassDeactivator>>();
-
- /**
- * Cache for the result. It won't contain many classes but it might be accessed frequently.
- * Valid entries are only true or false. If an entry isn't available or null, it gets calculated.
- */
- private static Map<Class<? extends Deactivatable>, Boolean> activationStatusCache
- = new ConcurrentHashMap<Class<? extends Deactivatable>, Boolean>();
-
- private ClassDeactivation()
- {
- // private ct to prevent utility class from instantiation.
- }
-
- /**
- * Evaluates if the given {@link Deactivatable} is active.
- *
- * @param targetClass {@link Deactivatable} under test.
- * @return <code>true</code> if it is active, <code>false</code> otherwise
- */
- public static boolean isActivated(Class<? extends Deactivatable> targetClass)
- {
- Boolean activatedClassCacheEntry = activationStatusCache.get(targetClass);
-
- if (activatedClassCacheEntry == null)
- {
- initDeactivatableCacheFor(targetClass);
- activatedClassCacheEntry = activationStatusCache.get(targetClass);
- }
- return activatedClassCacheEntry;
- }
-
- private static synchronized void initDeactivatableCacheFor(Class<? extends Deactivatable> targetClass)
- {
- Boolean activatedClassCacheEntry = activationStatusCache.get(targetClass);
-
- if (activatedClassCacheEntry != null) //double-check
- {
- return;
- }
-
- List<ClassDeactivator> classDeactivators = getClassDeactivators();
-
- Boolean isActivated = Boolean.TRUE;
- Class<? extends ClassDeactivator> deactivatedBy = null;
-
- LOG.fine("start evaluation if " + targetClass.getName() + " is de-/activated");
-
- // we get the classActivators ordered by it's ordinal
- // thus the last one which returns != null 'wins' ;)
- for (ClassDeactivator classDeactivator : classDeactivators)
- {
- Boolean isLocallyActivated = classDeactivator.isActivated(targetClass);
-
- if (isLocallyActivated != null)
- {
- isActivated = isLocallyActivated;
-
- /*
- * Check and log the details across class-deactivators
- */
- if (!isActivated)
- {
- deactivatedBy = classDeactivator.getClass();
- LOG.fine("Deactivating class " + targetClass);
- }
- else if (deactivatedBy != null)
- {
- LOG.fine("Reactivation of: " + targetClass.getName() + " by " +
- classDeactivator.getClass().getName() +
- " - original deactivated by: " + deactivatedBy.getName() + ".\n" +
- "If that isn't the intended behaviour, you have to use a higher ordinal for " +
- deactivatedBy.getName());
- }
- }
- }
-
- cacheResult(targetClass, isActivated);
- }
-
- private static void cacheResult(Class<? extends Deactivatable> targetClass, Boolean activated)
- {
- activationStatusCache.put(targetClass, activated);
- LOG.info("class: " + targetClass.getName() + " activated=" + activated);
- }
-
- /**
- * @return the List of configured @{link ClassDeactivator}s for the current context ClassLoader.
- */
- private static List<ClassDeactivator> getClassDeactivators()
- {
- ClassLoader classLoader = ClassUtils.getClassLoader(null);
- List<ClassDeactivator> classDeactivators = classDeactivatorMap.get(classLoader);
-
- if (classDeactivators == null)
- {
- return initConfiguredClassDeactivators(classLoader);
- }
-
- return classDeactivators;
- }
-
- //synchronized isn't needed - #initDeactivatableCacheFor is already synchronized
- private static List<ClassDeactivator> initConfiguredClassDeactivators(ClassLoader classLoader)
- {
- List<String> classDeactivatorClassNames = ConfigResolver.getAllPropertyValues(ClassDeactivator.class.getName());
-
- List<ClassDeactivator> classDeactivators = new ArrayList<ClassDeactivator>();
-
- for (String classDeactivatorClassName : classDeactivatorClassNames)
- {
- LOG.fine("processing ClassDeactivator: " + classDeactivatorClassName);
-
- try
- {
- ClassDeactivator currentClassDeactivator =
- (ClassDeactivator) ClassUtils.instantiateClassForName(classDeactivatorClassName);
- classDeactivators.add(currentClassDeactivator);
- }
- catch (Exception e)
- {
- LOG.warning(classDeactivatorClassName + " can't be instantiated");
- throw new IllegalStateException(e);
- }
- }
-
- classDeactivatorMap.put(classLoader, classDeactivators);
- return classDeactivators;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivator.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivator.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivator.java
deleted file mode 100644
index d0788e9..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/ClassDeactivator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.core.api.activation;
-
-import java.io.Serializable;
-
-/**
- * <p>An implementation has to be stateless.</p>
- *
- * <p>A class-deactivator allows to specify deactivated classes which can't be deactivated via std. CDI mechanisms.
- * This might be the case for CDI Extensions because CDI mechanisms are not available at startup time.</p>
- *
- * <p>A class-deactivator will be resolved from the environment via the default resolvers or via a custom resolver which
- * allows to use any type of configuration-format. See {@link org.apache.deltaspike.core.api.config.ConfigResolver}
- * for more information about how to configure it. The configuration key is
- * <code>org.apache.deltaspike.core.api.activation.ClassDeactivator</code></p>
- *
- * <p>All DlassDeactivators will get picked up in order of their ordinal and might explicitely activate or
- * deactivate {@link Deactivatable} classes. Returning a <code>null</code> value means that the ClassDeactivator
- * doesn't care about the very Deactivatable class.</p>
- *
- */
-public interface ClassDeactivator extends Serializable
-{
- /**
- * Provides classes which should be deactivated.
- *
- * @return {@link Boolean#FALSE} if class should get activated, {@link Boolean#FALSE} if class must be available
- * and <code>null</code> to let it as is (defined by default or other
- */
- Boolean isActivated(Class<? extends Deactivatable> deactivatableClazz);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/Deactivatable.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/Deactivatable.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/Deactivatable.java
deleted file mode 100644
index a0785e3..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/activation/Deactivatable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.core.api.activation;
-
-/**
- * <p>Interface to allow easier detection of deactivatable classes.</p>
- *
- * <p>These classes are activated by default and can be disabled on demand (e.g. via CDI config).
- * Since CDI, JSF,... currently don't allow to deactivate default implementations,
- * DeltaSpike has to introduce a proprietary mechanism.</p>
- *
- * <p>This is e.g. used to disable CDI Extensions in DeltaSpike and might get
- * used for other Extension libraries as well.</p>
- *
- * <p><b>Note:</b> It is suggested that the implementations
- * use the {@link ClassDeactivation} for implementing the lookup</p>
- */
-public interface Deactivatable
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/ClassDeactivator.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/ClassDeactivator.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/ClassDeactivator.java
new file mode 100644
index 0000000..10c6c62
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/ClassDeactivator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.core.spi.activation;
+
+import java.io.Serializable;
+
+/**
+ * <p>An implementation has to be stateless.</p>
+ *
+ * <p>A class-deactivator allows to specify deactivated classes which can't be deactivated via std. CDI mechanisms.
+ * This might be the case for CDI Extensions because CDI mechanisms are not available at startup time.</p>
+ *
+ * <p>A class-deactivator will be resolved from the environment via the default resolvers or via a custom resolver which
+ * allows to use any type of configuration-format. See {@link org.apache.deltaspike.core.api.config.ConfigResolver}
+ * for more information about how to configure it. The configuration key is
+ * <code>org.apache.deltaspike.core.spi.activation.ClassDeactivator</code></p>
+ *
+ * <p>All DlassDeactivators will get picked up in order of their ordinal and might explicitely activate or
+ * deactivate {@link Deactivatable} classes. Returning a <code>null</code> value means that the ClassDeactivator
+ * doesn't care about the very Deactivatable class.</p>
+ *
+ */
+public interface ClassDeactivator extends Serializable
+{
+ /**
+ * Provides classes which should be deactivated.
+ *
+ * @return {@link Boolean#FALSE} if class should get activated, {@link Boolean#FALSE} if class must be available
+ * and <code>null</code> to let it as is (defined by default or other
+ */
+ Boolean isActivated(Class<? extends Deactivatable> deactivatableClazz);
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/Deactivatable.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/Deactivatable.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/Deactivatable.java
new file mode 100644
index 0000000..8a02057
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/Deactivatable.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.core.spi.activation;
+
+/**
+ * <p>Interface to allow easier detection of deactivatable classes.</p>
+ *
+ * <p>These classes are activated by default and can be disabled on demand (e.g. via CDI config).
+ * Since CDI, JSF,... currently don't allow to deactivate default implementations,
+ * DeltaSpike has to introduce a proprietary mechanism.</p>
+ *
+ * <p>This is e.g. used to disable CDI Extensions in DeltaSpike and might get
+ * used for other Extension libraries as well.</p>
+ *
+ * <p><b>Note:</b> It is suggested that the implementations
+ * use the {@link org.apache.deltaspike.core.spi.activation.util.ClassDeactivation} for implementing the lookup</p>
+ */
+public interface Deactivatable
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/util/ClassDeactivation.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/util/ClassDeactivation.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/util/ClassDeactivation.java
new file mode 100644
index 0000000..c265ad4
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/util/ClassDeactivation.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.core.spi.activation.util;
+
+import org.apache.deltaspike.core.api.config.ConfigResolver;
+import org.apache.deltaspike.core.api.util.ClassUtils;
+import org.apache.deltaspike.core.spi.activation.ClassDeactivator;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+
+import javax.enterprise.inject.Typed;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+/**
+ * Helper methods for {@link ClassDeactivator}
+ */
+@Typed()
+public final class ClassDeactivation
+{
+ private static final Logger LOG = Logger.getLogger(ClassDeactivation.class.getName());
+
+ /**
+ * This Map holds the ClassLoader as first level to make it possible to have different configurations per
+ * WebApplication in an EAR or other Multi-ClassLoader scenario.
+ *
+ * The Map then contains a List of {@link ClassDeactivator}s in order of their configured ordinal.
+ */
+ private static Map<ClassLoader, List<ClassDeactivator>> classDeactivatorMap
+ = new ConcurrentHashMap<ClassLoader, List<ClassDeactivator>>();
+
+ /**
+ * Cache for the result. It won't contain many classes but it might be accessed frequently.
+ * Valid entries are only true or false. If an entry isn't available or null, it gets calculated.
+ */
+ private static Map<Class<? extends Deactivatable>, Boolean> activationStatusCache
+ = new ConcurrentHashMap<Class<? extends Deactivatable>, Boolean>();
+
+ private ClassDeactivation()
+ {
+ // private ct to prevent utility class from instantiation.
+ }
+
+ /**
+ * Evaluates if the given {@link Deactivatable} is active.
+ *
+ * @param targetClass {@link Deactivatable} under test.
+ * @return <code>true</code> if it is active, <code>false</code> otherwise
+ */
+ public static boolean isActivated(Class<? extends Deactivatable> targetClass)
+ {
+ Boolean activatedClassCacheEntry = activationStatusCache.get(targetClass);
+
+ if (activatedClassCacheEntry == null)
+ {
+ initDeactivatableCacheFor(targetClass);
+ activatedClassCacheEntry = activationStatusCache.get(targetClass);
+ }
+ return activatedClassCacheEntry;
+ }
+
+ private static synchronized void initDeactivatableCacheFor(Class<? extends Deactivatable> targetClass)
+ {
+ Boolean activatedClassCacheEntry = activationStatusCache.get(targetClass);
+
+ if (activatedClassCacheEntry != null) //double-check
+ {
+ return;
+ }
+
+ List<ClassDeactivator> classDeactivators = getClassDeactivators();
+
+ Boolean isActivated = Boolean.TRUE;
+ Class<? extends ClassDeactivator> deactivatedBy = null;
+
+ LOG.fine("start evaluation if " + targetClass.getName() + " is de-/activated");
+
+ // we get the classActivators ordered by it's ordinal
+ // thus the last one which returns != null 'wins' ;)
+ for (ClassDeactivator classDeactivator : classDeactivators)
+ {
+ Boolean isLocallyActivated = classDeactivator.isActivated(targetClass);
+
+ if (isLocallyActivated != null)
+ {
+ isActivated = isLocallyActivated;
+
+ /*
+ * Check and log the details across class-deactivators
+ */
+ if (!isActivated)
+ {
+ deactivatedBy = classDeactivator.getClass();
+ LOG.fine("Deactivating class " + targetClass);
+ }
+ else if (deactivatedBy != null)
+ {
+ LOG.fine("Reactivation of: " + targetClass.getName() + " by " +
+ classDeactivator.getClass().getName() +
+ " - original deactivated by: " + deactivatedBy.getName() + ".\n" +
+ "If that isn't the intended behaviour, you have to use a higher ordinal for " +
+ deactivatedBy.getName());
+ }
+ }
+ }
+
+ cacheResult(targetClass, isActivated);
+ }
+
+ private static void cacheResult(Class<? extends Deactivatable> targetClass, Boolean activated)
+ {
+ activationStatusCache.put(targetClass, activated);
+ LOG.info("class: " + targetClass.getName() + " activated=" + activated);
+ }
+
+ /**
+ * @return the List of configured @{link ClassDeactivator}s for the current context ClassLoader.
+ */
+ private static List<ClassDeactivator> getClassDeactivators()
+ {
+ ClassLoader classLoader = ClassUtils.getClassLoader(null);
+ List<ClassDeactivator> classDeactivators = classDeactivatorMap.get(classLoader);
+
+ if (classDeactivators == null)
+ {
+ return initConfiguredClassDeactivators(classLoader);
+ }
+
+ return classDeactivators;
+ }
+
+ //synchronized isn't needed - #initDeactivatableCacheFor is already synchronized
+ private static List<ClassDeactivator> initConfiguredClassDeactivators(ClassLoader classLoader)
+ {
+ List<String> classDeactivatorClassNames = ConfigResolver.getAllPropertyValues(ClassDeactivator.class.getName());
+
+ List<ClassDeactivator> classDeactivators = new ArrayList<ClassDeactivator>();
+
+ for (String classDeactivatorClassName : classDeactivatorClassNames)
+ {
+ LOG.fine("processing ClassDeactivator: " + classDeactivatorClassName);
+
+ try
+ {
+ ClassDeactivator currentClassDeactivator =
+ (ClassDeactivator) ClassUtils.instantiateClassForName(classDeactivatorClassName);
+ classDeactivators.add(currentClassDeactivator);
+ }
+ catch (Exception e)
+ {
+ LOG.warning(classDeactivatorClassName + " can't be instantiated");
+ throw new IllegalStateException(e);
+ }
+ }
+
+ classDeactivatorMap.put(classLoader, classDeactivators);
+ return classDeactivators;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/ExcludeExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/ExcludeExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/ExcludeExtension.java
index c86ac94..eb277cf 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/ExcludeExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/ExcludeExtension.java
@@ -18,8 +18,8 @@
*/
package org.apache.deltaspike.core.impl.exclude;
-import org.apache.deltaspike.core.api.activation.ClassDeactivation;
-import org.apache.deltaspike.core.api.activation.Deactivatable;
+import org.apache.deltaspike.core.spi.activation.util.ClassDeactivation;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
import org.apache.deltaspike.core.api.exclude.Exclude;
import org.apache.deltaspike.core.api.interpreter.ExpressionInterpreter;
import org.apache.deltaspike.core.api.projectstage.ProjectStage;
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java
index 86fcb34..96f4b3e 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java
@@ -18,7 +18,7 @@
*/
package org.apache.deltaspike.test.core.impl.activation;
-import org.apache.deltaspike.core.api.activation.Deactivatable;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
/**
* Class which isn't deactivated
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java
index 8cba1c0..b47f4aa 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java
@@ -18,7 +18,7 @@
*/
package org.apache.deltaspike.test.core.impl.activation;
-import org.apache.deltaspike.core.api.activation.Deactivatable;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
/**
* Class which is deactivated
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
index bb4e7a1..41ee855 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
@@ -18,7 +18,7 @@
*/
package org.apache.deltaspike.test.core.impl.activation;
-import org.apache.deltaspike.core.api.activation.ClassDeactivation;
+import org.apache.deltaspike.core.spi.activation.util.ClassDeactivation;
import org.apache.deltaspike.test.core.api.provider.TestBean;
import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
import org.apache.deltaspike.test.util.FileUtils;
@@ -34,7 +34,7 @@ import org.junit.runner.RunWith;
import java.net.URL;
/**
- * Test for {@link org.apache.deltaspike.core.api.activation.ClassDeactivator}
+ * Test for {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}
*/
@RunWith(Arquillian.class)
public class TestClassDeactivation
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java
index e7ec158..6fbe4ce 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java
@@ -19,15 +19,17 @@
package org.apache.deltaspike.test.core.impl.activation;
-import org.apache.deltaspike.core.api.activation.ClassDeactivator;
-import org.apache.deltaspike.core.api.activation.Deactivatable;
+import org.apache.deltaspike.core.spi.activation.ClassDeactivator;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
/**
- * Test {@link org.apache.deltaspike.core.api.activation.ClassDeactivator}
- * which is needed to test {@link org.apache.deltaspike.core.api.activation.ClassDeactivation}
+ * Test {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}
+ * which is needed to test {@link org.apache.deltaspike.core.spi.activation.util.ClassDeactivation}
*/
public class TestClassDeactivator implements ClassDeactivator
{
+ private static final long serialVersionUID = -3403907272881821406L;
+
@Override
public Boolean isActivated(Class<? extends Deactivatable> deactivatableClazz)
{
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/a5ff2fa3/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties b/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
index 577ff82..6dbde66 100644
--- a/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
+++ b/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
@@ -16,6 +16,6 @@
#under the License.
testProperty03=test_value_03
-org.apache.deltaspike.core.api.activation.ClassDeactivator=org.apache.deltaspike.test.core.impl.activation.TestClassDeactivator
+org.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.core.impl.activation.TestClassDeactivator
testProperty02=test_value_02
db=prodDB