neo4jr-social 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
 - data/.gitignore +21 -0
 - data/LICENSE +20 -0
 - data/README.rdoc +88 -0
 - data/Rakefile +70 -0
 - data/TODO +9 -0
 - data/VERSION +1 -0
 - data/bin/start-neo4jr-social +79 -0
 - data/config.ru +3 -0
 - data/examples/facebook.rb +33 -0
 - data/examples/linkedin.rb +38 -0
 - data/jetty-runtime/etc/jetty.xml +212 -0
 - data/jetty-runtime/etc/webdefault.xml +378 -0
 - data/jetty-runtime/lib/jetty-6.1.3.jar +0 -0
 - data/jetty-runtime/lib/jetty-util-6.1.3.jar +0 -0
 - data/jetty-runtime/lib/jsp-2.1/ant-1.6.5.jar +0 -0
 - data/jetty-runtime/lib/jsp-2.1/core-3.1.1.jar +0 -0
 - data/jetty-runtime/lib/jsp-2.1/jsp-2.1.jar +0 -0
 - data/jetty-runtime/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
 - data/jetty-runtime/lib/servlet-api-2.5-6.1.3.jar +0 -0
 - data/jetty-runtime/start.jar +0 -0
 - data/jetty-runtime/webapps/neo4jr-social.war +0 -0
 - data/lib/neo4jr-social.rb +14 -0
 - data/lib/neo4jr-social/service.rb +97 -0
 - data/lib/neo4jr-social/version.rb +3 -0
 - data/neo4jr-social.gemspec +97 -0
 - data/spec/service_spec.rb +112 -0
 - data/spec/spec.opts +1 -0
 - data/spec/spec_helper.rb +22 -0
 - data/tmp/war/WEB-INF/lib/jruby-core-1.4.0.jar +0 -0
 - data/tmp/war/WEB-INF/lib/jruby-rack-0.9.5.jar +0 -0
 - data/tmp/war/WEB-INF/lib/jruby-stdlib-1.4.0.jar +0 -0
 - data/tmp/war/WEB-INF/lib/neo4jr-social.rb +14 -0
 - data/tmp/war/WEB-INF/lib/neo4jr-social/service.rb +97 -0
 - data/tmp/war/WEB-INF/lib/neo4jr-social/version.rb +3 -0
 - data/tmp/war/WEB-INF/web.xml +38 -0
 - metadata +144 -0
 
| 
         @@ -0,0 +1,378 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0" encoding="ISO-8859-1"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            <!-- ===================================================================== -->
         
     | 
| 
      
 4 
     | 
    
         
            +
            <!-- This file contains the default descriptor for web applications.       -->
         
     | 
| 
      
 5 
     | 
    
         
            +
            <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
         
     | 
| 
      
 6 
     | 
    
         
            +
            <!-- The intent of this descriptor is to include jetty specific or common  -->
         
     | 
| 
      
 7 
     | 
    
         
            +
            <!-- configuration for all webapps.   If a context has a webdefault.xml    -->
         
     | 
| 
      
 8 
     | 
    
         
            +
            <!-- descriptor, it is applied before the contexts own web.xml file        -->
         
     | 
| 
      
 9 
     | 
    
         
            +
            <!--                                                                       -->
         
     | 
| 
      
 10 
     | 
    
         
            +
            <!-- A context may be assigned a default descriptor by:                    -->
         
     | 
| 
      
 11 
     | 
    
         
            +
            <!--  + Calling WebApplicationContext.setDefaultsDescriptor                -->
         
     | 
| 
      
 12 
     | 
    
         
            +
            <!--  + Passed an arg to addWebApplications                                -->
         
     | 
| 
      
 13 
     | 
    
         
            +
            <!--                                                                       -->
         
     | 
| 
      
 14 
     | 
    
         
            +
            <!-- This file is used both as the resource within the jetty.jar (which is -->
         
     | 
| 
      
 15 
     | 
    
         
            +
            <!-- used as the default if no explicit defaults descriptor is set) and it -->
         
     | 
| 
      
 16 
     | 
    
         
            +
            <!-- is copied to the etc directory of the Jetty distro and explicitly     -->
         
     | 
| 
      
 17 
     | 
    
         
            +
            <!-- by the jetty.xml file.                                                -->
         
     | 
| 
      
 18 
     | 
    
         
            +
            <!--                                                                       -->
         
     | 
| 
      
 19 
     | 
    
         
            +
            <!-- ===================================================================== -->
         
     | 
| 
      
 20 
     | 
    
         
            +
            <web-app 
         
     | 
| 
      
 21 
     | 
    
         
            +
               xmlns="http://java.sun.com/xml/ns/javaee" 
         
     | 
| 
      
 22 
     | 
    
         
            +
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         
     | 
