You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/02/19 13:52:00 UTC
[26/52] [partial] code contribution,
initial import of relevant modules of LMF-3.0.0-SNAPSHOT based on
revision 4bf944319368 of the default branch at https://code.google.com/p/lmf/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/ehcache-lmf.xml
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/ehcache-lmf.xml b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/ehcache-lmf.xml
new file mode 100644
index 0000000..03091fd
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/ehcache-lmf.xml
@@ -0,0 +1,420 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<!--
+CacheManager Configuration
+==========================
+An ehcache-lmf.xml corresponds to a single CacheManager.
+
+See instructions below or the ehcache schema (ehcache.xsd) on how to configure.
+
+System property tokens can be specified in this file which are replaced when the configuration
+is loaded. For example multicastGroupPort=${symbol_dollar}{multicastGroupPort} can be replaced with the
+System property either from an environment variable or a system property specified with a
+command line switch such as -DmulticastGroupPort=4446.
+
+The attributes of <ehcache> are:
+* name - an optional name for the CacheManager. The name is optional and primarily used
+for documentation or to distinguish Terracotta clustered cache state. With Terracotta
+clustered caches, a combination of CacheManager name and cache name uniquely identify a
+particular cache store in the Terracotta clustered memory.
+* updateCheck - an optional boolean flag specifying whether this CacheManager should check
+for new versions of Ehcache over the Internet. If not specified, updateCheck="true".
+* monitoring - an optional setting that determines whether the CacheManager should
+automatically register the SampledCacheMBean with the system MBean server. Currently,
+this monitoring is only useful when using Terracotta and thus the "autodetect" value
+will detect the presence of Terracotta and register the MBean. Other allowed values
+are "on" and "off". The default is "autodetect".
+-->
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" name="lmf">
+
+ <!--
+ DiskStore configuration
+ =======================
+
+ The diskStore element is optional. To turn off disk store path creation, comment out the diskStore
+ element below.
+
+ Configure it if you have overflowToDisk or diskPersistent enabled for any cache.
+
+ If it is not configured, and a cache is created which requires a disk store, a warning will be
+ issued and java.io.tmpdir will automatically be used.
+
+ diskStore has only one attribute - "path". It is the path to the directory where
+ .data and .index files will be created.
+
+ If the path is one of the following Java System Property it is replaced by its value in the
+ running VM. For backward compatibility these are not specified without being enclosed in the ${symbol_dollar}{token}
+ replacement syntax.
+
+ The following properties are translated:
+ * user.home - KiWiUser's home directory
+ * user.dir - KiWiUser's current working directory
+ * java.io.tmpdir - Default temp file path
+ * ehcache.disk.store.dir - A system property you would normally specify on the command line
+ e.g. java -Dehcache.disk.store.dir=/u01/myapp/diskdir ...
+
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+
+ -->
+ <diskStore path="java.io.tmpdir/lmf-cache/lmf"/>
+
+ <!--
+ Cachemanagereventlistener
+ =========================
+ Specifies a CacheManagerEventListenerFactory which is notified when Caches are added
+ or removed from the CacheManager.
+
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
+
+ The events include:
+ * adding a Cache
+ * removing a Cache
+
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
+
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
+
+
+ <!--
+ CacheManagerPeerProvider
+ ========================
+ (For distributed operation)
+
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+
+ One or more providers can be configured. The first one in the ehcache-lmf.xml is the default, which is used
+ for replication and bootstrapping.
+
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Providers are available for RMI, JGroups and JMS as shown following.
+
+ RMICacheManagerPeerProvider
+ +++++++++++++++++++++++++++
+
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
+
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will
+ propagate.
+
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
+
+ * hostName - the hostname or IP of the interface to be used for sending and receiving multicast packets
+ (relevant to mulithomed hosts only)
+
+ Configuring Manual Discovery:
+ Manual discovery requires a unique configuration per host. It is contains a list of rmiURLs for the peers, other
+ than itself. So, if we have server1, server2 and server3 the configuration will be:
+
+ In server1's configuration:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server2:40000/sampleCache1|//server3:40000/sampleCache1
+ | //server2:40000/sampleCache2|//server3:40000/sampleCache2"
+ propertySeparator="," />
+
+ In server2's configuration:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server3:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server3:40000/sampleCache2"
+ propertySeparator="," />
+
+ In server3's configuration:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"
+ propertySeparator="," />
+
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
+ * hostname (optional) - the hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+
+ JGroupsCacheManagerPeerProvider
+ +++++++++++++++++++++++++++++++
+ <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
+ properties="connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;
+ mcast_send_buf_size=150000;mcast_recv_buf_size=80000):
+ PING(timeout=2000;num_initial_members=6):
+ MERGE2(min_interval=5000;max_interval=10000):
+ FD_SOCK:VERIFY_SUSPECT(timeout=1500):
+ pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000):
+ UNICAST(timeout=5000):
+ pbcast.STABLE(desired_avg_gossip=20000):
+ FRAG:
+ pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=false)"
+ propertySeparator="::"
+ />
+ The only property necessary is the connect String used by jgroups to configure itself. Refer to the Jgroups documentation for explanation
+ of all the protocols. The example above uses UDP multicast. If the connect property is not specified the default JGroups connection will be
+ used.
+
+
+ JMSCacheManagerPeerProviderFactory
+ ++++++++++++++++++++++++++++++++++
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory"
+ properties="..."
+ propertySeparator=","
+ />
+
+ The JMS PeerProviderFactory uses JNDI to maintain message queue independence. Refer to the manual for full configuration
+ examples using ActiveMQ and Open Message Queue.
+
+ Valid properties are:
+ * initialContextFactoryName (mandatory) - the name of the factory used to create the message queue initial context.
+ * providerURL (mandatory) - the JNDI configuration information for the service provider to use.
+ * topicConnectionFactoryBindingName (mandatory) - the JNDI binding name for the TopicConnectionFactory
+ * topicBindingName (mandatory) - the JNDI binding name for the topic name
+ * getQueueBindingName (mandatory only if using jmsCacheLoader) - the JNDI binding name for the queue name
+ * securityPrincipalName - the JNDI java.naming.security.principal
+ * securityCredentials - the JNDI java.naming.security.credentials
+ * urlPkgPrefixes - the JNDI java.naming.factory.url.pkgs
+ * userName - the user name to use when creating the TopicConnection to the Message Queue
+ * password - the password to use when creating the TopicConnection to the Message Queue
+ * acknowledgementMode - the JMS Acknowledgement mode for both publisher and subscriber. The available choices are
+ AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE and SESSION_TRANSACTED. The default is AUTO_ACKNOWLEDGE.
+ -->
+<!-- <cacheManagerPeerProviderFactory-->
+<!-- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"-->
+<!-- properties="peerDiscovery=automatic,-->
+<!-- multicastGroupAddress=230.0.0.1,-->
+<!-- multicastGroupPort=4446, timeToLive=1"-->
+<!-- propertySeparator=","-->
+<!-- />-->
+
+
+ <!--
+ CacheManagerPeerListener
+ ========================
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which listens for messages from cache replicators participating in the cluster.
+
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ remoteObjectPort=40002,
+ socketTimeoutMillis=120000"
+ propertySeparator="," />
+
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the RMI Registry listener listens on. This defaults to a free port if not specified.
+ * remoteObjectPort - the port number on which the remote objects bound in the registry receive calls.
+ This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults to 120000ms.
+
+ -->
+<!-- <cacheManagerPeerListenerFactory-->
+<!-- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>-->
+
+ <!-- Cache configuration.
+
+ The following attributes are required.
+
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
+
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
+
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
+
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
+
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
+
+ The following attributes are optional.
+
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
+
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
+
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
+
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
+
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
+
+ -->
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="20000"
+ overflowToDisk="false"
+ memoryStoreEvictionPolicy="LRU"
+ />
+
+
+ <!-- the cache used for triple queries by KiWi -->
+ <cache name="uri-node-cache"
+ statistics="true"
+ maxElementsInMemory="100000"
+ timeToIdleSeconds="3600"
+ overflowToDisk="false"/>
+ <cache name="anon-node-cache"
+ statistics="true"
+ maxElementsInMemory="10000"
+ timeToIdleSeconds="3600"
+ overflowToDisk="false"/>
+ <cache name="literal-cache"
+ statistics="true"
+ maxElementsInMemory="10000"
+ timeToIdleSeconds="3600"
+ overflowToDisk="false"/>
+
+ <cache name="namespace-prefix-cache"
+ statistics="true"
+ maxElementsInMemory="100"
+ overflowToDisk="true"/>
+
+ <cache name="namespace-uri-cache"
+ statistics="true"
+ maxElementsInMemory="100"
+ overflowToDisk="true"/>
+
+ <!-- the cache used for triple queries by KiWi -->
+ <cache name="query-cache"
+ statistics="true"
+ maxElementsInMemory="200000"
+ timeToIdleSeconds="3600"
+ overflowToDisk="false"/>
+
+ <!-- the cache used for resource lookups from module jar files -->
+ <cache name="resource-cache"
+ statistics="true"
+ maxElementsInMemory="10000"
+ timeToIdleSeconds="3600"
+ timeToLiveSeconds="3600"
+ overflowToDisk="false"
+ memoryStoreEvictionPolicy="LRU"/>
+
+ <!-- the cache used for triple queries by KiWi -->
+ <cache name="page-cache"
+ statistics="true"
+ maxElementsInMemory="500"
+ timeToIdleSeconds="3600"
+ memoryStoreEvictionPolicy="LRU"
+ overflowToDisk="true"/>
+
+ <cache name="http-content-cache"
+ statistics="true"
+ maxElementsInMemory="500"
+ timeToIdleSeconds="3600"
+ memoryStoreEvictionPolicy="LRU"
+ overflowToDisk="true"/>
+
+
+ <!-- uncomment to enable cache debugging -->
+<!--
+ <cacheManagerPeerListenerFactory
+ class="org.terracotta.ehcachedx.monitor.probe.ProbePeerListenerFactory"
+ properties="monitorAddress=localhost, monitorPort=9889" />
+-->
+
+</ehcache>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
new file mode 100644
index 0000000..6b3235e
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
@@ -0,0 +1,70 @@
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!--
+ ~ Copyright (c) 2008-2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ -->
+
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+<!-- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> -->
+ <pattern>%d{HH:mm:ss.SSS} %-5level - %msg%n</pattern>
+<!-- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> -->
+ </encoder>
+ </appender>
+
+ <logger name="kiwi.core" level="INFO" />
+
+ <logger name="kiwi.reasoner" level="INFO" />
+
+ <logger name="at.newmedialab.sn" level="TRACE" />
+
+ <logger name="kiwi.social" level="TRACE" />
+
+ <logger name="org.hibernate" level="WARN" />
+ <!--
+ <logger name="org.hibernate.SQL" level="DEBUG" />
+ <logger name="org.hibernate.pretty" level="DEBUG" />
+ -->
+
+ <logger name="org.apache.solr" level="WARN" />
+
+ <logger name="org.quartz" level="WARN" />
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/META-INF/jetty-web.xml
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/META-INF/jetty-web.xml b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/META-INF/jetty-web.xml
new file mode 100644
index 0000000..9f224a7
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/META-INF/jetty-web.xml
@@ -0,0 +1,28 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
+ <Call class="org.jboss.weld.environment.jetty.WeldServletHandler" name="process">
+ <Arg><Ref id="webAppCtx"/></Arg>
+ </Call>
+</Configure>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-web.xml
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-web.xml b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-web.xml
new file mode 100644
index 0000000..97940d8
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-web.xml
@@ -0,0 +1,53 @@
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ -->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
+ "http://jetty.mortbay.org/configure.dtd">
+
+<Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
+
+ <Array id="annotationConfig" type="java.lang.String">
+ <Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
+ <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
+ <Item>org.mortbay.jetty.annotations.Configuration</Item> <!-- Enables annotation support -->
+ <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
+ <Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
+ </Array>
+
+ <Call class="org.jboss.weld.environment.jetty.MortbayWeldServletHandler" name="process">
+ <Arg><Ref id="webAppCtx"/></Arg>
+ </Call>
+</Configure>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/404.ftl
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/404.ftl b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/404.ftl
new file mode 100644
index 0000000..0b70b47
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/404.ftl
@@ -0,0 +1,88 @@
+<#--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <title>404 Not Found - LMF Linked Data Explorer</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <script type="text/javascript" src="${baseUri}core/public/js/lib/jquery-1.7.2.js"></script>
+ <script type="text/javascript" src="${baseUri}core/public/js/lib/jquery-ui-1.8.21.js"></script>
+ <link href="${baseUri}core/public/style/style1.css" title="screen" rel="stylesheet" type="text/css" />
+ <link href="${baseUri}core/public/style/center.css" title="screen" rel="stylesheet" type="text/css" />
+ <style type="text/css">
+ div#center {
+ float: none;
+ width: auto;
+ vertical-align: middle;
+ min-height: 400px;
+ margin: 0;
+ padding: 2em 30% 5em 30%;
+ }
+ div#center > * {
+ margin-top: 2em;
+ font-size: 1.6em;
+ }
+ div#center > p > a > img {
+ vertical-align: text-top;
+ margin-left: 0.15em;
+ }
+ </style>
+</head>
+
+<body>
+
+<div id="header">
+ <div id="logo">
+ <a href="${baseUri}">
+ <img src="${baseUri}core/public/img/lmf-white.png" alt="LMF" />
+ </a>
+ </div>
+ <h1>LMF Linked Data Explorer</h1>
+</div>
+
+<div id="center">
+
+ <h2>404 Not Found</h2>
+
+ <p>
+ <strong><a href="${baseUri}resource?uri=${encoded_uri}">${uri}</a></strong><a href="${uri}"><img src="${baseUri}core/public/img/link.png" alt="${uri}" title="go to ${uri} directly" /></a>
+ </p>
+
+ <p>
+ Sorry, but the requested resource could not be found in LMF right now,
+ but may be available again in the future.
+ </p>
+
+</div>
+
+<div id="footer" class="clear">
+ <span><abbr title="Linked Media Framework">LMF</abbr> is a project of <a href="http://www.newmedialab.at/">SNML-TNG</a></span>
+</div>
+
+<script type="text/javascript">
+
+ $(document).ready(function() {
+
+ });
+
+</script>
+
+</body>
+
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/admin.ftl
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/admin.ftl b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/admin.ftl
new file mode 100644
index 0000000..ac61f0b
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/admin.ftl
@@ -0,0 +1,79 @@
+<#--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Default-Style" content="${DEFAULT_STYLE}">
+ <link href="${SERVER_URL}core/public/style/javadoc.css" rel="stylesheet" type="text/css" />
+ <link href="${SERVER_URL}core/public/style/style1.css" title="screen" rel="stylesheet" type="text/css" />
+ <link href="${SERVER_URL}core/public/style/style2.css" title="beamer" rel="alternate stylesheet" type="text/css" />
+ <link href="${SERVER_URL}core/public/img/icon-small.ico" rel="SHORTCUT ICON">
+ <script type="text/javascript">
+ var _BASIC_URL = "${BASIC_URL}";
+ //use _SERVER_URL for webservice calls
+ var _SERVER_URL = "${SERVER_URL}";
+ </script>
+ <script type="text/javascript" src="${SERVER_URL}core/public/js/lib/jquery-1.7.2.js"></script>
+ <script type="text/javascript" src="${SERVER_URL}core/public/js/widgets/current-user.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ new LMF.currentUserWidget(_SERVER_URL, document.getElementById("login_logout")).init();
+ });
+ </script>
+ ${HEAD}
+ <title>LMF - The Linked Media Server</title>
+ <style type="text/css">
+ #login_logout {
+ float: right;
+ margin: 5px;
+ }
+ </style>
+ </head>
+ <body>
+ <a id="top-link" href="${SERVER_URL}">TOPLINK</a>
+ <div id="wrapper">
+ <div id="header">
+ <div id="logo">
+ <a href="${SERVER_URL}"><img src="${SERVER_URL}core/public/img/lmf-white.png" /></a>
+ </div>
+ <div id="header_text">
+ <h1>${CURRENT_TITLE}</h1>
+ <div id="topnav">
+ <div id="login_logout"></div>
+ </div>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div id="left">
+ ${MODULE_MENU}
+ </div>
+ <div id="center">
+ ${CONTENT}
+ </div>
+ <div class="clear"></div>
+ <div id="footer">
+ <span>
+ <a href="http://lmf.googlecode.com">LMF</a>
+ is a project of
+ <a href="http://www.newmedialab.at/">SNML-TNG</a>
+ </span>
+ </div>
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/rdfhtml.ftl
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/rdfhtml.ftl b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/rdfhtml.ftl
new file mode 100644
index 0000000..a874823
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/rdfhtml.ftl
@@ -0,0 +1,295 @@
+<#--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<!DOCTYPE html>
+<html lang="en" prefix="${prefixMappings}">
+
+<head>
+ <title>Resource/s in HTML</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <script type="text/javascript" src="${baseUri}core/public/js/lib/jquery-1.7.2.js"></script>
+ <script type="text/javascript" src="${baseUri}core/public/js/lib/jquery-ui-1.8.21.js"></script>
+ <link href="${baseUri}core/public/style/style1.css" title="screen" rel="stylesheet" type="text/css" />
+ <link href="${baseUri}core/public/style/rdfhtml.css" title="screen" rel="stylesheet" type="text/css" />
+ <link href="${baseUri}core/public/style/smoothness/jquery-ui-1.8.21.custom.css" title="screen" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="header">
+ <div id="logo">
+ <a href="${baseUri}">
+ <img src="${baseUri}core/public/img/lmf-white.png" alt="LMF" />
+ </a>
+ </div>
+ <h1>LMF Linked Data Explorer</h1>
+</div>
+
+<#function zebra index>
+ <#if (index % 2) == 0>
+ <#return "even" />
+ <#else>
+ <#return "odd" />
+ </#if>
+</#function>
+
+<#function cacheClass object>
+ <#if object.cache?has_content>
+ <#return "ldcache" />
+ <#else>
+ <#return "" />
+ </#if>
+</#function>
+
+<#function rdfaAttributes object>
+ <#return "${rdfaDatatype(object)} ${rdfaLanguage(object)}" />
+</#function>
+
+<#function rdfaDatatype object>
+ <#if object.datatype?has_content>
+ <#return "datatype=\"${object.datatype}\"" />
+ <#else>
+ <#return "" />
+ </#if>
+</#function>
+
+<#function rdfaLanguage object>
+ <#if object.lang?has_content>
+ <#return "lang=\"${object.lang}\"" />
+ <#else>
+ <#return "" />
+ </#if>
+</#function>
+
+<div id="tabs">
+
+ <ul>
+
+ <li><a href="#tab-raw-triples">raw triples</a></li>
+
+ <#if resources?size = 1>
+ <li><a href="#tab-inspection">inspection</a></li>
+ </#if>
+
+ </ul>
+
+ <div id="tab-raw-triples">
+
+ <#if resources?has_content>
+ <#list resources as resource>
+ <div class="subheader">
+ <h3>Local description of <a href="${resource.uri}" class="ldcache">${resource.uri}</a>:</h3>
+ </div>
+ <table>
+ <tr class="trClassHeader">
+ <th>property</th>
+ <th>has value</th>
+ <th>context</th>
+ <th id="info">info</th>
+ </tr>
+ <#list resource.triples as triple>
+ <tr class="${zebra(triple_index)}">
+ <td><a href="${triple.predicate.uri}" class="ldcache">${triple.predicate.curie}</a></td>
+ <td about="${resource.uri}">
+ <#if triple.object.uri?has_content>
+ <a rel="${triple.predicate.curie}" href="${triple.object.uri}" class="${cacheClass(triple.object)}">${triple.object.curie}</a>
+ <#else>
+ <span property="${triple.predicate.curie}" ${rdfaAttributes(triple.object)}>${triple.object.value}</span>
+ </#if>
+ </td>
+ <td><a href="${triple.context.curie}">${triple.context.curie}</a></td>
+ <td>${triple.info}</td>
+ </tr>
+ </#list>
+ </table>
+ <p id="rawrdf">
+ Get this resource in raw RDF:
+ <a href="${baseUri}resource?uri=${resource.encoded_uri}&format=application/rdf%2Bxml">RDF/XML</a>,
+ <a href="${baseUri}resource?uri=${resource.encoded_uri}&format=text/rdf%2Bn3">N3</a>,
+ <a href="${baseUri}resource?uri=${resource.encoded_uri}&format=text/turtle">Turtle</a>,
+ <a href="${baseUri}resource?uri=${resource.encoded_uri}&format=application/rdf%2Bjson">RDF/JSON</a>,
+ <a href="${baseUri}resource?uri=${resource.encoded_uri}&format=application/json">JSON-LD</a>
+ </p>
+ </#list>
+ <#else>
+ <div class='subheader'>
+ <h3>No local triples to display!</h3>
+ </div>
+ </#if>
+
+ </div>
+
+ <#if resources?size = 1>
+ <div id="tab-inspection">
+ <div class="subheader">
+ <h3>Inspection of <a href="${resources[0].uri}" class="ldcache">${resources[0].uri}</a>:</h3>
+ </div>
+ <div class="introspectionDetails">
+ <h4><a href="${resources[0].uri}" class="ldcache">${resources[0].uri}</a> as Subject</h4>
+ <button id="s0">|<</button>
+ <button id="s1"><</button>
+ <button id="s2">></button>
+ <button id="s3">+</button>
+ <button id="s4">-</button>
+ <table id="inspect_subject">
+ <tr class="trClassHeader">
+ <th>Subject</th>
+ <th>Property</th>
+ <th>Object</th>
+ <th>Context<th>
+ </tr>
+ </table>
+ </div>
+ <div class="introspectionDetails">
+ <h4><a href="${resources[0].uri}" class="ldcache">${resources[0].uri}</a> as Property</h4>
+ <table id="inspect_property">
+ <tr class="trClassHeader">
+ <th>Subject</th>
+ <th>Property</th>
+ <th>Object</th>
+ <th>Context<th>
+ </tr>
+ </table>
+ </div>
+ <div class="introspectionDetails">
+ <h4><a href="${resources[0].uri}" class="ldcache">${resources[0].uri}</a> as Object</h4>
+ <table id="inspect_object">
+ <tr class="trClassHeader">
+ <th>Subject</th>
+ <th>Property</th>
+ <th>Object</th>
+ <th>Context<th>
+ </tr>
+ </table>
+ </div>
+ <!--
+ <div class="introspectionDetails">
+ <h4><a href="${resources[0].uri}" class="ldcache">${resources[0].uri}</a> as Context</h4>
+ <table id="inspect_context">
+ <tr class="trClassHeader">
+ <th>Subject</th>
+ <th>Property</th>
+ <th>Object</th>
+ <th>Context<th>
+ </tr>
+ </table>
+ </div>
+ -->
+ </div>
+ </#if>
+
+</div>
+
+<div id="footer" class="clear">
+ <span><abbr title="Linked Media Framework">LMF</abbr> is a project of <a href="http://www.newmedialab.at/">SNML-TNG</a></span>
+</div>
+
+<script type="text/javascript">
+
+ $(document).ready(function() {
+
+ $("div#tabs").tabs();
+
+ $("a.ldcache").each(function(index) {
+ $(this).click(function() {
+ window.location.href = "${baseUri}resource?uri=" + encodeURIComponent($(this).attr("href"));
+ return false;
+ });
+ });
+
+ function loader(uri, type, target) {
+ function linkify(text) {
+ var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
+ return text.replace(exp,"<a href='$1' class='ldcache'>$1</a>");
+ }
+ function zebra(index) {
+ return ( index % 2 ? "even": "odd" );
+ }
+ function createRow(data, cssClass) {
+ return $("<tr>", {})
+ .append($("<td>", {html: linkify(data.s)}))
+ .append($("<td>", {html: linkify(data.p)}))
+ .append($("<td>", {html: linkify(data.o)}))
+ .append($("<td>", {html: linkify(data.c)}))
+ .addClass(cssClass);
+ }
+ return {
+ resource: uri,
+ target: $(target),
+ offset: 0,
+ limit: 10,
+ fetch: function() {
+ var self = this;
+ $.getJSON("${baseUri}inspect/" + type, {uri: self.resource, start: self.offset, limit: self.limit}, function(data) {
+ //self.target.empty();
+ for( var i in data) {
+ var t = data[i];
+ self.target.append(createRow(t, zebra(i)));
+ }
+ });
+ },
+ next: function(step) {
+ step = step || this.limit;
+ this.offset += step;
+ this.fetch();
+ },
+ prev: function(step) {
+ step = step || this.limit
+ this.offset = Math.max(this.offset - step, 0);
+ this.fetch();
+ },
+ more: function() {
+ this.limit += 5;
+ this.fetch();
+ },
+ less: function() {
+ this.limit = Math.max(this.limit - 5, 5);
+ this.fetch();
+ },
+ first: function() {
+ this.offset = 0;
+ this.fetch();
+ }
+ };
+ }
+
+ <#if resources?size = 1>
+ var subj = $("table#inspect_subject tbody");
+ var subjLoader = new loader("${resources[0].uri}", "subject", subj);
+ subjLoader.fetch();
+ $("#s0").click(function() {subjLoader.first();});
+ $("#s1").click(function() {subjLoader.prev();});
+ $("#s2").click(function() {subjLoader.next();});
+ $("#s3").click(function() {subjLoader.more();});
+ $("#s4").click(function() {subjLoader.less();});
+
+ var prop = $("table#inspect_property tbody");
+ var propLoader = new loader("${resources[0].uri}", "predicate", prop);
+ propLoader.fetch();
+
+ var obj = $("table#inspect_object tbody");
+ var objLoader = new loader("${resources[0].uri}", "object", obj);
+ objLoader.fetch();
+ </#if>
+
+ });
+
+</script>
+
+</body>
+
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fd0d24b
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,186 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+
+ <!-- enable LMF custom JNDI implementation -->
+ <listener>
+ <listener-class>kiwi.core.jndi.LMFJndiListener</listener-class>
+ </listener>
+
+
+ <!-- enable CDI / Weld for dependency injection -->
+ <listener>
+ <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
+ </listener>
+
+
+ <!-- Initialise the KiWi system -->
+ <listener>
+ <listener-class>kiwi.core.servlet.KiWiPreStartupListener</listener-class>
+ </listener>
+
+
+ <!-- RESTeasy Webservices -->
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <!--
+ specifies the LMF home directory; overridden by environment variable LMF_HOME or system property kiwi.home
+ -->
+ <context-param>
+ <param-name>kiwi.home</param-name>
+ <param-value>/tmp/lmf</param-value>
+ </context-param>
+
+ <!--
+ this filter performs startup configurations for first installation
+ -->
+ <filter>
+ <filter-name>KiWiPreStartupFilter</filter-name>
+ <filter-class>kiwi.core.servlet.KiWiPreStartupFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>KiWiPreStartupFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+
+ <!-- handle OPTIONS requests -->
+ <filter>
+ <filter-name>LMFOptionsFilter</filter-name>
+ <filter-class>kiwi.core.servlet.LMFOptionsFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>LMFOptionsFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+
+ <!-- Serve static resources from file system and from .jar files of the respective modules -->
+ <filter>
+ <filter-name>KiWiResourceFilter</filter-name>
+ <filter-class>kiwi.core.servlet.KiWiResourceFilter</filter-class>
+ <init-param>
+ <!-- cache resources loaded from module jar files? -->
+ <param-name>kiwi.resourceCaching</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>KiWiResourceFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <filter>
+ <filter-name>KiWiTransactionFilter</filter-name>
+ <filter-class>kiwi.core.servlet.KiWiTransactionFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>KiWiTransactionFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+
+
+ <!-- H2 Configuration -->
+ <filter>
+ <filter-name>KiWiH2ConsoleFilter</filter-name>
+ <filter-class>kiwi.core.servlet.KiWiH2ConsoleFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>KiWiH2ConsoleFilter</filter-name>
+ <url-pattern>/database/*</url-pattern>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>H2Console</servlet-name>
+ <servlet-class>org.h2.server.web.WebServlet</servlet-class>
+ <init-param> <param-name>webAllowOthers</param-name> <param-value>true</param-value> </init-param>
+ <!-- <init-param> <param-name>trace</param-name> <param-value></param-value> </init-param> -->
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>H2Console</servlet-name>
+ <url-pattern>/database/*</url-pattern>
+ </servlet-mapping>
+
+
+ <mime-mapping>
+ <extension>.xsl</extension>
+ <!-- per http://www.w3.org/TR/2006/PR-xslt20-20061121/ -->
+ <mime-type>application/xslt+xml</mime-type>
+ </mime-mapping>
+
+
+ <servlet>
+ <servlet-name>ViewStatusMessages</servlet-name>
+ <servlet-class>ch.qos.logback.classic.ViewStatusMessagesServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ViewStatusMessages</servlet-name>
+ <url-pattern>/logging/status</url-pattern>
+ </servlet-mapping>
+
+
+ <filter>
+ <filter-name>KiWi Webservices</filter-name>
+ <filter-class>
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+ </filter-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>kiwi.core.webservices.CoreApplication</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>KiWi Webservices</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <context-param>
+ <param-name>resteasy.injector.factory</param-name>
+ <param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>KiWiPostStartupFilter</filter-name>
+ <filter-class>
+ kiwi.core.servlet.KiWiPostStartupFilter
+ </filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>KiWiPostStartupFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+</web-app>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c9f0e9c
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp
@@ -0,0 +1,41 @@
+<%--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+--%>
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page import="kiwi.core.api.config.ConfigurationService" %>
+<%@ page import="kiwi.core.util.KiWiContext" %>
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ --%>
+<%
+ ConfigurationService configurationService = KiWiContext.getInstance(ConfigurationService.class);
+ response.sendRedirect(configurationService.getBaseUri()+configurationService.getStringConfiguration("kiwi.pages.startup"));
+%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/search/test_luke.html
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/search/test_luke.html b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/search/test_luke.html
new file mode 100644
index 0000000..9dd6d2d
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/search/test_luke.html
@@ -0,0 +1,42 @@
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <script type="text/javascript" src="javascripts/jquery.min.js"></script>
+ <title></title>
+ <script type="text/javascript">
+ ${symbol_dollar}(document).ready(function(){
+ ${symbol_dollar}.getJSON("../solr/skos/admin/luke?show=schema&wt=json",function(data){
+ var fields = [];
+ for(var property in data.schema.fields) {
+ fields.push(property);
+ }
+ console.log(fields);
+ })
+ })
+ </script>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
new file mode 100644
index 0000000..28ef3f0
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
@@ -0,0 +1,33 @@
+<!--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ Licensed 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.
+
+-->
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title></title>
+ <script type="text/javascript">
+ var x = location.href.substring(0,location.href.indexOf("LMF/")); alert(x);
+ </script>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
new file mode 100644
index 0000000..f446b13
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
@@ -0,0 +1,121 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ --%>
+
+<%@ page import="org.apache.lucene.LucenePackage,
+ org.apache.solr.common.util.XML,
+ org.apache.solr.core.SolrConfig,
+ org.apache.solr.core.SolrCore"%>
+<%@ page import="org.apache.solr.schema.IndexSchema"%>
+<%@ page import="java.io.File"%>
+<%@ page import="java.io.StringWriter"%>
+<%@ page import="java.net.InetAddress"%>
+<%@ page import="java.net.UnknownHostException"%>
+
+<%!
+ // only try to figure out the hostname once in a static block so
+ // we don't have a potentially slow DNS lookup on every admin request
+ static InetAddress addr = null;
+ static String hostname = "unknown";
+ static {
+ try {
+ addr = InetAddress.getLocalHost();
+ hostname = addr.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ //default to unknown
+ }
+ }
+%>
+
+<%
+ //
+ SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");
+ if (core == null) {
+ response.sendError( 404, "missing core name in path" );
+ return;
+ }
+
+ SolrConfig solrConfig = core.getSolrConfig();
+ int port = request.getServerPort();
+ IndexSchema schema = core.getSchema();
+
+ // enabled/disabled is purely from the point of a load-balancer
+ // and has no effect on local server function. If there is no healthcheck
+ // configured, don't put any status on the admin pages.
+ String enabledStatus = null;
+ String enabledFile = solrConfig.get("admin/healthcheck/text()",null);
+ boolean isEnabled = false;
+ if (enabledFile!=null) {
+ isEnabled = new File(enabledFile).exists();
+ }
+
+ String collectionName = schema!=null ? schema.getName():"unknown";
+
+ String defaultSearch = "";
+ {
+ StringWriter tmp = new StringWriter();
+ XML.escapeCharData
+ (solrConfig.get("admin/defaultQuery/text()", ""), tmp);
+ defaultSearch = tmp.toString();
+ }
+
+ String solrImplVersion = "";
+ String solrSpecVersion = "";
+ String luceneImplVersion = "";
+ String luceneSpecVersion = "";
+
+ {
+ Package p;
+ StringWriter tmp;
+
+ p = SolrCore.class.getPackage();
+
+ tmp = new StringWriter();
+ solrImplVersion = p.getImplementationVersion();
+ if (null != solrImplVersion) {
+ XML.escapeCharData(solrImplVersion, tmp);
+ solrImplVersion = tmp.toString();
+ }
+ tmp = new StringWriter();
+ solrSpecVersion = p.getSpecificationVersion() ;
+ if (null != solrSpecVersion) {
+ XML.escapeCharData(solrSpecVersion, tmp);
+ solrSpecVersion = tmp.toString();
+ }
+
+ p = LucenePackage.class.getPackage();
+
+ tmp = new StringWriter();
+ luceneImplVersion = p.getImplementationVersion();
+ if (null != luceneImplVersion) {
+ XML.escapeCharData(luceneImplVersion, tmp);
+ luceneImplVersion = tmp.toString();
+ }
+ tmp = new StringWriter();
+ luceneSpecVersion = p.getSpecificationVersion() ;
+ if (null != luceneSpecVersion) {
+ XML.escapeCharData(luceneSpecVersion, tmp);
+ luceneSpecVersion = tmp.toString();
+ }
+ }
+
+ String cwd=System.getProperty("user.dir");
+ String solrHome= solrConfig.getInstanceDir();
+
+ boolean cachingEnabled = !solrConfig.getHttpCachingConfig().isNever304();
+%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
new file mode 100644
index 0000000..d6b12b5
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
@@ -0,0 +1,90 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
+
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ --%>
+<%@include file="header.jsp" %>
+<%
+
+ String action = request.getParameter("action");
+ String enableActionStatus = "";
+ boolean isValid = false;
+
+ if (action != null) {
+ // Validate fname
+ if ("Enable".compareTo(action) == 0) isValid = true;
+ if ("Disable".compareTo(action) == 0) isValid = true;
+ }
+ if (isValid) {
+ if ("Enable".compareTo(action) == 0) {
+ try {
+ File enableFile = new File(enabledFile);
+ if (enableFile.createNewFile()) {
+ enableActionStatus += "Enable Succeeded (enable file ";
+ enableActionStatus += enabledFile;
+ enableActionStatus += " created)";
+ } else {
+ enableActionStatus += "Already Enabled";
+ }
+ } catch(Exception e) {
+ enableActionStatus += "Enable Failed: " + e.toString();
+ }
+ }
+ if ("Disable".compareTo(action) == 0) {
+ try {
+ File enableFile = new File(enabledFile);
+ if (enableFile.delete()) {
+ enableActionStatus = "Disable Succeeded (enable file ";
+ enableActionStatus += enabledFile;
+ enableActionStatus += " removed)";
+ } else {
+ enableActionStatus = "Already Disabled";
+ }
+ } catch(Exception e) {
+ enableActionStatus += "Disable Failed: " + e.toString();
+ }
+ }
+ } else {
+ enableActionStatus = "Illegal Action";
+ }
+ // :TODO: might want to rework this so any logging change happens *after*
+ SolrCore.log.info(enableActionStatus);
+%>
+<br clear="all">
+<table>
+ <tr>
+ <td>
+ <H3>Action:</H3>
+ </td>
+ <td>
+ <% XML.escapeCharData(action, out); %><br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <H4>Result:</H4>
+ </td>
+ <td>
+ <% XML.escapeCharData(enableActionStatus, out); %><br>
+ </td>
+ </tr>
+</table>
+<br><br>
+ <a href=".">Return to Admin Page</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
----------------------------------------------------------------------
diff --git a/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
new file mode 100644
index 0000000..214082a
--- /dev/null
+++ b/lmf-archetypes/lmf-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
@@ -0,0 +1,505 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ --%>
+
+<%@ page
+ import="org.apache.lucene.analysis.Analyzer,org.apache.lucene.analysis.CharReader,org.apache.lucene.analysis.CharStream,org.apache.lucene.analysis.TokenStream,org.apache.lucene.analysis.tokenattributes.CharTermAttribute,org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute,org.apache.lucene.index.Payload,org.apache.lucene.util.Attribute,org.apache.lucene.util.AttributeReflector,org.apache.lucene.util.AttributeSource,org.apache.solr.analysis.CharFilterFactory,org.apache.solr.analysis.TokenFilterFactory,org.apache.solr.analysis.TokenizerChain,org.apache.solr.analysis.TokenizerFactory,org.apache.solr.schema.FieldType,org.apache.solr.schema.SchemaField,javax.servlet.jsp.JspWriter,java.io.IOException"%>
+<%@ page import="java.io.Reader,java.io.StringReader" %>
+<%@ page import="java.math.BigInteger"%>
+<%@ page import="java.util.*"%>
+
+<%-- ${symbol_dollar}Id: analysis.jsp 1061035 2011-01-19 22:33:28Z uschindler ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Name: ${symbol_dollar} --%>
+
+<%@include file="header.jsp"%>
+
+<%
+ // is name a field name or a type name?
+ String nt = request.getParameter("nt");
+ if (nt == null || nt.length() == 0)
+ nt = "name"; // assume field name
+ nt = nt.toLowerCase(Locale.ENGLISH).trim();
+ String name = request.getParameter("name");
+ if (name == null || name.length() == 0)
+ name = "";
+ String val = request.getParameter("val");
+ if (val == null || val.length() == 0)
+ val = "";
+ String qval = request.getParameter("qval");
+ if (qval == null || qval.length() == 0)
+ qval = "";
+ String verboseS = request.getParameter("verbose");
+ boolean verbose = verboseS != null
+ && verboseS.equalsIgnoreCase("on");
+ String qverboseS = request.getParameter("qverbose");
+ boolean qverbose = qverboseS != null
+ && qverboseS.equalsIgnoreCase("on");
+ String highlightS = request.getParameter("highlight");
+ boolean highlight = highlightS != null
+ && highlightS.equalsIgnoreCase("on");
+%>
+
+<br clear="all">
+
+<h2>Field Analysis</h2>
+
+<form method="POST" action="analysis.jsp" accept-charset="UTF-8">
+<table>
+ <tr>
+ <td><strong>Field <select name="nt">
+ <option <%=nt.equals("name") ? "selected=${symbol_escape}"selected${symbol_escape}"" : ""%>>name</option>
+ <option <%=nt.equals("type") ? "selected=${symbol_escape}"selected${symbol_escape}"" : ""%>>type</option>
+ </select></strong></td>
+ <td><input class="std" name="name" type="text"
+ value="<%XML.escapeCharData(name, out);%>"></td>
+ </tr>
+ <tr>
+ <td><strong>Field value (Index)</strong> <br />
+ verbose output <input name="verbose" type="checkbox"
+ <%=verbose ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>> <br />
+ highlight matches <input name="highlight" type="checkbox"
+ <%=highlight ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>></td>
+ <td><textarea class="std" rows="8" cols="70" name="val">
+ <%
+ XML.escapeCharData(val, out);
+ %>
+ </textarea></td>
+ </tr>
+ <tr>
+ <td><strong>Field value (Query)</strong> <br />
+ verbose output <input name="qverbose" type="checkbox"
+ <%=qverbose ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>></td>
+ <td><textarea class="std" rows="1" cols="70" name="qval">
+ <%
+ XML.escapeCharData(qval, out);
+ %>
+ </textarea></td>
+ </tr>
+ <tr>
+
+ <td></td>
+
+ <td><input class="stdbutton" type="submit" value="analyze">
+ </td>
+
+ </tr>
+</table>
+</form>
+
+
+<%
+ SchemaField field = null;
+
+ if (name != "") {
+ if (nt.equals("name")) {
+ try {
+ field = schema.getField(name);
+ } catch (Exception e) {
+ out.print("<strong>Unknown Field: ");
+ XML.escapeCharData(name, out);
+ out.println("</strong>");
+ }
+ } else {
+ FieldType t = schema.getFieldTypes().get(name);
+ if (null == t) {
+ out.print("<strong>Unknown Field Type: ");
+ XML.escapeCharData(name, out);
+ out.println("</strong>");
+ } else {
+ field = new SchemaField("fakefieldoftype:" + name, t);
+ }
+ }
+ }
+
+ if (field != null) {
+ HashSet<String> matches = null;
+ if (qval != "" && highlight) {
+ Reader reader = new StringReader(qval);
+ Analyzer analyzer = field.getType().getQueryAnalyzer();
+ TokenStream tstream = analyzer.reusableTokenStream(
+ field.getName(), reader);
+ CharTermAttribute termAtt = tstream
+ .addAttribute(CharTermAttribute.class);
+ tstream.reset();
+ matches = new HashSet<String>();
+ while (tstream.incrementToken()) {
+ matches.add(termAtt.toString());
+ }
+ }
+
+ if (val != "") {
+ out.println("<h3>Index Analyzer</h3>");
+ doAnalyzer(out, field, val, false, verbose, matches);
+ }
+ if (qval != "") {
+ out.println("<h3>Query Analyzer</h3>");
+ doAnalyzer(out, field, qval, true, qverbose, null);
+ }
+ }
+%>
+
+
+</body>
+</html>
+
+
+<%!private static void doAnalyzer(JspWriter out, SchemaField field,
+ String val, boolean queryAnalyser, boolean verbose,
+ Set<String> match) throws Exception {
+
+ FieldType ft = field.getType();
+ Analyzer analyzer = queryAnalyser ? ft.getQueryAnalyzer() : ft
+ .getAnalyzer();
+ if (analyzer instanceof TokenizerChain) {
+ TokenizerChain tchain = (TokenizerChain) analyzer;
+ CharFilterFactory[] cfiltfacs = tchain.getCharFilterFactories();
+ TokenizerFactory tfac = tchain.getTokenizerFactory();
+ TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
+
+ if (cfiltfacs != null) {
+ String source = val;
+ for (CharFilterFactory cfiltfac : cfiltfacs) {
+ CharStream reader = CharReader
+ .get(new StringReader(source));
+ reader = cfiltfac.create(reader);
+ if (verbose) {
+ writeHeader(out, cfiltfac.getClass(),
+ cfiltfac.getArgs());
+ source = writeCharStream(out, reader);
+ }
+ }
+ }
+
+ TokenStream tstream = tfac.create(tchain
+ .charStream(new StringReader(val)));
+ List<AttributeSource> tokens = getTokens(tstream);
+ if (verbose) {
+ writeHeader(out, tfac.getClass(), tfac.getArgs());
+ }
+
+ writeTokens(out, tokens, ft, verbose, match);
+
+ for (TokenFilterFactory filtfac : filtfacs) {
+ if (verbose) {
+ writeHeader(out, filtfac.getClass(), filtfac.getArgs());
+ }
+
+ final Iterator<AttributeSource> iter = tokens.iterator();
+ tstream = filtfac.create(new TokenStream(tstream
+ .getAttributeFactory()) {
+
+ public boolean incrementToken() throws IOException {
+ if (iter.hasNext()) {
+ AttributeSource token = iter.next();
+ Iterator<Class<? extends Attribute>> atts = token
+ .getAttributeClassesIterator();
+ while (atts.hasNext())
+ // make sure all att impls in the token exist here
+ addAttribute(atts.next());
+ token.copyTo(this);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+ tokens = getTokens(tstream);
+
+ writeTokens(out, tokens, ft, verbose, match);
+ }
+
+ } else {
+ TokenStream tstream = analyzer.reusableTokenStream(field.getName(),
+ new StringReader(val));
+ tstream.reset();
+ List<AttributeSource> tokens = getTokens(tstream);
+ if (verbose) {
+ writeHeader(out, analyzer.getClass(), Collections.EMPTY_MAP);
+ }
+ writeTokens(out, tokens, ft, verbose, match);
+ }
+ }
+
+ static List<AttributeSource> getTokens(TokenStream tstream)
+ throws IOException {
+ List<AttributeSource> tokens = new ArrayList<AttributeSource>();
+ tstream.reset();
+ while (tstream.incrementToken()) {
+ tokens.add(tstream.cloneAttributes());
+ }
+ return tokens;
+ }
+
+ private static class ReflectItem {
+ final Class<? extends Attribute> attClass;
+ final String key;
+ final Object value;
+
+ ReflectItem(Class<? extends Attribute> attClass, String key,
+ Object value) {
+ this.attClass = attClass;
+ this.key = key;
+ this.value = value;
+ }
+ }
+
+ private static class Tok {
+ final String term;
+ final int pos;
+ final List<ReflectItem> reflected = new ArrayList<ReflectItem>();
+
+ Tok(AttributeSource token, int pos) {
+ this.term = token.addAttribute(CharTermAttribute.class).toString();
+ this.pos = pos;
+ token.reflectWith(new AttributeReflector() {
+ public void reflect(Class<? extends Attribute> attClass,
+ String key, Object value) {
+ // leave out position and term
+ if (CharTermAttribute.class.isAssignableFrom(attClass))
+ return;
+ if (PositionIncrementAttribute.class
+ .isAssignableFrom(attClass))
+ return;
+ reflected.add(new ReflectItem(attClass, key, value));
+ }
+ });
+ }
+ }
+
+ private static interface TokToStr {
+ public String toStr(Tok o);
+ }
+
+ private static void printRow(JspWriter out, String header,
+ String headerTitle, List<Tok>[] arrLst, TokToStr converter,
+ boolean multival, boolean verbose, Set<String> match)
+ throws IOException {
+ // find the maximum number of terms for any position
+ int maxSz = 1;
+ if (multival) {
+ for (List lst : arrLst) {
+ maxSz = Math.max(lst.size(), maxSz);
+ }
+ }
+
+ for (int idx = 0; idx < maxSz; idx++) {
+ out.println("<tr>");
+ if (idx == 0 && verbose) {
+ if (header != null) {
+ out.print("<th NOWRAP rowspan=${symbol_escape}"" + maxSz + "${symbol_escape}"");
+ if (headerTitle != null) {
+ out.print(" title=${symbol_escape}"");
+ XML.escapeCharData(headerTitle, out);
+ out.print("${symbol_escape}"");
+ }
+ out.print(">");
+ XML.escapeCharData(header, out);
+ out.println("</th>");
+ }
+ }
+
+ for (int posIndex = 0; posIndex < arrLst.length; posIndex++) {
+ List<Tok> lst = arrLst[posIndex];
+ if (lst.size() <= idx)
+ continue;
+ if (match != null && match.contains(lst.get(idx).term)) {
+ out.print("<td class=${symbol_escape}"highlight${symbol_escape}"");
+ } else {
+ out.print("<td class=${symbol_escape}"debugdata${symbol_escape}"");
+ }
+
+ // if the last value in the column, use up
+ // the rest of the space via rowspan.
+ if (lst.size() == idx + 1 && lst.size() < maxSz) {
+ out.print("rowspan=${symbol_escape}"" + (maxSz - lst.size() + 1) + '"');
+ }
+
+ out.print('>');
+
+ XML.escapeCharData(converter.toStr(lst.get(idx)), out);
+ out.print("</td>");
+ }
+
+ out.println("</tr>");
+ }
+
+ }
+
+ /* this method is totally broken, as no charset involved: new String(byte[]) is crap!
+ static String isPayloadString( Payload p ) {
+ String sp = new String(p.getData());
+ for( int i=0; i < sp.length(); i++ ) {
+ if( !Character.isDefined( sp.charAt(i) ) || Character.isISOControl( sp.charAt(i) ) )
+ return "";
+ }
+ return "(" + sp + ")";
+ }
+ */
+
+ static void writeHeader(JspWriter out, Class clazz, Map<String, String> args)
+ throws IOException {
+ out.print("<h4>");
+ out.print(clazz.getName());
+ XML.escapeCharData(" " + args, out);
+ out.println("</h4>");
+ }
+
+ // readable, raw, pos, type, start/end
+ static void writeTokens(JspWriter out, List<AttributeSource> tokens,
+ final FieldType ft, boolean verbose, Set<String> match)
+ throws IOException {
+
+ // Use a map to tell what tokens are in what positions
+ // because some tokenizers/filters may do funky stuff with
+ // very large increments, or negative increments.
+ HashMap<Integer, List<Tok>> map = new HashMap<Integer, List<Tok>>();
+ boolean needRaw = false;
+ int pos = 0, reflectionCount = -1;
+ for (AttributeSource t : tokens) {
+ String text = t.addAttribute(CharTermAttribute.class).toString();
+ if (!text.equals(ft.indexedToReadable(text))) {
+ needRaw = true;
+ }
+
+ pos += t.addAttribute(PositionIncrementAttribute.class)
+ .getPositionIncrement();
+ List lst = map.get(pos);
+ if (lst == null) {
+ lst = new ArrayList(1);
+ map.put(pos, lst);
+ }
+ Tok tok = new Tok(t, pos);
+ // sanity check
+ if (reflectionCount < 0) {
+ reflectionCount = tok.reflected.size();
+ } else {
+ if (reflectionCount != tok.reflected.size())
+ throw new RuntimeException(
+ "Should not happen: Number of reflected entries differs for position="
+ + pos);
+ }
+ lst.add(tok);
+ }
+
+ List<Tok>[] arr = (List<Tok>[]) map.values().toArray(
+ new ArrayList[map.size()]);
+
+ // Jetty 6.1.3 miscompiles a generics-enabled version..., without generics:
+ Arrays.sort(arr, new Comparator() {
+ public int compare(Object toks, Object toks1) {
+ return ((List<Tok>) toks).get(0).pos
+ - ((List<Tok>) toks1).get(0).pos;
+ }
+ });
+
+ out.println("<table width=${symbol_escape}"auto${symbol_escape}" class=${symbol_escape}"analysis${symbol_escape}" border=${symbol_escape}"1${symbol_escape}">");
+
+ if (verbose) {
+ printRow(out, "position", "calculated from "
+ + PositionIncrementAttribute.class.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ return Integer.toString(t.pos);
+ }
+ }, false, verbose, null);
+ }
+
+ printRow(out, "term text", CharTermAttribute.class.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ return ft.indexedToReadable(t.term);
+ }
+ }, true, verbose, match);
+
+ if (verbose) {
+ if (needRaw) {
+ printRow(out, "raw text", CharTermAttribute.class.getName(),
+ arr, new TokToStr() {
+ public String toStr(Tok t) {
+ // page is UTF-8, so anything goes.
+ return t.term;
+ }
+ }, true, verbose, match);
+ }
+
+ for (int att = 0; att < reflectionCount; att++) {
+ final ReflectItem item0 = arr[0].get(0).reflected.get(att);
+ final int i = att;
+ printRow(out, item0.key, item0.attClass.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ final ReflectItem item = t.reflected.get(i);
+ if (item0.attClass != item.attClass
+ || !item0.key.equals(item.key))
+ throw new RuntimeException(
+ "Should not happen: attribute types suddenly change at position="
+ + t.pos);
+ if (item.value instanceof Payload) {
+ Payload p = (Payload) item.value;
+ if (null != p) {
+ BigInteger bi = new BigInteger(p
+ .getData());
+ String ret = bi.toString(16);
+ if (ret.length() % 2 != 0) {
+ // Pad with 0
+ ret = "0" + ret;
+ }
+ //TODO maybe fix: ret += isPayloadString(p);
+ return ret;
+ }
+ return "";
+ } else {
+ return (item.value != null) ? item.value
+ .toString() : "";
+ }
+ }
+ }, true, verbose, null);
+ }
+ }
+
+ out.println("</table>");
+ }
+
+ static String writeCharStream(JspWriter out, CharStream input)
+ throws IOException {
+ out.println("<table width=${symbol_escape}"auto${symbol_escape}" class=${symbol_escape}"analysis${symbol_escape}" border=${symbol_escape}"1${symbol_escape}">");
+ out.println("<tr>");
+
+ out.print("<th NOWRAP>");
+ XML.escapeCharData("text", out);
+ out.println("</th>");
+
+ final int BUFFER_SIZE = 1024;
+ char[] buf = new char[BUFFER_SIZE];
+ int len = 0;
+ StringBuilder sb = new StringBuilder();
+ do {
+ len = input.read(buf, 0, BUFFER_SIZE);
+ if (len > 0)
+ sb.append(buf, 0, len);
+ } while (len == BUFFER_SIZE);
+ out.print("<td class=${symbol_escape}"debugdata${symbol_escape}">");
+ XML.escapeCharData(sb.toString(), out);
+ out.println("</td>");
+
+ out.println("</tr>");
+ out.println("</table>");
+ return sb.toString();
+ }%>