All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRegistrar Maven / Gradle / Ivy

Go to download

Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features

There is a newer version: 3.1.0
Show newest version
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