| 
      
 23 
     | 
    
         
            +
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
         
     | 
| 
      
 24 
     | 
    
         
            +
               metadata-complete="true"
         
     | 
| 
      
 25 
     | 
    
         
            +
               version="2.5"> 
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              <description>
         
     | 
| 
      
 28 
     | 
    
         
            +
                Default web.xml file.  
         
     | 
| 
      
 29 
     | 
    
         
            +
                This file is applied to a Web application before it's own WEB_INF/web.xml file
         
     | 
| 
      
 30 
     | 
    
         
            +
              </description>
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 34 
     | 
    
         
            +
              <!-- Context params to control Session Cookies                            -->
         
     | 
| 
      
 35 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 36 
     | 
    
         
            +
              <!-- UNCOMMENT TO ACTIVATE
         
     | 
| 
      
 37 
     | 
    
         
            +
              <context-param>
         
     | 
| 
      
 38 
     | 
    
         
            +
                <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
         
     | 
| 
      
 39 
     | 
    
         
            +
                <param-value>127.0.0.1</param-value>
         
     | 
| 
      
 40 
     | 
    
         
            +
              </context-param>
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              <context-param>
         
     | 
| 
      
 43 
     | 
    
         
            +
                <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
         
     | 
| 
      
 44 
     | 
    
         
            +
                <param-value>/</param-value>
         
     | 
| 
      
 45 
     | 
    
         
            +
              </context-param>
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              <context-param>
         
     | 
| 
      
 48 
     | 
    
         
            +
                <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
         
     | 
| 
      
 49 
     | 
    
         
            +
                <param-value>-1</param-value>
         
     | 
| 
      
 50 
     | 
    
         
            +
              </context-param>
         
     | 
| 
      
 51 
     | 
    
         
            +
              -->
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              <context-param>
         
     | 
| 
      
 54 
     | 
    
         
            +
                <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name>
         
     | 
| 
      
 55 
     | 
    
         
            +
                <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar|</param-value>
         
     | 
| 
      
 56 
     | 
    
         
            +
              </context-param>
         
     | 
| 
      
 57 
     | 
    
         
            +
                        
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 61 
     | 
    
         
            +
              <!-- The default servlet.                                                 -->
         
     | 
| 
      
 62 
     | 
    
         
            +
              <!-- This servlet, normally mapped to /, provides the handling for static -->
         
     | 
| 
      
 63 
     | 
    
         
            +
              <!-- content, OPTIONS and TRACE methods for the context.                  -->
         
     | 
| 
      
 64 
     | 
    
         
            +
              <!-- The following initParameters are supported:                          -->
         
     | 
| 
      
 65 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 66 
     | 
    
         
            +
              <!--   acceptRanges     If true, range requests and responses are         -->
         
     | 
| 
      
 67 
     | 
    
         
            +
              <!--                    supported                                         -->
         
     | 
| 
      
 68 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 69 
     | 
    
         
            +
              <!--   dirAllowed       If true, directory listings are returned if no    -->
         
     | 
| 
      
 70 
     | 
    
         
            +
              <!--                    welcome file is found. Else 403 Forbidden.        -->
         
     | 
| 
      
 71 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 72 
     | 
    
         
            +
              <!--   redirectWelcome  If true, redirect welcome file requests           -->
         
     | 
| 
      
 73 
     | 
    
         
            +
              <!--                    else use request dispatcher forwards              -->
         
     | 
| 
      
 74 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 75 
     | 
    
         
            +
              <!--   gzip             If set to true, then static content will be served--> 
         
     | 
| 
      
 76 
     | 
    
         
            +
              <!--                    as gzip content encoded if a matching resource is -->
         
     | 
| 
      
 77 
     | 
    
         
            +
              <!--                    found ending with ".gz"                           -->
         
     | 
| 
      
 78 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 79 
     | 
    
         
            +
              <!--   resoureBase      Can be set to replace the context resource base   -->
         
     | 
| 
      
 80 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 81 
     | 
    
         
            +
              <!--   relativeResourceBase                                               -->
         
     | 
| 
      
 82 
     | 
    
         
            +
              <!--                    Set with a pathname relative to the base of the   -->
         
     | 
| 
      
 83 
     | 
    
         
            +
              <!--                    servlet context root. Useful for only serving     -->
         
     | 
| 
      
 84 
     | 
    
         
            +
              <!--                    static content from only specific subdirectories. -->
         
     | 
| 
      
 85 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 86 
     | 
    
         
            +
              <!--   useFileMappedBuffer                                                -->
         
     | 
| 
      
 87 
     | 
    
         
            +
              <!--                    If set to true (the default), a  memory mapped    -->
         
     | 
| 
      
 88 
     | 
    
         
            +
              <!--                    file buffer will be used to serve static content  -->
         
     | 
