Package cz.vutbr.fit.layout.impl
Class BaseProcessor
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseProcessor
-
public abstract class BaseProcessor extends Object
A base of a processor. It takes care about the existing providers and operators and their invocation. It manages a repository where the resulting artifacts are stored.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description BaseProcessor()Creates the processor and configures to use a default (in-memory) artifact repository.BaseProcessor(ArtifactRepository repository)Creates the processor and configures it to use the given artifact repository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(AreaTree atree, AreaTreeOperator op, Map<String,Object> params)Applies an area tree operator to an area tree.protected ServiceManagercreateServiceManager()Creates the default instance of service manager.Map<String,ArtifactService>getArtifactProviders(org.eclipse.rdf4j.model.IRI artifactType)Gets the available artifact proiders of the given type used by the processor.Map<String,ArtifactService>getArtifactServices()Gets all the available artifact services used by the processor.Map<String,AreaTreeOperator>getOperators()Gets all the available area tree operators used by the processor.ArtifactRepositorygetRepository()Gets the currently used artifact repository.ServiceManagergetServiceManager()Gets the used instance of service manager for accessing the artifact services.ArtifactprocessArtifact(Artifact input, ArtifactService provider, Map<String,Object> params)Processes an input artifact and creates a new artifact by invoking an artifact service and its configuration.voidsetRepository(ArtifactRepository repository)Sets the artifact repository to be used.voidsetServiceManager(ServiceManager serviceManager)Configures the processor to use a custom service manager.
-
-
-
Constructor Detail
-
BaseProcessor
public BaseProcessor()
Creates the processor and configures to use a default (in-memory) artifact repository.
-
BaseProcessor
public BaseProcessor(ArtifactRepository repository)
Creates the processor and configures it to use the given artifact repository.- Parameters:
repository- the artifact repository to be used by the processor
-
-
Method Detail
-
createServiceManager
protected ServiceManager createServiceManager()
Creates the default instance of service manager.- Returns:
-
getRepository
public ArtifactRepository getRepository()
Gets the currently used artifact repository.- Returns:
- the artifact repository used
-
setRepository
public void setRepository(ArtifactRepository repository)
Sets the artifact repository to be used.- Parameters:
repository-
-
getServiceManager
public ServiceManager getServiceManager()
Gets the used instance of service manager for accessing the artifact services.- Returns:
- a service manager instance
-
setServiceManager
public void setServiceManager(ServiceManager serviceManager)
Configures the processor to use a custom service manager.- Parameters:
serviceManager- the service manager to use
-
getArtifactServices
public Map<String,ArtifactService> getArtifactServices()
Gets all the available artifact services used by the processor.- Returns:
- a map that maps service identifiers to the service implementations.
-
getArtifactProviders
public Map<String,ArtifactService> getArtifactProviders(org.eclipse.rdf4j.model.IRI artifactType)
Gets the available artifact proiders of the given type used by the processor.- Parameters:
artifactType- the type of the artifact- Returns:
- a map that maps service identifiers to the service implementations.
-
getOperators
public Map<String,AreaTreeOperator> getOperators()
Gets all the available area tree operators used by the processor.- Returns:
- a map that maps service identifiers to the operator implementations.
-
processArtifact
public Artifact processArtifact(Artifact input, ArtifactService provider, Map<String,Object> params) throws ServiceException
Processes an input artifact and creates a new artifact by invoking an artifact service and its configuration.- Parameters:
input- the input artifact ornullif the provider service does not require and input artifactprovider- the provider service to invokeparams- the provider service configuration to use- Returns:
- the new artifact obtained from the provider
- Throws:
ServiceException
-
apply
public void apply(AreaTree atree, AreaTreeOperator op, Map<String,Object> params)
Applies an area tree operator to an area tree.- Parameters:
atree-op-params-
-
-