use of org.apache.felix.scr.annotations.Deactivate in project sling by apache.
the class LogTracer method deactivate.
@Deactivate
private void deactivate() {
if (logServlet != null) {
logServlet.unregister();
}
if (slingFilterRegistration != null) {
slingFilterRegistration.unregister();
slingFilterRegistration = null;
}
if (filterRegistration != null) {
filterRegistration.unregister();
filterRegistration = null;
}
ServiceRegistration reg = logCollectorReg.getAndSet(null);
if (reg != null) {
reg.unregister();
}
requestContextHolder.remove();
}
use of org.apache.felix.scr.annotations.Deactivate in project stanbol by apache.
the class RefactorEnhancementEngine method deactivate.
@Deactivate
protected void deactivate(ComponentContext context) {
// Deactivation clears all the rules and releases OntoNet resources.
IRI recipeId = new IRI(engineConfiguration.getRecipeId());
try {
// step 1: get all the rules
log.debug("Recipe {} and its associated rules will be removed from the rule store.", recipeId);
Recipe recipe = null;
try {
recipe = ruleStore.getRecipe(recipeId);
} catch (RecipeConstructionException e) {
log.error(e.getMessage());
}
if (recipe != null) {
// step 2: remove the recipe
try {
if (ruleStore.removeRecipe(recipeId)) {
log.debug("Recipe {} has been removed correctly. Note that its rules will be removed separately.", recipeId);
} else
log.error("Recipe {} cannot be removed.", recipeId);
} catch (RecipeEliminationException e) {
log.error(e.getMessage());
}
}
} catch (NoSuchRecipeException ex) {
log.error("The recipe " + engineConfiguration.getRecipeId() + " doesn't exist", ex);
}
// step 3: clear OntoNet resources
scope.getCoreSpace().tearDown();
scope.tearDown();
onManager.deregisterScope(scope);
log.debug("OntoNet resources released : scope {}", scope);
log.info("in " + RefactorEnhancementEngine.class + " deactivate with context " + context);
}
use of org.apache.felix.scr.annotations.Deactivate in project stanbol by apache.
the class EntityhubDereferenceEngine method deactivate.
/**
* Deactivates this components.
*/
@Deactivate
protected void deactivate(ComponentContext context) {
//* unregister service
ServiceRegistration reg = engineRegistration;
if (reg != null) {
reg.unregister();
engineRegistration = null;
}
if (executorService != null) {
executorService.shutdown();
executorService = null;
}
//* reset engine
entityDereferenceEngine = null;
engineMetadata = null;
//close the tracking EntitySearcher
entityDereferencer.close();
entityDereferencer = null;
}
use of org.apache.felix.scr.annotations.Deactivate in project sling by apache.
the class WorkspaceCreator method deactivate.
@SuppressWarnings("unused")
@Deactivate
private void deactivate() {
Session s = null;
try {
s = repo.loginAdministrative(null);
Workspace w = s.getWorkspace();
deleteWorkspace(w, "ws3");
deleteWorkspace(w, "ws2");
deleteWorkspace(w, "ws1");
} catch (Exception e) {
// ignore
} finally {
if (s != null) {
s.logout();
}
}
}
use of org.apache.felix.scr.annotations.Deactivate in project sling by apache.
the class SuperimposingManagerImpl method deactivate.
@Deactivate
protected synchronized void deactivate(final ComponentContext ctx) throws RepositoryException {
try {
// make sure initialization has finished
if (null != initialization && !initialization.isDone()) {
initialization.cancel(/* myInterruptIfRunning */
true);
}
// de-register JCR observation
if (resolver != null) {
final Session session = resolver.adaptTo(Session.class);
if (session != null && this.observationEventListeners != null) {
for (EventListener eventListener : this.observationEventListeners) {
session.getWorkspace().getObservationManager().removeEventListener(eventListener);
}
}
}
// de-register all superimpsing resource providers
for (final SuperimposingResourceProviderImpl srp : superimposingProviders.values()) {
srp.unregisterService();
}
} finally {
if (null != resolver) {
resolver.close();
resolver = null;
}
initialization = null;
superimposingProviders.clear();
}
}
Aggregations