Class ServiceFactory
java.lang.Object
de.iip_ecosphere.platform.services.ServiceFactory
Provides access to the service manager instance.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static ServiceFactoryDescriptorprivate static final de.iip_ecosphere.platform.support.logging.Loggerprivate static ServiceManagerprivate static de.iip_ecosphere.platform.support.net.NetworkManagerSetupprivate static ServiceSetupprivate static de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetupprivate static de.iip_ecosphere.platform.transport.connectors.TransportSetupprivate static String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetupReturns the actual AAS setup for the implementing service manager.private static <T> TgetFromSetup(T object, Function<ServiceFactoryDescriptor, T> fromDesc, Function<ServiceSetup, T> fromSetup, Supplier<T> constructor, Consumer<T> setter) Returns an object from setup.static de.iip_ecosphere.platform.support.net.NetworkManagerSetupReturns the actual network manager setup.static ServiceManagerReturns the service manager.static ServiceSetupgetSetup()Returns the actual service setup for the implementing service manager.static Class<? extends ServiceSetup> Returns the service setup class.static Class<?>[]getTests(int index) Returns a test represented as it's class for execution in jUnit.static de.iip_ecosphere.platform.transport.connectors.TransportSetupReturns the actual transport setup for the implementing service manager.private static voidinit()Initializes this factory.static voidsetAasSetup(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup instance) Defines the AAS setup instance.static voidsetNetworkManagerSetup(de.iip_ecosphere.platform.support.net.NetworkManagerSetup instance) Defines the network manager setup instance.static voidsetYamlPath(String path) Sets the YAML path if setup YAML must be read from a nested object.
-
Field Details
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER -
desc
-
manager
-
service
-
setup
private static de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup setup -
transport
private static de.iip_ecosphere.platform.transport.connectors.TransportSetup transport -
netwMgrSetup
private static de.iip_ecosphere.platform.support.net.NetworkManagerSetup netwMgrSetup -
yamlPath
-
-
Constructor Details
-
ServiceFactory
public ServiceFactory()
-
-
Method Details
-
setYamlPath
Sets the YAML path if setup YAML must be read from a nested object. Shall be maintained by implementing class or tests. [testing]- Parameters:
path- the path, by default none/null
-
init
private static void init()Initializes this factory. -
getServiceManager
Returns the service manager.- Returns:
- the service manager
-
getSetupClass
Returns the service setup class.- Returns:
- the service setup class, either from the descriptor or
ServiceSetup
-
getSetup
Returns the actual service setup for the implementing service manager.- Returns:
- the service setup
-
getAasSetup
public static de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup getAasSetup()Returns the actual AAS setup for the implementing service manager.- Returns:
- the AAS setup
-
getNetworkManagerSetup
public static de.iip_ecosphere.platform.support.net.NetworkManagerSetup getNetworkManagerSetup()Returns the actual network manager setup.- Returns:
- the network manager setup
-
getTransport
public static de.iip_ecosphere.platform.transport.connectors.TransportSetup getTransport()Returns the actual transport setup for the implementing service manager.- Returns:
- the AAS setup
-
getFromSetup
private static <T> T getFromSetup(T object, Function<ServiceFactoryDescriptor, T> fromDesc, Function<ServiceSetup, T> fromSetup, Supplier<T> constructor, Consumer<T> setter) Returns an object from setup. If not anyway present, calls#init(), then first tries to get the object from the descriptor viafromDesc, then by directly loading the setup viagetSetupClass()andyamlPath, and finally viaconstructor.- Type Parameters:
T- the type of object to read- Parameters:
object- the actual value, returned if not nullfromDesc- the projection from the descriptorfromSetup- the projection from a freshly read setup as first fallbackconstructor- the constructor as second fallbacksetter- if a new object is obtained, store it for future use- Returns:
- the
objector if null from descriptor, setup or constructor
-
setAasSetup
public static void setAasSetup(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup instance) Defines the AAS setup instance.- Parameters:
instance- the new setup instance
-
setNetworkManagerSetup
public static void setNetworkManagerSetup(de.iip_ecosphere.platform.support.net.NetworkManagerSetup instance) Defines the network manager setup instance.- Parameters:
instance- the new setup instance
-
getTests
Returns a test represented as it's class for execution in jUnit. This is required if a test running a service manager and other components like AAS as plugins shall get execute a test independently. Delegates the work toServiceFactoryDescriptor. [testing]- Parameters:
index- a 0-based index of the test/suite to return; usually test and implementing service manager are in close relationship and know the valid indexes- Returns:
- the test classes or null if there is none for the given index
-