| 
      
 89 
     | 
    
         
            +
              <!--                    when using an NIO connector. Setting this value   -->
         
     | 
| 
      
 90 
     | 
    
         
            +
              <!--                    to false means that a direct buffer will be used  -->
         
     | 
| 
      
 91 
     | 
    
         
            +
              <!--                    instead. If you are having trouble with Windows   -->
         
     | 
| 
      
 92 
     | 
    
         
            +
              <!--                    file locking, set this to false.                  -->
         
     | 
| 
      
 93 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 94 
     | 
    
         
            +
              <!--  cacheControl      If set, all static content will have this value   -->
         
     | 
| 
      
 95 
     | 
    
         
            +
              <!--                    set as the cache-control header.                  -->
         
     | 
| 
      
 96 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 97 
     | 
    
         
            +
              <servlet>
         
     | 
| 
      
 98 
     | 
    
         
            +
                <servlet-name>default</servlet-name>
         
     | 
| 
      
 99 
     | 
    
         
            +
                <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class>
         
     | 
| 
      
 100 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 101 
     | 
    
         
            +
                  <param-name>acceptRanges</param-name>
         
     | 
| 
      
 102 
     | 
    
         
            +
                  <param-value>true</param-value>
         
     | 
| 
      
 103 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 104 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 105 
     | 
    
         
            +
                  <param-name>dirAllowed</param-name>
         
     | 
| 
      
 106 
     | 
    
         
            +
                  <param-value>true</param-value>
         
     | 
| 
      
 107 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 108 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 109 
     | 
    
         
            +
                  <param-name>redirectWelcome</param-name>
         
     | 
| 
      
 110 
     | 
    
         
            +
                  <param-value>false</param-value>
         
     | 
| 
      
 111 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 112 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 113 
     | 
    
         
            +
                  <param-name>maxCacheSize</param-name>
         
     | 
| 
      
 114 
     | 
    
         
            +
                  <param-value>2000000</param-value>
         
     | 
| 
      
 115 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 116 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 117 
     | 
    
         
            +
                  <param-name>maxCachedFileSize</param-name>
         
     | 
| 
      
 118 
     | 
    
         
            +
                  <param-value>254000</param-value>
         
     | 
| 
      
 119 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 120 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 121 
     | 
    
         
            +
                  <param-name>maxCachedFiles</param-name>
         
     | 
| 
      
 122 
     | 
    
         
            +
                  <param-value>1000</param-value>
         
     | 
| 
      
 123 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 124 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 125 
     | 
    
         
            +
                  <param-name>gzip</param-name>
         
     | 
| 
      
 126 
     | 
    
         
            +
                  <param-value>false</param-value>
         
     | 
| 
      
 127 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 128 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 129 
     | 
    
         
            +
                  <param-name>useFileMappedBuffer</param-name>
         
     | 
| 
      
 130 
     | 
    
         
            +
                  <param-value>false</param-value>
         
     | 
| 
      
 131 
     | 
    
         
            +
                </init-param>  
         
     | 
| 
      
 132 
     | 
    
         
            +
                <!--
         
     | 
| 
      
 133 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 134 
     | 
    
         
            +
                  <param-name>cacheControl</param-name>
         
     | 
| 
      
 135 
     | 
    
         
            +
                  <param-value>max-age=3600,public</param-value>
         
     | 
| 
      
 136 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 137 
     | 
    
         
            +
                -->
         
     | 
| 
      
 138 
     | 
    
         
            +
                <load-on-startup>0</load-on-startup>
         
     | 
| 
      
 139 
     | 
    
         
            +
              </servlet> 
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
              <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
         
     | 
| 
      
 142 
     | 
    
         
            +
              
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 145 
     | 
    
         
            +
              <!-- JSP Servlet                                                          -->
         
     | 
| 
      
 146 
     | 
    
         
            +
              <!-- This is the jasper JSP servlet from the jakarta project              -->
         
     | 
| 
      
 147 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 148 
     | 
    
         
            +
              <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
         
     | 
| 
      
 149 
     | 
    
         
            +
              <!-- used by Glassfish to support JSP pages.  Traditionally, this servlet -->
         
     | 
| 
      
 150 
     | 
    
         
            +
              <!-- is mapped to URL patterh "*.jsp".  This servlet supports the         -->
         
     | 
| 
      
 151 
     | 
    
         
            +
              <!-- following initialization parameters (default values are in square    -->
         
     | 
| 
      
 152 
     | 
    
         
            +
              <!-- brackets):                                                           -->
         
     | 
| 
      
 153 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 154 
     | 
    
         
            +
              <!--   checkInterval       If development is false and reloading is true, -->
         
     | 
| 
      
 155 
     | 
    
         
            +
              <!--                       background compiles are enabled. checkInterval -->
         
     | 
