Skip to content

Commit 1117bba

Browse files
Rodolfo Totarorodolfototaro
authored andcommitted
eclipse-archived#190 First Implementation of TriQuetrum Command Language (TqCL)
1 parent 4319819 commit 1117bba

File tree

195 files changed

+30667
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+30667
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.DS_Store
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src/main/java"/>
6+
<classpathentry kind="output" path="target/classes"/>
7+
</classpath>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>org.eclipse.triquetrum.commands.api</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.pde.ds.core.builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.pde.PluginNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: TqCL Api
4+
Bundle-SymbolicName: org.eclipse.triquetrum.commands.api
5+
Bundle-Version: 0.1.0.qualifier
6+
Bundle-Activator: org.eclipse.triquetrum.commands.api.TqCLServices
7+
Bundle-Vendor: Eclipse Triquetrum
8+
Require-Bundle: org.eclipse.core.runtime,
9+
org.eclipse.osgi.services;bundle-version="3.5.100"
10+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
11+
Bundle-ActivationPolicy: lazy
12+
Export-Package: org.eclipse.triquetrum.commands.api,
13+
org.eclipse.triquetrum.commands.api.services
14+
Service-Component: OSGI-INF/librariesProvider.xml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.triquetrum.commands.api">
3+
<implementation class="org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy"/>
4+
<reference bind="addLibraryProvider" cardinality="1..n" interface="org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider" name="TqCLLibraryProvider" policy="dynamic"/>
5+
<service>
6+
<provide interface="org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy"/>
7+
</service>
8+
</scr:component>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
output.. = target/classes/
2+
bin.includes = META-INF/,\
3+
.,\
4+
OSGI-INF/librariesProvider.xml
5+
source.. = src/main/java/
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Totaro Rodolfo
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Rodolfo Totaro - initial API and implementation and/or initial documentation
10+
*******************************************************************************/
11+
package org.eclipse.triquetrum.commands.api;
12+
13+
import java.util.Collection;
14+
15+
import org.eclipse.triquetrum.commands.api.services.ModelBuilderService;
16+
import org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider;
17+
import org.eclipse.triquetrum.commands.api.services.impl.TcQLLibraryProviderProxy;
18+
import org.osgi.framework.BundleActivator;
19+
import org.osgi.framework.BundleContext;
20+
import org.osgi.framework.InvalidSyntaxException;
21+
import org.osgi.framework.ServiceObjects;
22+
import org.osgi.framework.ServiceReference;
23+
24+
public class TqCLServices implements BundleActivator {
25+
26+
private static BundleContext context;
27+
28+
private static TqCLServices instance;
29+
30+
static BundleContext getContext() {
31+
return context;
32+
}
33+
34+
/*
35+
* (non-Javadoc)
36+
*
37+
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.
38+
* BundleContext)
39+
*/
40+
public void start(BundleContext bundleContext) throws Exception {
41+
TqCLServices.context = bundleContext;
42+
instance=this;
43+
}
44+
45+
/*
46+
* (non-Javadoc)
47+
*
48+
* @see
49+
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
50+
*/
51+
public void stop(BundleContext bundleContext) throws Exception {
52+
TqCLServices.context = null;
53+
instance=null;
54+
}
55+
56+
public static TqCLServices getInstance() {
57+
return instance;
58+
}
59+
60+
@SuppressWarnings("rawtypes")
61+
public ModelBuilderService getModelBuilderService(Class<?> modelClass) {
62+
try {
63+
Collection<ServiceReference<ModelBuilderService>> serviceReferences = getContext()
64+
.getServiceReferences(ModelBuilderService.class, null);
65+
for (ServiceReference<ModelBuilderService> serviceReference : serviceReferences) {
66+
//TODO:Release service when done
67+
ServiceObjects<ModelBuilderService> serviceObjects = getContext().getServiceObjects(serviceReference);
68+
ModelBuilderService service = serviceObjects.getService();
69+
if (service.getSupportedModelClass() == modelClass) {
70+
return service;
71+
}
72+
}
73+
} catch (InvalidSyntaxException e) {
74+
// TODO Auto-generated catch block
75+
e.printStackTrace();
76+
}
77+
78+
return null;
79+
}
80+
81+
public TqCLLibraryProvider getTqclLibraryProvider()
82+
{
83+
ServiceReference<TcQLLibraryProviderProxy> serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class);
84+
TcQLLibraryProviderProxy service = getContext().getService(serviceReference);
85+
return service;
86+
}
87+
88+
89+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.eclipse.triquetrum.commands.api.services;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class ActorDescriptor extends EntityDescriptor {
7+
8+
private List<PortDescriptor> ports = new ArrayList<>();
9+
10+
public ActorDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
11+
super(sourceLibrary,displayName, clazz, icon);
12+
}
13+
14+
@Override
15+
public String getCategory() {
16+
return "Actor";
17+
}
18+
19+
public void addPort(PortDescriptor port)
20+
{
21+
ports.add(port);
22+
}
23+
24+
public List<PortDescriptor> getPorts() {
25+
return ports;
26+
}
27+
28+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.eclipse.triquetrum.commands.api.services;
2+
3+
public class DirectorDescriptor extends EntityDescriptor {
4+
5+
public DirectorDescriptor(String sourceLibrary,String displayName, String clazz, String icon) {
6+
super(sourceLibrary,displayName, clazz, icon);
7+
// TODO Auto-generated constructor stub
8+
}
9+
10+
@Override
11+
public String getCategory() {
12+
return "Director";
13+
}
14+
15+
}

0 commit comments

Comments
 (0)