http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-dist/fuseki ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-dist/fuseki b/jena-fuseki2/jena-fuseki-dist/fuseki new file mode 100644 index 0000000..9cc1fe8 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-dist/fuseki @@ -0,0 +1,477 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ========= +# +# Startup script for Fuseki under *nix systems (works with cygwin too) +# +# Configuration +# ------------- +# Default values are loaded from /etc/default/fuseki, if it exists. +# +# JAVA +# Command to invoke Java. If not set, java (from the PATH) will be used. +# +# JAVA_OPTIONS +# Extra options to pass to the JVM. +# +# FUSEKI_HOME +# Where Fuseki is installed. If not set, the script will try +# to guess it based on the script invokation path. +# +# FUSEKI_BASE +# The root of the runtime area - logs files, system files, local configuration. +# Defaults to /etc/fuseki. +# +# FUSEKI_RUN +# Where the fuseki.pid file should be stored. It defaults +# first available of /var/run, /usr/var/run, and /tmp if not set. +# +# FUSEKI_PID +# The FUSEKI PID file, defaults to $FUSEKI_RUN/fuseki.pid +# +# FUSEKI_ARGS +# The arguments to pass to the Fuseki server on the command line. Defaults to: +# # if FUSEKI_CONF is not set +# --config=$FUSEKI_CONF # if FUSEKI_CONF is set +# +# FUSEKI_START +# Path to the jar file. Defaults to $FUSEKI_HOME/fuseki-server.jar + +# FUSEKI_CONF +# The Fuseki configuration file, usually in RDF Turtle notation. +# +# FUSEKI_USER +# If set, the server will be run as this user +# +# FUSEKI_LOGS +# Directory where logs will be generated. +# Fixed as $FUSEKI_BASE/logs. +# +# FUSEKI_LOGS_STDERROUT +# Log file with stderr and stdout log output from Fuseki. +# Defaults to $FUSEKI_LOGS/stderrout.log + +### BEGIN INIT INFO +# Provides: fuseki +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start Jena Fuseki at boot time +# Description: Jena Fuseki is a service that provides a SPARQL API over HTTP +### END INIT INFO + +# DEBUG=1 +NAME=fuseki +if [ -f /etc/default/$NAME ]; then + . /etc/default/$NAME +fi + +if [ -f /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + # simple replacements for LSB daemon logging functions if not defined + log_daemon_msg() { + echo $1 + } + log_begin_msg() { + echo $1 + } + log_end_msg() { + if [ $1 -eq 0]; then + echo '[OK]' + else + echo '[failed]' + fi + } +fi + +usage() +{ + echo "Usage: ${0##*/} {start|stop|restart|run|status}" + exit 1 +} + +[ $# -gt 0 ] || usage +CMD="$1" + +# Utility functions + +findDirectory() +{ + local L OP=$1 + shift + for L in "$@"; do + [ "$OP" "$L" ] || continue + printf %s "$L" + break + done +} + +findFile() +{ + local L F=$1 + shift + for L in "$@"; do + [ -f "${L}/${F}" ] || continue + printf %s "${L}/${F}" + break + done +} + +running() +{ + local PID=$(cat "$1" 2>/dev/null) || return 1 + ps -p "$PID" >/dev/null 2>&1 +} + +# Are we running in cygwin? +cygwin=false +case "`uname`" in + CYGWIN*) cygwin=true;; +esac + +# Set FUSKEI_HOME to the script invocation directory if it is not specified +if [ -z "$FUSEKI_HOME" ] +then + SCRIPT="$0" + # Catch common issue: script has been symlinked + if [ -L "$SCRIPT" ] + then + SCRIPT="$(readlink "$0")" + # If link is relative + case "$SCRIPT" in + /*) ;; # fine + *) SCRIPT=$( dirname "$0" )/$SCRIPT;; # fix + esac + fi + + # Work out root from script location + FUSEKI_HOME="$( cd "$( dirname "$SCRIPT" )" && pwd )" + +fi + +# Deal with Cygwin path issues +if [ "$cygwin" == "true" ] +then + FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"` +fi + +if [ ! -e "$FUSEKI_HOME" ] +then + log_daemon_msg "FUSEKI_HOME '$FUSEKI_HOME' does not exist" 1>&2 + exit 1 +fi + +if [ -z "$FUSEKI_BASE" ] +then + FUSEKI_BASE="/etc/fuseki" +fi + +if [ "$cygwin" == "true" ] +then + FUSEKI_BASE=`cygpath -w "$FUSEKI_BASE"` +fi + + +if [ ! -e "$FUSEKI_BASE" -o ! -d "$FUSEKI_BASE" ] +then + log_daemon_msg "FUSEKI_BASE '$FUSEKI_BASE' does not exist or is not a directory" 1>&2 + exit 1 +fi + +if [ ! -w "$FUSEKI_BASE" ] +then + log_daemon_msg "FUSEKI_BASE '$FUSEKI_BASE' is not writable." 1>&2 + exit 1 +fi + + +# Deal with Cygwin path issues +if [ "$cygwin" == "true" ] +then + FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"` + FUSEKI_BASE=`cygpath -w "$FUSEKI_BASE"` + fi + +# Find a location for the pid file +if [ -z "$FUSEKI_RUN" ] +then + FUSEKI_RUN=$(findDirectory -w /var/run /usr/var/run $FUSEKI_HOME /tmp) +fi + +# Get PID file name +if [ -z "$FUSEKI_PID" ] +then + FUSEKI_PID="$FUSEKI_RUN/fuseki.pid" +fi + +# Log directory +if [ -n "$FUSEKI_LOGS" ] +then + log_daemon_message "FUSEKI_LOGS can not be set externally - ignored" 1>&2 +fi +FUSEKI_LOGS="$FUSEKI_BASE/logs" + +# Std Err and Out log +if [ -z "$FUSEKI_LOGS_STDERROUT" ] +then + FUSEKI_LOGS_STDERROUT="$FUSEKI_LOGS/stderrout.log" +fi + +# Data directory +if [ -z "$FUSEKI_DATA_DIR" ] +then + FUSEKI_DATA_DIR="$FUSEKI_HOME/DB" +fi + +# Set up JAVA if not set +if [ -z "$JAVA" ] +then + JAVA=$(which java) +fi +if [ -z "$JAVA" ] +then + echo "Cannot find a Java JDK. Please set either set JAVA or put java (>=1.7) in your PATH." 2>&2 + exit 1 +fi + +# The location of the start up JAR +FUSEKI_START=${FUSEKI_START:-$FUSEKI_HOME/fuseki-server.jar} + +# Deal with Cygwin path issues +if [ "$cygwin" == "true" ] +then + DATA_DIR=`cygpath -w "$FUSEKI_DATA_DIR"` + FUSEKI_START=`cygpath -w "$FUSEKI_START"` +else + DATA_DIR="$FUSEKI_DATA_DIR" +fi + +# Some JVM settings +if [ -z "$JAVA_OPTIONS" ] +then + JAVA_OPTIONS="-Xmx1200M" +fi + +# Default Fuseki Arguments +if [ -z "$FUSEKI_ARGS" ] +then + if [ -z "$FUSEKI_CONF" ] + then + FUSEKI_ARGS="" + else + FUSEKI_ARGS="--config=$FUSEKI_CONF" + fi +fi + +# Run command + +RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$FUSEKI_START" $FUSEKI_ARGS) +RUN_CMD=("$JAVA" ${RUN_ARGS[@]}) + + +##################################################### +# Comment these out after you're happy with what +# the script is doing. +##################################################### +if (( DEBUG )) +then + log_daemon_msg "FUSEKI_HOME = $FUSEKI_HOME" + log_daemon_msg "FUSEKI_CONF = $FUSEKI_CONF" + log_daemon_msg "FUSEKI_RUN = $FUSEKI_RUN" + log_daemon_msg "FUSEKI_PID = $FUSEKI_PID" + log_daemon_msg "FUSEKI_ARGS = $FUSEKI_ARGS" + log_daemon_msg "FUSEKI_START = $FUSEKI_START" + log_daemon_msg "CONFIGS = ${CONFIGS[*]}" + log_daemon_msg "JAVA = $JAVA" + log_daemon_msg "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}" + log_daemon_msg "RUN_ARGS = ${RUN_ARGS[@]}" + log_daemon_msg "RUN_CMD = ${RUN_CMD[@]}" +fi + +NO_START=0 + +# Life cycle functions +start() { + if (( NO_START )); then + log_daemon_msg "Not starting Fuseki - NO_START=1" + exit + fi + + # Make sure the data and log directories exist + mkdir -p "$FUSEKI_DATA_DIR" + mkdir -p "$FUSEKI_LOGS" + + # Make sure the .jar file exists + if [ ! -e $FUSEKI_START ]; then + log_daemon_msg "Could not see Fuseki .jar file: \$FUSEKI_START has value '$FUSEKI_START'" + exit 1 + fi + + log_begin_msg "Starting Fuseki" + if type start-stop-daemon > /dev/null 2>&1 + then + unset CH_USER + if [ -n "$FUSEKI_USER" ] + then + CH_USER="--chuid $FUSEKI_USER" + fi + if start-stop-daemon --start $CH_USER --chdir "$FUSEKI_HOME" --background --make-pidfile --pidfile "$FUSEKI_PID" --startas /bin/bash -- -c "exec $JAVA ${RUN_ARGS[*]} > $FUSEKI_LOGS_STDERROUT 2>&1" + then + sleep 2 + if running "$FUSEKI_PID" + then + log_end_msg 0 + print_started + else + log_end_msg 1 + fi + else + log_end_msg 1 + log_daemon_msg "** start-stop-daemon failed to run" + fi + else + if running $FUSEKI_PID + then + log_end_msg 1 + log_daemon_msg 'Already Running!' + exit 1 + else + # dead pid file - remove + rm -f "$FUSEKI_PID" + fi + + if [ "$FUSEKI_USER" ] + then + touch "$FUSEKI_PID" + chown "$FUSEKI_USER" "$FUSEKI_PID" + su - "$FUSEKI_USER" -c " + log_daemon_msg "Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT" + exec ${RUN_CMD[*]} & + disown \$! + echo \$! > '$FUSEKI_PID'" + else + #log_daemon_msg "Redirecting Fuseki stderr/stdout to $FUSEKI_LOGS_STDERROUT" + exec "${RUN_CMD[@]}" &> "$FUSEKI_LOGS_STDERROUT" & + disown $! + echo $! > "$FUSEKI_PID" + fi + + log_end_msg 0 + print_started + fi +} + +print_started() { + log_daemon_msg "STARTED Fuseki `date`" + log_daemon_msg "PID=$(cat "$FUSEKI_PID" 2>/dev/null)" +} + +delete_fuseki_pid_file() { + rm -f "$FUSEKI_PID" +} + +stop() { + log_begin_msg "Stopping Fuseki: " + + if ! running "$FUSEKI_PID" + then + log_end_msg 1 + + # if a stop rather than a restart, signal failure to stop + if [ -z "$1" ] + then + exit 1 + fi + fi + + ############################################################### + # !!!! This code needs to be improved, too many repeats !!!! # + ############################################################### + if type start-stop-daemon > /dev/null 2>&1; then + start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal HUP + + ## Die after a 30 second timeout + TIMEOUT=30 + while running "$FUSEKI_PID"; do + if (( TIMEOUT-- == 0 )); then + start-stop-daemon --stop --pidfile "$FUSEKI_PID" --chdir "$FUSEKI_HOME" --startas "$JAVA" --signal KILL + fi + sleep 1 + done + delete_fuseki_pid_file + log_end_msg 0 + else + PID=$(cat "$FUSEKI_PID" 2>/dev/null) + kill "$PID" 2>/dev/null + + TIMEOUT=30 + while running $FUSEKI_PID; do + if (( TIMEOUT-- == 0 )); then + kill -KILL "$PID" 2>/dev/null + fi + sleep 1 + done + delete_fuseki_pid_file + log_end_msg 0 + fi +} + + +# Run in the foreground, as the current user +run() { + # Make sure the .jar file exists + if [ ! -e $FUSEKI_START ]; then + log_daemon_msg "Could not see Fuseki .jar file: \$FUSEKI_START has value '$FUSEKI_START'" + exit 1 + fi + exec "${RUN_CMD[@]}" +} + +case $CMD in + start) + start + ;; + stop) + stop + ;; + restart) + stop "restarting" + start + ;; + run) + run + ;; + status) + FUSEKI_PID=$(findFile fuseki.pid /var/run /usr/var/run $FUSEKI_HOME /tmp) + if running $FUSEKI_PID + then + PID=`cat "$FUSEKI_PID"` + log_daemon_msg "Fuseki is running with pid: $PID" + else + log_daemon_msg "Fuseki is not running" + fi + ;; + *) + usage + ;; +esac + +exit 0
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-dist/fuseki-server ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-dist/fuseki-server b/jena-fuseki2/jena-fuseki-dist/fuseki-server new file mode 100755 index 0000000..679b3bd --- /dev/null +++ b/jena-fuseki2/jena-fuseki-dist/fuseki-server @@ -0,0 +1,64 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Run fuseki as a standalone server + +export FUSEKI_HOME="${FUSEKI_HOME:-$PWD}" + +if [ ! -e "$FUSEKI_HOME" ] +then + echo "$FUSEKI_HOME does not exist" 1>&2 + exit 1 + fi + +JAR1="$FUSEKI_HOME/fuseki-server.jar" +JAR2="$FUSEKI_HOME/jena-fuseki-*-server.jar" +JAR="" + +for J in "$JAR1" "$JAR2" +do + # Expand + J="$(echo $J)" + if [ -e "$J" ] + then + JAR="$J" + break + fi +done + +if [ "$JAR" = "" ] +then + echo "Can't find jarfile to run" + exit 1 +fi + +# Deal with Cygwin path issues +cygwin=false +case "`uname`" in + CYGWIN*) cygwin=true;; +esac +if [ "$cygwin" = "true" ] +then + JAR=`cygpath -w "$JAR"` + FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"` +fi + +export FUSEKI_BASE="${FUSEKI_BASE:-$PWD/run}" + +JVM_ARGS=${JVM_ARGS:--Xmx1200M} + +exec java $JVM_ARGS -jar "$JAR" "$@" http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-dist/fuseki-server.bat ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-dist/fuseki-server.bat b/jena-fuseki2/jena-fuseki-dist/fuseki-server.bat new file mode 100644 index 0000000..5881660 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-dist/fuseki-server.bat @@ -0,0 +1,19 @@ +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. + +@echo off +@REM modify this to name the server jar +java -Xmx1200M -jar fuseki-server.jar %* http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-dist/pom.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-dist/pom.xml b/jena-fuseki2/jena-fuseki-dist/pom.xml new file mode 100644 index 0000000..6da0ca9 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-dist/pom.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <name>Apache Jena Fuseki - Binary distribution</name> + <artifactId>jena-fuseki-dist</artifactId> + <version>2.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <parent> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki</artifactId> + <version>2.0.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <description>Fuseki distribution</description> + <url>http://jena.apache.org/</url> + + <organization> + <name>Apache Jena</name> + <url>http://jena.apache.org/</url> + </organization> + + <licenses> + <license> + <name>Apache 2.0 License</name> + <url>http://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> + + <properties> + <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> + <build.time.xsd>${maven.build.timestamp}</build.time.xsd> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki-server</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki-war</artifactId> + <version>${project.version}</version> + <type>war</type> + </dependency> + + </dependencies> + <build> + <plugins> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>create-zip-assembly</id> + <phase>package</phase> + <!--<phase/>--> + <goals><goal>single</goal></goals> + <configuration> + <descriptors> + <descriptor>assembly-dist.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-server/dependency-reduced-pom.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-server/dependency-reduced-pom.xml b/jena-fuseki2/jena-fuseki-server/dependency-reduced-pom.xml new file mode 100644 index 0000000..270d99a --- /dev/null +++ b/jena-fuseki2/jena-fuseki-server/dependency-reduced-pom.xml @@ -0,0 +1,93 @@ +<?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/maven-v4_0_0.xsd"> + <parent> + <artifactId>jena-fuseki</artifactId> + <groupId>org.apache.jena</groupId> + <version>2.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jena-fuseki-server</artifactId> + <name>Apache Jena Fuseki - Server Standalone Jar</name> + <version>2.0.0-SNAPSHOT</version> + <description>Fuseki server - combined jar with built-in webserver.</description> + <url>http://jena.apache.org/</url> + <licenses> + <license> + <name>Apache 2.0 License</name> + <url>http://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> + <organization> + <name>Apache Jena</name> + <url>http://jena.apache.org/</url> + </organization> + <build> + <plugins> + <plugin> + <artifactId>maven-shade-plugin</artifactId> + <version>2.1</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + <configuration> + <shadedArtifactAttached>false</shadedArtifactAttached> + <transformers> + <transformer> + <mainClass>org.apache.jena.fuseki.FusekiCmd</mainClass> + </transformer> + <transformer /> + <transformer /> + <transformer> + <addHeader>false</addHeader> + </transformer> + </transformers> + <filters> + <filter> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + </configuration> + </plugin> + </plugins> + </build> + <repositories> + <repository> + <releases> + <enabled>false</enabled> + </releases> + <id>apache.snapshots</id> + <name>Apache Snapshot Repository</name> + <url>http://repository.apache.org/snapshots</url> + </repository> + </repositories> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>hamcrest-core</artifactId> + <groupId>org.hamcrest</groupId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <this.root>${project.artifactId}-${project.version}</this.root> + <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> + <build.time.xsd>${maven.build.timestamp}</build.time.xsd> + </properties> +</project> + http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-server/pom.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-server/pom.xml b/jena-fuseki2/jena-fuseki-server/pom.xml new file mode 100644 index 0000000..b809285 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-server/pom.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <name>Apache Jena Fuseki - Server Standalone Jar</name> + <artifactId>jena-fuseki-server</artifactId> + + <parent> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki</artifactId> + <version>2.0.0-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + + <packaging>jar</packaging> + <description>Fuseki server - combined jar with built-in webserver.</description> + <url>http://jena.apache.org/</url> + + <!-- Need if the parent is a snapshot --> + <repositories> + <repository> + <id>apache.snapshots</id> + <name>Apache Snapshot Repository</name> + <url>http://repository.apache.org/snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + </repository> + </repositories> + + <organization> + <name>Apache Jena</name> + <url>http://jena.apache.org/</url> + </organization> + + <licenses> + <license> + <name>Apache 2.0 License</name> + <url>http://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> + + <properties> + <this.root>${project.artifactId}-${project.version}</this.root> + <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> + <build.time.xsd>${maven.build.timestamp}</build.time.xsd> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki-core</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> + + <build> + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>2.1</version> + <configuration> + <shadedArtifactAttached>false</shadedArtifactAttached> + <!-- + <shadedClassifierName>server</shadedClassifierName> + --> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>org.apache.jena.fuseki.FusekiCmd</mainClass> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" /> + <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"> + <addHeader>false</addHeader> + </transformer> + </transformers> + <filters> + <filter> + <artifact>*:*</artifact> + <excludes> + <!-- Some jars are signed but shading breaks that. + Don't include signing files. + --> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + </configuration> + <executions> + <execution> + <phase>package</phase> + <!--<phase/><!- - Switch off --> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-war/pom.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/jena-fuseki-war/pom.xml b/jena-fuseki2/jena-fuseki-war/pom.xml new file mode 100644 index 0000000..3c80e05 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-war/pom.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <name>Apache Jena Fuseki - WAR file</name> + <artifactId>jena-fuseki-war</artifactId> + <version>2.0.0-SNAPSHOT</version> + + <parent> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki</artifactId> + <version>2.0.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <packaging>war</packaging> + + <description>WAR file for Fuseki</description> + <url>http://jena.apache.org/</url> + + <!-- Need if the parent is a snapshot --> + <repositories> + <repository> + <id>apache.snapshots</id> + <name>Apache Snapshot Repository</name> + <url>http://repository.apache.org/snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + </repository> + </repositories> + + <organization> + <name>Apache Jena</name> + <url>http://jena.apache.org/</url> + </organization> + + <licenses> + <license> + <name>Apache 2.0 License</name> + <url>http://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> + + <properties> + <this.root>${project.artifactId}-${project.version}</this.root> + + <server.jar.name>${this.root}-server</server.jar.name> + <!-- Eventually, move to jena-parent --> + <ver.jetty>9.1.1.v20140108</ver.jetty> + <ver.shiro>1.2.2</ver.shiro> + + <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> + <build.time.xsd>${maven.build.timestamp}</build.time.xsd> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-fuseki-core</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> + + <build> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.4</version> + <executions> + <execution> + <id>generate-webapp</id> + <phase>package</phase> + <goals><goal>war</goal></goals> + </execution> + </executions> + <configuration> + <warSourceDirectory>../jena-fuseki-core/src/main/webapp</warSourceDirectory> + <webXml>../jena-fuseki-core/src/main/webapp/WEB-INF/web.xml</webXml> + <!-- Safe: Don't put in the Jetty dependency nor javax.servlet --> + <packagingExcludes>WEB-INF/lib/jetty-*,WEB-INF/lib/javax.servlet*</packagingExcludes> + </configuration> + </plugin> + </plugins> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/make-html ---------------------------------------------------------------------- diff --git a/jena-fuseki2/make-html b/jena-fuseki2/make-html deleted file mode 100755 index 4ee6a81..0000000 --- a/jena-fuseki2/make-html +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for f in "$@" -do - echo "==== $f" - B="$(basename $f .md)" - D="$(dirname $f)" - X="$D/$B.html" - curl -s -XPOST -H 'Content-type:text/plain' \ - --data-binary @$f \ - https://api.github.com/markdown/raw \ - > $X - -done http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/pom.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/pom.xml b/jena-fuseki2/pom.xml index f839217..2215ab1 100644 --- a/jena-fuseki2/pom.xml +++ b/jena-fuseki2/pom.xml @@ -19,9 +19,12 @@ <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <name>Apache Jena - Fuseki2 (SPARQL 1.1 Server)</name> + <name>Apache Jena Fuseki (SPARQL 1.1 Server)</name> + <groupId>org.apache.jena</groupId> <artifactId>jena-fuseki</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> + + <description>Apache Jena Fuseki</description> <parent> <groupId>org.apache.jena</groupId> @@ -30,15 +33,9 @@ <relativePath>../jena-parent</relativePath> </parent> - <!-- We make the JAR file so that the shade plugin includes it. - The war:war goal is added to the package phase. - --> - <packaging>jar</packaging> - <description>Fuseki is a SPARQL 1.1 Server which provides query, update and graph store protocol endpoints that can be used to expose triple stores over HTTP</description> + <packaging>pom</packaging> <url>http://jena.apache.org/</url> - - <!-- Need if the parent is a snapshot --> <repositories> <repository> <id>apache.snapshots</id> @@ -74,361 +71,11 @@ <build.time.xsd>${maven.build.timestamp}</build.time.xsd> </properties> - <dependencies> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-arq</artifactId> - <version>2.12.2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-arq</artifactId> - <version>2.12.2-SNAPSHOT</version> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-core</artifactId> - <version>2.12.2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-tdb</artifactId> - <version>1.1.2-SNAPSHOT</version> - </dependency> - - <!-- - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>sdb</artifactId> - <version>${ver.sdb}</version> - <optional>true</optional> - </dependency> - --> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-text</artifactId> - <version>1.1.2-SNAPSHOT</version> - <exclusions> - <!-- - Get this via commons-fileupload and also via jena-text/sol4j - --> - <exclusion> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-spatial</artifactId> - <version>1.1.2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.shiro</groupId> - <artifactId>shiro-core</artifactId> - <version>${ver.shiro}</version> - </dependency> - - <dependency> - <groupId>org.apache.shiro</groupId> - <artifactId>shiro-web</artifactId> - <version>${ver.shiro}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <exclusions> - <!-- Replace with slf4j adapter --> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>commons-fileupload</groupId> - <artifactId>commons-fileupload</artifactId> - </dependency> - - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-webapp</artifactId> - <version>${ver.jetty}</version> - </dependency> - - - <!-- - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-runner</artifactId> - <version>${ver.jetty}</version> - </dependency> - --> - - <!-- Development and standalone jar (if built) --> - <!-- Jetty's useful servlets, inc compression --> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlets</artifactId> - <version>${ver.jetty}</version> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </dependency> - - <!-- Intercept any uses of Jakarta Commons Logging e.g. Apache Common HTTP client. --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </dependency> - - <!-- Needed because the Fuseki command line and the test suite reset logging levels --> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <exclusions> - <exclusion> - <groupId>javax.jms</groupId> - <artifactId>jms</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.jdmk</groupId> - <artifactId>jmxtools</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.jmx</groupId> - <artifactId>jmxri</artifactId> - </exclusion> - <exclusion> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - <excludes> - <exclude>org/apache/jena/fuseki/fuseki-properties.xml</exclude> - </excludes> - </resource> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - <includes> - <include>org/apache/jena/fuseki/fuseki-properties.xml</include> - </includes> - </resource> - </resources> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - <optimize>true</optimize> - <debug>true</debug> - <debuglevel>source,lines,vars</debuglevel> - <source>1.7</source> - <target>1.7</target> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>package</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - - <!-- - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <version>true</version> - <show>public</show> - <quiet>true</quiet> - <encoding>UTF-8</encoding> - <windowtitle>Apache Jena Fuseki</windowtitle> - <doctitle>Apache Jena Fuseki ${project.version}</doctitle> - <bottom>Licenced under the Apache License, Version 2.0</bottom> - </configuration> - </plugin> - --> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>**/TS_*.java</include> - </includes> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <configuration> - <overWriteReleases>false</overWriteReleases> - <overWriteIfNewer>true</overWriteIfNewer> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>2.1</version> - <configuration> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>server</shadedClassifierName> - <transformers> - <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> - <mainClass>org.apache.jena.fuseki.cmd.FusekiCmd</mainClass> - </transformer> - <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> - <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" /> - <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"> - <addHeader>false</addHeader> - </transformer> - </transformers> - <filters> - <filter> - <artifact>*:*</artifact> - <excludes> - <!-- Some jars are signed but shading breaks that. - Don't include signing files. - --> - <exclude>META-INF/*.SF</exclude> - <exclude>META-INF/*.DSA</exclude> - <exclude>META-INF/*.RSA</exclude> - </excludes> - </filter> - </filters> - </configuration> - <executions> - <execution> - <phase>package</phase> - <!--<phase/><!- - Switch off --> - <goals> - <goal>shade</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>2.4</version> - <executions> - <execution> - <id>generate-webapp</id> - <phase>package</phase> - <goals><goal>war</goal></goals> - </execution> - </executions> - <configuration> - <webappDirectory>${project.build.webappDirectory}</webappDirectory> - <!-- This can't be set because then maven will not install/deploy the war file --> - <!--<warName>${webapp.name}</warName>--> - <!-- Don't put in the Jetty dependency nor javax.servlet --> - <packagingExcludes>WEB-INF/lib/jetty-*,WEB-INF/lib/javax.servlet*</packagingExcludes> - </configuration> - </plugin> - - <!-- Untested. - <plugin> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-maven-plugin</artifactId> - <version>${ver.jetty}</version> - <configuration> - <war>target/${this.root}.war</war> - </configuration> - </plugin> - --> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <!-- After shaded jar, after war file - same phase --> - <executions> - <execution> - <id>create-zip-assembly</id> - <phase>package</phase> - <!--<phase/>--> - <goals><goal>single</goal></goals> - <configuration> - <!-- - <finalName>${assembly.zip.name}</finalName> - <appendAssemblyId>false</appendAssemblyId> - --> - <descriptors> - <descriptor>assembly-dist.xml</descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - </configuration> - </plugin> - - </plugins> - - </build> + <modules> + <module>jena-fuseki-core</module> + <module>jena-fuseki-war</module> + <module>jena-fuseki-server</module> + <module>jena-fuseki-dist</module> + </modules> </project> http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/DEF.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/DEF.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/DEF.java deleted file mode 100644 index 8d8495a..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/DEF.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import org.apache.jena.atlas.web.AcceptList ; -import org.apache.jena.atlas.web.MediaType ; -import static org.apache.jena.riot.WebContent.* ; - -public class DEF -{ - public static final MediaType acceptRDFXML = MediaType.create(contentTypeRDFXML) ; - public static final MediaType acceptNQuads = MediaType.create(contentTypeNQuads) ; - public static final MediaType acceptRSXML = MediaType.create(contentTypeResultsXML) ; - public static final MediaType acceptJSON = MediaType.create(contentTypeJSON) ; - - public static final AcceptList jsonOffer = AcceptList.create(contentTypeJSON) ; - - public static final AcceptList rdfOffer = AcceptList.create(contentTypeTurtle, - contentTypeTurtleAlt1, - contentTypeTurtleAlt2, - contentTypeNTriples, - contentTypeNTriplesAlt, - contentTypeRDFXML, - contentTypeJSONLD, - contentTypeRDFJSON, - contentTypeRDFThrift - ) ; - - public static final AcceptList quadsOffer = AcceptList.create(contentTypeTriG, - contentTypeTriGAlt1, - contentTypeTriGAlt2, - contentTypeJSONLD, - contentTypeNQuads, - contentTypeNQuadsAlt1, - contentTypeNQuadsAlt2 - ) ; - - // Offer for SELECT - public static final AcceptList rsOfferTable = AcceptList.create(contentTypeResultsJSON, - contentTypeTextCSV, - contentTypeTextTSV, - contentTypeResultsXML, - contentTypeResultsThrift, - contentTypeTextPlain - ) ; - - // Offer for ASK - public static final AcceptList rsOfferBoolean = AcceptList.create(contentTypeResultsJSON, - contentTypeTextCSV, - contentTypeTextTSV, - contentTypeResultsXML, - contentTypeTextPlain - ) ; - - - // Names for services in the default configuration - public static final String ServiceQuery = "query" ; - public static final String ServiceQueryAlt = "sparql" ; - public static final String ServiceUpdate = "update" ; - public static final String ServiceData = "data" ; - public static final String ServiceUpload = "upload" ; - public static final String ServiceGeneralQuery = "/sparql" ; -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/Fuseki.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/Fuseki.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/Fuseki.java deleted file mode 100644 index 0f42219..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/Fuseki.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki ; - -import java.util.Calendar ; -import java.util.TimeZone ; -import java.util.concurrent.TimeUnit ; - -import org.apache.jena.riot.RIOT ; -import org.apache.jena.riot.system.stream.LocatorFTP ; -import org.apache.jena.riot.system.stream.LocatorHTTP ; -import org.apache.jena.riot.system.stream.StreamManager ; -import org.slf4j.Logger ; -import org.slf4j.LoggerFactory ; - -import com.hp.hpl.jena.query.ARQ ; -import com.hp.hpl.jena.sparql.SystemARQ ; -import com.hp.hpl.jena.sparql.lib.Metadata ; -import com.hp.hpl.jena.sparql.mgt.SystemInfo ; -import com.hp.hpl.jena.sparql.util.Context ; -import com.hp.hpl.jena.sparql.util.MappingRegistry ; -import com.hp.hpl.jena.sparql.util.Utils ; -import com.hp.hpl.jena.tdb.TDB ; -import com.hp.hpl.jena.tdb.transaction.TransactionManager ; - -public class Fuseki { - // General fixed constants. - // See also FusekiServer for the naming on the filesystem - - /** Path to ??? */ - static public String PATH = "org.apache.jena.fuseki" ; - - /** a unique IRI for the Fuseki namespace */ - static public String FusekiIRI = "http://jena.apache.org/Fuseki" ; - - /** - * a unique IRI including the symbol notation for which properties should be - * appended - */ - static public String FusekiSymbolIRI = "http://jena.apache.org/fuseki#" ; - - /** Default location of the pages for the Fuseki UI */ - static public String PagesStatic = "pages" ; - - /** Dummy base URi string for parsing SPARQL Query and Update requests */ - static public final String BaseParserSPARQL = "http://server/unset-base/" ; - - /** Dummy base URi string for parsing SPARQL Query and Update requests */ - static public final String BaseUpload = "http://server/unset-base/" ; - - /** - * A relative resources path to the location of - * <code>fuseki-properties.xml</code> file. - */ - static private String metadataLocation = "org/apache/jena/fuseki/fuseki-properties.xml" ; - - /** - * Object which holds metadata specified within - * {@link Fuseki#metadataLocation} - */ - static private Metadata metadata = initMetadata() ; - - private static Metadata initMetadata() { - Metadata m = new Metadata() ; - // m.addMetadata(metadataDevLocation) ; - m.addMetadata(metadataLocation) ; - return m ; - } - - /** The name of the Fuseki server. Set to the string <code>Fuseki</code> by default. */ - static public final String NAME = "Fuseki" ; - - /** Version of this Fuseki instance */ - static public final String VERSION = metadata.get(PATH + ".version", "development") ; - - /** Date when Fuseki was built */ - static public final String BUILD_DATE = metadata.get(PATH + ".build.datetime", "unknown") ; - - /** An identifier for the HTTP Fuseki server instance */ - static public final String serverHttpName = NAME + " (" + VERSION + ")" ; - - /** Loger name for operations */ - public static final String actionLogName = PATH + ".Fuseki" ; - - /** Instance of log for operations */ - public static final Logger actionLog = LoggerFactory.getLogger(actionLogName) ; - - /** Logger name for standard webserver log file request log */ - public static final String requestLogName = PATH + ".Request" ; - - // See HttpAction.finishRequest. - // Normally OFF - /** Instance of a log for requests: format is NCSA. */ - public static final Logger requestLog = LoggerFactory.getLogger(requestLogName) ; - - /** Admin log file for operations. */ - public static final String adminLogName = PATH + ".Admin" ; - - /** Instance of log for operations. */ - public static final Logger adminLog = LoggerFactory.getLogger(adminLogName) ; - - /** Admin log file for operations. */ - public static final String builderLogName = PATH + ".Builder" ; - - /** Instance of log for operations. */ - public static final Logger builderLog = LoggerFactory.getLogger(builderLogName) ; - - /** Validation log file for operations. */ - public static final String validationLogName = PATH + ".Validate" ; - - /** Instance of log for validation. */ - public static final Logger validationLog = LoggerFactory.getLogger(adminLogName) ; - - /** Actual log file for general server messages. */ - public static final String serverLogName = PATH + ".Server" ; - - /** Instance of log for general server messages. */ - public static final Logger serverLog = LoggerFactory.getLogger(serverLogName) ; - - /** Logger used for the servletContent.log operations (if settable -- depends on environment) */ - public static final String servletRequestLogName = PATH + ".Servlet" ; - - /** Actual log file for config server messages. */ - public static final String configLogName = PATH + ".Config" ; - - /** Instance of log for config server messages. */ - public static final Logger configLog = LoggerFactory.getLogger(configLogName) ; - - /** Instance of log for config server message s */ - public static boolean verboseLogging = false ; - - /** - * An instance of management for stream opening, including redirecting - * through a location mapper whereby a name (e.g. URL) is redirected to - * another name (e.g. local file). - * */ - public static final StreamManager webStreamManager ; - static { - webStreamManager = new StreamManager() ; - // Only know how to handle http URLs - webStreamManager.addLocator(new LocatorHTTP()) ; - webStreamManager.addLocator(new LocatorFTP()) ; - } - - /** Default (and development) root of the Fuseki installation for fixed files. */ - public static String DFT_FUSEKI_HOME = "." ; - /** Default (and development) root of the varying files in this deployment. */ - public static String DFT_FUSEKI_BASE = "." ; - - private static boolean initialized = false ; - - // Serevr start time and uptime. - private static final long startMillis = System.currentTimeMillis() ; - // Hide server locale - private static final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("00:00")) ; - static { cal.setTimeInMillis(startMillis) ; } // Exactly the same start point! - - private static final String startDateTime = Utils.calendarToXSDDateTimeString(cal) ; - - /** Return the number of milliseconds since the server started */ - public static long serverUptimeMillis() { - return System.currentTimeMillis() - startMillis ; - } - - /** Server uptime in seconds */ - public static long serverUptimeSeconds() { - long x = System.currentTimeMillis() - startMillis ; - return TimeUnit.MILLISECONDS.toSeconds(x) ; - } - - /** XSD DateTime for when the server started */ - public static String serverStartedAt() { - return startDateTime ; - } - - /** - * Initialize an instance of the Fuseki server stack. - */ - public synchronized static void init() { - if ( initialized ) - return ; - initialized = true ; - // FusekiEnv.setEnvironment() ; - FusekiLogging.setLogging() ; - ARQ.init() ; - SystemInfo sysInfo = new SystemInfo(FusekiIRI, PATH, VERSION, BUILD_DATE) ; - SystemARQ.registerSubSystem(sysInfo) ; - RIOT.init() ; - TDB.init() ; - MappingRegistry.addPrefixMapping("fuseki", FusekiSymbolIRI) ; - - TDB.setOptimizerWarningFlag(false) ; - // Don't set TDB batch commits. - // This can be slower, but it less memory hungry and more predictable. - TransactionManager.QueueBatchSize = 0 ; - } - - /** - * Get server global {@link com.hp.hpl.jena.sparql.util.Context}. - * - * @return {@link com.hp.hpl.jena.query.ARQ#getContext()} - */ - public static Context getContext() { - return ARQ.getContext() ; - } - - // Force a call to init. - static { - init() ; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiCmd.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiCmd.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiCmd.java deleted file mode 100644 index 6d2e247..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiCmd.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -public class FusekiCmd { - public static void main(String[] args) { - // NOT logging. - System.err.println("Deprecated: Use org.apache.jena.fuseki.cmd.FusekiCmd") ; - org.apache.jena.fuseki.cmd.FusekiCmd.main(args) ; - } -} - http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java deleted file mode 100644 index 5e1b018..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - - -public class FusekiConfigException extends FusekiException -{ - public FusekiConfigException(String msg, Throwable cause) { super(msg, cause) ; } - public FusekiConfigException(String msg) { super(msg) ; } - public FusekiConfigException(Throwable cause) { super(cause) ; } - public FusekiConfigException() { super() ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiException.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiException.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiException.java deleted file mode 100644 index 04953ce..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import com.hp.hpl.jena.sparql.ARQException ; - -public class FusekiException extends ARQException -{ - public FusekiException(String msg, Throwable cause) { super(msg, cause) ; } - public FusekiException(String msg) { super(msg) ; } - public FusekiException(Throwable cause) { super(cause) ; } - public FusekiException() { super() ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLib.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLib.java deleted file mode 100644 index 52024d4..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLib.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import java.util.Iterator ; - -import javax.servlet.http.HttpServletRequest ; - -import org.apache.jena.atlas.lib.MultiMap ; -import org.apache.jena.atlas.lib.MultiMapToList ; -import org.apache.jena.atlas.web.ContentType ; -import org.apache.jena.fuseki.server.SystemState ; -import org.apache.jena.fuseki.servlets.HttpAction ; -import org.apache.jena.riot.Lang ; -import org.apache.jena.riot.RDFLanguages ; - -import com.hp.hpl.jena.graph.Graph ; -import com.hp.hpl.jena.graph.Node ; -import com.hp.hpl.jena.graph.Triple ; -import com.hp.hpl.jena.query.* ; -import com.hp.hpl.jena.rdf.model.Literal ; -import com.hp.hpl.jena.rdf.model.Model ; -import com.hp.hpl.jena.rdf.model.RDFNode ; -import com.hp.hpl.jena.rdf.model.Resource ; -import com.hp.hpl.jena.shared.PrefixMapping ; -import com.hp.hpl.jena.sparql.core.DatasetGraph ; -import com.hp.hpl.jena.sparql.core.Quad ; -import com.hp.hpl.jena.sparql.util.Convert ; -import com.hp.hpl.jena.vocabulary.RDFS ; - -public class FusekiLib { - // ==> ActionLib - - /** Get the content type of an action or return the default. - * @param action - * @return ContentType - */ - public static ContentType getContentType(HttpAction action) { - return getContentType(action.request) ; - } - - /** Get the content type of an action or return the default. - * @param request - * @return ContentType - */ - public static ContentType getContentType(HttpServletRequest request) { - String contentTypeHeader = request.getContentType() ; - if ( contentTypeHeader == null ) - return null ; - return ContentType.create(contentTypeHeader) ; - } - - /** Get the incoming Lang based on Content-Type of an action. - * @param action - * @param dft Default if no "Content-Type:" found. - * @return ContentType - */ - public static Lang getLangFromAction(HttpAction action, Lang dft) { - String contentTypeHeader = action.request.getContentType() ; - if ( contentTypeHeader == null ) - return dft ; - return RDFLanguages.contentTypeToLang(contentTypeHeader) ; - } - - static String fmtRequest(HttpServletRequest request) { - StringBuffer sbuff = new StringBuffer() ; - sbuff.append(request.getMethod()) ; - sbuff.append(" ") ; - sbuff.append(Convert.decWWWForm(request.getRequestURL())) ; - - String qs = request.getQueryString() ; - if ( qs != null ) { - String tmp = request.getQueryString() ; - tmp = Convert.decWWWForm(tmp) ; - tmp = tmp.replace('\n', ' ') ; - tmp = tmp.replace('\r', ' ') ; - sbuff.append("?").append(tmp) ; - } - return sbuff.toString() ; - } - - /** Parse the query string - do not process the body even for a form */ - public static MultiMap<String, String> parseQueryString(HttpServletRequest req) { - MultiMap<String, String> map = MultiMapToList.create() ; - - // Don't use ServletRequest.getParameter or getParamterNames - // as that reads form data. This code parses just the query string. - if ( req.getQueryString() != null ) { - String[] params = req.getQueryString().split("&") ; - for (int i = 0; i < params.length; i++) { - String p = params[i] ; - String[] x = p.split("=", 2) ; - String name = null ; - String value = null ; - - if ( x.length == 0 ) { // No "=" - name = p ; - value = "" ; - } else if ( x.length == 1 ) { // param= - name = x[0] ; - value = "" ; - } else { // param=value - name = x[0] ; - value = x[1] ; - } - map.put(name, value) ; - } - } - return map ; - } - - public static String safeParameter(HttpServletRequest request, String pName) { - String value = request.getParameter(pName) ; - value = value.replace("\r", "") ; - value = value.replace("\n", "") ; - return value ; - } - - // Do the addition directly on the dataset - public static void addDataInto(Graph data, DatasetGraph dsg, Node graphName) { - // Prefixes? - if ( graphName == null ) - graphName = Quad.defaultGraphNodeGenerated ; - - Iterator<Triple> iter = data.find(Node.ANY, Node.ANY, Node.ANY) ; - for (; iter.hasNext();) { - Triple t = iter.next() ; - dsg.add(graphName, t.getSubject(), t.getPredicate(), t.getObject()) ; - } - - PrefixMapping pmapSrc = data.getPrefixMapping() ; - PrefixMapping pmapDest = dsg.getDefaultGraph().getPrefixMapping() ; - pmapDest.setNsPrefixes(pmapSrc) ; - } - - public static void addDataInto(DatasetGraph src, DatasetGraph dest) { - Iterator<Quad> iter = src.find(Node.ANY, Node.ANY, Node.ANY, Node.ANY) ; - for (; iter.hasNext();) { - Quad q = iter.next() ; - dest.add(q) ; - } - - PrefixMapping pmapSrc = src.getDefaultGraph().getPrefixMapping() ; - PrefixMapping pmapDest = dest.getDefaultGraph().getPrefixMapping() ; - pmapDest.withDefaultMappings(pmapSrc) ; - } - - // ---- Helper code - public static ResultSet query(String string, Model m) { - return query(string, m, null, null) ; - } - - public static ResultSet query(String string, Dataset ds) { - return query(string, ds, null, null) ; - } - - public static ResultSet query(String string, Model m, String varName, RDFNode value) { - Query query = QueryFactory.create(SystemState.PREFIXES + string) ; - QuerySolutionMap initValues = null ; - if ( varName != null ) - initValues = querySolution(varName, value) ; - try ( QueryExecution qExec = QueryExecutionFactory.create(query, m, initValues) ) { - return ResultSetFactory.copyResults(qExec.execSelect()) ; - } - } - - public static ResultSet query(String string, Dataset ds, String varName, RDFNode value) { - Query query = QueryFactory.create(SystemState.PREFIXES + string) ; - QuerySolutionMap initValues = null ; - if ( varName != null ) - initValues = querySolution(varName, value) ; - try ( QueryExecution qExec = QueryExecutionFactory.create(query, ds, initValues) ) { - return ResultSetFactory.copyResults(qExec.execSelect()) ; - } - } - - private static QuerySolutionMap querySolution(String varName, RDFNode value) { - QuerySolutionMap qsm = new QuerySolutionMap() ; - querySolution(qsm, varName, value) ; - return qsm ; - } - - public static QuerySolutionMap querySolution(QuerySolutionMap qsm, String varName, RDFNode value) { - qsm.add(varName, value) ; - return qsm ; - } - - public static RDFNode getOne(Resource svc, String property) { - ResultSet rs = FusekiLib.query("SELECT * { ?svc " + property + " ?x}", svc.getModel(), "svc", svc) ; - if ( !rs.hasNext() ) - throw new FusekiConfigException("No property '" + property + "' for service " + FusekiLib.nodeLabel(svc)) ; - RDFNode x = rs.next().get("x") ; - if ( rs.hasNext() ) - throw new FusekiConfigException("Multiple properties '" + property + "' for service " + FusekiLib.nodeLabel(svc)) ; - return x ; - } - - // Node presentation - public static String nodeLabel(RDFNode n) { - if ( n == null ) - return "<null>" ; - if ( n instanceof Resource ) - return strForResource((Resource)n) ; - - Literal lit = (Literal)n ; - return lit.getLexicalForm() ; - } - - // XXX Lib - public static String strForResource(Resource r) { - return strForResource(r, r.getModel()) ; - } - - // XXX Lib - public static String strForResource(Resource r, PrefixMapping pm) { - if ( r == null ) - return "NULL " ; - if ( r.hasProperty(RDFS.label) ) { - RDFNode n = r.getProperty(RDFS.label).getObject() ; - if ( n instanceof Literal ) - return ((Literal)n).getString() ; - } - - if ( r.isAnon() ) - return "<<blank node>>" ; - - if ( pm == null ) - pm = r.getModel() ; - - return strForURI(r.getURI(), pm) ; - } - - public static String strForURI(String uri, PrefixMapping pm) { - if ( pm != null ) { - String x = pm.shortForm(uri) ; - - if ( !x.equals(uri) ) - return x ; - } - return "<" + uri + ">" ; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLogging.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLogging.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLogging.java deleted file mode 100644 index 1add2b2..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiLogging.java +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import java.io.File ; -import java.net.URL ; - -import org.apache.jena.atlas.lib.StrUtils ; -import org.apache.jena.atlas.logging.LogCtl ; -import org.apache.jena.fuseki.server.FusekiEnv ; -import org.apache.jena.riot.SysRIOT ; -import org.apache.log4j.PropertyConfigurator ; -import org.apache.log4j.helpers.Loader ; - -public class FusekiLogging -{ - // This class must not have static constants, or otherwise not use "Fuseki.*" - // or any class else where that might kick off logging. Otherwise, the - // setLogging is poiintless (it's already set). - // PlanB - reinitialize logging regardless on first call. - - // Set logging. - // 1/ Use log4j.configuration if defined. - // 2/ Use file:log4j.properties if exists - // 3/ Use log4j.properties on the classpath. - // 4/ Use built-in org/apache/jena/fuseki/log4j.properties on the classpath. - // 5/ Use Built in string - - /** Places for the log4j properties file at (3) */ - private static final String[] resourcesForLog4jProperties = { - "log4j.properties", - "org/apache/jena/fuseki/log4j.properties" - } ; - - private static final boolean LogLogging = false ; - private static boolean loggingInitialized = false ; - - public static synchronized void setLogging() { - if ( loggingInitialized ) - return ; - loggingInitialized = true ; - FusekiEnv.setEnvironment() ; - - logLogging("Fuseki logging") ; - // No loggers have been created but configuration may have been set up. - String x = System.getProperty("log4j.configuration", null) ; - logLogging("log4j.configuration = %s", x) ; - - if ( x != null ) { - // log4j wil initialize in the usual way. This includes avalue of - // "set", which indicates that logging was set before by some other Jena code. - if ( x.equals("set") ) - Fuseki.serverLog.warn("Fuseki logging: Unexpected: Log4j was setup by someother part of Jena") ; - return ; - } - logLogging("Fuseki logging - setup") ; - // Look for a log4j.properties in the current working directory - // and an existing FUSEKI_BASE for easy customization. - String fn1 = "log4j.properties" ; - String fn2 = null ; - - if ( FusekiEnv.FUSEKI_BASE != null ) - fn2 = FusekiEnv.FUSEKI_BASE.toString()+"/log4j.properties" ; - if ( attempt(fn1) ) return ; - if ( attempt(fn2) ) return ; - - // Try classpath - for ( String resourceName : resourcesForLog4jProperties ) { - // The log4j general initialization is done in a class static - // in LogManager so it can't be called again in any sensible manner. - // Instead, we include the same basic mechanism ... - logLogging("Fuseki logging - classpath %s", resourceName) ; - URL url = Loader.getResource(resourceName) ; - if ( url != null ) { - PropertyConfigurator.configure(url) ; - logLogging("Fuseki logging - found via classpath %s", url) ; - System.setProperty("log4j.configuration", url.toString()) ; - return ; - } - } - // Use builtin. - logLogging("Fuseki logging - Fallback log4j.properties string") ; - String dftLog4j = log4JsetupFallback() ; - LogCtl.resetLogging(dftLog4j); - // Stop anything attempting to do it again. - System.setProperty("log4j.configuration", "set") ; - } - - private static boolean attempt(String fn) { - try { - File f = new File(fn) ; - if ( f.exists() ) { - logLogging("Fuseki logging - found file:log4j.properties") ; - PropertyConfigurator.configure(fn) ; - System.setProperty("log4j.configuration", "file:" + fn) ; - return true ; - } - } - catch (Throwable th) {} - return false ; - } - - private static void logLogging(String fmt, Object ... args) { - if ( LogLogging ) { - System.out.printf(fmt, args) ; - System.out.println() ; - } - } - - private static String log4JsetupFallback() { - return StrUtils.strjoinNL - // Preferred: classes/log4j.properties, from src/main/resources/log4j.properties - // Keep these in-step. Different usages cause different logging initalizations; - // if the jar is rebundled, it may loose the associated log4.properties file. - ("## Plain output to stdout", - "log4j.appender.jena.plainstdout=org.apache.log4j.ConsoleAppender", - "log4j.appender.jena.plainstdout.target=System.out", - "log4j.appender.jena.plainstdout.layout=org.apache.log4j.PatternLayout", - "log4j.appender.jena.plainstdout.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %-10c{1} %-5p %m%n", - //"log4j.appender.jena.plainstdout.layout.ConversionPattern=%d{HH:mm:ss} %-10c{1} %-5p %m%n", - - "# Unadorned, for the requests log.", - "log4j.appender.fuseki.plain=org.apache.log4j.ConsoleAppender", - "log4j.appender.fuseki.plain.target=System.out", - "log4j.appender.fuseki.plain.layout=org.apache.log4j.PatternLayout", - "log4j.appender.fuseki.plain.layout.ConversionPattern=%m%n", - - "## Most things", - "log4j.rootLogger=INFO, jena.plainstdout", - "log4j.logger.com.hp.hpl.jena=WARN", - "log4j.logger.org.openjena=WARN", - "log4j.logger.org.apache.jena=WARN", - - "# Fuseki System logs.", - "log4j.logger." + Fuseki.serverLogName + "=INFO", - "log4j.logger." + Fuseki.actionLogName + "=INFO", - "log4j.logger." + Fuseki.adminLogName + "=INFO", - "log4j.logger." + Fuseki.validationLogName + "=INFO", - "log4j.logger." + Fuseki.configLogName + "=INFO", - - "log4j.logger.org.apache.jena.tdb.loader=INFO", - "log4j.logger.org.eclipse.jetty=WARN" , - "log4j.logger.org.apache.shiro=WARN", - - "# NCSA Request Access log", - "log4j.additivity."+Fuseki.requestLogName + "=false", - "log4j.logger."+Fuseki.requestLogName + "=OFF, fuseki.plain", - - "## Parser output", - "log4j.additivity" + SysRIOT.riotLoggerName + "=false", - "log4j.logger." + SysRIOT.riotLoggerName + "=INFO, plainstdout" - ) ; - } -} - http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java deleted file mode 100644 index be9be90..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import org.apache.jena.web.HttpSC ; - -public class FusekiNotFoundException extends FusekiRequestException -{ - public FusekiNotFoundException(String msg) { super(HttpSC.NOT_FOUND_404, msg) ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java deleted file mode 100644 index e197be2..0000000 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.fuseki; - -import org.apache.jena.web.HttpSC ; - - -public class FusekiRequestException extends FusekiException -{ - public static FusekiRequestException create(int code, String msg) - { - if ( code == HttpSC.NOT_FOUND_404 ) - return new FusekiNotFoundException(msg) ; - return new FusekiRequestException(code, msg) ; - } - - private final int statusCode ; - private final String responseMessage ; - protected FusekiRequestException(int code, String msg) - { - super(msg) ; - this.statusCode = code ; - responseMessage = msg ; - } - - public int getStatusCode() - { - return statusCode ; - } - - public String getResponseMessage() - { - return responseMessage ; - } - - @Override - public String toString() - { - return "HTTP: "+statusCode+" "+getMessage() ; - } -}
