From 0254a74d162f91c3dae92fb2c482e7b41f7aeb39 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 23 Dec 2013 18:42:50 +0100 Subject: [PATCH] [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 --- .../runtime/agent/ComponentContainer.java | 32 ++++++++ .../ComponentContainerImpl.java} | 22 ++++-- .../ComponentController.java | 2 +- .../ComponentDependencyAnalyzer.java | 2 +- .../{component => agent}/ComponentState.java | 2 +- .../strolch/runtime/agent/DataStoreMode.java | 16 ++-- .../runtime/agent/ElementMapHandler.java | 26 +++++++ ...ava => ElementMapHandlerConfigurator.java} | 8 +- ...eator.java => EmptyElementMapHandler.java} | 21 +++-- ...> EmptyElementMapHandlerConfigurator.java} | 25 +++--- .../runtime/agent/InMemoryElementMap.java | 34 +------- ...nMemoryElementMapConfigurationCreator.java | 77 ------------------- .../agent/InMemoryElementMapHandler.java | 53 +++++++++++++ .../runtime/agent/InMemoryOrderMap.java | 9 +-- .../runtime/agent/InMemoryResourceMap.java | 9 +-- .../{component => agent}/PostInitializer.java | 2 +- .../SimplePostInitializer.java | 4 +- .../strolch/runtime/agent/StrolchAgent.java | 35 ++++++--- .../StrolchComponent.java | 8 +- ...r.java => TransientElementMapHandler.java} | 15 ++-- ...ransientElementMapHandlerConfigurator.java | 47 +++++++++++ .../observer/DefaultObserverHandler.java | 6 +- .../DefaultStrolchPrivilegeHandler.java | 6 +- .../inmemory/InMemoryOrderQueryVisitor.java | 2 +- .../query/inmemory/InMemoryQueryVisitor.java | 2 +- .../InMemoryResourceQueryVisitor.java | 2 +- .../query/inmemory/OrderTypeNavigator.java | 5 +- .../query/inmemory/ResourceTypeNavigator.java | 6 +- .../component/ComponentContainerTest.java | 6 +- .../component/ControllerDependencyTest.java | 14 ++-- .../component/PersistenceHandlerTestImpl.java | 6 +- .../component/PostInitializerTestImpl.java | 6 +- .../component/ServiceHandlerTestImpl.java | 6 +- .../test/query/inmemory/QueryTest.java | 6 +- 34 files changed, 286 insertions(+), 236 deletions(-) create mode 100644 src/main/java/li/strolch/runtime/agent/ComponentContainer.java rename src/main/java/li/strolch/runtime/{component/ComponentContainer.java => agent/ComponentContainerImpl.java} (95%) rename src/main/java/li/strolch/runtime/{component => agent}/ComponentController.java (99%) rename src/main/java/li/strolch/runtime/{component => agent}/ComponentDependencyAnalyzer.java (99%) rename src/main/java/li/strolch/runtime/{component => agent}/ComponentState.java (97%) create mode 100644 src/main/java/li/strolch/runtime/agent/ElementMapHandler.java rename src/main/java/li/strolch/runtime/agent/{ElementMapConfigurationCreator.java => ElementMapHandlerConfigurator.java} (75%) rename src/main/java/li/strolch/runtime/agent/{EmptyElementMapConfigurationCreator.java => EmptyElementMapHandler.java} (64%) rename src/main/java/li/strolch/runtime/agent/{TransientElementMapConfigurationCreator.java => EmptyElementMapHandlerConfigurator.java} (63%) delete mode 100644 src/main/java/li/strolch/runtime/agent/InMemoryElementMapConfigurationCreator.java create mode 100644 src/main/java/li/strolch/runtime/agent/InMemoryElementMapHandler.java rename src/main/java/li/strolch/runtime/{component => agent}/PostInitializer.java (95%) rename src/main/java/li/strolch/runtime/{component => agent}/SimplePostInitializer.java (87%) rename src/main/java/li/strolch/runtime/{component => agent}/StrolchComponent.java (90%) rename src/main/java/li/strolch/runtime/agent/{TransientElementMapController.java => TransientElementMapHandler.java} (83%) create mode 100644 src/main/java/li/strolch/runtime/agent/TransientElementMapHandlerConfigurator.java diff --git a/src/main/java/li/strolch/runtime/agent/ComponentContainer.java b/src/main/java/li/strolch/runtime/agent/ComponentContainer.java new file mode 100644 index 000000000..bd16018c8 --- /dev/null +++ b/src/main/java/li/strolch/runtime/agent/ComponentContainer.java @@ -0,0 +1,32 @@ +/* + * Copyright 2013 Robert von Burg + * + * 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 + * + */ +public interface ComponentContainer { + + public abstract boolean hasComponent(Class clazz); + + public abstract T getComponent(Class clazz); + + public abstract OrderMap getOrderMap(); + + public abstract ResourceMap getResourceMap(); + +} \ No newline at end of file diff --git a/src/main/java/li/strolch/runtime/component/ComponentContainer.java b/src/main/java/li/strolch/runtime/agent/ComponentContainerImpl.java similarity index 95% rename from src/main/java/li/strolch/runtime/component/ComponentContainer.java rename to src/main/java/li/strolch/runtime/agent/ComponentContainerImpl.java index da8cf4425..4b4acae80 100644 --- a/src/main/java/li/strolch/runtime/component/ComponentContainer.java +++ b/src/main/java/li/strolch/runtime/agent/ComponentContainerImpl.java @@ -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, StrolchComponent> componentMap; private Map 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 getComponent(Class 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, StrolchComponent> componentMap, Map controllerMap, ComponentConfiguration componentConfiguration) { @@ -86,7 +98,7 @@ public class ComponentContainer { @SuppressWarnings("unchecked") Class strolchComponentClass = (Class) implClass; - Constructor constructor = strolchComponentClass.getConstructor(ComponentContainer.class, + Constructor constructor = strolchComponentClass.getConstructor(ComponentContainerImpl.class, String.class); StrolchComponent strolchComponent = constructor.newInstance(this, componentName); diff --git a/src/main/java/li/strolch/runtime/component/ComponentController.java b/src/main/java/li/strolch/runtime/agent/ComponentController.java similarity index 99% rename from src/main/java/li/strolch/runtime/component/ComponentController.java rename to src/main/java/li/strolch/runtime/agent/ComponentController.java index 950732b87..71918af5a 100644 --- a/src/main/java/li/strolch/runtime/component/ComponentController.java +++ b/src/main/java/li/strolch/runtime/agent/ComponentController.java @@ -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; diff --git a/src/main/java/li/strolch/runtime/component/ComponentDependencyAnalyzer.java b/src/main/java/li/strolch/runtime/agent/ComponentDependencyAnalyzer.java similarity index 99% rename from src/main/java/li/strolch/runtime/component/ComponentDependencyAnalyzer.java rename to src/main/java/li/strolch/runtime/agent/ComponentDependencyAnalyzer.java index 0b41ab193..8e9c79eb3 100644 --- a/src/main/java/li/strolch/runtime/component/ComponentDependencyAnalyzer.java +++ b/src/main/java/li/strolch/runtime/agent/ComponentDependencyAnalyzer.java @@ -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; diff --git a/src/main/java/li/strolch/runtime/component/ComponentState.java b/src/main/java/li/strolch/runtime/agent/ComponentState.java similarity index 97% rename from src/main/java/li/strolch/runtime/component/ComponentState.java rename to src/main/java/li/strolch/runtime/agent/ComponentState.java index f46ce989f..5a34de2db 100644 --- a/src/main/java/li/strolch/runtime/component/ComponentState.java +++ b/src/main/java/li/strolch/runtime/agent/ComponentState.java @@ -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; diff --git a/src/main/java/li/strolch/runtime/agent/DataStoreMode.java b/src/main/java/li/strolch/runtime/agent/DataStoreMode.java index a0fc0e1ad..99528fc24 100644 --- a/src/main/java/li/strolch/runtime/agent/DataStoreMode.java +++ b/src/main/java/li/strolch/runtime/agent/DataStoreMode.java @@ -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()) { diff --git a/src/main/java/li/strolch/runtime/agent/ElementMapHandler.java b/src/main/java/li/strolch/runtime/agent/ElementMapHandler.java new file mode 100644 index 000000000..d21820dff --- /dev/null +++ b/src/main/java/li/strolch/runtime/agent/ElementMapHandler.java @@ -0,0 +1,26 @@ +/* + * Copyright 2013 Robert von Burg + * + * 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 + */ +public interface ElementMapHandler { + + public ResourceMap getResourceMap(); + + public OrderMap getOrderMap(); +} diff --git a/src/main/java/li/strolch/runtime/agent/ElementMapConfigurationCreator.java b/src/main/java/li/strolch/runtime/agent/ElementMapHandlerConfigurator.java similarity index 75% rename from src/main/java/li/strolch/runtime/agent/ElementMapConfigurationCreator.java rename to src/main/java/li/strolch/runtime/agent/ElementMapHandlerConfigurator.java index 79ab017e0..4cfc70083 100644 --- a/src/main/java/li/strolch/runtime/agent/ElementMapConfigurationCreator.java +++ b/src/main/java/li/strolch/runtime/agent/ElementMapHandlerConfigurator.java @@ -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 - * */ -public interface ElementMapConfigurationCreator { +public interface ElementMapHandlerConfigurator { - public List getComponentConfigurations(RuntimeConfiguration runtimeConfiguration); + public ComponentConfiguration buildConfiguration(StrolchAgent agent); } diff --git a/src/main/java/li/strolch/runtime/agent/EmptyElementMapConfigurationCreator.java b/src/main/java/li/strolch/runtime/agent/EmptyElementMapHandler.java similarity index 64% rename from src/main/java/li/strolch/runtime/agent/EmptyElementMapConfigurationCreator.java rename to src/main/java/li/strolch/runtime/agent/EmptyElementMapHandler.java index f1501699f..f579e617c 100644 --- a/src/main/java/li/strolch/runtime/agent/EmptyElementMapConfigurationCreator.java +++ b/src/main/java/li/strolch/runtime/agent/EmptyElementMapHandler.java @@ -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 - * */ -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 configurations, - RuntimeConfiguration runtimeConfiguration) { - // nothing to do + public void initialize(ComponentConfiguration configuration) { + this.resourceMap = new InMemoryResourceMap(); + this.orderMap = new InMemoryOrderMap(); + super.initialize(configuration); } } diff --git a/src/main/java/li/strolch/runtime/agent/TransientElementMapConfigurationCreator.java b/src/main/java/li/strolch/runtime/agent/EmptyElementMapHandlerConfigurator.java similarity index 63% rename from src/main/java/li/strolch/runtime/agent/TransientElementMapConfigurationCreator.java rename to src/main/java/li/strolch/runtime/agent/EmptyElementMapHandlerConfigurator.java index 58553d970..140bfa036 100644 --- a/src/main/java/li/strolch/runtime/agent/TransientElementMapConfigurationCreator.java +++ b/src/main/java/li/strolch/runtime/agent/EmptyElementMapHandlerConfigurator.java @@ -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 - * */ -public class TransientElementMapConfigurationCreator extends InMemoryElementMapConfigurationCreator { +public class EmptyElementMapHandlerConfigurator implements ElementMapHandlerConfigurator { @Override - protected void addConfiguration(List 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 configurationValues = new HashMap<>(); - Set dependencies = new HashSet<>(); - dependencies.add(ResourceMap.class.getSimpleName()); - dependencies.add(OrderMap.class.getSimpleName()); + Set dependencies = Collections.emptySet(); + + RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration(); ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name, configurationValues, api, impl, dependencies); - configurations.add(configuration); + + return configuration; } } diff --git a/src/main/java/li/strolch/runtime/agent/InMemoryElementMap.java b/src/main/java/li/strolch/runtime/agent/InMemoryElementMap.java index c4a5f1627..d46ca2579 100644 --- a/src/main/java/li/strolch/runtime/agent/InMemoryElementMap.java +++ b/src/main/java/li/strolch/runtime/agent/InMemoryElementMap.java @@ -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 * */ -public abstract class InMemoryElementMap extends StrolchComponent implements ElementMap { +public abstract class InMemoryElementMap implements ElementMap { private Map> 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 diff --git a/src/main/java/li/strolch/runtime/agent/InMemoryElementMapConfigurationCreator.java b/src/main/java/li/strolch/runtime/agent/InMemoryElementMapConfigurationCreator.java deleted file mode 100644 index 80814967b..000000000 --- a/src/main/java/li/strolch/runtime/agent/InMemoryElementMapConfigurationCreator.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2013 Robert von Burg - * - * 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 - * - */ -public abstract class InMemoryElementMapConfigurationCreator implements ElementMapConfigurationCreator { - - protected static final Logger logger = LoggerFactory.getLogger(InMemoryElementMapConfigurationCreator.class); - - @Override - public List getComponentConfigurations(RuntimeConfiguration runtimeConfiguration) { - List configurations = new ArrayList<>(); - addConfiguration(configurations, runtimeConfiguration); - addResourceMapConfiguration(configurations, runtimeConfiguration); - addOrderMapConfiguration(configurations, runtimeConfiguration); - return configurations; - } - - protected abstract void addConfiguration(List configurations, - RuntimeConfiguration runtimeConfiguration); - - protected void addResourceMapConfiguration(List configurations, - RuntimeConfiguration runtimeConfiguration) { - - String name = ResourceMap.class.getSimpleName(); - String api = ResourceMap.class.getName(); - String impl = InMemoryResourceMap.class.getName(); - Map configurationValues = new HashMap<>(); - Set dependencies = Collections.emptySet(); - ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name, - configurationValues, api, impl, dependencies); - configurations.add(configuration); - } - - protected void addOrderMapConfiguration(List configurations, - RuntimeConfiguration runtimeConfiguration) { - - String name = OrderMap.class.getSimpleName(); - String api = OrderMap.class.getName(); - String impl = InMemoryOrderMap.class.getName(); - Map configurationValues = new HashMap<>(); - Set dependencies = Collections.emptySet(); - - ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name, - configurationValues, api, impl, dependencies); - configurations.add(configuration); - } -} diff --git a/src/main/java/li/strolch/runtime/agent/InMemoryElementMapHandler.java b/src/main/java/li/strolch/runtime/agent/InMemoryElementMapHandler.java new file mode 100644 index 000000000..8a3644c7f --- /dev/null +++ b/src/main/java/li/strolch/runtime/agent/InMemoryElementMapHandler.java @@ -0,0 +1,53 @@ +/* + * Copyright 2013 Robert von Burg + * + * 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 + * + */ +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; + } +} diff --git a/src/main/java/li/strolch/runtime/agent/InMemoryOrderMap.java b/src/main/java/li/strolch/runtime/agent/InMemoryOrderMap.java index 44d5825d8..571a2f4e6 100644 --- a/src/main/java/li/strolch/runtime/agent/InMemoryOrderMap.java +++ b/src/main/java/li/strolch/runtime/agent/InMemoryOrderMap.java @@ -16,7 +16,6 @@ package li.strolch.runtime.agent; import li.strolch.model.Order; -import li.strolch.runtime.component.ComponentContainer; /** * @author Robert von Burg @@ -24,11 +23,5 @@ import li.strolch.runtime.component.ComponentContainer; */ public class InMemoryOrderMap extends InMemoryElementMap implements OrderMap { - /** - * @param container - * @param componentName - */ - public InMemoryOrderMap(ComponentContainer container, String componentName) { - super(container, componentName); - } + // marker class } diff --git a/src/main/java/li/strolch/runtime/agent/InMemoryResourceMap.java b/src/main/java/li/strolch/runtime/agent/InMemoryResourceMap.java index 4057eb299..3fe095b21 100644 --- a/src/main/java/li/strolch/runtime/agent/InMemoryResourceMap.java +++ b/src/main/java/li/strolch/runtime/agent/InMemoryResourceMap.java @@ -16,7 +16,6 @@ package li.strolch.runtime.agent; import li.strolch.model.Resource; -import li.strolch.runtime.component.ComponentContainer; /** * @author Robert von Burg @@ -24,11 +23,5 @@ import li.strolch.runtime.component.ComponentContainer; */ public class InMemoryResourceMap extends InMemoryElementMap implements ResourceMap { - /** - * @param container - * @param componentName - */ - public InMemoryResourceMap(ComponentContainer container, String componentName) { - super(container, componentName); - } + // marker class } diff --git a/src/main/java/li/strolch/runtime/component/PostInitializer.java b/src/main/java/li/strolch/runtime/agent/PostInitializer.java similarity index 95% rename from src/main/java/li/strolch/runtime/component/PostInitializer.java rename to src/main/java/li/strolch/runtime/agent/PostInitializer.java index 0ed96140a..314ae186a 100644 --- a/src/main/java/li/strolch/runtime/component/PostInitializer.java +++ b/src/main/java/li/strolch/runtime/agent/PostInitializer.java @@ -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 diff --git a/src/main/java/li/strolch/runtime/component/SimplePostInitializer.java b/src/main/java/li/strolch/runtime/agent/SimplePostInitializer.java similarity index 87% rename from src/main/java/li/strolch/runtime/component/SimplePostInitializer.java rename to src/main/java/li/strolch/runtime/agent/SimplePostInitializer.java index 4b695143e..cd249dac0 100644 --- a/src/main/java/li/strolch/runtime/component/SimplePostInitializer.java +++ b/src/main/java/li/strolch/runtime/agent/SimplePostInitializer.java @@ -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 @@ -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); } diff --git a/src/main/java/li/strolch/runtime/agent/StrolchAgent.java b/src/main/java/li/strolch/runtime/agent/StrolchAgent.java index bbaf0e4f5..821acdc2b 100644 --- a/src/main/java/li/strolch/runtime/agent/StrolchAgent.java +++ b/src/main/java/li/strolch/runtime/agent/StrolchAgent.java @@ -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 - * */ 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 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); + } + } } diff --git a/src/main/java/li/strolch/runtime/component/StrolchComponent.java b/src/main/java/li/strolch/runtime/agent/StrolchComponent.java similarity index 90% rename from src/main/java/li/strolch/runtime/component/StrolchComponent.java rename to src/main/java/li/strolch/runtime/agent/StrolchComponent.java index d7d7561a0..5ee0dcea7 100644 --- a/src/main/java/li/strolch/runtime/component/StrolchComponent.java +++ b/src/main/java/li/strolch/runtime/agent/StrolchComponent.java @@ -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; } diff --git a/src/main/java/li/strolch/runtime/agent/TransientElementMapController.java b/src/main/java/li/strolch/runtime/agent/TransientElementMapHandler.java similarity index 83% rename from src/main/java/li/strolch/runtime/agent/TransientElementMapController.java rename to src/main/java/li/strolch/runtime/agent/TransientElementMapHandler.java index 97ef13819..4eb1e4554 100644 --- a/src/main/java/li/strolch/runtime/agent/TransientElementMapController.java +++ b/src/main/java/li/strolch/runtime/agent/TransientElementMapHandler.java @@ -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 - * */ -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(); diff --git a/src/main/java/li/strolch/runtime/agent/TransientElementMapHandlerConfigurator.java b/src/main/java/li/strolch/runtime/agent/TransientElementMapHandlerConfigurator.java new file mode 100644 index 000000000..83beebd71 --- /dev/null +++ b/src/main/java/li/strolch/runtime/agent/TransientElementMapHandlerConfigurator.java @@ -0,0 +1,47 @@ +/* + * Copyright 2013 Robert von Burg + * + * 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 + */ +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 configurationValues = new HashMap<>(); + Set dependencies = Collections.emptySet(); + + RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration(); + ComponentConfiguration configuration = new ComponentConfiguration(runtimeConfiguration, name, + configurationValues, api, impl, dependencies); + + return configuration; + } +} diff --git a/src/main/java/li/strolch/runtime/observer/DefaultObserverHandler.java b/src/main/java/li/strolch/runtime/observer/DefaultObserverHandler.java index 964f8e1e3..92e320201 100644 --- a/src/main/java/li/strolch/runtime/observer/DefaultObserverHandler.java +++ b/src/main/java/li/strolch/runtime/observer/DefaultObserverHandler.java @@ -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); } diff --git a/src/main/java/li/strolch/runtime/privilege/DefaultStrolchPrivilegeHandler.java b/src/main/java/li/strolch/runtime/privilege/DefaultStrolchPrivilegeHandler.java index aef4ce63d..e2ebb782b 100644 --- a/src/main/java/li/strolch/runtime/privilege/DefaultStrolchPrivilegeHandler.java +++ b/src/main/java/li/strolch/runtime/privilege/DefaultStrolchPrivilegeHandler.java @@ -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); } diff --git a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryOrderQueryVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryOrderQueryVisitor.java index e8a91feb4..c38408c68 100644 --- a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryOrderQueryVisitor.java +++ b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryOrderQueryVisitor.java @@ -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 diff --git a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java index 257733fc4..61fa75999 100644 --- a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java +++ b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java @@ -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 diff --git a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java index 932a1ebe5..a691fef5d 100644 --- a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java +++ b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java @@ -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 diff --git a/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java b/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java index 5be82aecd..547653294 100644 --- a/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java +++ b/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java @@ -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 @@ -37,6 +36,6 @@ public class OrderTypeNavigator extends StrolchTypeNavigator { @Override protected ElementMap getElementMap() { - return this.container.getComponent(OrderMap.class); + return this.container.getOrderMap(); } } diff --git a/src/main/java/li/strolch/runtime/query/inmemory/ResourceTypeNavigator.java b/src/main/java/li/strolch/runtime/query/inmemory/ResourceTypeNavigator.java index 48c78963c..7ca04a414 100644 --- a/src/main/java/li/strolch/runtime/query/inmemory/ResourceTypeNavigator.java +++ b/src/main/java/li/strolch/runtime/query/inmemory/ResourceTypeNavigator.java @@ -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 - * */ public class ResourceTypeNavigator extends StrolchTypeNavigator { @@ -38,6 +36,6 @@ public class ResourceTypeNavigator extends StrolchTypeNavigator { @Override protected ElementMap getElementMap() { - return this.container.getComponent(ResourceMap.class); + return this.container.getResourceMap(); } } diff --git a/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java b/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java index 1190863d5..74a2e8a16 100644 --- a/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java +++ b/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java @@ -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(); } } diff --git a/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java b/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java index 8edd0808b..86f21b9eb 100644 --- a/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java +++ b/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java @@ -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); diff --git a/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java index 5181b1a89..1f4759340 100644 --- a/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java +++ b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java @@ -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); } diff --git a/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java index e96a2bf89..1b3d42eff 100644 --- a/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java +++ b/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java @@ -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); } } diff --git a/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java index c7aae6274..f21a3229d 100644 --- a/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java +++ b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java @@ -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); } diff --git a/src/test/java/li/strolch/runtime/test/query/inmemory/QueryTest.java b/src/test/java/li/strolch/runtime/test/query/inmemory/QueryTest.java index 1a9f0ba97..afe5bbb7f 100644 --- a/src/test/java/li/strolch/runtime/test/query/inmemory/QueryTest.java +++ b/src/test/java/li/strolch/runtime/test/query/inmemory/QueryTest.java @@ -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 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 elementAndSelections = new ArrayList<>(); elementAndSelections.add(new IdSelection("@1"));