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

com.github.dynamicextensionsalfresco.osgi.spring.ConfigurationValuesFactoryBean 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.osgi.spring;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import com.github.dynamicextensionsalfresco.osgi.ConfigurationValues;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.util.Assert;

/**
 * {@link FactoryBean} that combines all the items from multiple Sets into a single Set.
 * 

* This implementation preserves the original item order. * * @author Laurens Fridael * * @param */ public class ConfigurationValuesFactoryBean implements FactoryBean> { /* Configuration */ private List> sets; private ConfigurationValues instance; /* Main operations */ @Override public boolean isSingleton() { return true; } @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public Class getObjectType() { return ConfigurationValues.class; } @Override public ConfigurationValues getObject() throws Exception { if (instance == null) { instance = createContainerConfiguration(); } return instance; } /* Utility operations */ protected ConfigurationValues createContainerConfiguration() { final Set items = new LinkedHashSet(getTotalSize()); for (final Set set : getSets()) { items.addAll(set); } return new ConfigurationValues(items); } protected int getTotalSize() { int totalSize = 0; for (final Set set : getSets()) { totalSize += set.size(); } return totalSize; } /* Configuration */ public void setSets(final List> sets) { Assert.notNull(sets); this.sets = sets; } protected List> getSets() { return sets; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy