use of org.iobserve.model.provider.neo4j.IModelProvider in project iobserve-analysis by research-iobserve.
the class AnalysisMain method createConfiguration.
@Override
protected AnalysisConfiguration createConfiguration(final Configuration configuration) throws ConfigurationException {
/**
* Configure model handling.
*/
// old model providers without neo4j
final PCMModelHandler modelFileHandler = new PCMModelHandler(this.modelInitDirectory);
final ICorrespondence correspondenceModel = modelFileHandler.getCorrespondenceModel();
/**
* initialize neo4j graphs.
*/
final GraphLoader graphLoader = new GraphLoader(this.modelDatabaseDirectory);
Graph repositoryModelGraph = graphLoader.initializeRepositoryModelGraph(modelFileHandler.getRepositoryModel());
Graph resourceEnvironmentGraph = graphLoader.initializeResourceEnvironmentModelGraph(modelFileHandler.getResourceEnvironmentModel());
Graph allocationModelGraph = graphLoader.initializeAllocationModelGraph(modelFileHandler.getAllocationModel());
Graph systemModelGraph = graphLoader.initializeSystemModelGraph(modelFileHandler.getSystemModel());
Graph usageModelGraph = graphLoader.initializeUsageModelGraph(modelFileHandler.getUsageModel());
/**
* load neo4j graphs.
*/
repositoryModelGraph = graphLoader.createRepositoryModelGraph();
resourceEnvironmentGraph = graphLoader.createResourceEnvironmentModelGraph();
allocationModelGraph = graphLoader.createAllocationModelGraph();
systemModelGraph = graphLoader.createSystemModelGraph();
usageModelGraph = graphLoader.createUsageModelGraph();
/**
* new graphModelProvider.
*/
final IModelProvider<Repository> repositoryModelProvider = new ModelProvider<>(repositoryModelGraph);
final IModelProvider<ResourceEnvironment> resourceEnvironmentModelProvider = new ModelProvider<>(resourceEnvironmentGraph);
final IModelProvider<Allocation> allocationModelProvider = new ModelProvider<>(allocationModelGraph);
final IModelProvider<org.palladiosimulator.pcm.system.System> systemModelProvider = new ModelProvider<>(systemModelGraph);
final IModelProvider<UsageModel> usageModelProvider = new ModelProvider<>(usageModelGraph);
// get systemId
final org.palladiosimulator.pcm.system.System systemModel = systemModelProvider.readOnlyRootComponent(org.palladiosimulator.pcm.system.System.class);
final String systemId = systemModel.getId();
try {
/**
* URLs for sending updates to the deployment visualization.
*/
// TODO this should be moved to the visualization sinks
final String[] sinks = configuration.getStringArrayProperty(ConfigurationKeys.CONTAINER_MANAGEMENT_SINK, ",");
if (sinks.length > 0) {
final InitializeDeploymentVisualization deploymentVisualization = new InitializeDeploymentVisualization(this.containerManagementVisualizationBaseUrl, systemId, allocationModelProvider, systemModelProvider, resourceEnvironmentModelProvider);
deploymentVisualization.initialize();
}
return new AnalysisConfiguration(configuration, repositoryModelProvider, resourceEnvironmentModelProvider, allocationModelProvider, systemModelProvider, usageModelProvider, correspondenceModel);
} catch (final MalformedURLException e) {
AbstractServiceMain.LOGGER.debug("URL construction for deployment visualization failed.", e);
return null;
} catch (final IOException e) {
AbstractServiceMain.LOGGER.debug("Deployment visualization could not connect to visualization service.", e);
return null;
}
}
Aggregations