Skip to content

Commit

Permalink
eclipse-archived#190 First Implementation of TriQuetrum Command Langu…
Browse files Browse the repository at this point in the history
…age (TqCL)

Signed-off-by: Rodolfo Totaro <[email protected]>
  • Loading branch information
rtotaro committed Feb 14, 2017
1 parent 4319819 commit 3d3a036
Show file tree
Hide file tree
Showing 195 changed files with 30,918 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.DS_Store
7 changes: 7 additions & 0 deletions org.eclipse.triquetrum.commands.api/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?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.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions org.eclipse.triquetrum.commands.api/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.triquetrum.commands.api</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
14 changes: 14 additions & 0 deletions org.eclipse.triquetrum.commands.api/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TqCL Api
Bundle-SymbolicName: org.eclipse.triquetrum.commands.api
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: org.eclipse.triquetrum.commands.api.TqCLServices
Bundle-Vendor: Eclipse Triquetrum
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osgi.services;bundle-version="3.5.100"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.triquetrum.commands.api,
org.eclipse.triquetrum.commands.api.services
Service-Component: OSGI-INF/librariesProvider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.triquetrum.commands.api">
<implementation class="org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy"/>
<reference bind="addLibraryProvider" cardinality="1..n" interface="org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider" name="TqCLLibraryProvider" policy="dynamic"/>
<service>
<provide interface="org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy"/>
</service>
</scr:component>
5 changes: 5 additions & 0 deletions org.eclipse.triquetrum.commands.api/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output.. = target/classes/
bin.includes = META-INF/,\
.,\
OSGI-INF/librariesProvider.xml
source.. = src/main/java/
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*******************************************************************************
* Copyright (c) 2016 Totaro Rodolfo
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rodolfo Totaro - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.triquetrum.commands.api;

import java.util.Collection;

import org.eclipse.triquetrum.commands.api.services.ModelBuilderService;
import org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider;
import org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceObjects;
import org.osgi.framework.ServiceReference;

public class TqCLServices implements BundleActivator {

private static BundleContext context;

private static TqCLServices instance;

static BundleContext getContext() {
return context;
}

/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.
* BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
TqCLServices.context = bundleContext;
instance=this;
}

/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
TqCLServices.context = null;
instance=null;
}

public static TqCLServices getInstance() {
return instance;
}

@SuppressWarnings("rawtypes")
public ModelBuilderService getModelBuilderService(Class<?> modelClass) {
try {
Collection<ServiceReference<ModelBuilderService>> serviceReferences = getContext()
.getServiceReferences(ModelBuilderService.class, null);
for (ServiceReference<ModelBuilderService> serviceReference : serviceReferences) {
//TODO:Release service when done
ServiceObjects<ModelBuilderService> serviceObjects = getContext().getServiceObjects(serviceReference);
ModelBuilderService service = serviceObjects.getService();
if (service.getSupportedModelClass() == modelClass) {
return service;
}
}
} catch (InvalidSyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return null;
}

public TqCLLibraryProvider getTqclLibraryProvider()
{
ServiceReference<TcQLLibraryProviderProxy> serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class);
TcQLLibraryProviderProxy service = getContext().getService(serviceReference);
return service;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.eclipse.triquetrum.commands.api.services;

import java.util.ArrayList;
import java.util.List;

public class ActorDescriptor extends EntityDescriptor {

private List<PortDescriptor> ports = new ArrayList<>();

public ActorDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
super(sourceLibrary,displayName, clazz, icon);
}

@Override
public String getCategory() {
return "Actor";
}

public void addPort(PortDescriptor port)
{
ports.add(port);
}

public List<PortDescriptor> getPorts() {
return ports;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.eclipse.triquetrum.commands.api.services;

public class DirectorDescriptor extends EntityDescriptor {

public DirectorDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
super(sourceLibrary,displayName, clazz, icon);
// TODO Auto-generated constructor stub
}

@Override
public String getCategory() {
return "Director";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.eclipse.triquetrum.commands.api.services;

import java.util.ArrayList;
import java.util.List;

public abstract class EntityDescriptor {

private String clazz;

private String displayName;

private String icon;

private String sourceLibrary;

private List<ParameterDescriptor> parameters = new ArrayList<>();

public EntityDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
super();
this.sourceLibrary = sourceLibrary;
this.displayName = displayName;
this.clazz = clazz;
this.icon = icon;
}


public String getSourceLibrary() {
return sourceLibrary;
}

public String getClazz() {
return clazz;
}

public String getDisplayName() {
return displayName;
}

public String getIcon() {
return icon;
}

public abstract String getCategory();


public void addParameter(ParameterDescriptor parameter) {
parameters.add(parameter);
}


public List<ParameterDescriptor> getParameters() {
return parameters;
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2016 Totaro Rodolfo
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rodolfo Totaro - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.triquetrum.commands.api.services;

import java.util.Map;


public interface ModelBuilderService<CompositeActor,Actor> {

public Class<?> getSupportedModelClass();

public CompositeActor createNewModel(String modelName, String folderPath);

public boolean insertActor(CompositeActor parent,String actorName,String actorclass,Map<String,String> parameters);

public boolean insertDirector(CompositeActor actor,String directorName, String entityClass, Map<String, String> params);

public boolean insertPort(Actor actor, String portClass, String entityClass, Map<String, String> params);

public boolean insertParameter(Actor actor, String parameterClass, String entityClass, Map<String, String> params);

public CompositeActor getParent(Actor actor);

public Actor getChild(CompositeActor parent, String name);

public boolean connect(CompositeActor currentActor, String from, String to);



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.eclipse.triquetrum.commands.api.services;

public class ParameterDescriptor extends EntityDescriptor {

private String defaultValue="";

public ParameterDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
super(sourceLibrary,displayName, clazz, icon);
}

@Override
public String getCategory() {
return "Parameter";
}

public String getDefaultValue() {
return defaultValue;
}

public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.eclipse.triquetrum.commands.api.services;

public class PortDescriptor extends EntityDescriptor {

private boolean input;

private boolean output;


public PortDescriptor(String sourceLibrary,String displayName, String clazz, String icon,boolean input,boolean output) {
super(sourceLibrary,displayName, clazz, icon);
this.input = input;
this.output = output;
}

@Override
public String getCategory() {
return "Port";
}



public boolean isInput() {
return input;
}

public boolean isOutput() {
return output;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2016 Totaro Rodolfo
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rodolfo Totaro - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.triquetrum.commands.api.services;

public class TcQLException extends Exception {

/**
*
*/
private static final long serialVersionUID = 8072711939052951422L;

}
Loading

0 comments on commit 3d3a036

Please sign in to comment.