Date: Thu, 28 Mar 2024 06:02:13 -0400 (EDT) Message-ID: <1602333538.27372.1711620133060@lyrasis1-roc-mp1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_27371_1580578458.1711620133060" ------=_Part_27371_1580578458.1711620133060 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This document will walk you through getting the code, building the webap= p, and exercising the REST API.
Fedora 4 requires Java 7 and Maven 3 (only for building the project). Ch= eck that you have them installed before proceeding:
$ java = -version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) $ mvn -version Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800) Maven home: /usr/share/maven Java version: 1.7.0_12-ea, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/= jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"
You can download pre-compiled binaries= and ru= n Fedora 4 in an existing Tomcat or Jetty instance. or pre-packaged Jet= ty instances, or build Fedora 4 from source (it's not difficult or too time= consuming).
Clone the latest code from Github:
$ git c= lone https://github.com/fcrepo4/fcrepo4.git Cloning into 'fc4'... remote: Counting objects: 40152, done. remote: Compressing objects: 100% (12759/12759), done. Receiving objects: 14% (5622/40152), 3.68 MiB | 912 KiB/s =20 [...] $ cd fcrepo4
And build the pro= ject (the first time you build Fedora 4 may take some time and bandwidth to= download all the development dependencies):
$ MAVEN= _OPTS=3D"-Xmx1024m -XX:MaxPermSize=3D256m" mvn clean install [INFO] Scanning for projects... [INFO] --------------------------------------------------------------------= ---- [INFO] Reactor Build Order: [INFO]=20 [INFO] fcrepo4 [INFO] fcrepo-jcr [INFO] fcrepo-metrics [INFO] fcrepo-storage-policy [INFO] fcrepo-kernel [INFO] fcrepo-audit [INFO] fcrepo-jms [INFO] fcrepo-serialization [INFO] fcrepo-http-commons [INFO] fcrepo-http-api [INFO] fcrepo-generator-dc [INFO] fcrepo-webapp [INFO] fcrepo-rss [INFO] fcrepo-webhooks [INFO] = =20 [INFO] --------------------------------------------------------------------= ---- [INFO] Building fcrepo4 4.0-SNAPSHOT [INFO] --------------------------------------------------------------------= ---- [INFO]=20 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ fcrepo --- [INFO] Deleting /Volumes/TempStorage/fedora4/fcrepo4/target [INFO]=20 [INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ fcrepo --- [INFO]=20 [INFO] --- maven-enforcer-plugin:1.2:enforce (default) @ fcrepo --- [INFO]=20 [INFO] --- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (pre-unit-t= est) @ fcrepo --- [....]
The webapp can be run from a bundled instance of jetty. The application =
will listen on port 8080 by default.
If you would like to run the webapp on a different port, you can add the "=
jetty.port" option in your maven command (e.g. mvn -Djetty.port=3D8=
181 jetty:run)
$ cd fc= repo-webapp $ MAVEN_OPTS=3D"-Xmx512m" mvn jetty:run [...] TRACE 10:50:43.845 (SessionProvider) Returning new InjectableSession... DEBUG 10:50:43.845 (InjectableSession) Initializing an InjectableSession wi= th SessionFactory org.fcrepo.session.SessionFactory@5a3c8525. TRACE 10:50:43.846 (SessionProvider) Returning new InjectableSession... DEBUG 10:50:43.846 (InjectableSession) Initializing an InjectableSession wi= th SessionFactory org.fcrepo.session.SessionFactory@5a3c8525. 2013-07-01 10:50:44.027:INFO:oejs.AbstractConnector:Started SelectChannelCo= nnector@0.0.0.0:8080 [INFO] Started Jetty Server [INFO] Starting scanner at interval of 2 seconds.
There's a nice, f= riendly HTML interface waiting for you at http://localhost:8080/rest/
The REST API documentatio= n provides a full listing of the features and functions of the REST API= . Here are some examples to get you started:
$ curl = "http://localhost:8080/rest/" @prefix dc: <http://purl.org/dc/terms/> . @prefix nt: <http://www.jcp.org/jcr/nt/1.0> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix test: <info:fedora/test/> . @prefix fedora-internal: <info:fedora/fedora-system:def/internal#> . @prefix image: <http://www.modeshape.org/images/1.0> . @prefix xs: <http://www.w3.org/2001/XMLSchema> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix fedorarelsext: <info:fedora/fedora-system:def/relations-external= #> . @prefix mix: <http://www.jcp.org/jcr/mix/1.0> . @prefix mode: <http://www.modeshape.org/1.0> . @prefix sv: <http://www.jcp.org/jcr/sv/1.0> . @prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> . @prefix fedora: <info:fedora/> . <http://localhost:8080/rest/> <http://microformats.org/wiki/rel-sitemap> <http://localhost:8080/rest/sitemap> ; <http://www.whatwg.org/specs/web-apps/current-work/#link-type-se= arch> <http://localhost:8080/rest/fcr:search> ; fedora:exportsAs <http://localhost:8080/rest//fcr= :export?format=3Djcr/xml> ; fedora-internal:clusterCacheMode "LOCAL" ; fedora-internal:clusterMembers "local" ; fedora-internal:clusterName "ISPN" ; fedora-internal:clusterNodeAddress "local" ; fedora-internal:clusterNodeView "Unknown" ; fedora-internal:clusterPhysicalAddress ...
The REST API supports a variety of RDF serialization formats, including:=
$ curl = http://localhost:8080/rest/ -H "Accept: application/rdf+xml" <rdf:RDF xmlns:fedora=3D"info:fedora/" xmlns:fedora-internal=3D"info:fedora/fedora-system:def/internal#" xmlns:image=3D"http://www.modeshape.org/images/1.0" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:mix=3D"http://www.jcp.org/jcr/mix/1.0" xmlns:test=3D"info:fedora/test/" xmlns:fedorarelsext=3D"info:fedora/fedora-system:def/relations-external= #" xmlns:nt=3D"http://www.jcp.org/jcr/nt/1.0" xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf=3D"http://xmlns.com/foaf/0.1/" xmlns:mode=3D"http://www.modeshape.org/1.0" xmlns:j.0=3D"info:fedora/fedora-system:def/internal#repository/" xmlns:xs=3D"http://www.w3.org/2001/XMLSchema" xmlns:j.1=3D"http://microformats.org/wiki/" xmlns:dc=3D"http://purl.org/dc/terms/" xmlns:sv=3D"http://www.jcp.org/jcr/sv/1.0" xmlns:j.2=3D"http://www.whatwg.org/specs/web-apps/current-work/#" xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#" >=20 <rdf:Description rdf:about=3D"http://localhost:8080/rest//fcr:export?f= ormat=3Djcr/xml"> <rdfs:label>jcr/xml</rdfs:label> </rdf:Description> <rdf:Description rdf:about=3D"http://localhost:8080/rest/"> <fedora-internal:numberOfChildren rdf:datatype=3D"http://www.w3.org/= 2001/XMLSchema#long">0</fedora-internal:numberOfChildren> <fedora-internal:hasNodeType>nt:unstructured</fedora-internal:= hasNodeType> <j.0:jcr.specification.version>2.0</j.0:jcr.specification.vers= ion> <j.0:option.unfiled.content.supported>false</j.0:option.unfile= d.content.supported> <fedora-internal:clusterNodeAddress>local</fedora-internal:clu= sterNodeAddress> <fedora-internal:hasNodeType>mix:referenceable</fedora-interna= l:hasNodeType> <j.0:node.type.management.update.in.use.suported>true</j.0:nod= e.type.management.update.in.use.suported> <j.0:query.xpath.doc.order>false</j.0:query.xpath.doc.order>= ; <j.0:level.2.supported>true</j.0:level.2.supported> <fedora-internal:hasNodeType>nt:resource</fedora-internal:hasN= odeType> <fedora-internal:hasNodeType>fedora:datastream</fedora-interna= l:hasNodeType>
or
$ curl = http://localhost:8080/rest/ -H "Accept: application/n-triples" <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#numberOfChildren> "0"^^<http://www.w3.org/2001/XMLSchema#long>= . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#hasNodeType> "nt:unstructured" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#repository/jcr.specification.version> "2.0" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#repository/option.unfiled.content.supported> "false" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#clusterNodeAddress> "local" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#hasNodeType> "mix:referenceable" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#repository/node.type.management.update.in.use.suported> "true" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#repository/query.xpath.doc.order> "false" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#repository/level.2.supported> "true" . <http://localhost:8080/rest/> <info:fedora/fedora-system:def/inter= nal#hasNodeType> "nt:resource" .
$ curl = http://localhost:8080/rest/ -X POST -v * About to connect() to localhost port 8080 (#0) * Trying ::1... * connected * Connected to localhost (::1) port 8080 (#0) > POST /rest/fcr:new HTTP/1.1 > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenS= SL/0.9.8r zlib/1.2.5 > Host: localhost:8080 > Accept: */* >=20 < HTTP/1.1 201 Created < Location: http://localhost:8080/rest/7f/50/8e/82/7f508e82-15f7-48de-92= a3-2575a1b749cf < Content-Type: text/plain < Transfer-Encoding: chunked < Server: Jetty(8.1.11.v20130520) $ curl http://localhost:8080/rest/7f/50/8e/82/7f508e82-15f7-48de-92a3-2575a= 1b749cf <http://localhost:8080/rest/7f/50/8e/82/7f508e82-15f7-48de-92a3-2575a1b7= 49cf> fedora:exportsAs <http://localhost:8080/rest/7f/5= 0/8e/82/7f508e82-15f7-48de-92a3-2575a1b749cf/fcr:export?format=3Djcr/xml>= ; ; fedora-internal:baseVersion <info:fedora/jcr:system/jcr:vers= ionStorage/0e/4e/11/0e4e11e565da7612554b06b092ee5e6e5fc1abec/jcr:rootVersio= n> ; fedora-internal:created "2013-07-01T17:52:51.406Z"^^<htt= p://www.w3.org/2001/XMLSchema#dateTime> ; fedora-internal:createdBy "<anonymous>" ; fedora-internal:createdby "<anonymous>" ; fedora-internal:hasParent <http://localhost:8080/rest/7f/5= 0/8e/82> ;
$ curl = -X DELETE http://localhost:8080/rest/7f/50/8e/82/7f508e82-15f7-48de-92a3-25= 75a1b749cf