[Major] refactored Element maps for better handling

Now they are not components, now there is an ElementMapHandler which
is the component and the OrderMap and ResourceMap can be retrieved from
the ElementMapHandler
This commit is contained in:
Robert von Burg 2013-12-23 18:42:50 +01:00
parent 8a084d0144
commit 0254a74d16
34 changed files with 286 additions and 236 deletions

View File

@ -0,0 +1,32 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed 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 li.strolch.runtime.agent;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public interface ComponentContainer {
public abstract boolean hasComponent(Class<?> clazz);
public abstract <T> T getComponent(Class<T> clazz);
public abstract OrderMap getOrderMap();
public abstract ResourceMap getResourceMap();
}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@ -29,9 +29,9 @@ import li.strolch.runtime.configuration.StrolchConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ComponentContainer {
public class ComponentContainerImpl implements ComponentContainer {
private static final Logger logger = LoggerFactory.getLogger(ComponentContainer.class);
private static final Logger logger = LoggerFactory.getLogger(ComponentContainerImpl.class);
private Map<Class<?>, StrolchComponent> componentMap;
private Map<String, ComponentController> controllerMap;
@ -39,7 +39,7 @@ public class ComponentContainer {
private StrolchConfiguration strolchConfiguration;
private ComponentState state;
public ComponentContainer() {
public ComponentContainerImpl() {
this.state = ComponentState.UNDEFINED;
}
@ -47,10 +47,12 @@ public class ComponentContainer {
return this.state;
}
@Override
public boolean hasComponent(Class<?> clazz) {
return this.componentMap.containsKey(clazz);
}
@Override
@SuppressWarnings("unchecked")
public <T> T getComponent(Class<T> clazz) {
T component = (T) this.componentMap.get(clazz);
@ -62,6 +64,16 @@ public class ComponentContainer {
return component;
}
@Override
public OrderMap getOrderMap() {
return getComponent(ElementMapHandler.class).getOrderMap();
}
@Override
public ResourceMap getResourceMap() {
return getComponent(ElementMapHandler.class).getResourceMap();
}
private void initializeComponent(Map<Class<?>, StrolchComponent> componentMap,
Map<String, ComponentController> controllerMap, ComponentConfiguration componentConfiguration) {
@ -86,7 +98,7 @@ public class ComponentContainer {
@SuppressWarnings("unchecked")
Class<StrolchComponent> strolchComponentClass = (Class<StrolchComponent>) implClass;
Constructor<StrolchComponent> constructor = strolchComponentClass.getConstructor(ComponentContainer.class,
Constructor<StrolchComponent> constructor = strolchComponentClass.getConstructor(ComponentContainerImpl.class,
String.class);
StrolchComponent strolchComponent = constructor.newInstance(this, componentName);

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
import java.text.MessageFormat;
import java.util.HashSet;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
import java.text.MessageFormat;
import java.util.HashSet;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
import java.text.MessageFormat;

View File

@ -24,32 +24,30 @@ import java.text.MessageFormat;
public enum DataStoreMode {
EMPTY {
@Override
public ElementMapConfigurationCreator getElementMapConfigurationConfigurator() {
return new EmptyElementMapConfigurationCreator();
public ElementMapHandlerConfigurator getElementMapConfigurationConfigurator() {
return new EmptyElementMapHandlerConfigurator();
}
}, //
TRANSIENT {
@Override
public ElementMapConfigurationCreator getElementMapConfigurationConfigurator() {
return new TransientElementMapConfigurationCreator();
public ElementMapHandlerConfigurator getElementMapConfigurationConfigurator() {
return new TransientElementMapHandlerConfigurator();
}
}, //
CACHED {
@Override
public ElementMapConfigurationCreator getElementMapConfigurationConfigurator() {
public ElementMapHandlerConfigurator getElementMapConfigurationConfigurator() {
throw new UnsupportedOperationException(MessageFormat.format("The mode {0} is not yet supported!", this)); //$NON-NLS-1$
}
}, //
TRANSACTIONAL {
@Override
public ElementMapConfigurationCreator getElementMapConfigurationConfigurator() {
public ElementMapHandlerConfigurator getElementMapConfigurationConfigurator() {
throw new UnsupportedOperationException(MessageFormat.format("The mode {0} is not yet supported!", this)); //$NON-NLS-1$
}
}; //
public ElementMapConfigurationCreator getElementMapConfigurationConfigurator() {
throw new UnsupportedOperationException("Please implement in enum!"); //$NON-NLS-1$
}
public abstract ElementMapHandlerConfigurator getElementMapConfigurationConfigurator();
public static DataStoreMode parseDataStoreMode(String modeS) {
for (DataStoreMode dataStoreMode : values()) {

View File

@ -0,0 +1,26 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed 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 li.strolch.runtime.agent;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public interface ElementMapHandler {
public ResourceMap getResourceMap();
public OrderMap getOrderMap();
}

View File

@ -15,16 +15,12 @@
*/
package li.strolch.runtime.agent;
import java.util.List;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public interface ElementMapConfigurationCreator {
public interface ElementMapHandlerConfigurator {
public List<ComponentConfiguration> getComponentConfigurations(RuntimeConfiguration runtimeConfiguration);
public ComponentConfiguration buildConfiguration(StrolchAgent agent);
}

View File

@ -15,20 +15,25 @@
*/
package li.strolch.runtime.agent;
import java.util.List;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public class EmptyElementMapConfigurationCreator extends InMemoryElementMapConfigurationCreator {
public class EmptyElementMapHandler extends InMemoryElementMapHandler {
/**
* @param container
* @param componentName
*/
public EmptyElementMapHandler(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}
@Override
protected void addConfiguration(List<ComponentConfiguration> configurations,
RuntimeConfiguration runtimeConfiguration) {
// nothing to do
public void initialize(ComponentConfiguration configuration) {
this.resourceMap = new InMemoryResourceMap();
this.orderMap = new InMemoryOrderMap();
super.initialize(configuration);
}
}

View File

@ -15,9 +15,8 @@
*/
package li.strolch.runtime.agent;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -26,23 +25,23 @@ import li.strolch.runtime.configuration.RuntimeConfiguration;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public class TransientElementMapConfigurationCreator extends InMemoryElementMapConfigurationCreator {
public class EmptyElementMapHandlerConfigurator implements ElementMapHandlerConfigurator {
@Override
protected void addConfiguration(List<ComponentConfiguration> configurations,
RuntimeConfiguration runtimeConfiguration) {
public ComponentConfiguration buildConfiguration(StrolchAgent agent) {
String name = ElementMapHandler.class.getSimpleName();
String api = ElementMapHandler.class.getName();
String impl = EmptyElementMapHandler.class.getName();
String name = TransientElementMapController.class.getSimpleName();
String api = TransientElementMapController.class.getName();
String impl = TransientElementMapController.class.getName();
Map<String, String> configurationValues = new HashMap<>();
Set<String> dependencies = new HashSet<>();
dependencies.add(ResourceMap.class.getSimpleName());
dependencies.add(OrderMap.class.getSimpleName());
Set<String> dependencies = Collections.emptySet();
RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration();
ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name,
configurationValues, api, impl, dependencies);
configurations.add(configuration);
return configuration;
}
}

View File

@ -24,48 +24,18 @@ import java.util.Map;
import java.util.Set;
import li.strolch.model.StrolchElement;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.configuration.ComponentConfiguration;
import ch.eitchnet.utils.helper.StringHelper;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public abstract class InMemoryElementMap<T extends StrolchElement> extends StrolchComponent implements ElementMap<T> {
public abstract class InMemoryElementMap<T extends StrolchElement> implements ElementMap<T> {
private Map<String, Map<String, T>> elementMap;
/**
* @param container
* @param componentName
*/
public InMemoryElementMap(ComponentContainer container, String componentName) {
super(container, componentName);
}
@Override
public void initialize(ComponentConfiguration configuration) {
public InMemoryElementMap() {
this.elementMap = new HashMap<>();
super.initialize(configuration);
}
@Override
public void start() {
super.start();
}
@Override
public void stop() {
this.elementMap.clear();
super.stop();
}
@Override
public void destroy() {
this.elementMap = null;
super.destroy();
}
@Override

View File

@ -1,77 +0,0 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed 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 li.strolch.runtime.agent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public abstract class InMemoryElementMapConfigurationCreator implements ElementMapConfigurationCreator {
protected static final Logger logger = LoggerFactory.getLogger(InMemoryElementMapConfigurationCreator.class);
@Override
public List<ComponentConfiguration> getComponentConfigurations(RuntimeConfiguration runtimeConfiguration) {
List<ComponentConfiguration> configurations = new ArrayList<>();
addConfiguration(configurations, runtimeConfiguration);
addResourceMapConfiguration(configurations, runtimeConfiguration);
addOrderMapConfiguration(configurations, runtimeConfiguration);
return configurations;
}
protected abstract void addConfiguration(List<ComponentConfiguration> configurations,
RuntimeConfiguration runtimeConfiguration);
protected void addResourceMapConfiguration(List<ComponentConfiguration> configurations,
RuntimeConfiguration runtimeConfiguration) {
String name = ResourceMap.class.getSimpleName();
String api = ResourceMap.class.getName();
String impl = InMemoryResourceMap.class.getName();
Map<String, String> configurationValues = new HashMap<>();
Set<String> dependencies = Collections.emptySet();
ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name,
configurationValues, api, impl, dependencies);
configurations.add(configuration);
}
protected void addOrderMapConfiguration(List<ComponentConfiguration> configurations,
RuntimeConfiguration runtimeConfiguration) {
String name = OrderMap.class.getSimpleName();
String api = OrderMap.class.getName();
String impl = InMemoryOrderMap.class.getName();
Map<String, String> configurationValues = new HashMap<>();
Set<String> dependencies = Collections.emptySet();
ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name,
configurationValues, api, impl, dependencies);
configurations.add(configuration);
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed 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 li.strolch.runtime.agent;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public abstract class InMemoryElementMapHandler extends StrolchComponent implements ElementMapHandler {
protected ResourceMap resourceMap;
protected OrderMap orderMap;
/**
* @param container
* @param componentName
*/
public InMemoryElementMapHandler(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}
/**
* @return the resourceMap
*/
@Override
public ResourceMap getResourceMap() {
assertContainerStarted();
return this.resourceMap;
}
/**
* @return the orderMap
*/
@Override
public OrderMap getOrderMap() {
assertContainerStarted();
return this.orderMap;
}
}

View File

@ -16,7 +16,6 @@
package li.strolch.runtime.agent;
import li.strolch.model.Order;
import li.strolch.runtime.component.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
@ -24,11 +23,5 @@ import li.strolch.runtime.component.ComponentContainer;
*/
public class InMemoryOrderMap extends InMemoryElementMap<Order> implements OrderMap {
/**
* @param container
* @param componentName
*/
public InMemoryOrderMap(ComponentContainer container, String componentName) {
super(container, componentName);
}
// marker class
}

View File

@ -16,7 +16,6 @@
package li.strolch.runtime.agent;
import li.strolch.model.Resource;
import li.strolch.runtime.component.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
@ -24,11 +23,5 @@ import li.strolch.runtime.component.ComponentContainer;
*/
public class InMemoryResourceMap extends InMemoryElementMap<Resource> implements ResourceMap {
/**
* @param container
* @param componentName
*/
public InMemoryResourceMap(ComponentContainer container, String componentName) {
super(container, componentName);
}
// marker class
}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
/**
* @author Robert von Burg <eitch@eitchnet.ch>

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
@ -25,7 +25,7 @@ public class SimplePostInitializer extends StrolchComponent implements PostIniti
* @param container
* @param componentName
*/
public SimplePostInitializer(ComponentContainer container, String componentName) {
public SimplePostInitializer(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}

View File

@ -17,9 +17,7 @@ package li.strolch.runtime.agent;
import java.io.File;
import java.text.MessageFormat;
import java.util.List;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.ConfigurationParser;
import li.strolch.runtime.configuration.RuntimeConfiguration;
@ -30,7 +28,6 @@ import org.slf4j.LoggerFactory;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public class StrolchAgent {
@ -38,7 +35,7 @@ public class StrolchAgent {
public static final String PROP_DATA_STORE_FILE = "dataStoreFile"; //$NON-NLS-1$
private static final Logger logger = LoggerFactory.getLogger(StrolchAgent.class);
private ComponentContainer container;
private ComponentContainerImpl container;
private StrolchConfiguration strolchConfiguration;
/**
@ -84,17 +81,31 @@ public class StrolchAgent {
RuntimeConfiguration runtimeConfiguration = this.strolchConfiguration.getRuntimeConfiguration();
DataStoreMode dataStoreMode = DataStoreMode.parseDataStoreMode(runtimeConfiguration.getString(
PROP_DATA_STORE_MODE, null));
ElementMapConfigurationCreator elementMapConfigurationCreator = dataStoreMode
.getElementMapConfigurationConfigurator();
List<ComponentConfiguration> componentConfigurations = elementMapConfigurationCreator
.getComponentConfigurations(runtimeConfiguration);
for (ComponentConfiguration configuration : componentConfigurations) {
this.strolchConfiguration.addConfiguration(configuration.getName(), configuration);
}
ComponentContainer container = new ComponentContainer();
ElementMapHandlerConfigurator mapHandlerConfigurator = dataStoreMode.getElementMapConfigurationConfigurator();
ComponentConfiguration configuration = mapHandlerConfigurator.buildConfiguration(this);
this.strolchConfiguration.addConfiguration(configuration.getName(), configuration);
ComponentContainerImpl container = new ComponentContainerImpl();
this.container = container;
logger.info(MessageFormat.format("Setup Agent {0}", runtimeConfiguration.getApplicationName())); //$NON-NLS-1$
}
public ResourceMap getResourceMap() {
assertContainerStarted();
return getContainer().getComponent(ElementMapHandler.class).getResourceMap();
}
public OrderMap getOrderMap() {
assertContainerStarted();
return getContainer().getComponent(ElementMapHandler.class).getOrderMap();
}
protected void assertContainerStarted() {
if (this.container == null || this.container.getState() != ComponentState.STARTED) {
String msg = "Container is not yet started!"; //$NON-NLS-1$
throw new IllegalStateException(msg);
}
}
}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.runtime.component;
package li.strolch.runtime.agent;
import java.text.MessageFormat;
@ -25,11 +25,11 @@ import org.slf4j.LoggerFactory;
public class StrolchComponent {
protected static final Logger logger = LoggerFactory.getLogger(StrolchComponent.class);
private final ComponentContainer container;
private final ComponentContainerImpl container;
private final String componentName;
private ComponentState state;
public StrolchComponent(ComponentContainer container, String componentName) {
public StrolchComponent(ComponentContainerImpl container, String componentName) {
this.container = container;
this.componentName = componentName;
this.state = ComponentState.UNDEFINED;
@ -46,7 +46,7 @@ public class StrolchComponent {
return this.state;
}
protected ComponentContainer getContainer() {
protected ComponentContainerImpl getContainer() {
return this.container;
}

View File

@ -20,17 +20,14 @@ import java.text.MessageFormat;
import li.strolch.model.xml.XmlModelDefaultHandler.XmlModelStatistics;
import li.strolch.model.xml.XmlModelFileHandler;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import ch.eitchnet.utils.helper.StringHelper;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public class TransientElementMapController extends StrolchComponent {
public class TransientElementMapHandler extends InMemoryElementMapHandler {
private File modelFile;
@ -38,7 +35,7 @@ public class TransientElementMapController extends StrolchComponent {
* @param container
* @param componentName
*/
public TransientElementMapController(ComponentContainer container, String componentName) {
public TransientElementMapHandler(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}
@ -50,16 +47,16 @@ public class TransientElementMapController extends StrolchComponent {
runtimeConfiguration, true);
this.modelFile = modelFile;
this.resourceMap = new InMemoryResourceMap();
this.orderMap = new InMemoryOrderMap();
super.initialize(configuration);
}
@Override
public void start() {
ResourceMap resourceMap = getContainer().getComponent(ResourceMap.class);
OrderMap orderMap = getContainer().getComponent(OrderMap.class);
InMemoryElementListener elementListener = new InMemoryElementListener(resourceMap, orderMap);
InMemoryElementListener elementListener = new InMemoryElementListener(this.resourceMap, this.orderMap);
XmlModelFileHandler handler = new XmlModelFileHandler(elementListener, this.modelFile);
handler.parseFile();
XmlModelStatistics statistics = handler.getStatistics();

View File

@ -0,0 +1,47 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed 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 li.strolch.runtime.agent;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class TransientElementMapHandlerConfigurator implements ElementMapHandlerConfigurator {
@Override
public ComponentConfiguration buildConfiguration(StrolchAgent agent) {
String name = ElementMapHandler.class.getSimpleName();
String api = ElementMapHandler.class.getName();
String impl = TransientElementMapHandler.class.getName();
Map<String, String> configurationValues = new HashMap<>();
Set<String> dependencies = Collections.emptySet();
RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration();
ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name,
configurationValues, api, impl, dependencies);
return configuration;
}
}

View File

@ -22,8 +22,8 @@ import java.util.List;
import java.util.Map;
import li.strolch.model.StrolchElement;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
import li.strolch.runtime.configuration.ComponentConfiguration;
/**
@ -44,7 +44,7 @@ public class DefaultObserverHandler extends StrolchComponent implements Observer
* @param container
* @param componentName
*/
public DefaultObserverHandler(ComponentContainer container, String componentName) {
public DefaultObserverHandler(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}

View File

@ -17,8 +17,8 @@ package li.strolch.runtime.privilege;
import java.io.File;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import ch.eitchnet.privilege.base.PrivilegeException;
@ -35,7 +35,7 @@ public class DefaultStrolchPrivilegeHandler extends StrolchComponent implements
private PrivilegeHandler privilegeHandler;
public DefaultStrolchPrivilegeHandler(ComponentContainer container, String componentName) {
public DefaultStrolchPrivilegeHandler(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}

View File

@ -21,7 +21,7 @@ import li.strolch.model.query.OrderQuery;
import li.strolch.model.query.OrderQueryVisitor;
import li.strolch.model.query.StateSelection;
import li.strolch.model.query.StrolchTypeNavigation;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.agent.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>

View File

@ -34,7 +34,7 @@ import li.strolch.model.query.ParameterSelection.IntegerParameterSelection;
import li.strolch.model.query.ParameterSelection.LongParameterSelection;
import li.strolch.model.query.ParameterSelection.StringListParameterSelection;
import li.strolch.model.query.ParameterSelection.StringParameterSelection;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.agent.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>

View File

@ -22,7 +22,7 @@ import li.strolch.model.Resource;
import li.strolch.model.query.ResourceQuery;
import li.strolch.model.query.ResourceQueryVisitor;
import li.strolch.model.query.StrolchTypeNavigation;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.agent.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>

View File

@ -16,9 +16,8 @@
package li.strolch.runtime.query.inmemory;
import li.strolch.model.Order;
import li.strolch.runtime.agent.ComponentContainer;
import li.strolch.runtime.agent.ElementMap;
import li.strolch.runtime.agent.OrderMap;
import li.strolch.runtime.component.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
@ -37,6 +36,6 @@ public class OrderTypeNavigator extends StrolchTypeNavigator<Order> {
@Override
protected ElementMap<Order> getElementMap() {
return this.container.getComponent(OrderMap.class);
return this.container.getOrderMap();
}
}

View File

@ -16,13 +16,11 @@
package li.strolch.runtime.query.inmemory;
import li.strolch.model.Resource;
import li.strolch.runtime.agent.ComponentContainer;
import li.strolch.runtime.agent.ElementMap;
import li.strolch.runtime.agent.ResourceMap;
import li.strolch.runtime.component.ComponentContainer;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*/
public class ResourceTypeNavigator extends StrolchTypeNavigator<Resource> {
@ -38,6 +36,6 @@ public class ResourceTypeNavigator extends StrolchTypeNavigator<Resource> {
@Override
protected ElementMap<Resource> getElementMap() {
return this.container.getComponent(ResourceMap.class);
return this.container.getResourceMap();
}
}

View File

@ -21,8 +21,8 @@ import static org.junit.Assert.assertNotNull;
import java.io.File;
import li.strolch.model.Resource;
import li.strolch.runtime.agent.ComponentContainer;
import li.strolch.runtime.agent.StrolchAgent;
import li.strolch.runtime.component.ComponentContainer;
import org.junit.Test;
import org.slf4j.Logger;
@ -91,7 +91,7 @@ public class ComponentContainerTest {
}
public static void destroyContainer(StrolchAgent agent) {
agent.getContainer().stop();
agent.getContainer().destroy();
agent.stop();
agent.destroy();
}
}

View File

@ -25,10 +25,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.ComponentController;
import li.strolch.runtime.component.ComponentDependencyAnalyzer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.ComponentController;
import li.strolch.runtime.agent.ComponentDependencyAnalyzer;
import li.strolch.runtime.agent.StrolchComponent;
import li.strolch.runtime.configuration.ConfigurationParser;
import li.strolch.runtime.configuration.StrolchConfiguration;
import li.strolch.runtime.configuration.StrolchConfigurationException;
@ -82,7 +82,7 @@ public class ControllerDependencyTest {
// : Downstream dependency for b is a
//
private ComponentContainer container;
private ComponentContainerImpl container;
private ComponentController con2;
private ComponentController con5;
private ComponentController con11;
@ -110,7 +110,7 @@ public class ControllerDependencyTest {
@Before
public void setupModel() {
this.container = new ComponentContainer();
this.container = new ComponentContainerImpl();
this.con2 = new ComponentController(new StrolchComponent(this.container, "2"));
this.con5 = new ComponentController(new StrolchComponent(this.container, "5"));
@ -539,7 +539,7 @@ public class ControllerDependencyTest {
@Test
public void shouldAddDepedencies() {
ComponentContainer container = new ComponentContainer();
ComponentContainerImpl container = new ComponentContainerImpl();
StrolchComponent component = new StrolchComponent(container, "1"); //$NON-NLS-1$
ComponentController controller = new ComponentController(component);

View File

@ -16,12 +16,12 @@
package li.strolch.runtime.test.component;
import li.strolch.model.Resource;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
public class PersistenceHandlerTestImpl extends StrolchComponent implements PersistenceHandlerTest {
public PersistenceHandlerTestImpl(ComponentContainer container, String componentName) {
public PersistenceHandlerTestImpl(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}

View File

@ -15,12 +15,12 @@
*/
package li.strolch.runtime.test.component;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
public class PostInitializerTestImpl extends StrolchComponent implements PostInitializerTest {
public PostInitializerTestImpl(ComponentContainer container, String componentName) {
public PostInitializerTestImpl(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}
}

View File

@ -15,12 +15,12 @@
*/
package li.strolch.runtime.test.component;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
public class ServiceHandlerTestImpl extends StrolchComponent implements ServiceHandlerTest {
public ServiceHandlerTestImpl(ComponentContainer container, String componentName) {
public ServiceHandlerTestImpl(ComponentContainerImpl container, String componentName) {
super(container, componentName);
}

View File

@ -33,8 +33,6 @@ import li.strolch.model.query.ParameterSelection;
import li.strolch.model.query.ResourceQuery;
import li.strolch.model.query.Selection;
import li.strolch.model.query.StrolchTypeNavigation;
import li.strolch.runtime.agent.OrderMap;
import li.strolch.runtime.agent.ResourceMap;
import li.strolch.runtime.agent.StrolchAgent;
import li.strolch.runtime.query.inmemory.InMemoryOrderQueryVisitor;
import li.strolch.runtime.query.inmemory.InMemoryQuery;
@ -57,7 +55,7 @@ public class QueryTest {
Resource res1 = createResource("@1", "Test Resource", "MyType");
IntegerParameter iP = new IntegerParameter("nbOfBooks", "Number of Books", 33);
res1.addParameter(BAG_ID, iP);
agent.getContainer().getComponent(ResourceMap.class).add(res1);
agent.getResourceMap().add(res1);
List<Selection> elementAndSelections = new ArrayList<>();
elementAndSelections.add(new IdSelection("@1"));
@ -80,7 +78,7 @@ public class QueryTest {
Order o1 = createOrder("@1", "Test Order", "MyType");
IntegerParameter iP = new IntegerParameter("nbOfBooks", "Number of Books", 33);
o1.addParameter(BAG_ID, iP);
agent.getContainer().getComponent(OrderMap.class).add(o1);
agent.getOrderMap().add(o1);
List<Selection> elementAndSelections = new ArrayList<>();
elementAndSelections.add(new IdSelection("@1"));