| 
      
 156 
     | 
    
         
            +
              <!--                       is the time in seconds between checks to see   -->
         
     | 
| 
      
 157 
     | 
    
         
            +
              <!--                       if a JSP page needs to be recompiled. [300]    -->
         
     | 
| 
      
 158 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 159 
     | 
    
         
            +
              <!--   compiler            Which compiler Ant should use to compile JSP   -->
         
     | 
| 
      
 160 
     | 
    
         
            +
              <!--                       pages.  See the Ant documenation for more      -->
         
     | 
| 
      
 161 
     | 
    
         
            +
              <!--                       information. [javac]                           -->
         
     | 
| 
      
 162 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 163 
     | 
    
         
            +
              <!--   classdebuginfo      Should the class file be compiled with         -->
         
     | 
| 
      
 164 
     | 
    
         
            +
              <!--                       debugging information?  [true]                 -->
         
     | 
| 
      
 165 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 166 
     | 
    
         
            +
              <!--   classpath           What class path should I use while compiling   -->
         
     | 
| 
      
 167 
     | 
    
         
            +
              <!--                       generated servlets?  [Created dynamically      -->
         
     | 
| 
      
 168 
     | 
    
         
            +
              <!--                       based on the current web application]          -->
         
     | 
| 
      
 169 
     | 
    
         
            +
              <!--                       Set to ? to make the container explicitly set  -->
         
     | 
| 
      
 170 
     | 
    
         
            +
              <!--                       this parameter.                                -->
         
     | 
| 
      
 171 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 172 
     | 
    
         
            +
              <!--   development         Is Jasper used in development mode (will check -->
         
     | 
| 
      
 173 
     | 
    
         
            +
              <!--                       for JSP modification on every access)?  [true] -->
         
     | 
| 
      
 174 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 175 
     | 
    
         
            +
              <!--   enablePooling       Determines whether tag handler pooling is      -->
         
     | 
| 
      
 176 
     | 
    
         
            +
              <!--                       enabled  [true]                                -->
         
     | 
| 
      
 177 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 178 
     | 
    
         
            +
              <!--   fork                Tell Ant to fork compiles of JSP pages so that -->
         
     | 
| 
      
 179 
     | 
    
         
            +
              <!--                       a separate JVM is used for JSP page compiles   -->
         
     | 
| 
      
 180 
     | 
    
         
            +
              <!--                       from the one Tomcat is running in. [true]      -->
         
     | 
| 
      
 181 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 182 
     | 
    
         
            +
              <!--   ieClassId           The class-id value to be sent to Internet      -->
         
     | 
| 
      
 183 
     | 
    
         
            +
              <!--                       Explorer when using <jsp:plugin> tags.         -->
         
     | 
| 
      
 184 
     | 
    
         
            +
              <!--                       [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93]   -->
         
     | 
| 
      
 185 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 186 
     | 
    
         
            +
              <!--   javaEncoding        Java file encoding to use for generating java  -->
         
     | 
| 
      
 187 
     | 
    
         
            +
              <!--                       source files. [UTF-8]                          -->
         
     | 
| 
      
 188 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 189 
     | 
    
         
            +
              <!--   keepgenerated       Should we keep the generated Java source code  -->
         
     | 
| 
      
 190 
     | 
    
         
            +
              <!--                       for each page instead of deleting it? [true]   -->
         
     | 
| 
      
 191 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 192 
     | 
    
         
            +
              <!--   logVerbosityLevel   The level of detailed messages to be produced  -->
         
     | 
| 
      
 193 
     | 
    
         
            +
              <!--                       by this servlet.  Increasing levels cause the  -->
         
     | 
| 
      
 194 
     | 
    
         
            +
              <!--                       generation of more messages.  Valid values are -->
         
     | 
| 
      
 195 
     | 
    
         
            +
              <!--                       FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
         
     | 
| 
      
 196 
     | 
    
         
            +
              <!--                       [WARNING]                                      -->
         
     | 
| 
      
 197 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 198 
     | 
    
         
            +
              <!--   mappedfile          Should we generate static content with one     -->
         
     | 
| 
      
 199 
     | 
    
         
            +
              <!--                       print statement per input line, to ease        -->
         
     | 
| 
      
 200 
     | 
    
         
            +
              <!--                       debugging?  [false]                            -->
         
     | 
| 
      
 201 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 202 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 203 
     | 
    
         
            +
              <!--   reloading           Should Jasper check for modified JSPs?  [true] -->
         
     | 
| 
      
 204 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 205 
     | 
    
         
            +
              <!--   suppressSmap        Should the generation of SMAP info for JSR45   -->
         
     | 
| 
      
 206 
     | 
    
         
            +
              <!--                       debugging be suppressed?  [false]              -->
         
     | 
