You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/01/05 18:34:27 UTC
[48/51] [abbrv] [partial] jena git commit: Maven modules for Fuseki2
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/dist/NOTICE
----------------------------------------------------------------------
diff --git a/jena-fuseki2/dist/NOTICE b/jena-fuseki2/dist/NOTICE
deleted file mode 100644
index a840c0b..0000000
--- a/jena-fuseki2/dist/NOTICE
+++ /dev/null
@@ -1,216 +0,0 @@
-Apache Jena - module Fuseki
-Copyright 2011-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
- - Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
- - Copyright 2010, 2011 Epimorphics Ltd.
- - Copyright 2010, 2011 Talis Systems Ltd.
-These have been licensed to the Apache Software Foundation under a software grant.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-slf4j:
- Copyright (c) 2004-2011 QOS.ch
- All rights reserved.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-(c) Copyright 2003, Plugged In Software
-This product includes software developed by
-PluggedIn Software under a BSD license.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
- Jetty Web Container
- Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
-
-under the Apache 2.0 License.
-
-The Jetty Web Container includes:
-
-UnixCrypt.java
-Copyright 1996 Aki Yoshida,
-modified April 2001 by Iris Van den Broeke, Daniel Deville.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-From Apache HttpComponents Client:
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
- Apache Xerces Java
- Copyright 1999-2013 The Apache Software Foundation
-
- This product includes software developed at
- The Apache Software Foundation (http://www.apache.org/).
-
- Portions of this software were originally based on the following:
- - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- - voluntary contributions made by Paul Eng on behalf of the
- Apache Software Foundation that were originally developed at iClick, Inc.,
- software copyright (c) 1999.
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-From Apache Lucene:
-
-ICU4J, (under analysis/icu) is licensed under an MIT styles license
-and Copyright (c) 1995-2008 International Business Machines Corporation and others
-
-Some data files (under analysis/icu/src/data) are derived from Unicode data such
-as the Unicode Character Database. See http://unicode.org/copyright.html for more
-details.
-
-Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is
-BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
-
-The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
-automatically generated with the moman/finenight FSA library, created by
-Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
-see http://sites.google.com/site/rrettesite/moman and
-http://bitbucket.org/jpbarrette/moman/overview/
-
-This product includes code (JaspellTernarySearchTrie) from Java Spelling
-Checking Package (jaspell): http://jaspell.sourceforge.net/
-License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
-
-The snowball stemmers in
- analysis/common/src/java/net/sf/snowball
-were developed by Martin Porter and Richard Boulton.
-The snowball stopword lists in
- analysis/common/src/resources/org/apache/lucene/analysis/snowball
-were developed by Martin Porter and Richard Boulton.
-The full snowball package is available from
- http://snowball.tartarus.org/
-
-The KStem stemmer in
- analysis/common/src/org/apache/lucene/analysis/en
-was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
-under the BSD-license.
-
-The Arabic,Persian,Romanian,Bulgarian, and Hindi analyzers (common) come with a default
-stopword list that is BSD-licensed created by Jacques Savoy.
-See http://members.unine.ch/jacques.savoy/clef/index.html.
-
-The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
-(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
-Ljiljana Dolamic.
-
-The Stempel analyzer (stempel) includes BSD-licensed software developed
-by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
-and Edmond Nolan.
-
-The Polish analyzer (stempel) comes with a default
-stopword list that is BSD-licensed created by the Carrot2 project. The file resides
-in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
-See http://project.carrot2.org/license.html.
-
-The SmartChineseAnalyzer source code (smartcn) was
-provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
-
-WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/)
-is derived from Unicode data such as the Unicode Character Database.
-See http://unicode.org/copyright.html for more details.
-
-The Morfologik analyzer (morfologik) includes BSD-licensed software
-developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
-
-Morfologik uses data from Polish ispell/myspell dictionary
-(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
-LGPL and Creative Commons ShareAlike.
-
-Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
-(http://sgjp.pl/morfeusz/)
-
-Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
-source code for this can be found at http://www.eclipse.org/jetty/downloads.php
-
-===========================================================================
-Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
-===========================================================================
-
-This software includes a binary and/or source version of data from
-
- mecab-ipadic-2.7.0-20070801
-
-which can be obtained from
-
- http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
-
-or
-
- http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
-
-===========================================================================
-mecab-ipadic-2.7.0-20070801 Notice
-===========================================================================
-
-Nara Institute of Science and Technology (NAIST),
-the copyright holders, disclaims all warranties with regard to this
-software, including all implied warranties of merchantability and
-fitness, in no event shall NAIST be liable for
-any special, indirect or consequential damages or any damages
-whatsoever resulting from loss of use, data or profits, whether in an
-action of contract, negligence or other tortuous action, arising out
-of or in connection with the use or performance of this software.
-
-A large portion of the dictionary entries
-originate from ICOT Free Software. The following conditions for ICOT
-Free Software applies to the current dictionary as well.
-
-Each User may also freely distribute the Program, whether in its
-original form or modified, to any third party or parties, PROVIDED
-that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
-on, or be attached to, the Program, which is distributed substantially
-in the same form as set out herein and that such intended
-distribution, if actually made, will neither violate or otherwise
-contravene any of the laws and regulations of the countries having
-jurisdiction over the User or the intended distribution itself.
-
-NO WARRANTY
-
-The program was produced on an experimental basis in the course of the
-research and development conducted during the project and is provided
-to users as so produced on an experimental basis. Accordingly, the
-program is provided without any warranty whatsoever, whether express,
-implied, statutory or otherwise. The term "warranty" used herein
-includes, but is not limited to, any warranty of the quality,
-performance, merchantability and fitness for a particular purpose of
-the program and the nonexistence of any infringement or violation of
-any right of any third party.
-
-Each user of the program will agree and understand, and be deemed to
-have agreed and understood, that there is no warranty whatsoever for
-the program and, accordingly, the entire risk arising from or
-otherwise connected with the program is assumed by the user.
-
-Therefore, neither ICOT, the copyright holder, or any other
-organization that participated in or was otherwise related to the
-development of the program and their respective officials, directors,
-officers and other employees shall be held liable for any and all
-damages, including, without limitation, general, special, incidental
-and consequential damages, arising out of or otherwise in connection
-with the use or inability to use the program or any product, material
-or result produced or otherwise obtained by using the program,
-regardless of whether they have been advised of, or otherwise had
-knowledge of, the possibility of such damages at any time during the
-project or thereafter. Each user will be deemed to have agreed to the
-foregoing by his or her commencement of use of the program. The term
-"use" as used herein includes, but is not limited to, the use,
-modification, copying and distribution of the program and the
-production of secondary products from the program.
-
-In the case where the program, whether in its original form or
-modified, was distributed or delivered to or received by a user from
-any person, organization or entity other than ICOT, unless it makes or
-grants independently of ICOT any specific warranty to the user in
-writing, such person, organization or entity, will also be exempted
-from and not be held liable to the user for any such damages as noted
-above as far as the program is concerned.
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/dwim
----------------------------------------------------------------------
diff --git a/jena-fuseki2/dwim b/jena-fuseki2/dwim
deleted file mode 100755
index a541688..0000000
--- a/jena-fuseki2/dwim
+++ /dev/null
@@ -1,19 +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.
-
-curl -XPOST --header "Content-type: text/trig" --data-binary @D.trig \
- http://localhost:3030/ds/data
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/dwim-upload
----------------------------------------------------------------------
diff --git a/jena-fuseki2/dwim-upload b/jena-fuseki2/dwim-upload
deleted file mode 100755
index 903561d..0000000
--- a/jena-fuseki2/dwim-upload
+++ /dev/null
@@ -1,48 +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.
-
-# How to do a file upload in curl
-
-# GSP strict
-U='http://localhost:3030/ds/data?graph=http://example/G'
-# PUT
-## curl --upload-file D.ttl --header 'Content-Type: text/turtle' "$U"
-
-# POST
-curl -XPOST --upload-file D.ttl --header 'Content-Type: text/turtle' "$U"
-
-# GSP strict / file upload
-## curl -F 'file=@D.ttl' http://localhost:3030/ds/data
-
-# Quads to GSP
-
-## curl -F 'file=@D.ttl' http://localhost:3030/ds/data
-## curl -F 'file=@D.trig' http://localhost:3030/ds/data
-
-# Quads to graph : NGs in data ignored
-# curl -F 'file=@D.trig' 'http://localhost:3030/ds/data?default'
-#curl -F 'file=@D.trig' 'http://localhost:3030/ds/data?graph=http://example/G'
-
-# Dataset
-## curl -F 'file=@D.trig' http://localhost:3030/ds
-
-# Upload service
-## curl -F 'file=@D.trig' -F 'name=http://graph/' 'http://localhost:3030/ds/upload'
-
-
-echo "==== Dataset"
-curl http://localhost:3030/ds
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/fuseki
----------------------------------------------------------------------
diff --git a/jena-fuseki2/fuseki b/jena-fuseki2/fuseki
deleted file mode 100644
index 9cc1fe8..0000000
--- a/jena-fuseki2/fuseki
+++ /dev/null
@@ -1,477 +0,0 @@
-#!/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/fuseki-server
----------------------------------------------------------------------
diff --git a/jena-fuseki2/fuseki-server b/jena-fuseki2/fuseki-server
deleted file mode 100755
index 679b3bd..0000000
--- a/jena-fuseki2/fuseki-server
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/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/fuseki-server.bat
----------------------------------------------------------------------
diff --git a/jena-fuseki2/fuseki-server.bat b/jena-fuseki2/fuseki-server.bat
deleted file mode 100644
index 5881660..0000000
--- a/jena-fuseki2/fuseki-server.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-@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-core/pom.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/pom.xml b/jena-fuseki2/jena-fuseki-core/pom.xml
new file mode 100644
index 0000000..efe35ec
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/pom.xml
@@ -0,0 +1,301 @@
+<?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>
+ <parent>
+ <groupId>org.apache.jena</groupId>
+ <artifactId>jena-fuseki</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <name>Apache Jena Fuseki - Server engine</name>
+ <artifactId>jena-fuseki-core</artifactId>
+
+ <!-- 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>
+ <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-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>
+ </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-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-resources-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java
new file mode 100644
index 0000000..8d8495a
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java
@@ -0,0 +1,79 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java
new file mode 100644
index 0000000..0f42219
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java
@@ -0,0 +1,227 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiCmd.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
new file mode 100644
index 0000000..5746394
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
@@ -0,0 +1,49 @@
+/**
+ * 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.lang.reflect.Method ;
+
+public class FusekiCmd {
+ public static void main(String[] args) {
+ // Must NOT use any logging. The command processor sets that up.
+ System.err.println("Deprecated: Use org.apache.jena.fuseki.cmd.FusekiCmd") ;
+ try {
+ // A
+ callByRefection("org.apache.jena.fuseki.cmd.FusekiCmd", "main", args) ;
+ } catch (ClassNotFoundException | NoSuchMethodException ex) {
+ System.err.println("Failed to find the command processor: "+ ex.getMessage()) ;
+ } catch (Exception ex) {
+ System.err.println("Failed to invoke the command processor: "+ ex.getMessage()) ;
+ ex.printStackTrace(System.err) ;
+ }
+ }
+
+ // Call a static of no arguments by reflection.
+ private static void callByRefection(String className, String staticMethod, String[] args)
+ throws Exception
+ {
+ Class<? > cls = Class.forName(className) ;
+ // Pass up : ClassNotFoundException
+
+ Method m = cls.getMethod(staticMethod, String[].class) ;
+ m.invoke(null, (Object)args) ;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
new file mode 100644
index 0000000..5e1b018
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiConfigException.java
@@ -0,0 +1,28 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiException.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiException.java
new file mode 100644
index 0000000..04953ce
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiException.java
@@ -0,0 +1,29 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
new file mode 100644
index 0000000..52024d4
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
@@ -0,0 +1,258 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLogging.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLogging.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLogging.java
new file mode 100644
index 0000000..1add2b2
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLogging.java
@@ -0,0 +1,171 @@
+/**
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
new file mode 100644
index 0000000..be9be90
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiNotFoundException.java
@@ -0,0 +1,26 @@
+/*
+ * 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/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
new file mode 100644
index 0000000..e197be2
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiRequestException.java
@@ -0,0 +1,57 @@
+/*
+ * 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() ;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/470ee4d7/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/async/AsyncPool.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/async/AsyncPool.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/async/AsyncPool.java
new file mode 100644
index 0000000..1d98ff2
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/async/AsyncPool.java
@@ -0,0 +1,97 @@
+/**
+ * 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.async;
+
+import static java.lang.String.format ;
+
+import java.util.* ;
+import java.util.concurrent.* ;
+
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.server.DataService ;
+
+/** The set of currently active async tasks */
+public class AsyncPool
+{
+ private static int nMaxThreads = 4 ;
+ private static int MAX_FINISHED = 20 ;
+
+ // See Executors.newCachedThreadPool and Executors.newFixedThreadPool
+ private ExecutorService executor = new ThreadPoolExecutor(0, nMaxThreads,
+ 120L, TimeUnit.SECONDS,
+ new LinkedBlockingQueue<Runnable>()) ;
+ private final Object mutex = new Object() ;
+ private long counter = 0 ;
+ private Map<String, AsyncTask> runningTasks = new LinkedHashMap<>() ;
+ private Map<String, AsyncTask> finishedTasks = new LinkedHashMap<>() ;
+
+ private static AsyncPool instance = new AsyncPool() ;
+ public static AsyncPool get()
+ { return instance ; }
+
+ private AsyncPool() { }
+
+ public AsyncTask submit(Runnable task, String displayName, DataService dataService) {
+ synchronized(mutex) {
+ String taskId = Long.toString(++counter) ;
+ Fuseki.serverLog.info(format("Task : %s : %s",taskId, displayName)) ;
+ Callable<Object> c = Executors.callable(task) ;
+ AsyncTask asyncTask = new AsyncTask(c, this, taskId, displayName, dataService) ;
+ Future<Object> x = executor.submit(asyncTask) ;
+ runningTasks.put(taskId, asyncTask) ;
+ return asyncTask ;
+ }
+ }
+
+ public Collection<AsyncTask> tasks() {
+ synchronized(mutex) {
+ List<AsyncTask> x = new ArrayList<>(runningTasks.size()+finishedTasks.size()) ;
+ x.addAll(runningTasks.values()) ;
+ x.addAll(finishedTasks.values()) ;
+ return x ;
+ }
+ }
+
+ public void finished(AsyncTask task) {
+ synchronized(mutex) {
+ String id = task.getTaskId() ;
+ runningTasks.remove(id) ;
+ while ( finishedTasks.size() >= MAX_FINISHED )
+ finishedTasks.remove(task.getTaskId()) ;
+ finishedTasks.put(id, task) ;
+ }
+ }
+
+ public AsyncTask getRunningTask(String taskId) {
+ synchronized(mutex) {
+ return runningTasks.get(taskId) ;
+ }
+ }
+
+ /** Get for any state */
+ public AsyncTask getTask(String taskId) {
+ synchronized(mutex) {
+ AsyncTask task = runningTasks.get(taskId) ;
+ if ( task != null )
+ return task ;
+ return finishedTasks.get(taskId) ;
+ }
+ }
+}
+