You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/03/30 17:44:08 UTC
[39/59] [abbrv] isis git commit: ISIS-789: adding
example/application/neoapp
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
new file mode 100644
index 0000000..d60a45f
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -0,0 +1,124 @@
+# 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.
+
+
+
+#################################################################################
+#
+# Persistor
+#
+#################################################################################
+
+
+
+# generally speaking this should not be enabled
+isis.persistor.disableConcurrencyChecking=false
+
+
+
+
+#################################################################################
+#
+# JDBC configuration
+#
+#################################################################################
+
+#
+# configuration file holding the JDO objectstore's JDBC configuration
+# (this is a bit of a hack... just exploiting fact that Isis also loads this file)
+#
+
+
+#
+# JDBC connection details
+# (also update the pom.xml to reference the appropriate JDBC driver)
+#
+
+#
+# neo4j
+#
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
+
+#
+# HSQLDB in-memory
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+#
+# HSQLDB in-memory (using log4jdbc-remix)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:hsqldb:mem:test
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+
+
+#
+# HSQLDB to file
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:/tmp/isis-simple-app/hsql-db;hsqldb.write_delay=false;shutdown=true
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+#
+# HSQLDB to file (using log4jdbc-remix)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:hsqldb:file:/tmp/isis-simple-app/hsql-db;hsqldb.write_delay=false;shutdown=true
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+
+
+#
+# PostgreSQL Server
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.postgresql.Driver
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:postgresql://localhost:5432/isis
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=isis
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=isis
+
+#
+# PostgreSQL Server (using log4jdbc-remix)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:postgresql://localhost:5432/isis
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=isis
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=isis
+
+
+
+#
+# MS SQL Server
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=com.microsoft.sqlserver.jdbc.SQLServerDriver
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:sqlserver://127.0.0.1:1433;instance=.;databaseName=simple
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=p4ssword
+
+#
+# MS SQL Server (using log4jdbc-remix)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=jdo
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=jdopass
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
new file mode 100644
index 0000000..2f41400
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
@@ -0,0 +1,104 @@
+# 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.
+
+#
+# configuration file for the JDO/DataNucleus objectstore
+#
+
+# identifies @PersistenceCapable entities to be eagerly registered
+# if move class to other package (eg com.mycompany.myapp.dom) then update
+isis.persistor.datanucleus.RegisterEntities.packagePrefix=dom
+
+# whether to persist the event data as a "clob" or as a "zipped" byte[]
+# default is "zipped"
+#isis.persistor.datanucleus.PublishingService.serializedForm=zipped
+
+
+#####################################################################
+#
+# DataNucleus' configuration
+#
+# The 'isis.persistor.datanucleus.impl' prefix is stripped off,
+# remainder is passed through to DataNucleus
+#
+#####################################################################
+
+isis.persistor.datanucleus.impl.datanucleus.autoCreateSchema=true
+isis.persistor.datanucleus.impl.datanucleus.validateTables=true
+isis.persistor.datanucleus.impl.datanucleus.validateConstraints=true
+
+
+#
+# Require explicit persistence (since entities are Comparable and using ObjectContracts#compareTo).
+# see http://www.datanucleus.org/products/accessplatform_3_0/jdo/transaction_types.html
+#
+isis.persistor.datanucleus.impl.datanucleus.persistenceByReachabilityAtCommit=false
+
+
+#
+# How column names are identified
+# (http://www.datanucleus.org/products/datanucleus/jdo/orm/datastore_identifiers.html)
+#
+isis.persistor.datanucleus.impl.datanucleus.identifier.case=PreserveCase
+
+isis.persistor.datanucleus.impl.datanucleus.schema.autoCreateAll=true
+isis.persistor.datanucleus.impl.datanucleus.schema.validateTables=true
+isis.persistor.datanucleus.impl.datanucleus.schema.validateConstraints=true
+
+
+#
+# Require explicit persistence (since entities are Comparable and using ObjectContracts#compareTo).
+# see http://www.datanucleus.org/products/accessplatform_3_0/jdo/transaction_types.html
+#
+isis.persistor.datanucleus.impl.datanucleus.persistenceByReachabilityAtCommit=false
+
+
+#
+# How column names are identified
+# (http://www.datanucleus.org/products/datanucleus/jdo/orm/datastore_identifiers.html)
+#
+isis.persistor.datanucleus.impl.datanucleus.identifier.case=MixedCase
+
+#
+# L2 cache
+# off except if explicitly marked as cacheable
+# http://www.datanucleus.org/products/datanucleus/jdo/cache.html
+#
+isis.persistor.datanucleus.impl.datanucleus.cache.level2.type=none
+isis.persistor.datanucleus.impl.datanucleus.cache.level2.mode=ENABLE_SELECTIVE
+
+
+
+#
+# uncomment to use JNDI rather than direct JDBC
+#
+#isis.persistor.datanucleus.impl.datanucleus.ConnectionFactoryName=java:comp/env/jdbc/quickstart
+
+#
+# uncomment to use JTA resource
+#
+#isis.persistor.datanucleus.impl.datanucleus.ConnectionFactory2Name=java:comp/env/jdbc/quickstart-nontx
+#isis.persistor.datanucleus.impl.javax.jdo.option.TransactionType=JTA
+
+
+
+#
+#
+# JDBC connection details
+# ... are in persistor.properties
+#
+#
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/shiro.ini
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/shiro.ini b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/shiro.ini
new file mode 100644
index 0000000..a643d86
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/shiro.ini
@@ -0,0 +1,93 @@
+#
+# 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.
+#
+
+[main]
+
+contextFactory = org.apache.isis.security.shiro.IsisLdapContextFactory
+contextFactory.url = ldap://localhost:10389
+contextFactory.authenticationMechanism = CRAM-MD5
+contextFactory.systemAuthenticationMechanism = simple
+contextFactory.systemUsername = uid=admin,ou=system
+contextFactory.systemPassword = secret
+
+ldapRealm = org.apache.isis.security.shiro.IsisLdapRealm
+ldapRealm.contextFactory = $contextFactory
+
+ldapRealm.searchBase = ou=groups,o=mojo
+ldapRealm.groupObjectClass = groupOfUniqueNames
+ldapRealm.uniqueMemberAttribute = uniqueMember
+ldapRealm.uniqueMemberAttributeValueTemplate = uid={0}
+
+# optional mapping from physical groups to logical application roles
+#ldapRealm.rolesByGroup = \
+# LDN_USERS: user_role,\
+# NYK_USERS: user_role,\
+# HKG_USERS: user_role,\
+# GLOBAL_ADMIN: admin_role,\
+# DEMOS: self-install_role
+
+ldapRealm.permissionsByRole=\
+ user_role = *:ToDoItemsJdo:*:*,\
+ *:ToDoItem:*:*; \
+ self-install_role = *:ToDoItemsFixturesService:install:* ; \
+ admin_role = *
+
+# to use ldap...
+# (see docs for details of how to setup users/groups in Apache Directory Studio).
+#securityManager.realms = $ldapRealm
+
+# to use .ini file
+securityManager.realms = $iniRealm
+
+
+
+# -----------------------------------------------------------------------------
+# Users and their assigned roles
+#
+# Each line conforms to the format defined in the
+# org.apache.shiro.realm.text.TextConfigurationRealm#setUserDefinitions JavaDoc
+# -----------------------------------------------------------------------------
+
+[users]
+# user = password, role1, role2, role3, ...
+
+
+sven = pass, admin_role
+dick = pass, user_role, self-install_role
+bob = pass, user_role, self-install_role
+joe = pass, user_role, self-install_role
+guest = guest, user_role
+
+
+
+# -----------------------------------------------------------------------------
+# Roles with assigned permissions
+#
+# Each line conforms to the format defined in the
+# org.apache.shiro.realm.text.TextConfigurationRealm#setRoleDefinitions JavaDoc
+# -----------------------------------------------------------------------------
+
+[roles]
+# role = perm1, perm2, perm3, ...
+# perm in format: packageName:className:memberName:r,w
+
+user_role = *:ToDoItemsJdo:*:*,\
+ *:ToDoItem:*:*
+self-install_role = *:ToDoItemsFixturesService:install:*
+admin_role = *
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
new file mode 100644
index 0000000..0a85fb6
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
@@ -0,0 +1,66 @@
+# 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.
+
+#
+# configuration file for the Restful Objects viewer
+#
+
+# the baseUrl for hrefs in the events generated by the RO EventSerializer
+isis.viewer.restfulobjects.RestfulObjectsSpecEventSerializer.baseUrl=http://localhost:8080/restful/
+
+# renders param details in the (incorrect) form that they were for GSOC2013 viewers
+# isis.viewer.restfulobjects.gsoc2013.legacyParamDetails=true
+
+# whether to honor UI hints, in particular Render(EAGERLY). Defaults to false.
+#isis.viewer.restfulobjects.honorUiHints=false
+
+
+
+###############################################################################
+# Non-standard configuration settings.
+#
+# If enabled of the following are enabled then the viewer is deviating from the
+# RO spec standard; compatibility may be compromised with RO clients.
+###############################################################################
+
+# whether to show only object properties for object members
+# (on the object representation only)
+# Takes precedence over the other 'suppress' below.
+#isis.viewer.restfulobjects.objectPropertyValuesOnly=true
+
+# whether to suppress "describedby" links. Defaults to false.
+#isis.viewer.restfulobjects.suppressDescribedByLinks=true
+
+# whether to suppress "update" links. Defaults to false.
+#isis.viewer.restfulobjects.suppressUpdateLink=true
+
+# whether to suppress "id" json-prop for object members. Defaults to false.
+#isis.viewer.restfulobjects.suppressMemberId=true
+
+# whether to suppress "links" json-prop for object members
+# (on the object representation only). Defaults to false.
+#isis.viewer.restfulobjects.suppressMemberLinks=true
+
+# whether to suppress "extensions" json-prop for object members
+# (on the object representation only). Defaults to false.
+#isis.viewer.restfulobjects.suppressMemberExtensions=true
+
+# whether to suppress "disabledReason" json-prop for object members
+# (on the object representation only). Defaults to false.
+#isis.viewer.restfulobjects.suppressMemberDisabledReason=true
+
+###############################################################################
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
new file mode 100644
index 0000000..79ddf66
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
@@ -0,0 +1,84 @@
+# 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.
+
+#
+# configuration file for the Wicket viewer
+#
+
+#
+# The maximum length of titles to display in standalone or parented tables.
+# Titles longer than this length will be truncated with trailing ellipses (...)
+#
+# For example, if set to 12, the title
+# "Buy milk on 15-Feb-13" will be truncated to "Buy milk ..."
+#
+# If set to 0, then only the icon will be shown.
+#
+isis.viewer.wicket.maxTitleLengthInStandaloneTables=0
+isis.viewer.wicket.maxTitleLengthInParentedTables=0
+
+
+#isis.viewer.wicket.datePattern=dd-MM-yyyy
+#isis.viewer.wicket.dateTimePattern=dd-MM-yyyy HH:mm
+#isis.viewer.wicket.datePickerPattern=DD-MM-YYYY
+
+#isis.viewer.wicket.datePattern=dd/MM/yy
+#isis.viewer.wicket.dateTimePattern=dd/MM/yy HH:mm
+#isis.viewer.wicket.datePickerPattern=DD/MM/YY
+
+
+#
+# whether to strip wicket tags from markup (default is true, as they may break some CSS rules)
+#
+#isis.viewer.wicket.stripWicketTags=false
+
+
+#
+# whether to suppress the 'rememberMe' checkbox on the login page (default is false)
+#
+#isis.viewer.wicket.suppressRememberMe=false
+
+#
+# if user attempts to access a protected URL before signing in, then as a convenience the viewer will continue
+# through to that destination after successful login. If you consider this to be a security risk then this flag
+# disables that behaviour (default is false).
+#
+#isis.viewer.wicket.clearOriginalDestination=true
+
+
+#
+# whether to show action dialogs on their own page rather than as a modal dialog (default is false)
+#
+#isis.viewer.wicket.disableModalDialogs=false
+
+
+#
+# the maximum number of pages to list in bookmark (default is 15)
+#
+#isis.viewer.wicket.bookmarkedPages.maxSize=15
+
+
+#
+# whether to show the bootstrap theme chooser (defaults false)
+#
+#isis.viewer.wicket.themes.showChooser=false
+isis.viewer.wicket.themes.showChooser=true
+
+#
+# comma-separated list of themes to choose from (default is to show all themes from bootswatch.com).
+#
+#isis.viewer.wicket.themes.enabled=bootstrap-theme,Cosmo,Flatly,Darkly,Sandstone,United
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/WEB-INF/web.xml b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..b169b00
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,309 @@
+<?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.
+-->
+<web-app id="WebApp_ID" version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Simple app</display-name>
+
+ <welcome-file-list>
+ <welcome-file>about/index.html</welcome-file>
+ </welcome-file-list>
+
+ <!-- shiro security configuration -->
+ <listener>
+ <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>ShiroFilter</filter-name>
+ <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>ShiroFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+
+ <!-- which configuration directory to read overloaded property files from -->
+ <!--
+ Normally configuration like this should be done from outside your web
+ application. Especially if your configuration is not know in advance or
+ if it can change depending on where the application gets deployed.
+
+ For instance to configure this in Tomcat outside the application WAR add
+ the following line to your application context ( For more detail see:
+ http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Context_Parameters )
+
+ <Parameter name="isis.config.dir" value="/usr/local/tomcat/conf/"
+ override="true"/>
+
+ If your configuration directory is fixed you can enable the following
+ context parameter in here and forget about the outside part.
+
+ <context-param>
+ <param-name>isis.config.dir</param-name>
+ <param-value>location of your config directory if fixed</param-value>
+ </context-param>
+ -->
+
+
+ <!--
+ determines which additional configuration files to search for
+ -->
+ <context-param>
+ <param-name>isis.viewers</param-name>
+ <param-value>wicket,restfulobjects</param-value>
+ </context-param>
+
+
+
+ <!--
+ for diagnostics
+ -->
+ <filter>
+ <filter-name>IsisLogOnExceptionFilter</filter-name>
+ <filter-class>org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>IsisLogOnExceptionFilter</filter-name>
+ <url-pattern>/wicket/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>IsisLogOnExceptionFilter</filter-name>
+ <url-pattern>/restful/*</url-pattern>
+ </filter-mapping>
+
+
+
+ <!-- cache static resources for 1 day -->
+ <filter>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <filter-class>org.apache.isis.core.webapp.content.ResourceCachingFilter</filter-class>
+ <init-param>
+ <param-name>CacheTime</param-name>
+ <param-value>86400</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.js</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.css</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.png</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.jpg</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.gif</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.html</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.swf</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>Resource</servlet-name>
+ <servlet-class>org.apache.isis.core.webapp.content.ResourceServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.css</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.png</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.jpg</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.gif</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.js</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.html</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.swf</url-pattern>
+ </servlet-mapping>
+
+
+
+ <!--
+ -
+ - config specific to the wicket-viewer
+ -
+ -->
+ <filter>
+ <filter-name>WicketFilter</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>webapp.SimpleApplication</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>WicketFilter</filter-name>
+ <url-pattern>/wicket/*</url-pattern>
+ </filter-mapping>
+
+
+ <context-param>
+ <param-name>configuration</param-name>
+ <!--
+ <param-value>deployment</param-value>
+ -->
+ <param-value>development</param-value>
+ </context-param>
+
+
+ <!--
+ -
+ - config specific to the restfulobjects-viewer
+ -
+ -->
+
+ <!--
+ THE FOLLOWING CONFIGURATION IS NOT REQUIRED IF THE WICKET VIEWER IS IN USE.
+ IF THE WICKET VIEWER CONFIGURATION IS REMOVED, THEN UNCOMMENT
+
+ <listener>
+ <listener-class>org.apache.isis.core.webapp.IsisWebAppBootstrapper</listener-class>
+ </listener>
+
+ <context-param>
+ <param-name>deploymentType</param-name>
+ <param-value>SERVER_EXPLORATION</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>isis.viewers</param-name>
+ <param-value>restfulobjects</param-value>
+ </context-param>
+ -->
+
+ <!-- bootstrap the RestEasy framework -->
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <!-- used by RestEasy to determine the JAX-RS resources and other related configuration -->
+ <context-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplication</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>resteasy.servlet.mapping.prefix</param-name>
+ <param-value>/restful/</param-value>
+ </context-param>
+
+
+ <!-- authenticate user, set up an Isis session -->
+ <filter>
+ <filter-name>IsisSessionFilterForRestfulObjects</filter-name>
+ <filter-class>org.apache.isis.core.webapp.IsisSessionFilter</filter-class>
+ <!-- authentication required for REST -->
+ <init-param>
+ <param-name>authenticationSessionStrategy</param-name>
+ <param-value>org.apache.isis.viewer.restfulobjects.server.authentication.AuthenticationSessionStrategyBasicAuth</param-value>
+ </init-param>
+ <init-param>
+ <!-- what to do if no session was found; we indicate to issue a 401 basic authentication challenge -->
+ <param-name>whenNoSession</param-name>
+ <param-value>basicAuthChallenge</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <!-- this is mapped to the entire app; however the IsisSessionFilter will "notice" if the session filter has already been
+ executed for the request pipeline, and if so will do nothing -->
+ <filter-name>IsisSessionFilterForRestfulObjects</filter-name>
+ <servlet-name>RestfulObjectsRestEasyDispatcher</servlet-name>
+ </filter-mapping>
+
+ <filter>
+ <filter-name>IsisTransactionFilterForRestfulObjects</filter-name>
+ <filter-class>org.apache.isis.viewer.restfulobjects.server.webapp.IsisTransactionFilterForRestfulObjects</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>IsisTransactionFilterForRestfulObjects</filter-name>
+ <servlet-name>RestfulObjectsRestEasyDispatcher</servlet-name>
+ </filter-mapping>
+
+
+ <servlet>
+ <servlet-name>RestfulObjectsRestEasyDispatcher</servlet-name>
+ <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>RestfulObjectsRestEasyDispatcher</servlet-name>
+ <url-pattern>/restful/*</url-pattern>
+ </servlet-mapping>
+
+
+ <!--
+ uncomment to use container-managed datasource;
+ for both container-managed (JTA) and non-container-managed transactions
+ -->
+ <!--
+ <resource-ref>
+ <description>db</description>
+ <res-ref-name>jdbc/quickstart</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ -->
+
+ <!--
+ uncomment to use container-managed datasource
+ with container-managed transactions (JTA).
+ -->
+ <!--
+ <resource-ref>
+ <description>db</description>
+ <res-ref-name>jdbc/quickstart-nontx</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ -->
+
+</web-app>
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/about/images/isis-logo.png
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/about/images/isis-logo.png b/example/application/neoapp/webapp/src/main/webapp/about/images/isis-logo.png
new file mode 100644
index 0000000..5284fe7
Binary files /dev/null and b/example/application/neoapp/webapp/src/main/webapp/about/images/isis-logo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/about/index.html
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/about/index.html b/example/application/neoapp/webapp/src/main/webapp/about/index.html
new file mode 100644
index 0000000..b623158
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/about/index.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+-->
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Apache Isis™ SimpleApp</title>
+
+ <style type="text/css">
+body {
+ background-color: #1A467B;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 90%;
+}
+
+li {
+ margin-top: 6px;
+ margin-bottom: 6px;
+}
+table {
+ border-collapse: collapse;
+}
+table, th, td {
+ border: 1px;
+ border-style: solid;
+ border-color: lightgray;
+}
+th, td {
+ padding: 10px;
+}
+#wrapper {
+ background-color: #ffffff;
+ width: 900px;
+ margin: 8px auto;
+ padding: 12px;
+}
+ </style>
+ </head>
+ <body>
+ <div id="wrapper">
+ <img alt="Isis Logo" src="about/images/isis-logo.png" />
+
+ <p>
+ <a href="http://isis.apache.org" target="_blank">Apache Isis</a>™ is a framework to let you rapidly develop
+ domain-driven apps in Java. This app has been generated using Isis'
+ <a href="http://isis.apache.org/intro/getting-started/simple%61pp-archetype.html" target="_blank">SimpleApp</a> archetype,
+ which configures Isis to run a very simple and purposefully minimal application.
+
+ <p>
+ The app itself consists of a single domain class,
+ <a href="https://github.com/apache/isis/blob/master/example/application/simple%61pp/dom/src/main/java/dom/simple/SimpleObject.java" target="_blank"><tt>SimpleObject</tt></a>,
+ along with an equally simple (factory/repository) domain service, <a href="https://github.com/apache/isis/blob/master/example/application/simple%61pp/dom/src/main/java/dom/simple/SimpleObjects.java" target="_blank"><tt>SimpleObjects</tt></a>.
+ </p>
+
+ <p>To access the app:</p>
+ <ul>
+ <li>
+ <p>
+ <b><a href="wicket/">wicket/</a></b>
+ </p>
+ <p>
+ provides accesses to a generic UI for end-users,
+ Isis' <a href="http://isis.apache.org/components/viewers/wicket/about.html" target="_blank">Wicket Viewer</a>.
+ As its name suggests, this viewer is built on top of <a href="http://wicket.apache.org" target="_blank">Apache Wicket</a>™.
+ </p>
+ </li>
+ <li>
+ <p>
+ <b>
+ <a href="restful/">restful/</a>
+ </b>
+ </p>
+ <p>
+ provides access to a RESTful API conformant with the
+ <a href="http://restfulobjects.org">Restful Objects</a> spec</td>. This is part of Isis Core. The
+ implementation technology is JBoss RestEasy.
+ </p>
+ </li>
+ <li>
+ <p>
+ <b>
+ <a href="cy2neo/index.html">cy2neo/</a>
+ </b>
+ </p>
+ <p>
+ provides a lightweight graph DB visualizer.
+ </p>
+ </li>
+ </ul>
+
+ <p>
+ The default user/password is <b><i>sven/pass</i></b> (as configured in the
+ <a href="https://github.com/apache/isis/blob/master/example/application/simple%61pp/webapp/src/main/webapp/WEB-INF/shiro.ini" target="_blank">shiro.ini</a> file).
+ </p>
+
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/css/application.css
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/css/application.css b/example/application/neoapp/webapp/src/main/webapp/css/application.css
new file mode 100644
index 0000000..9f1612a
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/css/application.css
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/cy2neo/bower.json
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/cy2neo/bower.json b/example/application/neoapp/webapp/src/main/webapp/cy2neo/bower.json
new file mode 100644
index 0000000..a3f7a95
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/cy2neo/bower.json
@@ -0,0 +1,31 @@
+{
+ "name": "cy2neo",
+ "version": "0.0.1",
+ "authors": [
+ "Michael Hunger <gi...@jexp.de>"
+ ],
+ "description": "Cy2Neo Tiny Neo4j Cypher Workbench with Alchemy.js Viz",
+ "main": "cy2neo.js",
+ "keywords": [
+ "neo4j",
+ "cypher",
+ "graph",
+ "database",
+ "repl",
+ "shell",
+ "console",
+ "graphviz",
+ "d3",
+ "graph"
+ ],
+ "license": "MIT",
+ "homepage": "http://jexp.github.io/cy2neo",
+ "private": true,
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/cy2neo/index.html
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/cy2neo/index.html b/example/application/neoapp/webapp/src/main/webapp/cy2neo/index.html
new file mode 100644
index 0000000..6f06a53
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/cy2neo/index.html
@@ -0,0 +1,135 @@
+<html>
+<head>
+<link rel="stylesheet" href="../scripts/alchemy/styles/vendor.css">
+<link rel="stylesheet" href="../scripts/alchemy/alchemy.css">
+<link rel="stylesheet" href="styles/codemirror.css">
+<link rel="stylesheet" href="styles/codemirror-neo.css">
+<link rel="stylesheet" href="styles/cy2neo.css">
+<link rel="stylesheet" href="styles/gh-fork-ribbon.css">
+<link rel="shortcut icon" href="a70134cc.alchemyFlatfavicon.ico">
+<title>Cy2Neo - Tiny Neo4j Cypher Workbench</title>
+</head>
+<body>
+ <div>
+ <input class="form-control" type="url" value="http://localhost:7474" id="neo4jUrl"/>
+ <textarea name="cypher" id="cypher" rows="4" cols="120" data-lang="cypher" class="code form-control">
+START x = node(*)
+MATCH (x)-[r?]->(m)
+RETURN x, r
+
+ </textarea>
+ <a href="#" title="Execute" id="execute"><i class="fa fa-play-circle-o"></i></a>
+ </div>
+
+<div class="alchemy tab-pane active" id="graph"></div>
+
+<!-- <ul class="nav nav-tabs" role="tablist">
+ <li class="active"><a href="#graph" role="tab" data-toggle="tab">Graph</a></li>
+ <li><a href="#table" role="tab" data-toggle="tab">Table</a></li>
+</ul> -->
+
+<!-- <div class="tab-content">
+ <div class="alchemy tab-pane active" id="graph"></div>
+ <div class="tab-pane" id="table">table</div>
+</div> -->
+<div id="alchemy" class="alchemy"></div>
+
+<div class="github-fork-ribbon-wrapper right-bottom">
+ <div class="github-fork-ribbon">
+ <a href="https://github.com/jexp/cy2neo">Fork me on GitHub</a>
+ </div>
+</div>
+
+
+<script src="scripts/codemirror.js"></script>
+<script src="scripts/codemirror-cypher.js"></script>
+<script src="scripts/alchemyConfig.js"></script>
+<script src="../scripts/alchemy/scripts/vendor.js"></script>
+<script src="../scripts/alchemy/alchemy.js"></script>
+<script src="scripts/neo.js"></script>
+
+<style type="text/css" media="screen">
+/* todo dynamic CSS */
+ .Movie circle {
+ fill: #00ff0e;
+ stroke: #00ffda;
+ }
+
+ .Person circle {
+ fill: #ff7921;
+ stroke: #4f07ff;
+ }
+</style>
+<script type="text/javascript">
+
+ function createEditor() {
+ return CodeMirror.fromTextArea(document.getElementById("cypher"), {
+ parserfile: ["scripts/codemirror-cypher.js"],
+ path: "scripts",
+ stylesheet: "styles/codemirror-neo.css",
+ autoMatchParens: true,
+ lineNumbers: true,
+ enterMode: "keep",
+ value: "some value"
+ });
+ }
+
+
+ $(document).ready(function() {
+
+ //todo dynamic configuration
+ //config.nodeTypes = "label"; // { type : ["NodeType1", "NodeType2", "AnotherNodeType"]};
+
+ //config.nodeCaption=function(n) {return n.name || n.title;};
+ /* config.edgeCaption={"caption":["ACTED_IN","DIRECTED","PRODUCED","REVIEWED","WROTE"]}; */
+ /* config.nodeMouseOver = function(n) {return n.id + "<br/>"+n.name || n.title;}; */
+ /* config.nodeMouseOver = function(n) {return "test";}; */
+
+
+ config.neo4jUrl="http://localhost:7474/db/data/cypher";
+
+ alchemy = new Alchemy(config);
+ alchemy.begin(config);
+
+ var neo = new Neo(function() { return config.neo4jUrl; });
+ var editor = createEditor();
+
+ $("#execute").click(function(evt) {
+ try {
+ /* var allEdges = alchemy.get.edges().all();
+ allEdges.forEach(function(edge){
+ edge.remove();
+ });
+ var allNodes = alchemy.get.nodes().all();
+ allNodes.forEach(function(node){
+ node.remove();
+ }); */
+ evt.preventDefault();
+ var query = editor.getValue();
+ console.log("Executing Query",query);
+ neo.executeQuery(query,{},function(err,res) {
+ res = res || {}
+ var graph=res.graph;
+ var labels = res.labels;
+ config.nodeTypes = {type: labels};
+ if (err) {
+ alchemy.conf.warningMessage=JSON.stringify(err);
+ alchemy.startGraph(null);
+ } else {
+ alchemy.startGraph(graph);
+ }
+ });
+ } catch(e) {
+ console.log(e);
+ }
+ return false;
+ });
+
+ //new Cy2Neo(config,"graph","cypher","execute", function() { return $("#neo4jUrl").val(); });
+ });
+
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/alchemyConfig.js
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/alchemyConfig.js b/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/alchemyConfig.js
new file mode 100644
index 0000000..a3c75f8
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/alchemyConfig.js
@@ -0,0 +1,33 @@
+var config = {
+
+ /* cluster : true, */
+
+ nodeCaption : "name",
+ /* rootNodeRadius : 30, */
+
+ /*showControlDash : true,
+
+ showStats : true,
+ nodeStats : true,
+
+ showFilters : true,
+ nodeFilters : true,*/
+
+/* captionToggle : true,
+ edgesToggle : true,
+ nodesToggle : true,*/
+ toggleRootNotes : false,
+
+ zoomControls : true,
+
+ dataSource : {
+ nodes : [],
+ edges : []
+ },
+ forceLocked : false,
+ alpha : 0.8,
+ edgeTypes : "caption",
+ directedEdges: true
+};
+
+// alchemy.begin(config)
http://git-wip-us.apache.org/repos/asf/isis/blob/fa30a76a/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/codemirror-cypher.js
----------------------------------------------------------------------
diff --git a/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/codemirror-cypher.js b/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/codemirror-cypher.js
new file mode 100644
index 0000000..24f9d7a
--- /dev/null
+++ b/example/application/neoapp/webapp/src/main/webapp/cy2neo/scripts/codemirror-cypher.js
@@ -0,0 +1,190 @@
+// Generated by CoffeeScript 1.6.3
+/*!
+Copyright (c) 2002-2014 "Neo Technology,"
+Network Engine for Objects in Lund AB [http://neotechnology.com]
+
+This file is part of Neo4j.
+
+Neo4j is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ var wordRegexp;
+
+ wordRegexp = function(words) {
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
+ };
+
+ CodeMirror.defineMode("cypher", function(config) {
+ var curPunc, funcs, indentUnit, keywords, operatorChars, popContext, preds, pushContext, tokenBase, tokenLiteral;
+ tokenBase = function(stream, state) {
+ var ch, curPunc, type, word;
+ ch = stream.next();
+ curPunc = null;
+ if (ch === "\"" || ch === "'") {
+ stream.match(/.+?["']/);
+ return "string";
+ }
+ if (/[{}\(\),\.;\[\]]/.test(ch)) {
+ curPunc = ch;
+ return "node";
+ } else if (ch === "/" && stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ } else if (operatorChars.test(ch)) {
+ stream.eatWhile(operatorChars);
+ return null;
+ } else {
+ stream.eatWhile(/[_\w\d]/);
+ if (stream.eat(":")) {
+ stream.eatWhile(/[\w\d_\-]/);
+ return "atom";
+ }
+ word = stream.current();
+ type = void 0;
+ if (funcs.test(word)) {
+ return "builtin";
+ }
+ if (preds.test(word)) {
+ return "def";
+ } else if (keywords.test(word)) {
+ return "keyword";
+ } else {
+ return "variable";
+ }
+ }
+ };
+ tokenLiteral = function(quote) {
+ return function(stream, state) {
+ var ch, escaped;
+ escaped = false;
+ ch = void 0;
+ while ((ch = stream.next()) != null) {
+ if (ch === quote && !escaped) {
+ state.tokenize = tokenBase;
+ break;
+ }
+ escaped = !escaped && ch === "\\";
+ }
+ return "string";
+ };
+ };
+ pushContext = function(state, type, col) {
+ return state.context = {
+ prev: state.context,
+ indent: state.indent,
+ col: col,
+ type: type
+ };
+ };
+ popContext = function(state) {
+ state.indent = state.context.indent;
+ return state.context = state.context.prev;
+ };
+ indentUnit = config.indentUnit;
+ curPunc = void 0;
+ funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "right", "round", "rtrim", "shortestPath", "sign", "sin", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "trim", "type", "upper"]);
+ preds = wordRegexp(["all", "and", "any", "has", "in", "none", "not", "or", "single", "xor"]);
+ keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "distinct", "drop", "else", "end", "false", "foreach", "from", "headers", "in", "index", "is", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "remove", "return", "scan", "set", "skip", "start", "then", "true", "union", "unique", "using", "when", "where", "with"]);
+ operatorChars = /[*+\-<>=&|~%^]/;
+ return {
+ startState: function(base) {
+ return {
+ tokenize: tokenBase,
+ context: null,
+ indent: 0,
+ col: 0
+ };
+ },
+ token: function(stream, state) {
+ var style;
+ if (stream.sol()) {
+ if (state.context && (state.context.align == null)) {
+ state.context.align = false;
+ }
+ state.indent = stream.indentation();
+ }
+ if (stream.eatSpace()) {
+ return null;
+ }
+ style = state.tokenize(stream, state);
+ if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
+ state.context.align = true;
+ }
+ if (curPunc === "(") {
+ pushContext(state, ")", stream.column());
+ } else if (curPunc === "[") {
+ pushContext(state, "]", stream.column());
+ } else if (curPunc === "{") {
+ pushContext(state, "}", stream.column());
+ } else if (/[\]\}\)]/.test(curPunc)) {
+ while (state.context && state.context.type === "pattern") {
+ popContext(state);
+ }
+ if (state.context && curPunc === state.context.type) {
+ popContext(state);
+ }
+ } else if (curPunc === "." && state.context && state.context.type === "pattern") {
+ popContext(state);
+ } else if (/atom|string|variable/.test(style) && state.context) {
+ if (/[\}\]]/.test(state.context.type)) {
+ pushContext(state, "pattern", stream.column());
+ } else if (state.context.type === "pattern" && !state.context.align) {
+ state.context.align = true;
+ state.context.col = stream.column();
+ }
+ }
+ return style;
+ },
+ indent: function(state, textAfter) {
+ var closing, context, firstChar;
+ firstChar = textAfter && textAfter.charAt(0);
+ context = state.context;
+ if (/[\]\}]/.test(firstChar)) {
+ while (context && context.type === "pattern") {
+ context = context.prev;
+ }
+ }
+ closing = context && firstChar === context.type;
+ if (!context) {
+ return 0;
+ } else if (context.type === "keywords") {
+ return newlineAndIndent;
+ } else if (context.align) {
+ return context.col + (closing ? 0 : 1);
+ } else {
+ return context.indent + (closing ? 0 : indentUnit);
+ }
+ }
+ };
+ });
+
+ CodeMirror.modeExtensions["cypher"] = {
+ autoFormatLineBreaks: function(text) {
+ var i, lines, reProcessedPortion;
+ lines = text.split("\n");
+ reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
+ i = 0;
+ while (i < lines.length) {
+ lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
+ i++;
+ }
+ return lines.join("\n");
+ }
+ };
+
+ CodeMirror.defineMIME("application/x-cypher-query", "cypher");
+
+}).call(this);