| 
      
 207 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 208 
     | 
    
         
            +
              <!--   dumpSmap            Should the SMAP info for JSR45 debugging be    -->
         
     | 
| 
      
 209 
     | 
    
         
            +
              <!--                       dumped to a file? [false]                      -->
         
     | 
| 
      
 210 
     | 
    
         
            +
              <!--                       False if suppressSmap is true                  -->
         
     | 
| 
      
 211 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 212 
     | 
    
         
            +
              <!--   scratchdir          What scratch directory should we use when      -->
         
     | 
| 
      
 213 
     | 
    
         
            +
              <!--                       compiling JSP pages?  [default work directory  -->
         
     | 
| 
      
 214 
     | 
    
         
            +
              <!--                       for the current web application]               -->
         
     | 
| 
      
 215 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 216 
     | 
    
         
            +
              <!--   tagpoolMaxSize      The maximum tag handler pool size  [5]         -->
         
     | 
| 
      
 217 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 218 
     | 
    
         
            +
              <!--   xpoweredBy          Determines whether X-Powered-By response       -->
         
     | 
| 
      
 219 
     | 
    
         
            +
              <!--                       header is added by generated servlet  [false]  -->
         
     | 
| 
      
 220 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 221 
     | 
    
         
            +
              <!-- If you wish to use Jikes to compile JSP pages:                       -->
         
     | 
| 
      
 222 
     | 
    
         
            +
              <!--   Set the init parameter "compiler" to "jikes".  Define              -->
         
     | 
| 
      
 223 
     | 
    
         
            +
              <!--   the property "-Dbuild.compiler.emacs=true" when starting Jetty     -->
         
     | 
| 
      
 224 
     | 
    
         
            +
              <!--   to cause Jikes to emit error messages in a format compatible with  -->
         
     | 
| 
      
 225 
     | 
    
         
            +
              <!--   Jasper.                                                            -->
         
     | 
| 
      
 226 
     | 
    
         
            +
              <!--   If you get an error reporting that jikes can't use UTF-8 encoding, -->
         
     | 
| 
      
 227 
     | 
    
         
            +
              <!--   try setting the init parameter "javaEncoding" to "ISO-8859-1".     -->
         
     | 
| 
      
 228 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 229 
     | 
    
         
            +
              <servlet id="jsp">
         
     | 
| 
      
 230 
     | 
    
         
            +
                <servlet-name>jsp</servlet-name>
         
     | 
| 
      
 231 
     | 
    
         
            +
                <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
         
     | 
| 
      
 232 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 233 
     | 
    
         
            +
                    <param-name>logVerbosityLevel</param-name>
         
     | 
| 
      
 234 
     | 
    
         
            +
                    <param-value>DEBUG</param-value>
         
     | 
| 
      
 235 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 236 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 237 
     | 
    
         
            +
                    <param-name>fork</param-name>
         
     | 
| 
      
 238 
     | 
    
         
            +
                    <param-value>false</param-value>
         
     | 
| 
      
 239 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 240 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 241 
     | 
    
         
            +
                    <param-name>xpoweredBy</param-name>
         
     | 
| 
      
 242 
     | 
    
         
            +
                    <param-value>false</param-value>
         
     | 
| 
      
 243 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 244 
     | 
    
         
            +
                <!--  
         
     | 
| 
      
 245 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 246 
     | 
    
         
            +
                    <param-name>classpath</param-name>
         
     | 
| 
      
 247 
     | 
    
         
            +
                    <param-value>?</param-value>
         
     | 
| 
      
 248 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 249 
     | 
    
         
            +
                -->
         
     | 
| 
      
 250 
     | 
    
         
            +
                <load-on-startup>0</load-on-startup>
         
     | 
| 
      
 251 
     | 
    
         
            +
              </servlet>
         
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
              <servlet-mapping> 
         
     | 
| 
      
 254 
     | 
    
         
            +
                <servlet-name>jsp</servlet-name> 
         
     | 
| 
      
 255 
     | 
    
         
            +
                <url-pattern>*.jsp</url-pattern> 
         
     | 
| 
      
 256 
     | 
    
         
            +
                <url-pattern>*.jspf</url-pattern>
         
     | 
| 
      
 257 
     | 
    
         
            +
                <url-pattern>*.jspx</url-pattern>
         
     | 
| 
      
 258 
     | 
    
         
            +
                <url-pattern>*.xsp</url-pattern>
         
     | 
| 
      
 259 
     | 
    
         
            +
                <url-pattern>*.JSP</url-pattern> 
         
     | 
| 
      
 260 
     | 
    
         
            +
                <url-pattern>*.JSPF</url-pattern>
         
     | 
| 
      
 261 
     | 
    
         
            +
                <url-pattern>*.JSPX</url-pattern>
         
     | 
| 
      
 262 
     | 
    
         
            +
                <url-pattern>*.XSP</url-pattern>
         
     | 
| 
      
 263 
     | 
    
         
            +
              </servlet-mapping>
         
     | 
| 
      
 264 
     | 
    
         
            +
              
         
     | 
| 
      
 265 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 266 
     | 
    
         
            +
              <!-- Dynamic Servlet Invoker.                                             -->
         
     | 
| 
      
 267 
     | 
    
         
            +
              <!-- This servlet invokes anonymous servlets that have not been defined   -->
         
     | 
| 
      
 268 
     | 
    
         
            +
              <!-- in the web.xml or by other means. The first element of the pathInfo  -->
         
     | 
| 
      
 269 
     | 
    
         
            +
              <!-- of a request passed to the envoker is treated as a servlet name for  -->
         
     | 
| 
      
 270 
     | 
    
         
            +
              <!-- an existing servlet, or as a class name of a new servlet.            -->
         
     | 
| 
      
 271 
     | 
    
         
            +
              <!-- This servlet is normally mapped to /servlet/*                        -->
         
     | 
| 
      
 272 
     | 
    
         
            +
              <!-- This servlet support the following initParams:                       -->
         
     | 
| 
      
 273 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 274 
     | 
    
         
            +
              <!--  nonContextServlets       If false, the invoker can only load        -->
         
     | 
| 
      
 275 
     | 
    
         
            +
              <!--                           servlets from the contexts classloader.    -->
         
     | 
| 
      
 276 
     | 
    
         
            +
              <!--                           This is false by default and setting this  -->
         
     | 
| 
      
 277 
     | 
    
         
            +
              <!--                           to true may have security implications.    -->
         
     | 
| 
      
 278 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 279 
     | 
    
         
            +
              <!--  verbose                  If true, log dynamic loads                 -->
         
     | 
| 
      
 280 
     | 
    
         
            +
              <!--                                                                      -->
         
     | 
| 
      
 281 
     | 
    
         
            +
              <!--  *                        All other parameters are copied to the     -->
         
     | 
| 
      
 282 
     | 
    
         
            +
              <!--                           each dynamic servlet as init parameters    -->
         
     | 
| 
      
 283 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 284 
     | 
    
         
            +
              <!-- Uncomment for dynamic invocation
         
     | 
| 
      
 285 
     | 
    
         
            +
              <servlet>
         
     | 
| 
      
 286 
     | 
    
         
            +
                <servlet-name>invoker</servlet-name>
         
     | 
| 
      
 287 
     | 
    
         
            +
                <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class>
         
     | 
| 
      
 288 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 289 
     | 
    
         
            +
                  <param-name>verbose</param-name>
         
     | 
| 
      
 290 
     | 
    
         
            +
                  <param-value>false</param-value>
         
     | 
| 
      
 291 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 292 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 293 
     | 
    
         
            +
                  <param-name>nonContextServlets</param-name>
         
     | 
| 
      
 294 
     | 
    
         
            +
                  <param-value>false</param-value>
         
     | 
| 
      
 295 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 296 
     | 
    
         
            +
                <init-param>
         
     | 
| 
      
 297 
     | 
    
         
            +
                  <param-name>dynamicParam</param-name>
         
     | 
| 
      
 298 
     | 
    
         
            +
                  <param-value>anyValue</param-value>
         
     | 
| 
      
 299 
     | 
    
         
            +
                </init-param>
         
     | 
| 
      
 300 
     | 
    
         
            +
                <load-on-startup>0</load-on-startup>
         
     | 
| 
      
 301 
     | 
    
         
            +
              </servlet>
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
              <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
         
     | 
| 
      
 304 
     | 
    
         
            +
              -->
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
             
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
      
 308 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 309 
     | 
    
         
            +
              <session-config>
         
     | 
| 
      
 310 
     | 
    
         
            +
                <session-timeout>30</session-timeout>
         
     | 
| 
      
 311 
     | 
    
         
            +
              </session-config>
         
     | 
| 
      
 312 
     | 
    
         
            +
             
     | 
| 
      
 313 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 314 
     | 
    
         
            +
              <!-- Default MIME mappings                                                -->
         
     | 
| 
      
 315 
     | 
    
         
            +
              <!-- The default MIME mappings are provided by the mime.properties        -->
         
     | 
| 
      
 316 
     | 
    
         
            +
              <!-- resource in the org.mortbay.jetty.jar file.  Additional or modified  -->
         
     | 
| 
      
 317 
     | 
    
         
            +
              <!-- mappings may be specified here                                       -->
         
     | 
| 
      
 318 
     | 
    
         
            +
              <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
         
     | 
| 
      
 319 
     | 
    
         
            +
              <!-- UNCOMMENT TO ACTIVATE
         
     | 
| 
      
 320 
     | 
    
         
            +
              <mime-mapping>
         
     | 
| 
      
 321 
     | 
    
         
            +
                <extension>mysuffix</extension>
         
     | 
| 
      
 322 
     | 
    
         
            +
                <mime-type>mymime/type</mime-type>
         
     | 
| 
      
 323 
     | 
    
         
            +
              </mime-mapping>
         
     | 
| 
      
 324 
     | 
    
         
            +
              -->
         
     | 
| 
      
 325 
     | 
    
         
            +
             
     | 
| 
      
 326 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 327 
     | 
    
         
            +
              <welcome-file-list>
         
     | 
| 
      
 328 
     | 
    
         
            +
                <welcome-file>index.html</welcome-file>
         
     | 
| 
      
 329 
     | 
    
         
            +
                <welcome-file>index.htm</welcome-file>
         
     | 
| 
      
 330 
     | 
    
         
            +
                <welcome-file>index.jsp</welcome-file>
         
     | 
| 
      
 331 
     | 
    
         
            +
              </welcome-file-list>
         
     | 
| 
      
 332 
     | 
    
         
            +
             
     | 
| 
      
 333 
     | 
    
         
            +
              <!-- ==================================================================== -->
         
     | 
| 
      
 334 
     | 
    
         
            +
              <locale-encoding-mapping-list>
         
     | 
| 
      
 335 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
         
     | 
| 
      
 336 
     | 
    
         
            +
                <locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 337 
     | 
    
         
            +
                <locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 338 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 339 
     | 
    
         
            +
                <locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 340 
     | 
    
         
            +
                <locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 341 
     | 
    
         
            +
                <locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 342 
     | 
    
         
            +
                <locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
         
     | 
| 
      
 343 
     | 
    
         
            +
                <locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 344 
     | 
    
         
            +
                <locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 345 
     | 
    
         
            +
                <locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 346 
     | 
    
         
            +
                <locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 347 
     | 
    
         
            +
                <locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 348 
     | 
    
         
            +
                <locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 349 
     | 
    
         
            +
                <locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 350 
     | 
    
         
            +
                <locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 351 
     | 
    
         
            +
                <locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 352 
     | 
    
         
            +
                <locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
         
     | 
| 
      
 353 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
         
     | 
| 
      
 354 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>     
         
     | 
| 
      
 355 
     | 
    
         
            +
                <locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 356 
     | 
    
         
            +
                <locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 357 
     | 
    
         
            +
                <locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 358 
     | 
    
         
            +
                <locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 359 
     | 
    
         
            +
                <locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 360 
     | 
    
         
            +
                <locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 361 
     | 
    
         
            +
                <locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 362 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 363 
     | 
    
         
            +
                <locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 364 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 365 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 366 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 367 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
         
     | 
| 
      
 368 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 369 
     | 
    
         
            +
                <locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
         
     | 
| 
      
 370 
     | 
    
         
            +
                <locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
         
     | 
| 
      
 371 
     | 
    
         
            +
                <locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
         
     | 
| 
      
 372 
     | 
    
         
            +
                <locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
         
     | 
| 
      
 373 
     | 
    
         
            +
                <locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>   
         
     | 
| 
      
 374 
     | 
    
         
            +
              </locale-encoding-mapping-list>
         
     | 
| 
      
 375 
     | 
    
         
            +
             
     | 
| 
      
 376 
     | 
    
         
            +
              
         
     | 
| 
      
 377 
     | 
    
         
            +
              
         
     | 
| 
      
 378 
     | 
    
         
            +
            </web-app>
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            include Java
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 6 
     | 
    
         
            +
            gem 'sinatra'
         
     | 
| 
      
 7 
     | 
    
         
            +
            gem 'json_pure'
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem 'neo4jr-simple'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            require 'sinatra'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'neo4jr-simple'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'neo4jr-social/service'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,97 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Neo4jr
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Service < Sinatra::Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                        
         
     | 
| 
      
 4 
     | 
    
         
            +
                get '/info' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                  Neo4jr::DB.stats.to_json
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
                
         
     | 
| 
      
 8 
     | 
    
         
            +
                get '/nodes' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                  nodes = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 10 
     | 
    
         
            +
                    nodes = neo.all_nodes.map{|m| m.to_hash }        
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
                  nodes.to_json
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              
         
     | 
| 
      
 15 
     | 
    
         
            +
                post '/nodes' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  node = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 17 
     | 
    
         
            +
                    node = neo.create_node(params)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  node.to_hash.to_json
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                get '/nodes/:node_id' do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  Neo4jr::DB.getNodeById(params.delete('node_id')).to_json
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  
         
     | 
| 
      
 26 
     | 
    
         
            +
                put '/nodes/:node_id' do
         
     | 
| 
      
 27 
     | 
    
         
            +
                  node = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    node = neo.getNodeById(params.delete('node_id'))
         
     | 
| 
      
 29 
     | 
    
         
            +
                    node.update_properties(params)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  node.to_hash.to_json
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
                delete '/nodes/:node_id' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 36 
     | 
    
         
            +
                    node = neo.getNodeById(params['node_id'])
         
     | 
| 
      
 37 
     | 
    
         
            +
                    node.delete
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
      
 41 
     | 
    
         
            +
                get '/nodes/:node_id/relationships' do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  relationships = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 43 
     | 
    
         
            +
                    node              = neo.getNodeById(params.delete('node_id'))
         
     | 
| 
      
 44 
     | 
    
         
            +
                    if relationship_type = params.delete('type')
         
     | 
| 
      
 45 
     | 
    
         
            +
                      relationship_type = RelationshipType.instance(relationship_type)
         
     | 
| 
      
 46 
     | 
    
         
            +
                      node.getRelationships(relationship_type.to_a).hashify_objects
         
     | 
| 
      
 47 
     | 
    
         
            +
                    else
         
     | 
| 
      
 48 
     | 
    
         
            +
                      node.getRelationships.hashify_objects
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
                  relationships.to_json
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
                
         
     | 
| 
      
 54 
     | 
    
         
            +
                post '/nodes/:node_id/relationships' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  relationships = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 56 
     | 
    
         
            +
                    node              = neo.getNodeById(params.delete('node_id'))
         
     | 
| 
      
 57 
     | 
    
         
            +
                    to_node           = neo.getNodeById(params.delete('to'))
         
     | 
| 
      
 58 
     | 
    
         
            +
                    relationship_type = RelationshipType.instance(params.delete('type'))
         
     | 
| 
      
 59 
     | 
    
         
            +
                    relationship      = node.create_relationship_to to_node, relationship_type
         
     | 
| 
      
 60 
     | 
    
         
            +
                    relationship.update_properties(params)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    node.getRelationships(relationship_type.to_a).hashify_objects
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  relationships.to_json
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                #optional direction & depth
         
     | 
| 
      
 67 
     | 
    
         
            +
                get '/nodes/:node_id/path' do
         
     | 
| 
      
 68 
     | 
    
         
            +
                  paths = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 69 
     | 
    
         
            +
                    relationship  = Neo4jr::RelationshipType.instance(params.delete('type'))
         
     | 
| 
      
 70 
     | 
    
         
            +
                    start_node    = neo.getNodeById(params.delete('node_id'))
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end_node      = neo.getNodeById(params.delete('to'))
         
     | 
| 
      
 72 
     | 
    
         
            +
                    depth         = params.delete('depth') || 2
         
     | 
| 
      
 73 
     | 
    
         
            +
                    direction     = Neo4jr::Direction.from_string(params.delete('direction') || 'both')
         
     | 
| 
      
 74 
     | 
    
         
            +
                    shortest_path = AllSimplePaths.new(start_node, end_node, depth.to_i, direction, relationship.to_a)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    paths = shortest_path.getPaths
         
     | 
| 
      
 76 
     | 
    
         
            +
                    paths.map{|p| p.map{|n| n.to_hash }}
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  paths.to_json
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
                
         
     | 
| 
      
 81 
     | 
    
         
            +
                #optional
         
     | 
| 
      
 82 
     | 
    
         
            +
                get '/nodes/:node_id/recommendations' do
         
     | 
| 
      
 83 
     | 
    
         
            +
                  suggestions = Neo4jr::DB.execute do |neo|
         
     | 
| 
      
 84 
     | 
    
         
            +
                    relationship = Neo4jr::RelationshipType.incoming(params.delete('type'))
         
     | 
| 
      
 85 
     | 
    
         
            +
                    start_node   = neo.getNodeById(params.delete('node_id'))
         
     | 
| 
      
 86 
     | 
    
         
            +
                    level        = (params.delete('level') || 1).to_i
         
     | 
| 
      
 87 
     | 
    
         
            +
                    order        = Order::BREADTH_FIRST
         
     | 
| 
      
 88 
     | 
    
         
            +
                    return_when  = Return.when do |current_position|
         
     | 
| 
      
 89 
     | 
    
         
            +
                      current_position.depth > level
         
     | 
| 
      
 90 
     | 
    
         
            +
                    end
         
     | 
| 
      
 91 
     | 
    
         
            +
                    traverser = start_node.traverse(order, Stop.at(level + 1), return_when, relationship)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    traverser.map{|node| node.to_hash }
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
                  suggestions.to_json
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
              end
         
     | 
| 
      
 97 
     | 
    
         
            +
            end
         
     |