Permalink
Browse files

Premier commit avec la base de JAX RS + Jetty

  • Loading branch information...
0 parents commit 26228be00d812b3dc3318976e3701bcafd2e7b46 sdaclin committed Apr 25, 2011
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+ <action>
+ <actionName>CUSTOM-Jetty Run</actionName>
+ <displayName>Jetty Run</displayName>
+ <goals>
+ <goal>jetty:run</goal>
+ </goals>
+ </action>
+ <action>
+ <actionName>run</actionName>
+ <goals>
+ <goal>jetty:stop</goal>
+ <goal>jetty:run</goal>
+ </goals>
+ </action>
+ <action>
+ <actionName>debug</actionName>
+ <goals>
+ <goal>package</goal>
+
+ </goals>
+ <properties>
+
+
+ <netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
+ </properties>
+ </action>
+ </actions>
132 pom.xml
@@ -0,0 +1,132 @@
+
+<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>fr.astek.gex</groupId>
+ <artifactId>GexServer</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <name>GexServer Web App</name>
+
+ <properties>
+ <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jdkLevel>1.5</jdkLevel>
+ <jetty.plugin.version>6.1.26</jetty.plugin.version>
+ <jetty.version>7.4.0.v20110414</jetty.version>
+ <jersey.version>1.6</jersey.version>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-json</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-http</artifactId>
+ <version>${jetty.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>${jdkLevel}</source>
+ <target>${jdkLevel}</target>
+ <compilerArguments>
+ <endorseddirs>${endorsed.dir}</endorseddirs>
+ </compilerArguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>${jetty.plugin.version}</version>
+ <configuration>
+ <stopPort>9966</stopPort>
+ <stopKey>jetty-stop</stopKey>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
+ <filename>target/yyyy_mm_dd.request.log</filename>
+ <retainDays>90</retainDays>
+ <append>true</append>
+ <extended>true</extended>
+ <logTimeZone>GMT</logTimeZone>
+ </requestLog>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${endorsed.dir}</outputDirectory>
+ <silent>true</silent>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax</groupId>
+ <artifactId>javaee-endorsed-api</artifactId>
+ <version>6.0</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <finalName>GexServer</finalName>
+ </build>
+
+</project>
@@ -0,0 +1,65 @@
+package fr.astek.gex.model;
+
+import java.util.Date;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author sdaclin
+ */
+@XmlRootElement
+public class Exigence {
+ String id;
+ String nodeId;
+ String parentId;
+ Date date;
+ TypeExigence type;
+ String text;
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public TypeExigence getType() {
+ return type;
+ }
+
+ public void setType(TypeExigence type) {
+ this.type = type;
+ }
+}
@@ -0,0 +1,33 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package fr.astek.gex.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author sdaclin
+ */
+@XmlRootElement
+public class JsonElt {
+ private String name="Durand";
+ private String firstName="Pierre";
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
@@ -0,0 +1,66 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package fr.astek.gex.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author sdaclin
+ */
+@XmlRootElement
+public class Node {
+
+ String id;
+ String parentId;
+ String typeExigenceTree;
+ String label;
+ Boolean project;
+
+ public Node(){};
+
+ public Node(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Boolean getProject() {
+ return project;
+ }
+
+ public void setProject(Boolean project) {
+ this.project = project;
+ }
+
+ public String getTypeExigenceTree() {
+ return typeExigenceTree;
+ }
+
+ public void setTypeExigenceTree(String typeExigenceTree) {
+ this.typeExigenceTree = typeExigenceTree;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+}
@@ -0,0 +1,28 @@
+package fr.astek.gex.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author sdaclin
+ */
+@XmlRootElement
+public class TypeExigence {
+ private String id;
+ private String label;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
@@ -0,0 +1,31 @@
+package fr.astek.gex.server.rest;
+
+import fr.astek.gex.model.Node;
+import fr.astek.gex.server.service.AgexService;
+import java.util.List;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author sdaclin
+ */
+@Path("/node")
+public class NodeResource {
+
+ @GET
+ @Path("/list/{nodeId}")
+ @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
+ public List<Node> getNodeContent(@PathParam("nodeId") String nodeId) {
+ return AgexService.listNode(nodeId);
+ }
+
+ @GET
+ @Path("/id/{nodeId}")
+ @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
+ public Node getNode(@PathParam("nodeId") String nodeId) {
+ return AgexService.getNode(nodeId);
+ }
+}
Oops, something went wrong.

0 comments on commit 26228be

Please sign in to comment.