Skip to content
Snippets Groups Projects
Commit 504bd24b authored by Matthias Blohm's avatar Matthias Blohm
Browse files

project initialization

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 505 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="fixtures"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/bin/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>descartes.kieker4dql.dqlconnector.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.kit.ipd.descartes.solving.dqlconnector.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
source.. = src/,\
fixtures/
output.. = bin/
bin.includes = META-INF/,\
fixtures/
LIST ENTITIES
USING dml@'/tools.descartes.dql.connector.dml.tests/fixtures/Queries/SimpleFineGrainedBehaviorClosedWorkload.properties';
\ No newline at end of file
## Model Instance
dml.files.usageprofile=/tools.descartes.dql.connector.dml.tests/fixtures/SimpleFineGrainedBehaviorClosedWorkload/fixture.usageprofile
dml.files.system=/tools.descartes.dql.connector.dml.tests/fixtures/SimpleFineGrainedBehaviorClosedWorkload/fixture.system
dml.files.resourcelandscape=/tools.descartes.dql.connector.dml.tests/fixtures/SimpleFineGrainedBehaviorClosedWorkload/fixture.resourcelandscape
dml.files.repository=/tools.descartes.dql.connector.dml.tests/fixtures/SimpleFineGrainedBehaviorClosedWorkload/fixture.repository
dml.files.deployment=/tools.descartes.dql.connector.dml.tests/fixtures/SimpleFineGrainedBehaviorClosedWorkload/fixture.deployment
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>descartes.kieker4dql.dqlconnector.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<testResources>
<testResource>
<directory>fixtures</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>descartes.kieker4dql</groupId>
<artifactId>kieker4dql</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>descartes.kieker4dql.dqlconnector.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<testResources>
<testResource>
<directory>fixtures</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>descartes.kieker4dql</groupId>
<artifactId>kieker4dql</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/bin/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>descartes.kieker4dql.dqlconnector</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.kit.ipd.descartes.solving.dqlconnector</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>descartes.kieker4dql.dqlconnector</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>descartes.kieker4dql</groupId>
<artifactId>kieker4dql</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>descartes.kieker4dql.dqlconnector</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>descartes.kieker4dql</groupId>
<artifactId>kieker4dql</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
</project>
package descartes.kieker4dql.dqlconnector;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}
package descartes.kieker4dql.dqlconnector;
import tools.descartes.dql.connector.ConnectorProvider;
import tools.descartes.dql.connector.ModelStructureQueryConnector;
import tools.descartes.dql.connector.PerformanceIssueQueryConnector;
import tools.descartes.dql.connector.PerformanceMetricsQueryConnector;
public class ConnectorProviderImpl implements ConnectorProvider {
@Override
public ModelStructureQueryConnector createModelStructureQueryConnectorInstance() {
return new ModelStructureQueryConnectorImpl();
}
@Override
public PerformanceIssueQueryConnector createPerformanceIssueQueryConnectorInstance() {
return null;
}
@Override
public PerformanceMetricsQueryConnector createPerformanceMetricsQueryConnectorInstance() {
return new PerformanceMetricsQueryConnectorImpl();
}
}
package edu.kit.ipd.descartes.solving.dqlconnector;
import tools.descartes.dql.connector.ConnectorProvider;
import tools.descartes.dql.connector.ModelStructureQueryConnector;
import tools.descartes.dql.connector.PerformanceIssueQueryConnector;
import tools.descartes.dql.connector.PerformanceMetricsQueryConnector;
public class ConnectorProviderImpl implements ConnectorProvider {
@Override
public ModelStructureQueryConnector createModelStructureQueryConnectorInstance() {
return new ModelStructureQueryConnectorImpl();
}
@Override
public PerformanceIssueQueryConnector createPerformanceIssueQueryConnectorInstance() {
return null;
}
@Override
public PerformanceMetricsQueryConnector createPerformanceMetricsQueryConnectorInstance() {
return new PerformanceMetricsQueryConnectorImpl();
}
}
package descartes.kieker4dql.dqlconnector;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.query.conditions.eobjects.EObjectCondition;
import org.eclipse.emf.query.ocl.conditions.BooleanOCLCondition;
import org.eclipse.emf.query.statements.FROM;
import org.eclipse.emf.query.statements.IQueryResult;
import org.eclipse.emf.query.statements.SELECT;
import org.eclipse.emf.query.statements.WHERE;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.OCL;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import edu.kit.ipd.descartes.solving.DMLModels;
import edu.kit.ipd.descartes.solving.ValidationError;
import tools.descartes.dql.core.engine.util.DQLLogger;
/*
* Helper class for various tasks and property store for Palladio
*/
public class DMLHelper {
public static final String OCL_QUERY_RESOURCES = "self.oclIsKindOf(ProcessingResourceSpecification)";
public static final String OCL_QUERY_SERVICES_ELSC = "self.oclIsKindOf(SystemCallUserAction) or self.oclIsKindOf(UsageScenario)";
public static final String OCL_QUERY_SERVICES_ECAC = "self.oclIsKindOf(ExternalCallAction)";
public static final String OCL_QUERY_SERVICES_ECFR = "self.oclIsKindOf(ExternalCallFrequency)";
public static final String FILES_USAGEPROFILE_KEY = "dml.files.usageprofile";
public static final String FILES_SYSTEM_KEY = "dml.files.system";
public static final String FILES_RESOURCELANDSCAPE_KEY = "dml.files.resourcelandscape";
public static final String FILES_REPOSITORY_KEY = "dml.files.repository";
public static final String FILES_DEPLOYMENT_KEY = "dml.files.deployment";
public static final String OUTPUTDIRECTORY = "dml.outputdirectory";
public static final String METRIC_UTILIZATION = "utilization";
public static final String METRIC_RESPONSE_TIME_AVG = "avgResponseTime";
public static final String METRIC_THROUGHPUT = "throughput";
// TODO add support for resptime distribution metrics
//public static final String METRIC_RESPONSE_TIME_PERCENTILE;
//public static final String METRIC_RESPONSE_TIME_DISTRIBUTION;
public static final String EXPERIMENT_ID = "DQL";
public static final String TOOL_CONFIG_NAME = "DQLToolConfig";
private static final Logger log = DQLLogger.getLogger(DMLHelper.class.getName());
public static void checkProperties(final Properties properties,
final String[] keys) {
for (final String key : keys) {
if (properties.get(key) == null) {
final String msg = "Required key in properties missing: " + key;
log.error(msg);
throw new RuntimeException(msg);
}
}
}
public static DMLModelFiles createDMLModelFiles(final String modelLocation) {
final DMLModelFiles dmlModelFiles = new DMLModelFiles();
final Properties properties = getAbsolutePathProperties(modelLocation);
checkProperties(properties, new String[] {
DMLHelper.FILES_DEPLOYMENT_KEY,
DMLHelper.FILES_USAGEPROFILE_KEY });
dmlModelFiles.setDeploymentFile(properties.getProperty(DMLHelper.FILES_DEPLOYMENT_KEY));
dmlModelFiles.setUsageProfileFile(properties.getProperty(DMLHelper.FILES_USAGEPROFILE_KEY));
if (properties.getProperty(DMLHelper.OUTPUTDIRECTORY) == null) {
dmlModelFiles.setOutputDirectory(
new File(modelLocation).getParentFile().getAbsolutePath() + File.separator + "results");
} else if (properties.getProperty(DMLHelper.OUTPUTDIRECTORY).contains("result")) {
dmlModelFiles.setOutputDirectory(properties.getProperty(DMLHelper.OUTPUTDIRECTORY));
} else {
dmlModelFiles
.setOutputDirectory(properties.getProperty(DMLHelper.OUTPUTDIRECTORY) + File.separator + "results");
}
return dmlModelFiles;
}
public static List<EObject> executeOCLQueryWithoutContext(
final EObject[] modelInstances, final String oclQuery) {
final ArrayList<EObject> elements = new ArrayList<EObject>();
final OCL ocl = OCL.newInstance();
EObjectCondition oclConstraint = null;
try {
oclConstraint = new BooleanOCLCondition<EClassifier, EClass, EObject>(
ocl.getEnvironment(), oclQuery, null);
} catch (final ParserException e) {
e.printStackTrace();
}
SELECT select = null;
IQueryResult result = null;
final WHERE where = new WHERE(oclConstraint);
final IProgressMonitor progressMonitor = new NullProgressMonitor();
for (final EObject object :modelInstances) {
final FROM from = new FROM(object);
select = new SELECT(SELECT.UNBOUNDED, false, from, where,
progressMonitor);
result = select.execute();
elements.addAll(result);
}
return elements;
}
public static DMLModels loadModels(DMLModelFiles files) {
ModelLoader modelLoader = new ModelLoader(files);
return modelLoader.load();
}
public static void openValidationErrorWindow(Collection<ValidationError> errors) {
final List<ValidationError> finalErrors = new LinkedList<ValidationError>();
finalErrors.addAll(errors);
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog dialog = new ValidationErrorDialog(activeShell, finalErrors);
dialog.open();
}
});
}
public static Properties getAbsolutePathProperties(final String dmlPropertiesLocation) {
final Properties properties = new Properties();
File file = new File(dmlPropertiesLocation);
if (file == null || !file.exists()) {
log.error("Specified file in USING not accessible, unable to execute the query further. Aborting.");
return null;
}
try {
properties.load(new FileInputStream(file));
} catch (final IOException e) {
log.error("Could not load model instance properties from specified model location in USING clause");
e.printStackTrace();
}
String propertiesFolder = new File(dmlPropertiesLocation).getParentFile().getAbsolutePath();
for (Entry<Object, Object> property : properties.entrySet()) {
String path = (String) property.getValue();
if (!new File(path).exists()) {
property.setValue(propertiesFolder + File.separator + path);
}
}
return properties;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment