com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annotations-runtime Show documentation
Show all versions of annotations-runtime Show documentation
Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features
package com.github.dynamicextensionsalfresco.webscripts;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.extensions.webscripts.WebScript;
public class AnnotationWebScriptRegistrar implements ApplicationContextAware {
/* Dependencies */
private ApplicationContext applicationContext;
private AnnotationWebScriptBuilder annotationBasedWebScriptBuilder;
private WebScriptUriRegistry webScriptUriRegistry;
/* State */
private final List webScripts = new ArrayList();
/* Main operations */
public void registerWebScripts() {
for (final String beanName : applicationContext.getBeanDefinitionNames()) {
for (final WebScript webScript : annotationBasedWebScriptBuilder.createWebScripts(beanName)) {
webScriptUriRegistry.registerWebScript(webScript);
webScripts.add(webScript);
}
}
}
public void unregisterWebScripts() {
for (final Iterator it = webScripts.iterator(); it.hasNext();) {
final WebScript webScript = it.next();
webScriptUriRegistry.unregisterWebScript(webScript);
it.remove();
}
}
/* State */
public List getWebScripts() {
return webScripts;
}
/* Dependencies */
@Override
public void setApplicationContext(final ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
public void setAnnotationBasedWebScriptBuilder(final AnnotationWebScriptBuilder annotationBasedWebScriptBuilder) {
this.annotationBasedWebScriptBuilder = annotationBasedWebScriptBuilder;
}
public void setWebScriptUriRegistry(final WebScriptUriRegistry webScriptUriRegistry) {
this.webScriptUriRegistry = webScriptUriRegistry;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy