Skip to content

Commit 85c197c

Browse files
committed
Bundle reorganising. Aber support added.
1 parent 28ed02c commit 85c197c

18 files changed

Lines changed: 1403 additions & 16 deletions

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<artifactId>core</artifactId>
1919
<version>${project.version}</version>
2020
</dependency>
21+
<dependency>
22+
<groupId>org.geppetto</groupId>
23+
<artifactId>simulation</artifactId>
24+
<version>${project.version}</version>
25+
</dependency>
2126
<dependency>
2227
<groupId>org.springframework</groupId>
2328
<artifactId>org.springframework.core</artifactId>

src/main/java/META-INF/spring/osgi-config.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<osgi:service id="Neo4jDataSourceExporter" ref="neo4jDataSource"
1515
interface="org.geppetto.core.datasources.IDataSourceService">
1616
</osgi:service>
17-
<bean id="neo4jDataSource" scope="prototype" class="org.geppetto.datasources.Neo4jDataSourceService">
17+
<bean id="neo4jDataSource" scope="prototype" class="org.geppetto.datasources.neo4j.Neo4jDataSourceService">
1818
<aop:scoped-proxy proxy-target-class="false"/>
1919
</bean>
2020

21-
<osgi:service id="AmberOWLDataSourceExporter" ref="amberOWLDataSource"
21+
<osgi:service id="AberOWLDataSourceExporter" ref="aberOWLDataSource"
2222
interface="org.geppetto.core.datasources.IDataSourceService">
2323
</osgi:service>
24-
<bean id="amberOWLDataSource" scope="prototype" class="org.geppetto.datasources.AmberOWLDataSourceService">
24+
<bean id="aberOWLDataSource" scope="prototype" class="org.geppetto.datasources.aberowl.AberOWLDataSourceService">
2525
<aop:scoped-proxy proxy-target-class="false"/>
2626
</bean>
2727

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*******************************************************************************
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2011 - 2015 OpenWorm.
5+
* http://openworm.org
6+
*
7+
* All rights reserved. This program and the accompanying materials
8+
* are made available under the terms of the MIT License
9+
* which accompanies this distribution, and is available at
10+
* http://opensource.org/licenses/MIT
11+
*
12+
* Contributors:
13+
* OpenWorm - http://openworm.org/people.html
14+
*
15+
* Permission is hereby granted, free of charge, to any person obtaining a copy
16+
* of this software and associated documentation files (the "Software"), to deal
17+
* in the Software without restriction, including without limitation the rights
18+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19+
* copies of the Software, and to permit persons to whom the Software is
20+
* furnished to do so, subject to the following conditions:
21+
*
22+
* The above copyright notice and this permission notice shall be included in
23+
* all copies or substantial portions of the Software.
24+
*
25+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
29+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
30+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
31+
* USE OR OTHER DEALINGS IN THE SOFTWARE.
32+
*******************************************************************************/
33+
package org.geppetto.datasources;
34+
35+
import java.util.ArrayList;
36+
import java.util.List;
37+
38+
import org.geppetto.core.datasources.IDataSourceService;
39+
import org.geppetto.core.datasources.QueryChecker;
40+
import org.geppetto.core.model.GeppettoModelAccess;
41+
import org.geppetto.core.services.AService;
42+
import org.geppetto.model.DataSource;
43+
import org.geppetto.model.Query;
44+
import org.geppetto.model.variables.Variable;
45+
46+
/**
47+
* @author matteocantarelli
48+
*
49+
*/
50+
public abstract class ADataSourceService extends AService implements IDataSourceService
51+
{
52+
53+
public enum ConnectionType
54+
{
55+
GET, POST
56+
}
57+
58+
private DataSource configuration;
59+
60+
private String dataSourceTemplate;
61+
62+
private GeppettoModelAccess geppettoModelAccess;
63+
64+
public ADataSourceService(String dataSourceTemplate)
65+
{
66+
this.dataSourceTemplate = dataSourceTemplate;
67+
}
68+
69+
@Override
70+
public void initialize(DataSource configuration, GeppettoModelAccess geppettoModelAccess)
71+
{
72+
this.configuration = configuration;
73+
this.geppettoModelAccess = geppettoModelAccess;
74+
}
75+
76+
protected GeppettoModelAccess getGeppettoModelAccess()
77+
{
78+
return geppettoModelAccess;
79+
}
80+
81+
protected String getTemplate()
82+
{
83+
return dataSourceTemplate;
84+
}
85+
86+
/**
87+
* @return the configuration for this DataSourceService
88+
*/
89+
protected DataSource getConfiguration()
90+
{
91+
return configuration;
92+
}
93+
94+
/**
95+
* @param url
96+
* @param queryString
97+
* @return
98+
*/
99+
protected String getQueryURL(String url, String queryString)
100+
{
101+
String queryURL = null;
102+
// TODO Do we need a template? Plain concatenation?
103+
return queryURL;
104+
}
105+
106+
/*
107+
* (non-Javadoc)
108+
*
109+
* @see org.geppetto.core.model.QueryProvider#getAvailableQueries(org.geppetto.model.variables.Variable)
110+
*/
111+
@Override
112+
public List<Query> getAvailableQueries(Variable variable)
113+
{
114+
List<Query> availableQueries = new ArrayList<Query>();
115+
for(Query query : configuration.getQueries())
116+
{
117+
if(QueryChecker.check(query, variable))
118+
{
119+
availableQueries.add(query);
120+
}
121+
}
122+
return availableQueries;
123+
}
124+
125+
/*
126+
* (non-Javadoc)
127+
*
128+
* @see org.geppetto.core.services.IService#registerGeppettoService()
129+
*/
130+
@Override
131+
public void registerGeppettoService() throws Exception
132+
{
133+
// Nothing to do here
134+
}
135+
136+
}

src/main/java/org/geppetto/datasources/DummyDataSourceService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*******************************************************************************/
3333
package org.geppetto.datasources;
3434

35-
import org.geppetto.core.datasources.ADataSourceService;
3635
import org.geppetto.core.datasources.GeppettoDataSourceException;
3736
import org.geppetto.core.datasources.IDataSourceService;
3837
import org.geppetto.core.datasources.IQueryListener;

0 commit comments

Comments
 (0)