Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial import of ecosystem transport services
- Loading branch information
David Corsar
committed
Apr 26, 2012
1 parent
756899a
commit c32a88a
Showing
157 changed files
with
4,864 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"/> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> | ||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>ecosystem.transport</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.maven.ide.eclipse.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.maven.ide.eclipse.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Mon Apr 23 12:08:35 IST 2012 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 | ||
org.eclipse.jdt.core.compiler.compliance=1.5 | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.source=1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#Mon Apr 23 12:08:35 IST 2012 | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
fullBuildGoals=process-test-resources | ||
resolveWorkspaceProjects=true | ||
resourceFilterGoals=process-resources resources\:testResources | ||
skipCompilerPlugin=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -sv -X DELETE $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -sv -X GET $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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> | ||
<groupId>uk.ac.dotrural.irp</groupId> | ||
<artifactId>ecosystem.transport</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>uk.ac.dotrural.irp</groupId> | ||
<artifactId>ecosystem.core</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<type>jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.me.jstott</groupId> | ||
<artifactId>jcoord</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<jetty.version>6.1.18</jetty.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>maven-jetty-plugin</artifactId> | ||
<version>${jetty.version}</version> | ||
<configuration> | ||
<systemProperties> | ||
<systemProperty> | ||
<name>http.proxyHost</name> | ||
<value>proxy.abdn.ac.uk</value> | ||
</systemProperty> | ||
<systemProperty> | ||
<name>http.proxyPort</name> | ||
<value>8080</value> | ||
</systemProperty> | ||
</systemProperties> | ||
<reload>manual</reload> | ||
<stopKey>stop</stopKey> | ||
<stopPort>9966</stopPort> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -sv -X POST -HContent-type:application/json --data "$1" $2 |
31 changes: 31 additions & 0 deletions
31
src/main/java/uk/ac/dotrural/irp/ecosystem/transport/Util.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package uk.ac.dotrural.irp.ecosystem.transport; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import uk.ac.dotrural.irp.ecosystem.transport.models.jaxb.timetable.Line; | ||
import uk.ac.dotrural.irp.ecosystem.transport.queries.alert.ServiceDays; | ||
|
||
public class Util { | ||
public static ServiceDays[] getServiceDays(boolean... days) { | ||
ArrayList<ServiceDays> selectedDays = new ArrayList<ServiceDays>(); | ||
ServiceDays[] serviceDays = ServiceDays.values(); | ||
|
||
for (int i = 0; i < days.length; i++) { | ||
if (days[i]) | ||
selectedDays.add(serviceDays[i]); | ||
} | ||
return selectedDays.toArray(new ServiceDays[selectedDays.size()]); | ||
} | ||
public static Line contains(List<Line> lines, String lineUri) { | ||
if (lines.size() == 0) | ||
return null; | ||
|
||
for (Line route : lines) { | ||
if (route.getUri().equals(lineUri.trim())) | ||
return route; | ||
} | ||
|
||
return null; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/main/java/uk/ac/dotrural/irp/ecosystem/transport/ecosystemTransportResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package uk.ac.dotrural.irp.ecosystem.transport; | ||
|
||
import javax.ws.rs.DELETE; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.PUT; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Context; | ||
import javax.ws.rs.core.UriInfo; | ||
|
||
import org.springframework.context.annotation.Scope; | ||
|
||
import uk.ac.dotrural.irp.ecosystem.core.models.jaxb.system.EndpointInfo; | ||
import uk.ac.dotrural.irp.ecosystem.core.models.jaxb.system.Query; | ||
import uk.ac.dotrural.irp.ecosystem.core.models.jaxb.system.ServiceInitialiser; | ||
import uk.ac.dotrural.irp.ecosystem.core.models.jaxb.system.SystemMessage; | ||
import uk.ac.dotrural.irp.ecosystem.core.resources.RESTFulSPARQL; | ||
import uk.ac.dotrural.irp.ecosystem.core.services.SPARQLEndpoint; | ||
import uk.ac.dotrural.irp.ecosystem.core.util.Util; | ||
|
||
@Path("/ecosystem.transport") | ||
@Scope("request") | ||
public class ecosystemTransportResource implements RESTFulSPARQL { | ||
|
||
@Context | ||
private UriInfo uriInfo; | ||
|
||
private SPARQLEndpoint ecosystemTransportEndpoint; | ||
|
||
public void setServiceEndpoint(SPARQLEndpoint ecosystemTransportEndpoint) { | ||
this.ecosystemTransportEndpoint = ecosystemTransportEndpoint; | ||
} | ||
|
||
public SystemMessage init(ServiceInitialiser si) { | ||
return ecosystemTransportEndpoint.init(uriInfo, si); | ||
} | ||
|
||
public void update(Query query) { | ||
ecosystemTransportEndpoint.update(query); | ||
} | ||
|
||
public String query(Query query) { | ||
return Util.resultsetToString(ecosystemTransportEndpoint.query(query)); | ||
} | ||
|
||
public EndpointInfo info() { | ||
return ecosystemTransportEndpoint.info(); | ||
} | ||
|
||
@POST | ||
@Path("create") | ||
public void create(){ | ||
// TODO incomplete method | ||
} | ||
|
||
@GET | ||
@Path("get") | ||
public Object get(){ | ||
// TODO incomplete method | ||
return null; | ||
} | ||
|
||
@DELETE | ||
@Path("delele") | ||
public void delete(){ | ||
// TODO incomplete method | ||
} | ||
|
||
@PUT | ||
@Path("update") | ||
public void update(){ | ||
// TODO incomplete method | ||
} | ||
} |
165 changes: 165 additions & 0 deletions
165
src/main/java/uk/ac/dotrural/irp/ecosystem/transport/models/jaxb/alert/Alert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
package uk.ac.dotrural.irp.ecosystem.transport.models.jaxb.alert; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
@XmlRootElement | ||
public class Alert | ||
{ | ||
private String uri; | ||
private String authenticationToken; | ||
private String userUri; | ||
private String lineUri; | ||
private boolean inbound; | ||
private double latitude; | ||
private double longitude; | ||
private int startTimeHour; | ||
private int startTimeMin; | ||
private int endTimeHour; | ||
private int endTimeMin; | ||
private int minutesBefore; | ||
private boolean [] days; | ||
|
||
@XmlElement(name="uri") | ||
public String getUri() | ||
{ | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) | ||
{ | ||
this.uri = uri; | ||
} | ||
|
||
@XmlElement(name="authenticationToken") | ||
public String getAuthenticationToken() | ||
{ | ||
return authenticationToken; | ||
} | ||
|
||
public void setAuthenticationToken(String authenticationToken) | ||
{ | ||
this.authenticationToken = authenticationToken; | ||
} | ||
|
||
@XmlElement(name="userUri") | ||
public String getUserUri() | ||
{ | ||
return userUri; | ||
} | ||
|
||
public void setUserUri(String userUri) | ||
{ | ||
this.userUri = userUri; | ||
} | ||
|
||
@XmlElement(name="lineUri") | ||
public String getLineUri() | ||
{ | ||
return lineUri; | ||
} | ||
|
||
public void setLineUri(String lineUri) | ||
{ | ||
this.lineUri = lineUri; | ||
} | ||
|
||
@XmlElement(name="inbound") | ||
public boolean getInbound() | ||
{ | ||
return inbound; | ||
} | ||
|
||
public void setInbound(boolean inbound) | ||
{ | ||
this.inbound = inbound; | ||
} | ||
|
||
@XmlElement(name="latitude") | ||
public double getLatitude() | ||
{ | ||
return latitude; | ||
} | ||
|
||
public void setLatitude(double latitude) | ||
{ | ||
this.latitude = latitude; | ||
} | ||
|
||
@XmlElement(name="longitude") | ||
public double getLongitude() | ||
{ | ||
return longitude; | ||
} | ||
|
||
public void setLongitude(double longitude) | ||
{ | ||
this.longitude = longitude; | ||
} | ||
|
||
@XmlElement(name="startTimeHour") | ||
public int getStartTimeHour() | ||
{ | ||
return startTimeHour; | ||
} | ||
|
||
public void setStartTimeHour(int startTimeHour) | ||
{ | ||
this.startTimeHour = startTimeHour; | ||
} | ||
|
||
@XmlElement(name="startTimeMin") | ||
public int getStartTimeMin() | ||
{ | ||
return startTimeMin; | ||
} | ||
|
||
public void setStartTimeMin(int startTimeMin) | ||
{ | ||
this.startTimeMin = startTimeMin; | ||
} | ||
|
||
@XmlElement(name="endTimeHour") | ||
public int getEndTimeHour() | ||
{ | ||
return endTimeHour; | ||
} | ||
|
||
public void setEndTimeHour(int endTimeHour) | ||
{ | ||
this.endTimeHour = endTimeHour; | ||
} | ||
|
||
@XmlElement(name="endTimeMin") | ||
public int getEndTimeMin() | ||
{ | ||
return endTimeMin; | ||
} | ||
|
||
public void setEndTimeMin(int endTimeMin) | ||
{ | ||
this.endTimeMin = endTimeMin; | ||
} | ||
|
||
@XmlElement(name="minutesBefore") | ||
public int getMinutesBefore() | ||
{ | ||
return minutesBefore; | ||
} | ||
|
||
public void setMinutesBefore(int minutesBefore) | ||
{ | ||
this.minutesBefore = minutesBefore; | ||
} | ||
|
||
@XmlElement(name="days") | ||
public boolean[] getDays() | ||
{ | ||
return days; | ||
} | ||
|
||
public void setDays(boolean[] days) | ||
{ | ||
this.days = days; | ||
} | ||
} |
Oops, something went wrong.