changeset 0:813aa2c5bc4b

first ingest
author dwinter
date Wed, 24 Nov 2010 16:56:28 +0100
parents
children ede4c4ead6f5
files .classpath .project .settings/.jsdtscope .settings/org.eclipse.core.resources.prefs .settings/org.eclipse.jdt.core.prefs .settings/org.eclipse.wst.common.component .settings/org.eclipse.wst.common.project.facet.core.xml .settings/org.eclipse.wst.jsdt.ui.superType.container .settings/org.eclipse.wst.jsdt.ui.superType.name WebContent/META-INF/MANIFEST.MF WebContent/WEB-INF/web.xml libs/log4j-1.2.15.jar libs/org.restlet.ext.servlet.jar libs/org.restlet.jar src/de/mpiwg/itgroup/metaDataManagerRestlet/RestServer.java src/de/mpiwg/itgroup/metaDataManagerRestlet/pid/PIDcreator.java src/de/mpiwg/itgroup/metaDataManagerRestlet/staticPages/PID.html
diffstat 17 files changed, 251 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.classpath	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6.0 (MacOS X Default)">
+		<attributes>
+			<attribute name="owner.project.facets" value="java"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
+		<attributes>
+			<attribute name="owner.project.facets" value="jst.web"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+	<classpathentry kind="lib" path="libs/org.restlet.jar"/>
+	<classpathentry kind="lib" path="libs/log4j-1.2.15.jar"/>
+	<classpathentry kind="lib" path="libs/org.restlet.ext.servlet.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/MetaDataManager"/>
+	<classpathentry kind="output" path="build/classes"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.project	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MetaDataManagerRestlet</name>
+	<comment></comment>
+	<projects>
+		<project>MetaDataManager</project>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/.jsdtscope	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="WebContent"/>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+		<attributes>
+			<attribute name="hide" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+	<classpathentry kind="output" path=""/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.core.resources.prefs	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,3 @@
+#Mon Aug 16 12:52:16 CEST 2010
+eclipse.preferences.version=1
+encoding//src/de/mpiwg/itgroup/metaDataManagerRestlet/staticPages/PID.html=UTF-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.jdt.core.prefs	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,8 @@
+#Mon Aug 16 10:21:43 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.wst.common.component	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+    <wb-module deploy-name="MetaDataManagerRestlet">
+        <wb-resource deploy-path="/" source-path="/WebContent"/>
+        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
+        <dependent-module archiveName="log4j-1.2.15.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/MetaDataManagerRestlet/libs/log4j-1.2.15.jar">
+            <dependency-type>uses</dependency-type>
+        </dependent-module>
+        <dependent-module archiveName="org.restlet.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/MetaDataManagerRestlet/libs/org.restlet.jar">
+            <dependency-type>uses</dependency-type>
+        </dependent-module>
+        <dependent-module archiveName="org.restlet.ext.servlet.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/MetaDataManagerRestlet/libs/org.restlet.ext.servlet.jar">
+            <dependency-type>uses</dependency-type>
+        </dependent-module>
+        <dependent-module archiveName="MetaDataManager.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/MetaDataManager/MetaDataManager">
+            <dependency-type>uses</dependency-type>
+        </dependent-module>
+        <property name="java-output-path" value="/MetaDaterManagerRestlet/build/classes"/>
+        <property name="context-root" value="MetaDataManagerRestlet"/>
+    </wb-module>
+</project-modules>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <runtime name="Apache Tomcat v6.0"/>
+  <fixed facet="jst.web"/>
+  <fixed facet="java"/>
+  <fixed facet="wst.jsdt.web"/>
+  <installed facet="java" version="1.6"/>
+  <installed facet="jst.web" version="2.5"/>
+  <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,1 @@
+Window
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebContent/META-INF/MANIFEST.MF	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebContent/WEB-INF/web.xml	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4"
+xmlns="http://java.sun.com/xml/ns/j2ee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+<display-name>RESTfulJavaWebServices-Restlet</display-name>
+<!-- Application classname -->
+<context-param>
+<param-name>org.restlet.application</param-name>
+<param-value>de.mpiwg.itgroup.metaDataManagerRestlet.RestServer</param-value>
+</context-param>
+
+
+<!-- Restletadapter -->
+<servlet>
+<servlet-name>RestletServlet</servlet-name>
+<servlet-class>
+org.restlet.ext.servlet.ServerServlet
+</servlet-class>
+</servlet>
+
+<!-- Catchallrequests -->
+<servlet-mapping>
+<servlet-name>RestletServlet</servlet-name>
+<url-pattern>/*</url-pattern>
+</servlet-mapping>
+</web-app>
\ No newline at end of file
Binary file libs/log4j-1.2.15.jar has changed
Binary file libs/org.restlet.ext.servlet.jar has changed
Binary file libs/org.restlet.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/metaDataManagerRestlet/RestServer.java	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,39 @@
+package de.mpiwg.itgroup.metaDataManagerRestlet;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.restlet.Application;
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.routing.Router;
+import org.restlet.routing.Template;
+import org.restlet.routing.TemplateRoute;
+
+import de.mpiwg.itgroup.metaDataManagerRestlet.pid.PIDcreator;
+
+
+
+public class RestServer extends Application {
+
+	public RestServer(Context parentContext){
+		super(parentContext);
+		
+		Logger rl = Logger.getRootLogger();
+		BasicConfigurator.configure();
+		rl.setLevel(Level.DEBUG);
+		
+		
+	}
+	
+	public synchronized Restlet createInboundRoot(){
+		Router router = new Router(getContext());
+		
+		router.attach("/PID",PIDcreator.class);
+		
+		
+		
+		return router;
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/metaDataManagerRestlet/pid/PIDcreator.java	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,60 @@
+package de.mpiwg.itgroup.metaDataManagerRestlet.pid;
+
+import java.io.InputStream;
+
+import org.apache.log4j.Logger;
+import org.restlet.data.Form;
+import org.restlet.data.MediaType;
+import org.restlet.representation.InputRepresentation;
+import org.restlet.representation.Representation;
+import org.restlet.representation.StringRepresentation;
+import org.restlet.resource.Get;
+import org.restlet.resource.Options;
+import org.restlet.resource.Post;
+import org.restlet.resource.ServerResource;
+
+import de.mpiwg.itgroup.metadataManager.pid.PidGenerator;
+
+
+
+public class PIDcreator extends ServerResource {
+
+private Logger logger = Logger.getRootLogger();
+	
+	/**
+	 * Erlaubt cross scripting bei Aufruf aus Javascript
+	 * @param entity
+	 */
+	@Options
+	public void doOptions(Representation entity) {
+	    Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers");
+	    if (responseHeaders == null) {
+	        responseHeaders = new Form();
+	        getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
+	    }
+	    responseHeaders.add("Access-Control-Allow-Origin", "*");
+	    responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS,GET");
+	    responseHeaders.add("Access-Control-Allow-Headers", "Content-Type");
+	    responseHeaders.add("Access-Control-Allow-Credentials", "false");
+	    responseHeaders.add("Access-Control-Max-Age", "60");
+	}
+
+	@Post
+	public Representation createPid(){
+		PidGenerator pg = new PidGenerator();
+		String pid = pg.getPID();
+		Representation rep = new StringRepresentation(pid, MediaType.TEXT_PLAIN);
+		return rep;
+	}
+	
+	@Get("html")
+	public Representation getHTML(){
+		InputStream is = getClass().getResourceAsStream("/de/mpiwg/itgroup/metaDataManagerRestlet/staticPages/PID.html");
+		
+		Representation rep = new InputRepresentation(is,MediaType.TEXT_HTML);
+		return rep;
+		
+	}
+	
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/metaDataManagerRestlet/staticPages/PID.html	Wed Nov 24 16:56:28 2010 +0100
@@ -0,0 +1,7 @@
+<html>
+<body>
+<h1>PID Generator</h1>
+<p>Erzeugt PIDs für den Gebrauch am MPIWG</p>
+<p>Usage: POST /PID, zurück kommt eine ID als Plain-Text.
+</body>
+</html>
\ No newline at end of file