├── .gitignore ├── .travis.yml ├── CHANGELOG.textile ├── LICENSE.txt ├── README.textile ├── doc ├── Acknowledgments.textile ├── Basic-REST-API.textile ├── Command-Line.textile ├── Creating-an-Extension.textile ├── Deploying-an-Extension.textile ├── Downloads.textile ├── Extension-Annotations.textile ├── Extension-Configuration.textile ├── Extension-Documentation.textile ├── Extension-Naming.textile ├── Extension-Parameters.textile ├── Extension-Points.textile ├── Extension-Response.textile ├── Extensions-and-Gremlin.textile ├── Extensions.textile ├── Getting-Started.textile ├── Gremlin-Extension.textile ├── Home.textile ├── Introduction.textile ├── Mapping-a-URI-to-JSON.textile ├── Monitoring.textile ├── Property-Data-Types.textile ├── Release-Notes.textile ├── RexPro-Java.textile ├── RexPro-Messages.textile ├── RexPro.textile ├── Rexster-Configuration.textile ├── Rexster-Console.textile ├── Rexster-Kibbles.textile ├── Rexster-Mime-Types.textile ├── Rexster-Security.textile ├── Specific-Graph-Configurations.textile ├── The-Benefits-of-Rexster.textile ├── The-Dog-House.textile ├── Troubleshooting.textile └── images │ ├── dog-on-leash.png │ ├── dog-reading.png │ ├── ganglia-logo.jpg │ ├── graphite-logo.png │ ├── grateful-dataset.graffle │ ├── grateful-dataset.png │ ├── json-in-out.graffle │ ├── json-in-out.png │ ├── json-logo.png │ ├── metrics-hat.png │ ├── minus.png │ ├── plus.png │ ├── rexpro-logo.graffle │ ├── rexpro-logo.png │ ├── rexster-2.png │ ├── rexster-brian.png │ ├── rexster-character-1.png │ ├── rexster-character-2.png │ ├── rexster-character-3.png │ ├── rexster-dalmatian.png │ ├── rexster-dog-house-browse.png │ ├── rexster-dog-house-extension-expanded.png │ ├── rexster-dog-house-extension-launched.png │ ├── rexster-dog-house-extension-list.png │ ├── rexster-dog-house-gremlin.png │ ├── rexster-dog-house-index.png │ ├── rexster-dog-house-viz.png │ ├── rexster-dogeatdog.png │ ├── rexster-doghouse.png │ ├── rexster-dogstar.png │ ├── rexster-fluffy.png │ ├── rexster-ganglia-1.png │ ├── rexster-ganglia-2.png │ ├── rexster-graphite.png │ ├── rexster-jmx.png │ ├── rexster-kibbles-logo.graffle │ ├── rexster-kibbles-logo.png │ ├── rexster-logo.graffle │ ├── rexster-logo.png │ ├── rexster-mcgruff.png │ ├── rexster-metrics-logo.graffle │ ├── rexster-metrics-logo.png │ ├── rexster-santas-little-helper.png │ ├── rexster-system-arch.graffle │ ├── rexster-system-arch.png │ ├── tinkerpop-splash.png │ └── visualvm-jmx.png ├── pom.xml ├── rexster-console ├── README.textile ├── bin │ ├── rexster-console.bat │ └── rexster-console.sh ├── pom.xml └── src │ ├── assembly │ ├── distribution.xml │ └── standalone.xml │ └── main │ ├── bin │ ├── README.txt │ ├── rexster-console.bat │ └── rexster-console.sh │ └── java │ └── com │ └── tinkerpop │ └── rexster │ └── console │ ├── ConsoleSettings.java │ ├── ResultAndBindings.java │ └── RexsterConsole.java ├── rexster-core ├── README.textile ├── pom.xml └── src │ ├── assembly │ ├── distribution.xml │ └── standalone.xml │ ├── main │ └── java │ │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ ├── RexsterApplicationGraph.java │ │ ├── RexsterResourceContext.java │ │ ├── Tokens.java │ │ ├── config │ │ ├── GraphConfiguration.java │ │ ├── GraphConfigurationContext.java │ │ └── GraphConfigurationException.java │ │ ├── extension │ │ ├── AbstractRexsterExtension.java │ │ ├── ExtensionAllowed.java │ │ ├── ExtensionApi.java │ │ ├── ExtensionApiBehavior.java │ │ ├── ExtensionConfiguration.java │ │ ├── ExtensionDefinition.java │ │ ├── ExtensionDescriptor.java │ │ ├── ExtensionMethod.java │ │ ├── ExtensionNaming.java │ │ ├── ExtensionPoint.java │ │ ├── ExtensionRequestParameter.java │ │ ├── ExtensionResponse.java │ │ ├── ExtensionSegmentSet.java │ │ ├── HttpMethod.java │ │ ├── RexsterContext.java │ │ └── RexsterExtension.java │ │ ├── gremlin │ │ └── converter │ │ │ └── ResultConverter.java │ │ ├── server │ │ ├── AbstractMapRexsterApplication.java │ │ └── RexsterApplication.java │ │ └── util │ │ ├── ElementHelper.java │ │ ├── HierarchicalConfigurationComparator.java │ │ ├── QueryProperties.java │ │ └── RequestObjectHelper.java │ └── test │ └── java │ └── com │ └── tinkerpop │ └── rexster │ ├── RexsterApplicationGraphTest.java │ ├── extension │ ├── ExtensionAllowedTest.java │ ├── ExtensionConfigurationTest.java │ ├── ExtensionMethodTest.java │ ├── ExtensionResponseTest.java │ └── ExtensionSegmentSetTest.java │ └── util │ ├── ElementHelperTest.java │ └── RequestObjectHelperTest.java ├── rexster-kibbles ├── README.textile ├── batch-kibble │ ├── README.textile │ ├── doc │ │ └── images │ │ │ ├── rexster-batch-logo.graffle │ │ │ └── rexster-batch-logo.png │ ├── pom.xml │ └── src │ │ ├── assembly │ │ ├── distribution.xml │ │ └── standalone.xml │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── tinkerpop │ │ │ │ └── rexster │ │ │ │ └── kibbles │ │ │ │ └── batch │ │ │ │ └── BatchExtension.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.tinkerpop.rexster.extension.RexsterExtension │ │ └── test │ │ └── java │ │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ └── kibbles │ │ └── batch │ │ └── BatchExtensionTest.java ├── frames-kibble │ ├── README.textile │ ├── doc │ │ └── images │ │ │ ├── rexster-frames-logo.graffle │ │ │ └── rexster-frames-logo.png │ ├── pom.xml │ └── src │ │ ├── assembly │ │ ├── distribution.xml │ │ └── standalone.xml │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── tinkerpop │ │ │ │ └── rexster │ │ │ │ └── kibbles │ │ │ │ └── frames │ │ │ │ └── FramesExtension.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.tinkerpop.rexster.extension.RexsterExtension │ │ └── test │ │ └── java │ │ └── com │ │ └── tinkerpop │ │ ├── frames │ │ └── domain │ │ │ ├── classes │ │ │ ├── NamedObject.java │ │ │ ├── Person.java │ │ │ └── Project.java │ │ │ └── incidences │ │ │ ├── Created.java │ │ │ ├── CreatedBy.java │ │ │ └── Knows.java │ │ └── rexster │ │ └── kibbles │ │ └── frames │ │ └── FramesExtensionTest.java ├── pom.xml ├── sample-kibbles │ ├── README.textile │ ├── doc │ │ └── images │ │ │ ├── rexster-sample-logo.graffle │ │ │ └── rexster-sample-logo.png │ ├── pom.xml │ └── src │ │ ├── assembly │ │ ├── distribution.xml │ │ └── standalone.xml │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── tinkerpop │ │ │ │ └── rexster │ │ │ │ └── kibbles │ │ │ │ └── sample │ │ │ │ ├── AbstractSampleExtension.java │ │ │ │ ├── MapConfigurationExtension.java │ │ │ │ ├── MetricExtension.java │ │ │ │ ├── ParametersExtension.java │ │ │ │ ├── PingAddOnExtension.java │ │ │ │ ├── PingExtension.java │ │ │ │ ├── ProducesXmlExtension.java │ │ │ │ ├── SecureExtension.java │ │ │ │ ├── SimplePathExtension.java │ │ │ │ └── SimpleRootExtension.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.tinkerpop.rexster.extension.RexsterExtension │ │ └── test │ │ └── java │ │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ └── kibbles │ │ └── sample │ │ ├── ParametersExtensionTest.java │ │ ├── PingExtensionTest.java │ │ ├── ProducesXmlExtensionTest.java │ │ ├── SimplePathExtensionTest.java │ │ └── SimpleRootExtensionTest.java └── sparql-kibble │ ├── README.textile │ ├── doc │ └── images │ │ ├── rexster-sparql-logo.graffle │ │ └── rexster-sparql-logo.png │ ├── pom.xml │ └── src │ ├── assembly │ ├── distribution.xml │ └── standalone.xml │ ├── main │ ├── java │ │ └── com │ │ │ └── tinkerpop │ │ │ └── rexster │ │ │ └── kibbles │ │ │ └── sparql │ │ │ └── SparqlExtension.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.tinkerpop.rexster.extension.RexsterExtension │ └── test │ └── java │ └── com │ └── tinkerpop │ └── rexster │ └── kibbles │ └── sparql │ └── SparqlExtensionTest.java ├── rexster-protocol ├── README.textile ├── pom.xml └── src │ ├── assembly │ ├── distribution.xml │ └── standalone.xml │ ├── main │ └── java │ │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ ├── client │ │ ├── RemoteRexsterSession.java │ │ ├── RexProClientConnection.java │ │ ├── RexProClientFilter.java │ │ ├── RexProException.java │ │ ├── RexsterClient.java │ │ ├── RexsterClientFactory.java │ │ ├── RexsterClientHandler.java │ │ ├── RexsterClientTokens.java │ │ ├── TryRexProSessioned.java │ │ └── TryRexProSessionless.java │ │ ├── gremlin │ │ └── converter │ │ │ ├── ConsoleResultConverter.java │ │ │ ├── JSONResultConverter.java │ │ │ ├── MsgPackResultConverter.java │ │ │ └── SerializedResultConverter.java │ │ └── protocol │ │ ├── BitWorks.java │ │ ├── EngineConfiguration.java │ │ ├── EngineController.java │ │ ├── EngineHolder.java │ │ ├── RexsterApplicationHolder.java │ │ ├── filter │ │ ├── RexProProcessorFilter.java │ │ └── RexProServerFilter.java │ │ ├── msg │ │ ├── ErrorResponseMessage.java │ │ ├── MessageTokens.java │ │ ├── MessageType.java │ │ ├── MessageUtil.java │ │ ├── RexProBindings.java │ │ ├── RexProMessage.java │ │ ├── RexProMessageMeta.java │ │ ├── RexProMessageMetaField.java │ │ ├── RexProScriptResult.java │ │ ├── ScriptRequestMessage.java │ │ ├── ScriptResponseMessage.java │ │ ├── SessionRequestMessage.java │ │ └── SessionResponseMessage.java │ │ ├── serializer │ │ ├── RexProSerializer.java │ │ ├── json │ │ │ ├── JSONSerializer.java │ │ │ └── templates │ │ │ │ ├── BindingsTemplate.java │ │ │ │ ├── JsonConverter.java │ │ │ │ ├── JsonTemplate.java │ │ │ │ ├── MetaTemplate.java │ │ │ │ └── messages │ │ │ │ ├── ErrorResponseMessageTemplate.java │ │ │ │ ├── RexProMessageTemplate.java │ │ │ │ ├── ScriptRequestMessageTemplate.java │ │ │ │ ├── ScriptResponseMessageTemplate.java │ │ │ │ ├── SessionRequestMessageTemplate.java │ │ │ │ └── SessionResponseMessageTemplate.java │ │ └── msgpack │ │ │ ├── MsgPackSerializer.java │ │ │ └── templates │ │ │ ├── BindingsTemplate.java │ │ │ ├── MetaTemplate.java │ │ │ ├── ResultsConverter.java │ │ │ ├── ResultsTemplate.java │ │ │ └── messages │ │ │ ├── ErrorResponseMessageTemplate.java │ │ │ ├── MsgPackScriptResponseMessageTemplate.java │ │ │ ├── RexProMessageTemplate.java │ │ │ ├── ScriptRequestMessageTemplate.java │ │ │ ├── SessionRequestMessageTemplate.java │ │ │ └── SessionResponseMessageTemplate.java │ │ ├── server │ │ ├── IncompleteRexProRequestException.java │ │ ├── RexProRequest.java │ │ ├── ScriptServer.java │ │ └── SessionServer.java │ │ └── session │ │ ├── AbstractRexProSession.java │ │ ├── RexProSession.java │ │ ├── RexProSessionMonitor.java │ │ └── RexProSessions.java │ └── test │ └── java │ └── com │ └── tinkerpop │ └── rexster │ ├── gremlin │ └── converter │ │ ├── ConsoleResultConverterTest.java │ │ ├── JSONResultConverterTest.java │ │ └── MsgPackResultConverterTest.java │ └── protocol │ ├── BitWorksTest.java │ ├── EngineHolderTest.java │ ├── MsgPackConverterTest.java │ ├── msg │ ├── ErrorResponseMessageTest.java │ ├── MessageUtilTest.java │ ├── RexProMessageMetaFieldTest.java │ ├── ScriptRequestMessageTest.java │ ├── ScriptResponseMessageTest.java │ ├── SessionRequestMessageTest.java │ └── SessionResponseMessageTest.java │ └── serializer │ └── AbstractResultSerializerTest.java └── rexster-server ├── bin ├── rexster.bat └── rexster.sh ├── build.xml ├── config ├── init.groovy └── rexster.xml ├── data ├── graph-example-1.ntriple ├── graph-example-1 │ ├── tinkergraph-metadata.dat │ └── tinkergraph.json ├── graph-example-2 │ ├── tinkergraph-metadata.dat │ └── tinkergraph.json └── sailgraph │ ├── namespaces.dat │ ├── triples-posc.alloc │ ├── triples-posc.dat │ ├── triples-spoc.alloc │ ├── triples-spoc.dat │ ├── triples.prop │ ├── txn-status │ ├── values.dat │ ├── values.hash │ └── values.id ├── pom.xml └── src ├── assembly ├── distribution.xml └── standalone.xml ├── integration ├── java │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ ├── AbstractGraphResourceIntegrationTest.java │ │ ├── AbstractResourceIntegrationTest.java │ │ ├── EdgeResourceIntegrationTest.java │ │ ├── GraphResourceIntegrationTest.java │ │ ├── GraphTestHolder.java │ │ ├── IndexResourceIntegrationTest.java │ │ ├── VertexResourceIntegrationTest.java │ │ └── rexpro │ │ ├── AbstractRexProIntegrationTest.java │ │ ├── AbstractRexsterClientIntegrationTest.java │ │ ├── AbstractScriptRequestIntegrationTest.java │ │ ├── AbstractSessionRequestMessageTest.java │ │ ├── json │ │ ├── RexsterClientIntegrationTest.java │ │ ├── ScriptRequestIntegrationTest.java │ │ └── SessionRequestIntegrationTest.java │ │ └── msgpack │ │ ├── RexsterClientIntegrationTest.java │ │ ├── ScriptRequestIntegrationTest.java │ │ └── SessionRequestIntegrationTest.java └── resources │ └── com │ └── tinkerpop │ └── rexster │ └── rexster-integration-test.xml ├── main ├── bin │ ├── README.txt │ ├── rexster-service.sh │ ├── rexster.bat │ └── rexster.sh ├── ext │ └── README.txt ├── java │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ ├── AbstractSubResource.java │ │ ├── Application.java │ │ ├── BaseResource.java │ │ ├── EdgeResource.java │ │ ├── GraphResource.java │ │ ├── IndexResource.java │ │ ├── KeyIndexResource.java │ │ ├── PrefixResource.java │ │ ├── RexsterMediaType.java │ │ ├── RexsterResource.java │ │ ├── RootResource.java │ │ ├── VertexResource.java │ │ ├── config │ │ ├── AbstractSailGraphConfiguration.java │ │ ├── GraphConfigurationContainer.java │ │ ├── IdGraphConfiguration.java │ │ ├── LinkedDataSailGraphConfiguration.java │ │ ├── MemoryStoreSailGraphConfiguration.java │ │ ├── NativeStoreSailGraphConfiguration.java │ │ ├── Neo4jGraphConfiguration.java │ │ ├── RexsterGraphGraphConfiguration.java │ │ ├── SparkseeGraphConfiguration.java │ │ ├── SparqlRepositorySailGraphConfiguration.java │ │ └── TinkerGraphGraphConfiguration.java │ │ ├── filter │ │ ├── AbstractSecurityFilter.java │ │ ├── CharsetHolder.java │ │ ├── DefaultSecurityFilter.java │ │ └── HeaderResponseFilter.java │ │ ├── gremlin │ │ ├── GremlinEvaluationJob.java │ │ ├── GremlinExtension.java │ │ ├── GremlinFactory.java │ │ ├── GremlinGarbageCollector.java │ │ ├── GremlinSession.java │ │ └── GremlinSessions.java │ │ ├── server │ │ ├── DefaultRexsterApplication.java │ │ ├── GrizzlyIoStrategyFactory.java │ │ ├── HttpRexsterServer.java │ │ ├── RexProRexsterServer.java │ │ ├── RexsterApplicationProvider.java │ │ ├── RexsterCommandLine.java │ │ ├── RexsterProperties.java │ │ ├── RexsterServer.java │ │ ├── RexsterSettings.java │ │ ├── ShutdownManager.java │ │ ├── XmlRexsterApplication.java │ │ └── metrics │ │ │ ├── AbstractHostPortReporterConfig.java │ │ │ ├── AbstractReporterConfig.java │ │ │ ├── ConsoleReporterConfig.java │ │ │ ├── GangliaReporterConfig.java │ │ │ ├── GraphiteReporterConfig.java │ │ │ ├── HostPort.java │ │ │ ├── HttpReporterConfig.java │ │ │ ├── RegexMetricFilter.java │ │ │ └── ReporterConfig.java │ │ ├── servlet │ │ ├── DogHouseServlet.java │ │ ├── EvaluatorServlet.java │ │ └── RexsterStaticHttpHandler.java │ │ └── util │ │ ├── JuliToLog4jHandler.java │ │ ├── LogLevel.java │ │ ├── MockTinkerTransactionalGraph.java │ │ └── StatisticsHelper.java └── resources │ ├── META-INF │ └── services │ │ └── com.tinkerpop.rexster.extension.RexsterExtension │ ├── com │ └── tinkerpop │ │ └── rexster │ │ └── log4j.properties │ └── public │ ├── css │ ├── dot-luv │ │ ├── images │ │ │ ├── ui-bg_diagonals-thick_15_0b3e6f_40x40.png │ │ │ ├── ui-bg_dots-medium_30_0b58a2_4x4.png │ │ │ ├── ui-bg_dots-small_20_333333_2x2.png │ │ │ ├── ui-bg_dots-small_30_a32d00_2x2.png │ │ │ ├── ui-bg_dots-small_40_00498f_2x2.png │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_40_292929_40x100.png │ │ │ ├── ui-bg_gloss-wave_20_111111_500x100.png │ │ │ ├── ui-icons_00498f_256x240.png │ │ │ ├── ui-icons_98d2fb_256x240.png │ │ │ ├── ui-icons_9ccdfc_256x240.png │ │ │ └── ui-icons_ffffff_256x240.png │ │ └── jquery-ui-1.8.7.custom.css │ ├── elastic.css │ ├── elastic.print.css │ └── rexster.css │ ├── favicon.ico │ ├── img │ ├── ajax-loader.gif │ ├── bg.gif │ ├── rexster-corner.png │ ├── rexster-logo.png │ ├── rexster-peek.png │ ├── spinner.gif │ └── tinkerpop-splash.png │ ├── index.html │ ├── javascript │ ├── domReady.js │ ├── lib │ │ ├── dust-full-0.3.0.min.js │ │ ├── elastic-2.0.3.js │ │ ├── has-detect-features.js │ │ ├── has.js │ │ ├── jit-yc.js │ │ ├── jquery-1.4.4.js │ │ ├── jquery-history.js │ │ ├── jquery-jsonviewer.js │ │ ├── jquery-ui-1.8.7.custom.js │ │ ├── jquery-url.js │ │ ├── json2.js │ │ └── underscore.js │ ├── main.js │ ├── order.js │ ├── require-jquery.js │ ├── rexster.js │ └── rexster │ │ ├── ajax.js │ │ ├── graph-viz.js │ │ ├── history.js │ │ ├── server.js │ │ ├── template │ │ └── template.js │ │ └── ui │ │ ├── element-toolbar.js │ │ ├── graph.js │ │ ├── info.js │ │ ├── main-menu.js │ │ └── terminal.js │ └── main.html ├── performance ├── java │ └── com │ │ └── tinkerpop │ │ └── rexster │ │ ├── AbstractRexsterPerformanceTest.java │ │ ├── ScenarioGremlinAdditionTest.java │ │ ├── ScenarioGremlinTraverseTest.java │ │ ├── ScenarioReadManyEdgesTest.java │ │ ├── ScenarioReadManyVerticesTest.java │ │ └── ScenarioWriteManyVerticesTest.java └── resources │ └── com │ └── tinkerpop │ └── rexster │ └── rexster-performance-test.xml └── test └── java └── com └── tinkerpop └── rexster ├── AbstractSubResourceTest.java ├── BaseResourceTest.java ├── BaseTest.java ├── EdgeResourceTest.java ├── GraphResourceTest.java ├── IndexResourceTest.java ├── KeyIndexResourceTest.java ├── MockEdge.java ├── MockIndex.java ├── MockVertex.java ├── PrefixResourceTest.java ├── ResourceHolder.java ├── RexsterResourceTest.java ├── VertexResourceTest.java ├── config ├── AbstractSailGraphConfigurationTest.java ├── GraphConfigurationContainerTest.java ├── IdGraphConfigurationTest.java ├── MockBadGraphConfiguration.java ├── MockGraphConfiguration.java ├── MockIndexableGraphConfiguration.java ├── MockSailGraphConfiguration.java ├── Neo4jGraphConfigurationTest.java ├── SparkseeGraphConfigurationTest.java └── TinkerGraphGraphConfigurationTest.java ├── filter └── CharsetHolderTest.java ├── gremlin └── GremlinExtensionTest.java └── server ├── DefaultRexsterApplicationTest.java ├── RexsterSettingsTest.java ├── RexsterXmlData.java ├── XmlRexsterApplicationTest.java └── metrics └── RegexMetricFilterTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | /target 3 | /data 4 | /rexster-server/release 5 | /rexster-server/target 6 | /rexster-kibbles/target 7 | /rexster-kibbles/*/target 8 | /rexster-core/target 9 | /rexster-console/target 10 | /rexster-protocol/target 11 | /bin 12 | # eclipse project files and local rexster.xml 13 | *.classpath 14 | *.project 15 | .idea/ 16 | *.iml 17 | .rexster_history 18 | *.prefs 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | install: mvn install -DskipTests=true 3 | jdk: 4 | - oraclejdk7 5 | - openjdk7 6 | - openjdk6 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-Infinity, TinkerPop [http://tinkerpop.com] 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the TinkerPop nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL TINKERPOP BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | 3 | 4 | 5 | *IMPORTANT* - TinkerPop is now a part of the Apache Software Foundation and "TinkerPop 3.x":http://tinkerpop.apache.org/ is the latest incarnation of The TinkerPop. This project is TinkerPop 2.x and is no longer active. 6 | 7 | Rexster is a graph server that exposes any "Blueprints":http://blueprints.tinkerpop.com graph through HTTP/REST and a binary protocol called "RexPro":https://github.com/tinkerpop/rexster/wiki/RexPro. "Extensions":https://github.com/tinkerpop/rexster/wiki/Extensions support standard traversal goals such as search, score, rank, and, in concert, recommendation. Rexster makes extensive use of "Blueprints":http://blueprints.tinkerpop.com, "Pipes":http://pipes.tinkerpop.com, and "Gremlin":http://gremlin.tinkerpop.com. In this way its possible to run Rexster over various graph systems including: 8 | 9 | * "TinkerGraph":http://wiki.github.com/tinkerpop/gremlin/tinkergraph in-memory graph 10 | * "Neo4j":http://neo4j.org/ graph database 11 | * "OrientDB":http://www.orientechnologies.com/ graph database 12 | * "Sparksee":http://www.sparsity-technologies.com/#sparksee graph database 13 | * "Titan":http://thinkaurelius.github.com/titan/ graph database 14 | * "Sesame 2.0":http://www.openrdf.org compliant RDF stores 15 | * Many "third-party":https://github.com/tinkerpop/blueprints/wiki Blueprints implementations 16 | 17 | Rexster provides a browser-based user interface known as "The Dog House":https://github.com/tinkerpop/rexster/wiki/The-Dog-House. This interface allows for viewing vertices, edges, and their related properties. A web-based console for executing "Gremlin":http://gremlin.tinkerpop.com scripts is provided along with a "Rexster Console":https://github.com/tinkerpop/rexster/wiki/Rexster-Console which allows remote evaluation of scripts within the Rexster Server context. 18 | 19 | The documentation for Rexster can be found at this "location":http://rexster.tinkerpop.com. Finally, please visit "TinkerPop":http://tinkerpop.com for other software products. 20 | -------------------------------------------------------------------------------- /doc/Acknowledgments.textile: -------------------------------------------------------------------------------- 1 | 2 | 3 | This section provides a list of the people that have contributed in some way to the creation of Rexster. 4 | 5 | # "Stephen Mallette":http://stephen.genoprime.com -- designed, developed, tested, and documented Rexster. 6 | # "Marko A. Rodriguez":http://markorodriguez.com -- designed, developed, tested, and documented Rexster. 7 | # "Peter Neubauer":http://www.linkedin.com/in/neubauer -- aided in the evangelizing and conceptualizing of Rexster. 8 | # "Pierre De Wilde":http://www.linkedin.com/in/pierredewilde -- designed and tested new features. 9 | # "Blake Eggleston":https://github.com/bdeggleston -- aided in the design and development of [[RexPro]]. 10 | # "Ketrina Yim":http://www.ketrinayim.com/ -- designed the Rexster logo. 11 | 12 | Please review Rexster's "pom.xml":http://github.com/tinkerpop/rexster/blob/master/pom.xml. Rexster would not be possible without the work done by others to create these useful packages. -------------------------------------------------------------------------------- /doc/Downloads.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | [[Release Notes]] for all versions 3 | ==
== 4 | 5 | * *Rexster 2.x* 6 | ** Rexster 2.4.0 7 | *** "Rexster 2.4.0 Server":http://tinkerpop.com/downloads/rexster/rexster-server-2.4.0.zip 8 | *** "Rexster 2.4.0 Console":http://tinkerpop.com/downloads/rexster/rexster-console-2.4.0.zip 9 | ** Rexster 2.3.0 10 | *** "Rexster 2.3.0 Server":http://tinkerpop.com/downloads/rexster/rexster-server-2.3.0.zip 11 | *** "Rexster 2.3.0 Console":http://tinkerpop.com/downloads/rexster/rexster-console-2.3.0.zip 12 | ** Rexster 2.2.0 13 | *** "Rexster 2.2.0 Server":http://tinkerpop.com/downloads/rexster/rexster-server-2.2.0.zip 14 | *** "Rexster 2.2.0 Console":http://tinkerpop.com/downloads/rexster/rexster-console-2.2.0.zip 15 | ** Rexster 2.1.0 16 | *** "Rexster 2.1.0 Server":http://tinkerpop.com/downloads/rexster/rexster-server-2.1.0.zip 17 | *** "Rexster 2.1.0 Console":http://tinkerpop.com/downloads/rexster/rexster-console-2.1.0.zip 18 | ** "Rexster 2.0.0":http://tinkerpop.com/downloads/rexster/rexster-server-2.0.0.zip 19 | 20 | * *Rexster 0.x* 21 | ** "Rexster 0.8":http://tinkerpop.com/downloads/rexster/rexster-0.8.zip 22 | ** "Rexster 0.7":http://tinkerpop.com/downloads/rexster/rexster-0.7.zip 23 | ** "Rexster 0.6":http://tinkerpop.com/downloads/rexster/rexster-0.6.zip 24 | ** "Rexster 0.5":http://tinkerpop.com/downloads/rexster/rexster-0.5.zip 25 | ** "Rexster 0.4.1":http://tinkerpop.com/downloads/rexster/rexster-0.4.1.zip 26 | ** "Rexster 0.4":http://tinkerpop.com/downloads/rexster/rexster-0.4.zip 27 | ** "Rexster 0.3":http://tinkerpop.com/downloads/rexster/rexster-0.3.zip 28 | ** "Rexster 0.2":http://tinkerpop.com/downloads/rexster/rexster-0.2.zip 29 | ** "Rexster 0.1.5":http://tinkerpop.com/downloads/rexster/rexster-0.1.5.zip 30 | ** "Rexster 0.1":http://tinkerpop.com/downloads/rexster/rexster-0.1.zip -------------------------------------------------------------------------------- /doc/Extension-Annotations.textile: -------------------------------------------------------------------------------- 1 | [[http://www.wpclipart.com/animals/dogs/cartoon_dogs/cartoon_dogs_6/cartoon_dog_T.png|width=100px]] 2 | 3 | Extensions are identified by implementing the @RexsterExtension@ interface and are defined and exposed through Rexster by way of the @Annotations@ assigned to the extension class and its methods. 4 | 5 | |_. annotation |_. arguments |_. applies to |_. description | 6 | | @@ExtensionNaming@ | @namespace@, @name@ | class | defines the namespace and identifying extension name | 7 | | @@ExtensionDescriptor@ | @description@, @api@, @apiBehavior@ | method | meta-data exposed through REST | 8 | | @@ExtensionApi@ | @parameterName@, @description@ | @ExtensionDescriptor.api@ | defines the parameters of the extension | 9 | | @@ExtensionDefinition@ | @extensionPoint@, @path@, @tryIncludeRexsterAttributes@, @produces@, @method@, @autoCommitTransaction@ | method | defines how the extension is exposed in the REST API | 10 | | @@RexsterContext@ | | parameter | Rexster will try to inject variables from its context into method parameters | 11 | | @@ExtensionRequestParameter@ | @name@, @description@, @defaultValue@, @parseToJson@ | parameter | Rexster will try to inject the value of the @name@ from the request parameters | 12 | 13 | 14 | -------------------------------------------------------------------------------- /doc/Extensions-and-Gremlin.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/gremlin/raw/master/doc/images/gremlin-logo.png! 2 | 3 | Its possible to write "Gremlin":http://gremlin.tinkerpop.com based extensions. To do so, you will need to make sure to make use of "GMaven":http://docs.codehaus.org/display/GMAVEN/Home in your @pom.xml@. For example: 4 | 5 | ```xml 6 | 7 | org.codehaus.gmaven 8 | gmaven-plugin 9 | 1.3 10 | 11 | 12 | 13 | generateStubs 14 | compile 15 | generateTestStubs 16 | testCompile 17 | 18 | 19 | 1.7 20 | 21 | 22 | 23 | 24 | ``` 25 | 26 | Next you can then create a Gremlin-based extension. 27 | 28 | ```java 29 | @ExtensionNaming(namespace = "ex", name = "gremlinExample") 30 | public class GremlinBasedExtension extends AbstractRexsterExtension { 31 | 32 | static { 33 | Gremlin.load(); 34 | } 35 | 36 | @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX) 37 | @ExtensionDescriptor(description = "Traversal with native Gremlin") 38 | public ExtensionResponse evaluate(@RexsterContext RexsterResourceContext context, 39 | @RexsterContext Vertex v) { 40 | 41 | JSONObject results = new JSONObject(); 42 | results.put("foaf count", v.out('knows').out('knows').count()) 43 | return ExtensionResponse.ok(results); 44 | } 45 | } 46 | ``` 47 | 48 | *NOTE* Like all extensions, don't forget to add the extension's full class name to your 49 | 50 | ```text 51 | src/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension 52 | ``` 53 | 54 | Please see [[Deploying an Extension]] for more details 55 | -------------------------------------------------------------------------------- /doc/Extensions.textile: -------------------------------------------------------------------------------- 1 | [[http://www.wpclipart.com/animals/dogs/cartoon_dogs/cartoon_dogs_6/cartoon_dog_T.png|width=100px]] 2 | 3 | Extensions provide for a way to plug-in new functions to existing Rexster resources (specifically, graphs, vertices and edges) allowing for support of standard traversal goals such as search, score, rank, and, in concert, recommendation. 4 | 5 | Rexster is packaged with the [[Gremlin Extension]] which allows users to execute ad-hoc computations on the graph backend. [[Rexster Kibbles]] contains additional extensions that can easily plug-in to Rexster. 6 | 7 | Extensions are identified by implementing the @RexsterExtension@ interface and are defined using a series of @Annotations@ (see [[Extension Annotations]]) which instruct Rexster how to expose it through the REST API. The @Annotations@ are applied to to any class and method to be exposed through the REST API. These @Annotations@ allow for the definition of meta-data, such as extension description and API documentation, the @ExtensionPoint@, which refers to the Rexster resource the extension applies to, namespacing, and the injection of Rexster context into an extension method. 8 | 9 | Methods marked for extension must return an @ExtensionResponse@ which is a wrapper for a a standard "Jersey":http://jersey.java.net/ @Response@ object. The @ExtensionResponse@ has a series of helper methods for building its own instances so that the underlying details of Jersey are hidden from view. At the same time, the option to build-you-own Jersey @Response@ object remains open for complete flexibility. 10 | 11 | Extensions are configured per graph in "rexster.xml":https://github.com/tinkerpop/rexster/blob/master/rexster-server/rexster.xml. This means that different extensions can be applied to different graphs. Furthermore, each graph extension may be given a different configuration (to the extent that the extension allows for configuration, at least). 12 | -------------------------------------------------------------------------------- /doc/Mapping-a-URI-to-JSON.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/json-logo.png! 2 | 3 | Up to this point, it has been assumed that a parametrized URI is the input to a traversal. While this is true, the URI is actually converted into a JSON object and that serves as the primary object by which the traversal code can retrieve its parameters from. The mapping between a URI and JSON is described using an example (as taken from the Parameters Sample [[Kibble|Rexster Kibbles]]). 4 | 5 | ```text 6 | http://localhost:8182/graphs/tp-sample/parameters?a=1&b.a=marko&b.b=true&b.c.a=peter&c=[marko,povel] 7 | ``` 8 | 9 | ```javascript 10 | { 11 | "a" : "1", 12 | "b" : { 13 | "a" : "marko", 14 | "b" : "true", 15 | "c" : { 16 | "a" : "peter" 17 | } 18 | } 19 | "c" : ["marko","povel"] 20 | } 21 | ``` 22 | 23 | *Note* - Data types in the URI can be encoded using [[Property Data Types]]. 24 | 25 | There are two JSON documents used during a Rexster query: 26 | 27 | # @requestObject@ (input) is generated from the query parameter component of the URI request. 28 | # @responseObject@ (output) is provided by extension the results of the evaluation. 29 | 30 | Rexster provides support for parsing and constructing the @requestObject@ and @responseObject@, respectively. 31 | 32 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/json-in-out.png! -------------------------------------------------------------------------------- /doc/Rexster-Kibbles.textile: -------------------------------------------------------------------------------- 1 | [[https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-kibbles-logo.png]] 2 | 3 | Rexster Kibbles is a collection of general-purpose [[extensions|Extensions]] for "Rexster":http://rexster.tinkerpop.com. Each "kibble" is its own self-contained project in the repository. To install a kibble: 4 | 5 | # Download the Kibble @jar@ (or build the project) 6 | # Drop the @jar@ into the @ext/@ directory of Rexster 7 | # Start (or restart) the server. 8 | 9 | See also [[Deploying an Extension]] for information on configuration of @rexster.xml@. 10 | 11 | h1. The Kibbles 12 | 13 | * "Sample Kibbles":https://github.com/tinkerpop/rexster/tree/master/rexster-kibbles/sample-kibbles - a few well documented extension samples that should help those who want to get started extending Rexster 14 | * "Frames Kibble":https://github.com/tinkerpop/rexster/tree/master/rexster-kibbles/frames-kibble - expose graph elements through a _frame_ in the REST API 15 | * "SPARQL Kibble":https://github.com/tinkerpop/rexster/tree/master/rexster-kibbles/sparql-kibble - execute SPARQL queries on a graph. 16 | * "Batch Kibble":https://github.com/tinkerpop/rexster/tree/master/rexster-kibbles/batch-kibble - execute a series of operations in a batch/transaction. 17 | * more to come! 18 | 19 | Documentation on usage and configuration for individual Kibbles can be found in each Kibble's respective @README.textile@. -------------------------------------------------------------------------------- /doc/The-Benefits-of-Rexster.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | 3 | Before diving into Rexster, its good to know what Rexster was designed for and what potential use it can serve. The following itemization provides a collection of reasons for using Rexster. 4 | 5 | * Rexster allows developers to communicate with "Blueprints-enabled":http://blueprints.tinkerpop.com graphs in a language agnostic fashion. Blueprints is a Java API for graph databases. By using Rexster, the Blueprints API is exposed over HTTP/REST. 6 | * Rexster allows any Blueprints-enabled graph to exist as a standalone server. Thus, multiple clients communicate with the same graph database through Rexster. 7 | * Rexster provides ad-hoc queries through the graph traversal language "Gremlin":http://gremlin.tinkerpop.com. 8 | * Rexster is extensible given the power of [[Extensions]] providing developer friendly classes that support common graph use cases such as searching, ranking, and recommendation. 9 | * The Rexster community provides a set of BSD-licensed extensions through the [[Rexster Kibbles]]. -------------------------------------------------------------------------------- /doc/images/dog-on-leash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/dog-on-leash.png -------------------------------------------------------------------------------- /doc/images/dog-reading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/dog-reading.png -------------------------------------------------------------------------------- /doc/images/ganglia-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/ganglia-logo.jpg -------------------------------------------------------------------------------- /doc/images/graphite-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/graphite-logo.png -------------------------------------------------------------------------------- /doc/images/grateful-dataset.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/grateful-dataset.graffle -------------------------------------------------------------------------------- /doc/images/grateful-dataset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/grateful-dataset.png -------------------------------------------------------------------------------- /doc/images/json-in-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/json-in-out.png -------------------------------------------------------------------------------- /doc/images/json-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/json-logo.png -------------------------------------------------------------------------------- /doc/images/metrics-hat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/metrics-hat.png -------------------------------------------------------------------------------- /doc/images/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/minus.png -------------------------------------------------------------------------------- /doc/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/plus.png -------------------------------------------------------------------------------- /doc/images/rexpro-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexpro-logo.png -------------------------------------------------------------------------------- /doc/images/rexster-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-2.png -------------------------------------------------------------------------------- /doc/images/rexster-brian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-brian.png -------------------------------------------------------------------------------- /doc/images/rexster-character-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-character-1.png -------------------------------------------------------------------------------- /doc/images/rexster-character-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-character-2.png -------------------------------------------------------------------------------- /doc/images/rexster-character-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-character-3.png -------------------------------------------------------------------------------- /doc/images/rexster-dalmatian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dalmatian.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-browse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-browse.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-extension-expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-extension-expanded.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-extension-launched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-extension-launched.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-extension-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-extension-list.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-gremlin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-gremlin.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-index.png -------------------------------------------------------------------------------- /doc/images/rexster-dog-house-viz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dog-house-viz.png -------------------------------------------------------------------------------- /doc/images/rexster-dogeatdog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dogeatdog.png -------------------------------------------------------------------------------- /doc/images/rexster-doghouse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-doghouse.png -------------------------------------------------------------------------------- /doc/images/rexster-dogstar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-dogstar.png -------------------------------------------------------------------------------- /doc/images/rexster-fluffy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-fluffy.png -------------------------------------------------------------------------------- /doc/images/rexster-ganglia-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-ganglia-1.png -------------------------------------------------------------------------------- /doc/images/rexster-ganglia-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-ganglia-2.png -------------------------------------------------------------------------------- /doc/images/rexster-graphite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-graphite.png -------------------------------------------------------------------------------- /doc/images/rexster-jmx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-jmx.png -------------------------------------------------------------------------------- /doc/images/rexster-kibbles-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-kibbles-logo.png -------------------------------------------------------------------------------- /doc/images/rexster-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-logo.png -------------------------------------------------------------------------------- /doc/images/rexster-mcgruff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-mcgruff.png -------------------------------------------------------------------------------- /doc/images/rexster-metrics-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-metrics-logo.png -------------------------------------------------------------------------------- /doc/images/rexster-santas-little-helper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-santas-little-helper.png -------------------------------------------------------------------------------- /doc/images/rexster-system-arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/rexster-system-arch.png -------------------------------------------------------------------------------- /doc/images/tinkerpop-splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/tinkerpop-splash.png -------------------------------------------------------------------------------- /doc/images/visualvm-jmx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/doc/images/visualvm-jmx.png -------------------------------------------------------------------------------- /rexster-console/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | 3 | Rexster Console is a remote REPL for "Rexster":http://rexster.tinkerpop.com. 4 | 5 | The documentation for Rexster Console can be found at this "location":https://github.com/tinkerpop/rexster/wiki/Rexster-Console. Finally, please visit "TinkerPop":http://tinkerpop.com for other software products. -------------------------------------------------------------------------------- /rexster-console/bin/rexster-console.bat: -------------------------------------------------------------------------------- 1 | :: Windows launcher script for Rexster Console 2 | @echo off 3 | 4 | cd %CD%\..\target\ 5 | 6 | set TARGET= 7 | 8 | for /f "tokens=*" %%a in ('dir /b /ad') do ( 9 | if exist "%%a\bin\rexster-console.bat" set TARGET=%%a 10 | ) 11 | 12 | cd %TARGET%\bin\ 13 | call rexster-console.bat %* -------------------------------------------------------------------------------- /rexster-console/bin/rexster-console.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "$0" )" && pwd )" 4 | 5 | $DIR/../target/rexster-console-*-standalone/bin/rexster-console.sh $@ 6 | -------------------------------------------------------------------------------- /rexster-console/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | 9 | 0775 10 | target/${project.artifactId}-${project.version}-standalone/bin 11 | bin 12 | 13 | *.sh 14 | *.bat 15 | 16 | 17 | 18 | ../doc 19 | 20 | 21 | src 22 | 23 | 24 | target/${project.artifactId}-${project.version}-standalone/lib 25 | lib 26 | 27 | 28 | 29 | 30 | pom.xml 31 | src 32 | 33 | 34 | ../LICENSE.txt 35 | / 36 | 37 | 38 | src/main/bin/README.txt 39 | / 40 | 41 | 42 | -------------------------------------------------------------------------------- /rexster-console/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | dir 5 | 6 | false 7 | 8 | 9 | 10 | src/main/bin 11 | /bin 12 | 0755 13 | 14 | 15 | target/*.jar 16 | /lib 17 | 18 | 19 | 20 | 21 | 22 | /lib 23 | false 24 | compile 25 | 26 | 27 | /lib 28 | false 29 | provided 30 | 31 | 32 | -------------------------------------------------------------------------------- /rexster-console/src/main/bin/README.txt: -------------------------------------------------------------------------------- 1 | -= Rexster Console: A remote REPL for Rexster =- 2 | 3 | Script evaluation within Rexster Console occurs remotely on a Rexster server. 4 | Rexster Console communicates with any Gremlin-flavored JSR223 compliant ScriptEngine hosted within the Rexster server. 5 | Rexster Console provides access to configured graphs within Rexster server. 6 | 7 | -------------------------------------------------------------------------------- /rexster-console/src/main/bin/rexster-console.bat: -------------------------------------------------------------------------------- 1 | :: Windows launcher script for Rexster Console 2 | @echo off 3 | 4 | set work=%CD% 5 | 6 | if [%work:~-3%]==[bin] cd .. 7 | 8 | set LIBDIR=lib 9 | 10 | set JAVA_OPTIONS=-Xms32m -Xmx512m 11 | 12 | :: Launch the application 13 | java %JAVA_OPTIONS% %JAVA_ARGS% -cp %LIBDIR%/*; com.tinkerpop.rexster.console.RexsterConsole %* -------------------------------------------------------------------------------- /rexster-console/src/main/bin/rexster-console.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # From: http://stackoverflow.com/a/246128 4 | # - To resolve finding the directory after symlinks 5 | SOURCE="${BASH_SOURCE[0]}" 6 | while [ -h "$SOURCE" ]; do 7 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 8 | SOURCE="$(readlink "$SOURCE")" 9 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 10 | done 11 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 12 | 13 | CP=$( echo $DIR/../lib/*.jar . | sed 's/ /:/g') 14 | CP=$CP:$( echo $DIR/../ext/*.jar . | sed 's/ /:/g') 15 | #echo $CP 16 | 17 | # Find Java 18 | if [ "$JAVA_HOME" = "" ] ; then 19 | JAVA="java -server" 20 | else 21 | JAVA="$JAVA_HOME/bin/java -server" 22 | fi 23 | 24 | # Set Java options 25 | if [ "$JAVA_OPTIONS" = "" ] ; then 26 | JAVA_OPTIONS="-Xms32m -Xmx512m" 27 | fi 28 | 29 | # Execute the application and return its exit code 30 | exec $JAVA $JAVA_OPTIONS -cp $CP com.tinkerpop.rexster.console.RexsterConsole $@ 31 | -------------------------------------------------------------------------------- /rexster-console/src/main/java/com/tinkerpop/rexster/console/ResultAndBindings.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.console; 2 | 3 | import java.util.List; 4 | 5 | public class ResultAndBindings { 6 | private Object result; 7 | private List bindings; 8 | 9 | public ResultAndBindings(final Object result, final List bindings) { 10 | this.result = result; 11 | this.bindings = bindings; 12 | } 13 | 14 | public Object getResult() { 15 | return result; 16 | } 17 | 18 | public List getBindings() { 19 | return bindings; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rexster-core/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | 3 | Rexster Core provides the building blocks utilized in the extension of Rexster. These components include classes for creating: 4 | 5 | * "Extensions":https://github.com/tinkerpop/rexster/wiki/Extensions 6 | * Graph Configurations 7 | 8 | The documentation for Rexster can be found at this "location":http://rexster.tinkerpop.com. Finally, please visit "TinkerPop":http://tinkerpop.com for other software products. -------------------------------------------------------------------------------- /rexster-core/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | doc/javadoc 13 | 14 | 15 | target 16 | 17 | rexster-core-*.jar 18 | 19 | 20 | 21 | 22 | 23 | pom.xml 24 | src 25 | 26 | 27 | ../LICENSE.txt 28 | / 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /rexster-core/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/config/GraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | 5 | /** 6 | * The GraphConfiguration interface is used to take a Configuration object from rexster.xml and from that 7 | * generate a new Graph instance. 8 | *

9 | * This interface can be used to construct new Graph configuration types for Rexster for other Blueprints 10 | * implementations not yet supported by Rexster (i.e. Infinite Graph). 11 | * 12 | * @author Stephen Mallette (http://stephen.genoprime.com) 13 | */ 14 | public interface GraphConfiguration { 15 | Graph configureGraphInstance(GraphConfigurationContext context) throws GraphConfigurationException; 16 | } 17 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/config/GraphConfigurationContext.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.rexster.RexsterApplicationGraph; 4 | import org.apache.commons.configuration.Configuration; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * A helper object which contains properties and references for a GraphConfiguration. 10 | * 11 | * @author Joshua Shinavier (http://fortytwo.net) 12 | */ 13 | public class GraphConfigurationContext { 14 | private final Configuration properties; 15 | private final Map graphs; 16 | 17 | public GraphConfigurationContext(final Configuration properties, 18 | final Map graphs) { 19 | this.properties = properties; 20 | this.graphs = graphs; 21 | } 22 | 23 | /** 24 | * @return the configuration properties for the graph under construction 25 | */ 26 | public Configuration getProperties() { 27 | return properties; 28 | } 29 | 30 | /** 31 | * @return a map of references, by name, to all graphs constructed up to this point. 32 | * This allows the graph under construction to build upon other graphs. 33 | */ 34 | public Map getGraphs() { 35 | return graphs; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/config/GraphConfigurationException.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | /** 4 | * Exception thrown when an error occurs while configuring a Graph in a GraphConfiguration implementation. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public class GraphConfigurationException extends Exception { 9 | 10 | public GraphConfigurationException(String msg) { 11 | super(msg); 12 | } 13 | 14 | public GraphConfigurationException(Throwable inner) { 15 | super(inner); 16 | } 17 | 18 | public GraphConfigurationException(String msg, Throwable inner) { 19 | super(msg, inner); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/AbstractRexsterExtension.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import com.tinkerpop.rexster.Tokens; 4 | import org.codehaus.jettison.json.JSONObject; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * Base class for extensions. Consider using this class a starting point for extension creation. 11 | * 12 | * @author Stephen Mallette (http://stephen.genoprime.com) 13 | */ 14 | public abstract class AbstractRexsterExtension implements RexsterExtension { 15 | 16 | /** 17 | * By default this returns true. Overriding classes should evaluate the configuration to determine 18 | * if it is correct. 19 | */ 20 | public boolean isConfigurationValid(ExtensionConfiguration extensionConfiguration) { 21 | return true; 22 | } 23 | 24 | protected JSONObject generateErrorJson() { 25 | return this.generateErrorJson(null); 26 | } 27 | 28 | /** 29 | * Generates a standard JSON object with error information. 30 | * 31 | * @param api Adds an API element to the error output. If null the key will not be added. 32 | */ 33 | protected JSONObject generateErrorJson(JSONObject api) { 34 | Map map = new HashMap(); 35 | map.put(Tokens.SUCCESS, false); 36 | 37 | if (api != null) { 38 | map.put(Tokens.API, api); 39 | } 40 | 41 | return new JSONObject(map); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionAllowed.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | /** 4 | * Holds namespaces that define which extensions are allowed for a specific graph. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public class ExtensionAllowed { 9 | private final String namespace; 10 | 11 | /** 12 | * Initializes a new ExtensionAllowed object as taken from rexster.xml. 13 | * The namespace may be wildcarded to be one of the follows: *:*, namespace:*, namespace:extension 14 | */ 15 | public ExtensionAllowed(final String namespace) { 16 | // must match this format *:*, namespace:*, namespace:extension 17 | if (namespace == null || (!(namespace.matches("([\\w-]+|\\*):([\\w-]+|\\*)") 18 | && !(namespace.startsWith("*") && namespace.equals("*.*"))))) { 19 | throw new IllegalArgumentException("The namespace must match the format of *:*, namespace:*, namespace:extension"); 20 | } 21 | 22 | this.namespace = namespace; 23 | } 24 | 25 | /** 26 | * Determines if the namespace and extension are allowed given the configuration of the graph in rexster.xml. 27 | */ 28 | public boolean isExtensionAllowed(final ExtensionSegmentSet extensionSegmentSet) { 29 | boolean allowed = false; 30 | 31 | if (this.namespace.equals("*:*")) { 32 | allowed = true; 33 | } else if (this.namespace.equals(extensionSegmentSet.getNamespace() + ":*")) { 34 | allowed = true; 35 | } else if (this.namespace.equals(extensionSegmentSet.getNamespace() + ":" + extensionSegmentSet.getExtension())) { 36 | allowed = true; 37 | } 38 | 39 | return allowed; 40 | } 41 | 42 | @Override 43 | public boolean equals(Object o) { 44 | if (this == o) return true; 45 | if (o == null || getClass() != o.getClass()) return false; 46 | 47 | final ExtensionAllowed that = (ExtensionAllowed) o; 48 | 49 | if (!namespace.equals(that.namespace)) return false; 50 | 51 | return true; 52 | } 53 | 54 | @Override 55 | public int hashCode() { 56 | return namespace.hashCode(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionApi.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | /** 7 | * Represents one parameter in the API of the extension. 8 | * 9 | * @author Stephen Mallette (http://stephen.genoprime.com) 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | public @interface ExtensionApi { 13 | String parameterName(); 14 | 15 | String description() default ""; 16 | } 17 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionApiBehavior.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | /** 4 | * Defines how the extension API information should be generated. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public enum ExtensionApiBehavior { 9 | /** 10 | * Generates the API from the ExtensionDescriptor on the method only. 11 | */ 12 | EXTENSION_DESCRIPTOR_ONLY, 13 | 14 | /** 15 | * Generates the API from the ExtensionRequestParameter for each parameter in the method only. 16 | */ 17 | EXTENSION_PARAMETER_ONLY, 18 | 19 | /** 20 | * Generates the API from both the ExtensionDescriptor and ExtensionRequestParameters annotations, 21 | * where the ExtensionRequestParameters override keys presented by the ExtensionDescriptor. 22 | */ 23 | DEFAULT 24 | } 25 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionDefinition.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Defines an extension method to rexster. Extensions may be applied to one of three 10 | * extension points: graph, vertex and edge. This basically means that extensions can 11 | * hang from any one of these resources in rexster. 12 | * 13 | * @author Stephen Mallette (http://stephen.genoprime.com) 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(ElementType.METHOD) 17 | public @interface ExtensionDefinition { 18 | 19 | /** 20 | * Defines the resource from which this extension is applied. 21 | */ 22 | ExtensionPoint extensionPoint(); 23 | 24 | /** 25 | * Defines the path to the method extension. 26 | */ 27 | String path() default ""; 28 | 29 | /** 30 | * If the ExtensionDefinition is configured to produce JSON, setting this value to true 31 | * will try to insert the Rexster version and query time attributes. 32 | */ 33 | boolean tryIncludeRexsterAttributes() default true; 34 | 35 | // don't clean up namespace http://stackoverflow.com/questions/1425088/incompatible-types-found-required-default-enums-in-annotations 36 | 37 | /** 38 | * The HTTP method that the extension method will support. By default this is set to ANY which means any 39 | * request will be passed through to the extension. 40 | */ 41 | HttpMethod method() default com.tinkerpop.rexster.extension.HttpMethod.ANY; 42 | 43 | /** 44 | * Specifies the media type to be returned by the extension. By default this value 45 | * is application/json. 46 | */ 47 | String produces() default javax.ws.rs.core.MediaType.APPLICATION_JSON; 48 | 49 | /** 50 | * When set to true, the transaction will commit with success or failure when the extension completes. 51 | * Untrapped errors will always commit with failure. 52 | */ 53 | boolean autoCommitTransaction() default true; 54 | } 55 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionDescriptor.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The descriptor for the extension used for self-documentation and hypermedia. 10 | * 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target({ElementType.METHOD}) 15 | public @interface ExtensionDescriptor { 16 | String description(); 17 | 18 | ExtensionApi[] api() default {}; 19 | 20 | // don't clean up namespace http://stackoverflow.com/questions/1425088/incompatible-types-found-required-default-enums-in-annotations 21 | ExtensionApiBehavior apiBehavior() default com.tinkerpop.rexster.extension.ExtensionApiBehavior.DEFAULT; 22 | } 23 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionNaming.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Provides for a namespace and extension name which is applied at a class level. Extensions 10 | * are then exposed on specific graphs by their namespace and name via rexster.xml configuration. 11 | * 12 | * @author Stephen Mallette (http://stephen.genoprime.com) 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target(ElementType.TYPE) 16 | public @interface ExtensionNaming { 17 | String name() default ""; 18 | 19 | String namespace() default "g"; 20 | } 21 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionPoint.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public enum ExtensionPoint { 7 | GRAPH, 8 | VERTEX, 9 | EDGE 10 | } 11 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/ExtensionRequestParameter.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Tries to extract a value from the request to inject into the extension. 10 | * 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target({ElementType.PARAMETER}) 15 | public @interface ExtensionRequestParameter { 16 | String name(); 17 | 18 | String description() default ""; 19 | 20 | /** 21 | * This value can only be set to primitive/string values. Values are set as a string, but 22 | * will be coerced to the type connected to this annotation. Even though this is an array 23 | * it is treated as a single value so that it can be evaluated to null. Only the first value 24 | * is used if more than one is specified. 25 | */ 26 | String[] defaultValue() default {}; 27 | 28 | boolean parseToJson() default true; 29 | } 30 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | /** 4 | * The HTTP Method. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public enum HttpMethod { 9 | POST, 10 | GET, 11 | DELETE, 12 | OPTIONS, 13 | HEAD, 14 | PUT, 15 | ANY 16 | } 17 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/RexsterContext.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marks a parameter on an extension method as one that should receive attention from Rexster by 10 | * plugging in values that match the expected types from the request. This annotation can be 11 | * applied to these types: edge/vertex/graph (dependent on the ExtensionPoint), 12 | * and RexsterResourceContext. 13 | * 14 | * @author Stephen Mallette (http://stephen.genoprime.com) 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.PARAMETER) 18 | public @interface RexsterContext { 19 | } 20 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/extension/RexsterExtension.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.extension; 2 | 3 | /** 4 | * Marks a class as one that can be used as an extension to Rexster. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public interface RexsterExtension { 9 | 10 | /** 11 | * Determines if the configuration for the extension is valid. 12 | * 13 | * @return True if the configuration is valid and false otherwise. 14 | */ 15 | public boolean isConfigurationValid(final ExtensionConfiguration extensionConfiguration); 16 | } 17 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/gremlin/converter/ResultConverter.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.gremlin.converter; 2 | 3 | /** 4 | * A ResultConverter converts output from Gremlin to some other format. 5 | *

6 | * An example is the ConsoleResultConverter which takes Gremlin output and converts it to a list of Strings for 7 | * display in the Console. 8 | * 9 | * @param the type to convert Gremlin output to. 10 | * 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | public interface ResultConverter { 14 | /** 15 | * Converts the result to a sensible format given the implementation. 16 | *

17 | * Gremlin can send back many different kinds of output as a result. That output is the value passed to 18 | * this method to be processed and converted to some other type. A result may be an Iterator, Vertex, 19 | * Edge, numeric, string, etc. Implementation is not trivial. 20 | */ 21 | T convert(final Object result) throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/util/HierarchicalConfigurationComparator.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.util; 2 | 3 | import org.apache.commons.configuration.Configuration; 4 | import org.apache.commons.configuration.ConfigurationComparator; 5 | import org.apache.commons.configuration.HierarchicalConfiguration; 6 | 7 | import java.util.Iterator; 8 | 9 | /** 10 | * @author Stephen Mallette (http://stephen.genoprime.com) 11 | */ 12 | public class HierarchicalConfigurationComparator implements ConfigurationComparator { 13 | @Override 14 | public boolean compare(Configuration h1, Configuration h2) { 15 | Iterator itty = h2.getKeys(); 16 | while(itty.hasNext()) { 17 | final String nextKey = (String) itty.next(); 18 | if (!h1.containsKey(nextKey)) { 19 | return false; 20 | } 21 | } 22 | 23 | // this pass is a reverse of the above which tries to fail fast by checking for new keys in "that". this 24 | // pass looks for keys which exist in "this" but not "that" but also checks the values of those fields. 25 | itty = h1.getKeys(); 26 | while(itty.hasNext()) { 27 | final String nextKey = (String) itty.next(); 28 | if (!h2.containsKey(nextKey)) { 29 | return false; 30 | } 31 | 32 | final Object val2 = h2.getProperty(nextKey); 33 | final Object val1 = h1.getProperty(nextKey); 34 | if (val1 instanceof HierarchicalConfiguration && val2 instanceof HierarchicalConfiguration) { 35 | if (!compare((HierarchicalConfiguration) val1, (HierarchicalConfiguration) val2)) return false; 36 | } else { 37 | if (!h1.getProperty(nextKey).equals(h2.getProperty(nextKey))) return false; 38 | } 39 | } 40 | 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rexster-core/src/main/java/com/tinkerpop/rexster/util/QueryProperties.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.util; 2 | 3 | import com.tinkerpop.blueprints.Query; 4 | 5 | /** 6 | * Holder for query properties parsed by the RequestObjectHelper to be translated into a Vertex Query. 7 | * 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | */ 10 | public class QueryProperties { 11 | private final Query.Compare compare; 12 | private final String name; 13 | private final Comparable value; 14 | 15 | public QueryProperties(final String name, final Query.Compare compare, final Comparable value){ 16 | this.compare = compare; 17 | this.name = name; 18 | this.value = value; 19 | } 20 | 21 | public Query.Compare getCompare() { 22 | return compare; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public Comparable getValue() { 30 | return value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rexster-kibbles/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-kibbles-logo.png! 2 | 3 | Rexster Kibbles is a collection of "extensions":https://github.com/tinkerpop/rexster/wiki/Extensions for the "Rexster":http://rexster.tinkerpop.com graph server. 4 | -------------------------------------------------------------------------------- /rexster-kibbles/batch-kibble/doc/images/rexster-batch-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-kibbles/batch-kibble/doc/images/rexster-batch-logo.png -------------------------------------------------------------------------------- /rexster-kibbles/batch-kibble/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | 13 | 14 | target/site 15 | 16 | 17 | target 18 | 19 | batch-kibble-*.jar 20 | 21 | 22 | 23 | 24 | 25 | pom.xml 26 | src 27 | 28 | 29 | ../../LICENSE.txt 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /rexster-kibbles/batch-kibble/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-kibbles/batch-kibble/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension: -------------------------------------------------------------------------------- 1 | com.tinkerpop.rexster.kibbles.batch.BatchExtension -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/doc/images/rexster-frames-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-kibbles/frames-kibble/doc/images/rexster-frames-logo.png -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | 13 | 14 | target/site 15 | 16 | 17 | target 18 | 19 | frames-kibble-*.jar 20 | 21 | 22 | 23 | 24 | 25 | pom.xml 26 | src 27 | 28 | 29 | ../../LICENSE.txt 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension: -------------------------------------------------------------------------------- 1 | com.tinkerpop.rexster.kibbles.frames.FramesExtension -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/classes/NamedObject.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.classes; 2 | 3 | import com.tinkerpop.frames.Property; 4 | 5 | /** 6 | * @author Marko A. Rodriguez (http://markorodriguez.com) 7 | */ 8 | public interface NamedObject { 9 | 10 | @Property("name") 11 | public String getName(); 12 | 13 | @Property("name") 14 | public void setName(final String name); 15 | } 16 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/classes/Person.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.classes; 2 | 3 | 4 | import com.tinkerpop.frames.Adjacency; 5 | import com.tinkerpop.frames.Incidence; 6 | import com.tinkerpop.frames.Property; 7 | import com.tinkerpop.frames.domain.incidences.Created; 8 | import com.tinkerpop.frames.domain.incidences.Knows; 9 | 10 | import java.util.Collection; 11 | 12 | /** 13 | * @author Marko A. Rodriguez (http://markorodriguez.com) 14 | */ 15 | public interface Person extends NamedObject { 16 | 17 | @Property("age") 18 | public Integer getAge(); 19 | 20 | @Property("age") 21 | public void setAge(int age); 22 | 23 | @Property("age") 24 | public void removeAge(); 25 | 26 | @Adjacency(label = "knows") 27 | public Collection getKnows(); 28 | 29 | @Incidence(label = "knows") 30 | public Collection getKnowsPeople(); 31 | 32 | @Adjacency(label = "created") 33 | public Collection getCreated(); 34 | 35 | @Incidence(label = "created") 36 | public Collection getCreatedProjects(); 37 | 38 | @Incidence(label = "knows") 39 | public void addKnowsPerson(final Person person); 40 | 41 | @Adjacency(label = "knows") 42 | public Knows addKnows(final Person person); 43 | 44 | @Incidence(label = "created") 45 | public void addCreatedProject(final Project project); 46 | 47 | @Adjacency(label = "created") 48 | public Created addCreated(final Project project); 49 | 50 | @Incidence(label = "knows") 51 | public void removeKnowsPerson(final Person person); 52 | 53 | @Adjacency(label = "knows") 54 | public void removeKnows(final Knows knows); 55 | 56 | /*@GremlinInference(script = "_{x=it}.outE('created').inV.inE('created').outV{it!=x}") 57 | public Collection getCoCreators();*/ 58 | 59 | } 60 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/classes/Project.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.classes; 2 | 3 | 4 | import com.tinkerpop.blueprints.Direction; 5 | import com.tinkerpop.frames.Adjacency; 6 | import com.tinkerpop.frames.Incidence; 7 | import com.tinkerpop.frames.Property; 8 | import com.tinkerpop.frames.domain.incidences.CreatedBy; 9 | 10 | import java.util.Collection; 11 | 12 | /** 13 | * @author Marko A. Rodriguez (http://markorodriguez.com) 14 | */ 15 | public interface Project extends NamedObject { 16 | 17 | @Property("lang") 18 | public String getLanguage(); 19 | 20 | @Adjacency(label = "created", direction = Direction.IN) 21 | public Collection getCreatedByPeople(); 22 | 23 | @Incidence(label = "created", direction = Direction.IN) 24 | public Collection getCreatedBy(); 25 | 26 | @Adjacency(label = "created", direction = Direction.IN) 27 | public void removeCreatedByPerson(Person person); 28 | 29 | @Incidence(label = "created", direction = Direction.IN) 30 | public void removeCreatedBy(CreatedBy createdBy); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/incidences/Created.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.incidences; 2 | 3 | import com.tinkerpop.frames.Domain; 4 | import com.tinkerpop.frames.Property; 5 | import com.tinkerpop.frames.Range; 6 | import com.tinkerpop.frames.domain.classes.Person; 7 | import com.tinkerpop.frames.domain.classes.Project; 8 | 9 | /** 10 | * @author Marko A. Rodriguez (http://markorodriguez.com) 11 | */ 12 | public interface Created { 13 | @Domain 14 | public Project getDomain(); 15 | 16 | @Range 17 | public Person getRange(); 18 | 19 | @Property("weight") 20 | public Float getWeight(); 21 | 22 | @Property("weight") 23 | public void setWeight(float weight); 24 | } 25 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/incidences/CreatedBy.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.incidences; 2 | 3 | import com.tinkerpop.frames.Domain; 4 | import com.tinkerpop.frames.Property; 5 | import com.tinkerpop.frames.Range; 6 | import com.tinkerpop.frames.domain.classes.Person; 7 | import com.tinkerpop.frames.domain.classes.Project; 8 | 9 | /** 10 | * @author Marko A. Rodriguez (http://markorodriguez.com) 11 | */ 12 | public interface CreatedBy { 13 | 14 | @Domain 15 | public Project getDomain(); 16 | 17 | @Range 18 | public Person getRange(); 19 | 20 | @Property("weight") 21 | public Float getWeight(); 22 | } 23 | -------------------------------------------------------------------------------- /rexster-kibbles/frames-kibble/src/test/java/com/tinkerpop/frames/domain/incidences/Knows.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.frames.domain.incidences; 2 | 3 | import com.tinkerpop.frames.Domain; 4 | import com.tinkerpop.frames.Property; 5 | import com.tinkerpop.frames.Range; 6 | import com.tinkerpop.frames.domain.classes.Person; 7 | 8 | /** 9 | * @author Marko A. Rodriguez (http://markorodriguez.com) 10 | */ 11 | public interface Knows { 12 | 13 | @Property("weight") 14 | public Float getWeight(); 15 | 16 | @Property("weight") 17 | public Float setWeight(float weight); 18 | 19 | @Domain 20 | public Person getDomain(); 21 | 22 | @Range 23 | public Person getRange(); 24 | } 25 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/rexster-kibbles/sample-kibbles/doc/images/rexster-sample-logo.png! 2 | 3 | 4 | h1. Sample Kibbles 5 | 6 | The Sample Kibbles project provides a series of well documented Rexster Extensions to help developers get started in their efforts to extend Rexster. 7 | 8 | The following examples are included: 9 | 10 | |_. extension |_. description |_. uri | 11 | | @MapConfigurationExtension@ | Demonstrates how graph specific configuration in rexster.xml can be exposed to the extension. | @http://base/graphs/graph/tp-sample/map-config@ | 12 | | @MetricExtension@ | Demonstrates how to register custom metrics to be reported statistics through the "Metrics":http://metrics.codahale.com/. | @http://base/graphs/graph/tp-sample/metric@ | 13 | | @ParametersExtension@ | Demonstrates echoing of different kinds of request parameters. | @http://base/graphs/graph/tp-sample/parameters@ | 14 | | @PingExtension@ | Performs a simple echo of the value of a URI query string parameter. | @http://base/graphs/graph/tp-sample/ping@ | 15 | | @PingAddOnExtension@ | Performs a simple echo of the value of a URI query string parameter demonstrating that Extensions can be spread across multiple classes within a namespace and extension name. | @http://basegraphs//graph/tp-sample/ping/pong@ | 16 | | @ProducesXmlExtension@ | Demonstrates how to return types other than @application/json@. | @http://base/graphs/graph/vertices/1/tp-sample/produces-xml@ 17 | @http://base/graphs/graph/edges/1/tp-sample/produces-xml@ | 18 | | @SecureExtension@ | Demonstrates how to get a @Principal@ object from the @SecurityContext@. | @http://base/graphs/graph/vertices/1/tp-sample/secure@ | 19 | | @SimplePathExtension@ | Demonstrates how a pathed extension works where multiple extension methods are exposed from the same extension point. | @http://basegraphs//graph/tp-sample/simple-path/some-work@ 20 | @http://base/graphs/graph/tp-sample/simple-path/other-work@ | 21 | | @SimpleRootExtension@ | Demonstrates how a root extension works. | @http://base/graphs/graph/tp-sample/simple-root@ 22 | @http://base/graphs/graph/tp-sample/vertices/1/simple-root@ 23 | @http://base/graphs/graph/tp-sample/edges/1/simple-root@ | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/doc/images/rexster-sample-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-kibbles/sample-kibbles/doc/images/rexster-sample-logo.png -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | 13 | 14 | target/site 15 | 16 | 17 | target 18 | 19 | sample-kibbles-*.jar 20 | 21 | 22 | 23 | 24 | 25 | pom.xml 26 | src 27 | 28 | 29 | ../../LICENSE.txt 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/main/java/com/tinkerpop/rexster/kibbles/sample/AbstractSampleExtension.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sample; 2 | 3 | import com.tinkerpop.rexster.extension.AbstractRexsterExtension; 4 | 5 | /** 6 | * Base class for samples. 7 | */ 8 | public abstract class AbstractSampleExtension extends AbstractRexsterExtension { 9 | public static final String EXTENSION_NAMESPACE = "tp-sample"; 10 | } 11 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/main/java/com/tinkerpop/rexster/kibbles/sample/ProducesXmlExtension.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sample; 2 | 3 | import com.tinkerpop.blueprints.Edge; 4 | import com.tinkerpop.blueprints.Vertex; 5 | import com.tinkerpop.rexster.extension.ExtensionDefinition; 6 | import com.tinkerpop.rexster.extension.ExtensionDescriptor; 7 | import com.tinkerpop.rexster.extension.ExtensionNaming; 8 | import com.tinkerpop.rexster.extension.ExtensionPoint; 9 | import com.tinkerpop.rexster.extension.ExtensionResponse; 10 | import com.tinkerpop.rexster.extension.RexsterContext; 11 | 12 | import javax.ws.rs.core.MediaType; 13 | import javax.ws.rs.core.Response; 14 | 15 | /** 16 | * An extension that returns an XML representation of a vertex and an edge. 17 | */ 18 | @ExtensionNaming(name = ProducesXmlExtension.EXTENSION_NAME, namespace = AbstractSampleExtension.EXTENSION_NAMESPACE) 19 | public class ProducesXmlExtension extends AbstractSampleExtension { 20 | public static final String EXTENSION_NAME = "produces-xml"; 21 | 22 | /** 23 | * Takes a vertex and converts the "standard" properties to XML. 24 | */ 25 | @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX, produces = MediaType.APPLICATION_XML) 26 | @ExtensionDescriptor(description = "returns standard properties of a vertex as XML.") 27 | public ExtensionResponse doVertexToXml(@RexsterContext Vertex vertex) { 28 | String xml = "" + vertex.getId().toString() + ""; 29 | return new ExtensionResponse(Response.ok(xml).build()); 30 | } 31 | 32 | /** 33 | * Takes a edge and converts the "standard" properties to XML. 34 | */ 35 | @ExtensionDefinition(extensionPoint = ExtensionPoint.EDGE, produces = MediaType.APPLICATION_XML) 36 | @ExtensionDescriptor(description = "returns standard properties of an edge as XML.") 37 | public ExtensionResponse doEdgeToXml(@RexsterContext Edge edge) { 38 | String xml = "" + edge.getId().toString() + ""; 39 | return new ExtensionResponse(Response.ok(xml).build()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/main/java/com/tinkerpop/rexster/kibbles/sample/SecureExtension.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sample; 2 | 3 | import com.tinkerpop.rexster.extension.ExtensionDefinition; 4 | import com.tinkerpop.rexster.extension.ExtensionDescriptor; 5 | import com.tinkerpop.rexster.extension.ExtensionNaming; 6 | import com.tinkerpop.rexster.extension.ExtensionPoint; 7 | import com.tinkerpop.rexster.extension.ExtensionResponse; 8 | import com.tinkerpop.rexster.extension.RexsterContext; 9 | 10 | import javax.ws.rs.core.SecurityContext; 11 | import java.security.Principal; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | /** 16 | * An extension that demostrates how to get a Principal from the SecurityContext. 17 | */ 18 | @ExtensionNaming(name = SecureExtension.EXTENSION_NAME, namespace = AbstractSampleExtension.EXTENSION_NAMESPACE) 19 | public class SecureExtension extends AbstractSampleExtension { 20 | public static final String EXTENSION_NAME = "secure"; 21 | 22 | /** 23 | * ttp://localhost:8182/graphs/tinkergraph/vertices/1/tp-sample/secure 24 | */ 25 | @ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH) 26 | @ExtensionDescriptor(description = "shows if security is on or off and who the user is if it is on.") 27 | public ExtensionResponse doSomethingIfSecure(@RexsterContext SecurityContext securityContext) { 28 | 29 | final Map map = new HashMap(); 30 | final Principal principal = securityContext.getUserPrincipal(); 31 | 32 | // if is set to "none" in rexster.xml the principal will 33 | // return as null 34 | if (principal == null) { 35 | map.put("security", "authentication off"); 36 | map.put("user", ""); 37 | } else { 38 | map.put("security", "authentication on"); 39 | map.put("user", principal.getName()); 40 | } 41 | 42 | return ExtensionResponse.ok(map); 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension: -------------------------------------------------------------------------------- 1 | com.tinkerpop.rexster.kibbles.sample.MapConfigurationExtension 2 | com.tinkerpop.rexster.kibbles.sample.MetricExtension 3 | com.tinkerpop.rexster.kibbles.sample.ParametersExtension 4 | com.tinkerpop.rexster.kibbles.sample.PingExtension 5 | com.tinkerpop.rexster.kibbles.sample.PingAddOnExtension 6 | com.tinkerpop.rexster.kibbles.sample.ProducesXmlExtension 7 | com.tinkerpop.rexster.kibbles.sample.SecureExtension 8 | com.tinkerpop.rexster.kibbles.sample.SimplePathExtension 9 | com.tinkerpop.rexster.kibbles.sample.SimpleRootExtension 10 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/test/java/com/tinkerpop/rexster/kibbles/sample/PingExtensionTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sample; 2 | 3 | import com.tinkerpop.rexster.extension.ExtensionResponse; 4 | import org.codehaus.jettison.json.JSONObject; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import javax.ws.rs.core.Response; 9 | 10 | public class PingExtensionTest { 11 | private PingExtension pingExtension = new PingExtension(); 12 | 13 | @Test 14 | public void evaluatePingValid() { 15 | String replyToSend = "pong"; 16 | ExtensionResponse response = pingExtension.evaluatePing(null, null, replyToSend); 17 | 18 | // the response should never be null 19 | Assert.assertNotNull(response); 20 | 21 | // the ExtensionResponse really just wraps an underlying jersey response and that 22 | // should not be null 23 | Response jerseyResponse = response.getJerseyResponse(); 24 | Assert.assertNotNull(jerseyResponse); 25 | 26 | // the services return an OK status code. 27 | Assert.assertEquals(Response.Status.OK.getStatusCode(), jerseyResponse.getStatus()); 28 | 29 | // JSON is wrapped in the jersey response. 30 | JSONObject json = (JSONObject) jerseyResponse.getEntity(); 31 | Assert.assertNotNull(json); 32 | 33 | // the JSON has an output property and it contains the data from the toString call on the 34 | // requested element. 35 | Assert.assertTrue(json.has("ping")); 36 | Assert.assertEquals(replyToSend, json.optString("ping")); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /rexster-kibbles/sample-kibbles/src/test/java/com/tinkerpop/rexster/kibbles/sample/ProducesXmlExtensionTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sample; 2 | 3 | import com.tinkerpop.blueprints.Edge; 4 | import com.tinkerpop.blueprints.Graph; 5 | import com.tinkerpop.blueprints.Vertex; 6 | import com.tinkerpop.blueprints.impls.tg.TinkerGraphFactory; 7 | import com.tinkerpop.rexster.extension.ExtensionResponse; 8 | import org.junit.Assert; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import javax.ws.rs.core.Response; 13 | 14 | public class ProducesXmlExtensionTest { 15 | private Graph graph; 16 | private ProducesXmlExtension extension = new ProducesXmlExtension(); 17 | 18 | @Before 19 | public void beforeTest() { 20 | // in some cases it may be preferable to mock the Graph but for quick test purposes. the sample 21 | // graph is good and stable. 22 | this.graph = TinkerGraphFactory.createTinkerGraph(); 23 | } 24 | 25 | @Test 26 | public void doVertexToXml() { 27 | Vertex v = this.graph.getVertex(1); 28 | ExtensionResponse extensionResponse = this.extension.doVertexToXml(v); 29 | 30 | Assert.assertNotNull(extensionResponse); 31 | Response response = extensionResponse.getJerseyResponse(); 32 | Assert.assertNotNull(response); 33 | Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); 34 | 35 | String xml = (String) response.getEntity(); 36 | Assert.assertEquals("1", xml); 37 | } 38 | 39 | @Test 40 | public void doEdgeToXml() { 41 | Edge e = this.graph.getEdge(11); 42 | ExtensionResponse extensionResponse = this.extension.doEdgeToXml(e); 43 | 44 | Assert.assertNotNull(extensionResponse); 45 | Response response = extensionResponse.getJerseyResponse(); 46 | Assert.assertNotNull(response); 47 | Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); 48 | 49 | String xml = (String) response.getEntity(); 50 | Assert.assertEquals("11", xml); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/rexster-kibbles/sparql-kibble/doc/images/rexster-sparql-logo.png! 2 | 3 | The "SPARQL":http://www.w3.org/TR/rdf-sparql-query/ Kibble provides a means to execute SPARQL queries against "Sail graph":https://github.com/tinkerpop/blueprints/wiki/Sail-Implementation implementations. 4 | 5 | h2. REST API 6 | 7 | h3. GET Operations 8 | 9 | |_. returns |_. uri |_. description | 10 | | map of vertices | @http://base/graphs/graph/tp/sparql?query=some-sparql@ | executes a SPARQL query (denoted by some-sparql) | 11 | 12 | It is important to remember that the SPARQL query for the @query@ parameter must be URL encoded. For example this SPARQL query: 13 | 14 | bc. SELECT ?x ?y WHERE { ?x ?y } 15 | 16 | needs to be encoded to: 17 | 18 | bc. http://localhost:8182/graphs/sailgraph/tp/sparql?query=SELECT%20%3Fx%20%3Fy%20WHERE%20{%20%3Fx%20%3Chttp%3A%2F%2Ftinkerpop.com%23knows%3E%20%3Fy%20} 19 | 20 | It is also possible to POST JSON or form data to this URI. For example: 21 | 22 | bc. curl -v -X POST -H "Content-Type:application/json" -d '{"query":"SELECT ?x ?y WHERE { ?x ?y }"}' http://localhost:8182/graphs/sailgraph/tp/sparql 23 | 24 | will return: 25 | 26 | bc. { 27 | "results":[ 28 | {"y":{"_id":"http:\/\/tinkerpop.com#2","_type":"vertex","kind":"uri"}, 29 | "x":{"_id":"http:\/\/tinkerpop.com#1","_type":"vertex","kind":"uri"}}, 30 | {"y":{"_id":"http:\/\/tinkerpop.com#4","_type":"vertex","kind":"uri"}, 31 | "x":{"_id":"http:\/\/tinkerpop.com#1","_type":"vertex","kind":"uri"}} 32 | ], 33 | "success":true, 34 | "version":"0.4", 35 | "queryTime":90.959991 36 | } 37 | -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/doc/images/rexster-sparql-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-kibbles/sparql-kibble/doc/images/rexster-sparql-logo.png -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | 13 | 14 | target/site 15 | 16 | 17 | target 18 | 19 | sparql-kibble-*.jar 20 | 21 | 22 | 23 | 24 | 25 | pom.xml 26 | src 27 | 28 | 29 | ../../LICENSE.txt 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension: -------------------------------------------------------------------------------- 1 | com.tinkerpop.rexster.kibbles.sparql.SparqlExtension -------------------------------------------------------------------------------- /rexster-kibbles/sparql-kibble/src/test/java/com/tinkerpop/rexster/kibbles/sparql/SparqlExtensionTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.kibbles.sparql; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.blueprints.impls.sail.SailGraph; 5 | import com.tinkerpop.blueprints.impls.sail.SailGraphFactory; 6 | import com.tinkerpop.blueprints.impls.sail.impls.MemoryStoreSailGraph; 7 | import com.tinkerpop.rexster.RexsterResourceContext; 8 | import com.tinkerpop.rexster.Tokens; 9 | import com.tinkerpop.rexster.extension.ExtensionResponse; 10 | import org.codehaus.jettison.json.JSONArray; 11 | import org.codehaus.jettison.json.JSONObject; 12 | import org.junit.Assert; 13 | import org.junit.Before; 14 | import org.junit.Test; 15 | 16 | import javax.ws.rs.core.Response; 17 | 18 | public class SparqlExtensionTest { 19 | private Graph graph; 20 | private RexsterResourceContext ctx; 21 | 22 | @Before 23 | public void beforeTest() { 24 | 25 | SailGraph sailGraph = new MemoryStoreSailGraph(); 26 | SailGraphFactory.createTinkerGraph(sailGraph); 27 | 28 | this.graph = sailGraph; 29 | 30 | } 31 | 32 | @Test 33 | public void evaluateSparqlNoReturnKeysNoShowTypes() { 34 | String sparqlQuery = "SELECT ?x ?y WHERE { ?x ?y }"; 35 | 36 | this.ctx = new RexsterResourceContext(null, null, null, new JSONObject(), null, null, null, null); 37 | 38 | SparqlExtension extension = new SparqlExtension(); 39 | ExtensionResponse extensionResponse = extension.evaluateSparql(this.ctx, this.graph, sparqlQuery); 40 | 41 | Assert.assertNotNull(extensionResponse); 42 | Assert.assertFalse(extensionResponse.isErrorResponse()); 43 | 44 | Response jerseyResponse = extensionResponse.getJerseyResponse(); 45 | Assert.assertNotNull(jerseyResponse); 46 | Assert.assertEquals(Response.Status.OK.getStatusCode(), jerseyResponse.getStatus()); 47 | 48 | JSONObject jsonResponseEntity = (JSONObject) jerseyResponse.getEntity(); 49 | Assert.assertNotNull(jsonResponseEntity); 50 | 51 | Assert.assertTrue(jsonResponseEntity.has(Tokens.RESULTS)); 52 | 53 | JSONArray results = jsonResponseEntity.optJSONArray(Tokens.RESULTS); 54 | Assert.assertNotNull(results); 55 | Assert.assertEquals(2, results.length()); 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /rexster-protocol/README.textile: -------------------------------------------------------------------------------- 1 | !https://github.com/tinkerpop/rexster/raw/master/doc/images/rexster-logo.png! 2 | 3 | Rexster Protocol contains the components for Rexster's binary protocol "RexPro". Currently, it's primarily used by Rexster Console and isn't really ready for other binary protocol clients. 4 | 5 | The documentation for Rexster can be found at this "location":http://rexster.tinkerpop.com. Finally, please visit "TinkerPop":http://tinkerpop.com for other software products. -------------------------------------------------------------------------------- /rexster-protocol/src/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | distribution 3 | 4 | zip 5 | 6 | 7 | 8 | src 9 | 10 | 11 | target/apidocs 12 | doc/javadoc 13 | 14 | 15 | target 16 | 17 | rexster-protocol-*.jar 18 | 19 | 20 | 21 | 22 | 23 | pom.xml 24 | src 25 | 26 | 27 | ../LICENSE.txt 28 | / 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /rexster-protocol/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | jar 5 | 6 | false 7 | 8 | 9 | 10 | target/classes 11 | / 12 | 13 | 14 | 15 | 16 | 17 | / 18 | true 19 | runtime 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/client/RexProException.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.client; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public class RexProException extends Exception { 7 | public RexProException(final String msg) { 8 | super(msg); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/client/RexsterClientHandler.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.client; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProMessage; 4 | import org.apache.log4j.Logger; 5 | import org.glassfish.grizzly.filterchain.BaseFilter; 6 | import org.glassfish.grizzly.filterchain.FilterChainContext; 7 | import org.glassfish.grizzly.filterchain.NextAction; 8 | 9 | import java.io.IOException; 10 | 11 | /** 12 | * @author Stephen Mallette (http://stephen.genoprime.com) 13 | */ 14 | class RexsterClientHandler extends BaseFilter { 15 | private static final Logger logger = Logger.getLogger(RexsterClientHandler.class); 16 | 17 | public NextAction handleRead(final FilterChainContext ctx) throws IOException { 18 | try { 19 | RexsterClient.putResponse((RexProMessage) ctx.getMessage()); 20 | } catch (Exception e) { 21 | logger.error("RexProMessage could not be cast to to be place on the response map.", e); 22 | } 23 | 24 | return ctx.getStopAction(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/client/RexsterClientTokens.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.client; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public class RexsterClientTokens { 7 | 8 | public static final String CONFIG_HOSTNAME = "hostname"; 9 | public static final String CONFIG_PORT = "port"; 10 | public static final String CONFIG_GRAPH_NAME = "graph-name"; 11 | public static final String CONFIG_GRAPH_OBJECT_NAME = "graph-obj-name"; 12 | public static final String CONFIG_TRANSACTION = "transaction"; 13 | public static final String CONFIG_TIMEOUT_CONNECTION_MS = "timeout-connection-ms"; 14 | public static final String CONFIG_TIMEOUT_WRITE_MS = "timeout-write-ms"; 15 | public static final String CONFIG_TIMEOUT_READ_MS = "timeout-read-ms"; 16 | public static final String CONFIG_MESSAGE_RETRY_COUNT = "message-retry-count"; 17 | public static final String CONFIG_MESSAGE_RETRY_WAIT_MS = "message-retry-wait-ms"; 18 | public static final String CONFIG_MAX_ASYNC_WRITE_QUEUE_BYTES = "max-async-write-queue-size"; 19 | public static final String CONFIG_LANGUAGE = "language"; 20 | public static final String CONFIG_SERIALIZER = "serializer"; 21 | } 22 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/gremlin/converter/MsgPackResultConverter.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.gremlin.converter; 2 | 3 | import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.ResultsConverter; 4 | import org.msgpack.MessagePack; 5 | import org.msgpack.packer.BufferPacker; 6 | 7 | /** 8 | * Converts a result from Gremlin to a byte array encoded by MsgPack. 9 | * 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public class MsgPackResultConverter implements ResultConverter { 13 | private final MessagePack msgpack = new MessagePack(); 14 | 15 | public byte[] convert(final Object result) throws Exception { 16 | final BufferPacker packer = msgpack.createBufferPacker(1024); 17 | try { 18 | ResultsConverter.serializeObject(result, packer); 19 | return packer.toByteArray(); 20 | } catch (Exception e) { 21 | throw e; 22 | } finally { 23 | packer.close(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/RexsterApplicationHolder.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.rexster.RexsterApplicationGraph; 5 | import com.tinkerpop.rexster.Tokens; 6 | import com.tinkerpop.rexster.server.RexsterApplication; 7 | 8 | import java.util.Set; 9 | 10 | /** 11 | * Proxies call to the RexsterApplication instance to limit the methods available in RexsterConsole. 12 | * 13 | * @author Stephen Mallette (http://stephen.genoprime.com) 14 | * @author Blake Eggleston (bdeggleston.github.com) 15 | */ 16 | public class RexsterApplicationHolder { 17 | private final RexsterApplication rexsterApplication; 18 | 19 | public RexsterApplicationHolder(final RexsterApplication rexsterApplication) { 20 | this.rexsterApplication = rexsterApplication; 21 | } 22 | 23 | public Graph getGraph(final String graphName) { 24 | return this.rexsterApplication.getGraph(graphName); 25 | } 26 | 27 | public RexsterApplicationGraph getApplicationGraph(final String graphName) { 28 | return this.rexsterApplication.getApplicationGraph(graphName); 29 | } 30 | 31 | public Set getGraphNames() { 32 | return this.rexsterApplication.getGraphNames(); 33 | } 34 | 35 | public String getVersion() { 36 | return Tokens.REXSTER_VERSION; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/filter/RexProProcessorFilter.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.filter; 2 | 3 | import com.tinkerpop.rexster.protocol.server.RexProRequest; 4 | import org.glassfish.grizzly.filterchain.BaseFilter; 5 | import org.glassfish.grizzly.filterchain.FilterChainContext; 6 | import org.glassfish.grizzly.filterchain.NextAction; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * @author Blake Eggleston (bdeggleston.github.com) 12 | */ 13 | public class RexProProcessorFilter extends BaseFilter { 14 | public NextAction handleRead(final FilterChainContext ctx) throws IOException { 15 | final RexProRequest request = ctx.getMessage(); 16 | request.process(); 17 | ctx.write(request); 18 | return ctx.getStopAction(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/ErrorResponseMessage.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import org.msgpack.annotation.Message; 4 | 5 | /** 6 | * Represents an Error message. 7 | * 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | * @author Blake Eggleston (bdeggleston.github.com) 10 | */ 11 | @Message 12 | public class ErrorResponseMessage extends RexProMessage { 13 | public String ErrorMessage; 14 | 15 | public static final Integer INVALID_MESSAGE_ERROR = 0; 16 | public static final Integer INVALID_SESSION_ERROR = 1; 17 | public static final Integer SCRIPT_FAILURE_ERROR = 2; 18 | public static final Integer AUTH_FAILURE_ERROR = 3; 19 | public static final Integer GRAPH_CONFIG_ERROR = 4; 20 | public static final Integer CHANNEL_CONFIG_ERROR = 5; 21 | public static final Integer RESULT_SERIALIZATION_ERROR = 6; 22 | public static final Integer UNKNOWN_ERROR = 7; 23 | 24 | protected static final String FLAG_META_KEY = "flag"; 25 | protected RexProMessageMetaField[] getMetaFields() { 26 | RexProMessageMetaField[] fields = { 27 | //indicates this session should be destroyed 28 | RexProMessageMetaField.define(FLAG_META_KEY, true, Integer.class) 29 | }; 30 | return fields; 31 | } 32 | 33 | public Integer metaGetFlag() { 34 | Object value = Meta.get(FLAG_META_KEY); 35 | if (value instanceof Integer) { 36 | return (Integer) value; 37 | } else if (value instanceof Long) { 38 | return ((Long) value).intValue(); 39 | } else { 40 | return null; 41 | } 42 | } 43 | 44 | public void metaSetFlag(Integer val) { 45 | Meta.put(FLAG_META_KEY, val); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/MessageTokens.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | * @author Blake Eggleston (bdeggleston.github.com) 6 | */ 7 | public final class MessageTokens { 8 | public static final String ERROR_INVALID_TAG = "The message has an invalid flag."; 9 | public static final String ERROR_SESSION_NOT_SPECIFIED = "The message does not specify a session."; 10 | public static final String ERROR_SESSION_INVALID = "The session on the request does not exist or has otherwise expired."; 11 | public static final String ERROR_IN_SCRIPT_PROCESSING = "An error occurred while processing the script for language [%s]. All transactions across all graphs in the session have been concluded with failure: %s"; 12 | public static final String ERROR_UNEXPECTED_MESSAGE_TYPE = "Message did not match an expected type."; 13 | public static final String ERROR_GRAPH_REDEFINITION = "A graph name has already been defined on this session"; 14 | public static final String ERROR_CHANNEL_REDEFINITION = "A channel has already been defined on this session"; 15 | public static final String ERROR_RESULT_SERIALIZATION = "Script was successfully executed but the result of the script was not properly serialized."; 16 | } 17 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/MessageType.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | /** 4 | * Values that represent standard message types for RexPro. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | * @author Blake Eggleston (bdeggleston.github.com) 8 | */ 9 | public class MessageType { 10 | /** 11 | * Represents an Error message. 12 | */ 13 | public static final byte ERROR = 0; 14 | 15 | /** 16 | * Represents a request to open or close a session. 17 | */ 18 | public static final byte SESSION_REQUEST = 1; 19 | 20 | /** 21 | * Represents a response to a session request with a newly defined session and available ScriptEngine 22 | * languages or a closed session confirmation.. 23 | */ 24 | public static final byte SESSION_RESPONSE = 2; 25 | 26 | /** 27 | * Represents a request to process a script. 28 | */ 29 | public static final byte SCRIPT_REQUEST = 3; 30 | 31 | /** 32 | * Represents a response to a script request that formats results to MsgPack format. 33 | */ 34 | public static final byte SCRIPT_RESPONSE = 5; 35 | } 36 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/MessageUtil.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import com.tinkerpop.rexster.client.RexProException; 4 | 5 | import java.util.List; 6 | import java.util.UUID; 7 | 8 | /** 9 | * @author Stephen Mallette (http://stephen.genoprime.com) 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public class MessageUtil { 13 | public static ErrorResponseMessage createErrorResponse(final byte[] request, final byte[] session, 14 | final Integer flag, final String errorMessage) { 15 | final ErrorResponseMessage msg = new ErrorResponseMessage(); 16 | msg.Request = request; 17 | msg.Session = session; 18 | msg.ErrorMessage = errorMessage; 19 | 20 | msg.metaSetFlag(flag); 21 | try { 22 | msg.validateMetaData(); 23 | } catch (RexProException ex) { 24 | // 25 | } 26 | return msg; 27 | } 28 | 29 | public static SessionResponseMessage createNewSession(byte[] request, final List languages) { 30 | final UUID sessionKey = UUID.randomUUID(); 31 | 32 | final SessionResponseMessage responseMessage = new SessionResponseMessage(); 33 | responseMessage.setSessionAsUUID(sessionKey); 34 | responseMessage.Request = request; 35 | responseMessage.Languages = new String[languages.size()]; 36 | languages.toArray(responseMessage.Languages); 37 | 38 | return responseMessage; 39 | } 40 | 41 | public static SessionResponseMessage createEmptySession(byte[] request) { 42 | final SessionResponseMessage responseMessage = new SessionResponseMessage(); 43 | responseMessage.setSessionAsUUID(RexProMessage.EMPTY_SESSION); 44 | responseMessage.Request = request; 45 | responseMessage.Languages = new String[0]; 46 | 47 | return responseMessage; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/RexProMessageMeta.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * HashMap with a msgpack template 8 | * 9 | * @author Blake Eggleston (bdeggleston.github.com) 10 | */ 11 | public class RexProMessageMeta extends HashMap { 12 | 13 | public RexProMessageMeta() { } 14 | public RexProMessageMeta(int i) { super(i); } 15 | public RexProMessageMeta(int i, float v) { super(i, v); } 16 | public RexProMessageMeta(Map map) { super(map); } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/RexProScriptResult.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | /** 4 | * Object with a msgpack template 5 | * 6 | * @author Blake Eggleston (bdeggleston.github.com) 7 | */ 8 | public class RexProScriptResult { 9 | 10 | private Object value; 11 | 12 | public RexProScriptResult() { 13 | this.value = null; 14 | } 15 | 16 | public RexProScriptResult(Object value) { 17 | this.value = value; 18 | } 19 | 20 | public Object get() { 21 | return value; 22 | } 23 | 24 | public void set(Object val) { 25 | value = val; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/ScriptResponseMessage.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import com.tinkerpop.rexster.gremlin.converter.MsgPackResultConverter; 4 | import org.msgpack.annotation.Message; 5 | 6 | /** 7 | * Represents a response to a script request that formats results to MsgPack format. 8 | * 9 | * @author Stephen Mallette (http://stephen.genoprime.com) 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | @Message 13 | public class ScriptResponseMessage extends RexProMessage { 14 | private static final MsgPackResultConverter converter = new MsgPackResultConverter(); 15 | 16 | public RexProScriptResult Results = new RexProScriptResult(); 17 | public RexProBindings Bindings = new RexProBindings(); 18 | 19 | public static byte[] convertResultToBytes(final Object result) throws Exception { 20 | return converter.convert(result); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/SessionRequestMessage.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import org.msgpack.annotation.Message; 4 | 5 | /** 6 | * Represents a request to open or close a session. 7 | * 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | * @author Blake Eggleston (bdeggleston.github.com) 10 | */ 11 | @Message 12 | public class SessionRequestMessage extends RexProMessage { 13 | 14 | protected static final String KILL_SESSION_META_KEY = "killSession"; 15 | protected static final String GRAPH_NAME_META_KEY = "graphName"; 16 | protected static final String GRAPH_OBJECT_NAME_META_KEY = "graphObjName"; 17 | protected RexProMessageMetaField[] getMetaFields() { 18 | RexProMessageMetaField[] fields = { 19 | //indicates this session should be destroyed 20 | RexProMessageMetaField.define(KILL_SESSION_META_KEY, false, false, Boolean.class), 21 | 22 | //sets the graph and graph variable name for this session, optional 23 | RexProMessageMetaField.define(GRAPH_NAME_META_KEY, false, null, String.class), 24 | RexProMessageMetaField.define(GRAPH_OBJECT_NAME_META_KEY, false, "g", String.class) 25 | }; 26 | return fields; 27 | } 28 | 29 | public String Username; 30 | public String Password; 31 | 32 | public void metaSetKillSession(Boolean val) { 33 | Meta.put(KILL_SESSION_META_KEY, val); 34 | } 35 | 36 | public Boolean metaGetKillSession() { 37 | return (Boolean) Meta.get(KILL_SESSION_META_KEY); 38 | } 39 | 40 | public void metaSetGraphName(String val) { 41 | Meta.put(GRAPH_NAME_META_KEY, val); 42 | } 43 | 44 | public String metaGetGraphName() { 45 | return (String) Meta.get(GRAPH_NAME_META_KEY); 46 | } 47 | 48 | public void metaSetGraphObjName(String val) { 49 | Meta.put(GRAPH_OBJECT_NAME_META_KEY, val); 50 | } 51 | 52 | public String metaGetGraphObjName() { 53 | return (String) Meta.get(GRAPH_OBJECT_NAME_META_KEY); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/msg/SessionResponseMessage.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.msg; 2 | 3 | import org.msgpack.annotation.Message; 4 | 5 | /** 6 | * Represents a response to a session request with a newly defined session and available ScriptEngine 7 | * languages or a closed session confirmation. 8 | * 9 | * @author Stephen Mallette (http://stephen.genoprime.com) 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | @Message 13 | public class SessionResponseMessage extends RexProMessage { 14 | public String[] Languages; 15 | } 16 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/RexProSerializer.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProMessage; 4 | 5 | import java.io.IOException; 6 | 7 | /** 8 | * RexPro serializer interface. Use this to implement new serializers 9 | * 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public interface RexProSerializer { 13 | 14 | /** 15 | * Consumes a byte array and RexProMessage class and returns a RexProMessage instance 16 | * 17 | * @param bytes 18 | * @param messageClass 19 | * @param 20 | * @return 21 | */ 22 | public Message deserialize(byte[] bytes, Class messageClass) throws IOException; 23 | 24 | /** 25 | * Consumes a RexProMessage and returns a byte array 26 | * 27 | * @param message 28 | * @param 29 | * @return 30 | */ 31 | public byte[] serialize(Message message, Class messageClass) throws IOException; 32 | 33 | /** 34 | * Returns the byte uniquely identifying this serializer 35 | * @return 36 | */ 37 | public byte getSerializerId(); 38 | } 39 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/BindingsTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProBindings; 4 | import org.codehaus.jackson.JsonNode; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * @author Blake Eggleston (bdeggleston.github.com) 10 | */ 11 | public class BindingsTemplate implements JsonTemplate { 12 | @Override 13 | public RexProBindings deserialize(JsonNode json) { 14 | return new RexProBindings((Map) JsonConverter.fromJsonNode(json)); 15 | } 16 | 17 | @Override 18 | public JsonNode serialize(RexProBindings src) { 19 | return JsonConverter.toJsonNode(src); 20 | } 21 | 22 | 23 | public static BindingsTemplate instance = new BindingsTemplate(); 24 | static public BindingsTemplate getInstance() { 25 | return instance; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/JsonTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates; 2 | 3 | import org.codehaus.jackson.JsonNode; 4 | 5 | /** 6 | * @author Blake Eggleston (bdeggleston.github.com) 7 | */ 8 | public interface JsonTemplate { 9 | public T deserialize(JsonNode json); 10 | public JsonNode serialize(T src); 11 | } 12 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/MetaTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProMessageMeta; 4 | import org.codehaus.jackson.JsonNode; 5 | import org.codehaus.jackson.node.JsonNodeFactory; 6 | import org.codehaus.jackson.node.ObjectNode; 7 | 8 | import java.util.Iterator; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author Blake Eggleston (bdeggleston.github.com) 13 | */ 14 | public class MetaTemplate implements JsonTemplate { 15 | 16 | @Override 17 | public RexProMessageMeta deserialize(JsonNode json) { 18 | RexProMessageMeta meta = new RexProMessageMeta(); 19 | Iterator itr = json.getFieldNames(); 20 | while (itr.hasNext()) { 21 | String key = itr.next(); 22 | JsonNode val = json.get(key); 23 | meta.put(key, JsonConverter.fromJsonNode(val)); 24 | } 25 | return meta; 26 | } 27 | 28 | @Override 29 | public JsonNode serialize(RexProMessageMeta src) { 30 | ObjectNode map = new ObjectNode(JsonNodeFactory.instance); 31 | for (Map.Entry entry: src.entrySet()) { 32 | map.put(entry.getKey(), JsonConverter.toJsonNode(entry.getValue())); 33 | } 34 | return map; 35 | } 36 | 37 | public static MetaTemplate instance = new MetaTemplate(); 38 | static public MetaTemplate getInstance() { 39 | return instance; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/ErrorResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage; 4 | import org.codehaus.jackson.node.ArrayNode; 5 | 6 | public class ErrorResponseMessageTemplate extends RexProMessageTemplate { 7 | 8 | @Override 9 | protected ErrorResponseMessage instantiateMessage() { 10 | return new ErrorResponseMessage(); 11 | } 12 | 13 | @Override 14 | protected void writeMessageArray(ArrayNode array, ErrorResponseMessage message) { 15 | super.writeMessageArray(array, message); 16 | array.add(message.ErrorMessage); 17 | } 18 | 19 | @Override 20 | protected ErrorResponseMessage readMessageArray(ArrayNode array, ErrorResponseMessage msg) { 21 | super.readMessageArray(array, msg); 22 | msg.ErrorMessage = array.get(3).asText(); 23 | return msg; 24 | } 25 | 26 | public static ErrorResponseMessageTemplate instance = new ErrorResponseMessageTemplate(); 27 | static public ErrorResponseMessageTemplate getInstance() { 28 | return instance; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/RexProMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProMessage; 4 | import com.tinkerpop.rexster.protocol.serializer.json.templates.JsonConverter; 5 | import com.tinkerpop.rexster.protocol.serializer.json.templates.JsonTemplate; 6 | import com.tinkerpop.rexster.protocol.serializer.json.templates.MetaTemplate; 7 | import org.codehaus.jackson.JsonNode; 8 | import org.codehaus.jackson.node.ArrayNode; 9 | import org.codehaus.jackson.node.JsonNodeFactory; 10 | 11 | import java.util.UUID; 12 | 13 | public abstract class RexProMessageTemplate implements JsonTemplate { 14 | 15 | protected abstract Message instantiateMessage(); 16 | 17 | protected void writeMessageArray(ArrayNode array, Message message) { 18 | array.add(JsonConverter.toJsonNode(message.Session==null?null:message.sessionAsUUID().toString())); 19 | array.add(JsonConverter.toJsonNode(message.Request==null?null:message.requestAsUUID().toString())); 20 | array.add(MetaTemplate.getInstance().serialize(message.Meta)); 21 | } 22 | 23 | protected Message readMessageArray(final ArrayNode array, final Message msg) { 24 | if (!array.get(0).isNull()) { 25 | msg.setSessionAsUUID(UUID.fromString(array.get(0).getTextValue())); 26 | } 27 | if (!array.get(1).isNull()) { 28 | msg.setRequestAsUUID(UUID.fromString(array.get(1).getTextValue())); 29 | } 30 | msg.Meta = MetaTemplate.getInstance().deserialize(array.get(2)); 31 | return msg; 32 | } 33 | 34 | public JsonNode serialize(Message message) { 35 | ArrayNode msgArray = new ArrayNode(JsonNodeFactory.instance); 36 | writeMessageArray(msgArray, message); 37 | return msgArray; 38 | } 39 | 40 | public Message deserialize(JsonNode json) { 41 | ArrayNode msgArray = (ArrayNode) json; 42 | return readMessageArray(msgArray, instantiateMessage()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/ScriptRequestMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.ScriptRequestMessage; 4 | import com.tinkerpop.rexster.protocol.serializer.json.templates.BindingsTemplate; 5 | import com.tinkerpop.rexster.protocol.serializer.json.templates.JsonConverter; 6 | import org.codehaus.jackson.node.ArrayNode; 7 | 8 | public class ScriptRequestMessageTemplate extends RexProMessageTemplate { 9 | 10 | @Override 11 | protected ScriptRequestMessage instantiateMessage() { 12 | return new ScriptRequestMessage(); 13 | } 14 | 15 | @Override 16 | protected void writeMessageArray(ArrayNode array, ScriptRequestMessage message) { 17 | super.writeMessageArray(array, message); 18 | array.add(JsonConverter.toJsonNode(message.LanguageName)); 19 | array.add(JsonConverter.toJsonNode(message.Script)); 20 | array.add(BindingsTemplate.getInstance().serialize(message.Bindings)); 21 | } 22 | 23 | @Override 24 | protected ScriptRequestMessage readMessageArray(ArrayNode array, ScriptRequestMessage msg) { 25 | super.readMessageArray(array, msg); 26 | msg.LanguageName = array.get(3).asText(); 27 | msg.Script = array.get(4).asText(); 28 | msg.Bindings = BindingsTemplate.getInstance().deserialize(array.get(5)); 29 | return msg; 30 | } 31 | 32 | public static ScriptRequestMessageTemplate instance = new ScriptRequestMessageTemplate(); 33 | static public ScriptRequestMessageTemplate getInstance() { 34 | return instance; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/ScriptResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.gremlin.converter.SerializedResultConverter; 4 | import com.tinkerpop.rexster.protocol.msg.ScriptResponseMessage; 5 | import com.tinkerpop.rexster.protocol.serializer.json.templates.BindingsTemplate; 6 | import com.tinkerpop.rexster.protocol.serializer.json.templates.JsonConverter; 7 | import org.codehaus.jackson.node.ArrayNode; 8 | 9 | public class ScriptResponseMessageTemplate extends RexProMessageTemplate { 10 | 11 | @Override 12 | protected ScriptResponseMessage instantiateMessage() { 13 | return new ScriptResponseMessage(); 14 | } 15 | 16 | @Override 17 | protected void writeMessageArray(ArrayNode array, ScriptResponseMessage message) { 18 | super.writeMessageArray(array, message); 19 | array.add(JsonConverter.toJsonNode(SerializedResultConverter.convert(message.Results.get()))); 20 | array.add(BindingsTemplate.getInstance().serialize(message.Bindings)); 21 | } 22 | 23 | @Override 24 | protected ScriptResponseMessage readMessageArray(ArrayNode array, ScriptResponseMessage msg) { 25 | super.readMessageArray(array, msg); 26 | msg.Results.set(JsonConverter.fromJsonNode(array.get(3))); 27 | msg.Bindings = BindingsTemplate.getInstance().deserialize(array.get(4)); 28 | return msg; 29 | } 30 | 31 | public static ScriptResponseMessageTemplate instance = new ScriptResponseMessageTemplate(); 32 | static public ScriptResponseMessageTemplate getInstance() { 33 | return instance; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/SessionRequestMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.SessionRequestMessage; 4 | import org.codehaus.jackson.node.ArrayNode; 5 | 6 | public class SessionRequestMessageTemplate extends RexProMessageTemplate { 7 | 8 | @Override 9 | protected SessionRequestMessage instantiateMessage() { 10 | return new SessionRequestMessage(); 11 | } 12 | 13 | @Override 14 | protected void writeMessageArray(ArrayNode array, SessionRequestMessage message) { 15 | super.writeMessageArray(array, message); 16 | array.add(message.Username); 17 | array.add(message.Password); 18 | } 19 | 20 | @Override 21 | protected SessionRequestMessage readMessageArray(ArrayNode array, SessionRequestMessage msg) { 22 | super.readMessageArray(array, msg); 23 | msg.Username = array.get(3).asText(); 24 | msg.Password = array.get(4).asText(); 25 | return msg; 26 | } 27 | 28 | public static SessionRequestMessageTemplate instance = new SessionRequestMessageTemplate(); 29 | static public SessionRequestMessageTemplate getInstance() { 30 | return instance; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/json/templates/messages/SessionResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.json.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.SessionResponseMessage; 4 | import com.tinkerpop.rexster.protocol.serializer.json.templates.JsonConverter; 5 | import org.codehaus.jackson.node.ArrayNode; 6 | 7 | import java.util.ArrayList; 8 | 9 | public class SessionResponseMessageTemplate extends RexProMessageTemplate { 10 | 11 | @Override 12 | protected SessionResponseMessage instantiateMessage() { 13 | return new SessionResponseMessage(); 14 | } 15 | 16 | @Override 17 | protected void writeMessageArray(ArrayNode array, SessionResponseMessage message) { 18 | super.writeMessageArray(array, message); 19 | array.add(JsonConverter.toJsonNode(message.Languages)); 20 | } 21 | 22 | @Override 23 | protected SessionResponseMessage readMessageArray(ArrayNode array, SessionResponseMessage msg) { 24 | super.readMessageArray(array, msg); 25 | ArrayList languages = (ArrayList) JsonConverter.fromJsonNode(array.get(3)); 26 | msg.Languages = languages.toArray(new String[languages.size()]); 27 | return msg; 28 | } 29 | 30 | public static SessionResponseMessageTemplate instance = new SessionResponseMessageTemplate(); 31 | static public SessionResponseMessageTemplate getInstance() { 32 | return instance; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/ResultsTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProScriptResult; 4 | import org.msgpack.packer.Packer; 5 | import org.msgpack.template.AbstractTemplate; 6 | import org.msgpack.template.Templates; 7 | import org.msgpack.unpacker.Unpacker; 8 | 9 | import java.io.IOException; 10 | 11 | /** 12 | * Template for interpreter output 13 | * 14 | * @author Blake Eggleston (bdeggleston.github.com) 15 | */ 16 | public class ResultsTemplate extends AbstractTemplate { 17 | @Override 18 | public void write(Packer pk, RexProScriptResult v) throws IOException { 19 | write(pk, v, false); 20 | } 21 | 22 | public void write(final Packer pk, final RexProScriptResult v, final boolean required) throws IOException { 23 | RexProScriptResult result = v; 24 | if (result == null) { 25 | result = new RexProScriptResult(); 26 | } 27 | try{ 28 | ResultsConverter.serializeObject(result.get(), pk); 29 | } catch (Exception ex) { 30 | throw new IOException(ex.toString()); 31 | } 32 | } 33 | 34 | @Override 35 | public RexProScriptResult read(Unpacker u, RexProScriptResult to) throws IOException { 36 | return read(u, to, false); 37 | } 38 | 39 | public RexProScriptResult read(final Unpacker u, final RexProScriptResult to, final boolean required) throws IOException { 40 | if (!required && u.trySkipNil()) { 41 | return null; 42 | } 43 | 44 | RexProScriptResult result; 45 | if(to != null) { 46 | result = to; 47 | } else { 48 | result = new RexProScriptResult(); 49 | } 50 | 51 | result.set(ResultsConverter.deserializeObject(u.read(Templates.TValue))); 52 | return result; 53 | } 54 | 55 | public static ResultsTemplate instance = new ResultsTemplate(); 56 | static public ResultsTemplate getInstance() { 57 | return instance; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/messages/ErrorResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage; 4 | import org.msgpack.packer.Packer; 5 | import org.msgpack.unpacker.Unpacker; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public class ErrorResponseMessageTemplate extends RexProMessageTemplate { 13 | 14 | protected int messageArraySize() { 15 | return super.messageArraySize() + 1; 16 | } 17 | 18 | protected ErrorResponseMessage instantiateMessage() { 19 | return new ErrorResponseMessage(); 20 | } 21 | 22 | protected void writeMessageArray(final Packer pk, final ErrorResponseMessage msg) throws IOException { 23 | super.writeMessageArray(pk, msg); 24 | pk.write(msg.ErrorMessage); 25 | } 26 | 27 | protected ErrorResponseMessage readMessageArray(final Unpacker un, final ErrorResponseMessage msg) throws IOException { 28 | ErrorResponseMessage message = super.readMessageArray(un, msg); 29 | message.ErrorMessage = un.trySkipNil()?null:un.readString(); 30 | return message; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/messages/MsgPackScriptResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.RexProScriptResult; 4 | import com.tinkerpop.rexster.protocol.msg.ScriptResponseMessage; 5 | import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.BindingsTemplate; 6 | import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.ResultsTemplate; 7 | import org.msgpack.packer.Packer; 8 | import org.msgpack.unpacker.Unpacker; 9 | 10 | import java.io.IOException; 11 | 12 | /** 13 | * @author Blake Eggleston (bdeggleston.github.com) 14 | */ 15 | public class MsgPackScriptResponseMessageTemplate extends RexProMessageTemplate { 16 | 17 | protected int messageArraySize() { 18 | return super.messageArraySize() + 2; 19 | } 20 | 21 | @Override 22 | protected ScriptResponseMessage instantiateMessage() { 23 | return new ScriptResponseMessage(); 24 | } 25 | 26 | @Override 27 | protected ScriptResponseMessage readMessageArray(final Unpacker un, final ScriptResponseMessage msg) throws IOException { 28 | ScriptResponseMessage message = super.readMessageArray(un, msg); 29 | RexProScriptResult scriptResult = ResultsTemplate.getInstance().read(un, null); 30 | message.Results.set(scriptResult == null ? null : scriptResult.get()); 31 | message.Bindings = BindingsTemplate.getInstance().read(un, null); 32 | return message; 33 | } 34 | 35 | @Override 36 | protected void writeMessageArray(final Packer pk, final ScriptResponseMessage msg) throws IOException { 37 | super.writeMessageArray(pk, msg); 38 | ResultsTemplate.getInstance().write(pk, msg.Results); 39 | BindingsTemplate.getInstance().write(pk, msg.Bindings); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/messages/ScriptRequestMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.ScriptRequestMessage; 4 | import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.BindingsTemplate; 5 | import org.msgpack.packer.Packer; 6 | import org.msgpack.unpacker.Unpacker; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * @author Blake Eggleston (bdeggleston.github.com) 12 | */ 13 | public class ScriptRequestMessageTemplate extends RexProMessageTemplate { 14 | protected int messageArraySize() { 15 | return super.messageArraySize() + 3; 16 | } 17 | 18 | protected ScriptRequestMessage instantiateMessage() { 19 | return new ScriptRequestMessage(); 20 | } 21 | 22 | protected void writeMessageArray(final Packer pk, final ScriptRequestMessage msg) throws IOException { 23 | super.writeMessageArray(pk, msg); 24 | pk.write(msg.LanguageName); 25 | pk.write(msg.Script); 26 | BindingsTemplate.getInstance().write(pk, msg.Bindings); 27 | } 28 | 29 | protected ScriptRequestMessage readMessageArray(final Unpacker un, final ScriptRequestMessage msg) throws IOException { 30 | ScriptRequestMessage message = super.readMessageArray(un, msg); 31 | message.LanguageName = un.trySkipNil()?null:un.readString(); 32 | message.Script = un.trySkipNil()?null:un.readString(); 33 | message.Bindings = BindingsTemplate.getInstance().read(un, null); 34 | return message; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/messages/SessionRequestMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.SessionRequestMessage; 4 | import org.msgpack.packer.Packer; 5 | import org.msgpack.unpacker.Unpacker; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public class SessionRequestMessageTemplate extends RexProMessageTemplate { 13 | 14 | protected int messageArraySize() { 15 | return super.messageArraySize() + 2; 16 | } 17 | 18 | protected SessionRequestMessage instantiateMessage() { 19 | return new SessionRequestMessage(); 20 | } 21 | 22 | protected void writeMessageArray(final Packer pk, final SessionRequestMessage msg) throws IOException { 23 | super.writeMessageArray(pk, msg); 24 | pk.write(msg.Username); 25 | pk.write(msg.Password); 26 | } 27 | 28 | protected SessionRequestMessage readMessageArray(final Unpacker un, final SessionRequestMessage msg) throws IOException { 29 | SessionRequestMessage message = super.readMessageArray(un, msg); 30 | message.Username = un.trySkipNil()?null:un.readString(); 31 | message.Password = un.trySkipNil()?null:un.readString(); 32 | return message; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /rexster-protocol/src/main/java/com/tinkerpop/rexster/protocol/serializer/msgpack/templates/messages/SessionResponseMessageTemplate.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages; 2 | 3 | import com.tinkerpop.rexster.protocol.msg.SessionResponseMessage; 4 | import org.msgpack.packer.Packer; 5 | import org.msgpack.unpacker.Unpacker; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * @author Blake Eggleston (bdeggleston.github.com) 11 | */ 12 | public class SessionResponseMessageTemplate extends RexProMessageTemplate { 13 | 14 | protected int messageArraySize() { 15 | return super.messageArraySize() + 1; 16 | } 17 | 18 | protected SessionResponseMessage instantiateMessage() { 19 | return new SessionResponseMessage(); 20 | } 21 | 22 | protected void writeMessageArray(final Packer pk, final SessionResponseMessage msg) throws IOException { 23 | super.writeMessageArray(pk, msg); 24 | pk.writeArrayBegin(msg.Languages.length); 25 | for (String lang : msg.Languages) { 26 | pk.write(lang); 27 | } 28 | pk.writeArrayEnd(); 29 | } 30 | 31 | protected SessionResponseMessage readMessageArray(final Unpacker un, final SessionResponseMessage msg) throws IOException { 32 | SessionResponseMessage message = super.readMessageArray(un, msg); 33 | if (!un.trySkipNil()){ 34 | message.Languages = new String[un.readArrayBegin()]; 35 | for (int i=0; i() {{ add("groovy"); }}); 32 | 33 | Assert.assertNotNull(msg); 34 | Assert.assertEquals(request, msg.Request); 35 | Assert.assertEquals("groovy", msg.Languages[0]); 36 | 37 | final SessionResponseMessage newMsg = MessageUtil.createNewSession(request, new ArrayList() {{ add("groovy"); }}); 38 | Assert.assertFalse(Arrays.equals(newMsg.Session, msg.Session)); 39 | } 40 | 41 | @Test 42 | public void createEmptySession() { 43 | byte [] request = "request".getBytes(); 44 | final SessionResponseMessage msg = MessageUtil.createEmptySession(request); 45 | 46 | Assert.assertNotNull(msg); 47 | Assert.assertEquals(request, msg.Request); 48 | Assert.assertEquals(0, msg.Languages.length); 49 | Assert.assertTrue(Arrays.equals(BitWorks.convertUUIDToByteArray(RexProMessage.EMPTY_SESSION), msg.Session)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /rexster-server/bin/rexster.bat: -------------------------------------------------------------------------------- 1 | :: Windows launcher script for Rexster 2 | @echo off 3 | 4 | cd %CD%\..\target\ 5 | 6 | set TARGET= 7 | 8 | for /f "tokens=*" %%a in ('dir /b /ad') do ( 9 | if exist "%%a\bin\rexster.bat" set TARGET=%%a 10 | ) 11 | 12 | cd %TARGET%\bin\ 13 | call rexster.bat %* -------------------------------------------------------------------------------- /rexster-server/bin/rexster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "$0" )" && pwd )" 4 | 5 | $DIR/../target/rexster-server-*-standalone/bin/rexster.sh $@ 6 | -------------------------------------------------------------------------------- /rexster-server/config/init.groovy: -------------------------------------------------------------------------------- 1 | Gremlin.defineStep('codeveloper',[Vertex,Pipe], {_().sideEffect{x = it}.out('created').in('created').filter{!x.equals(it)}}) 2 | 3 | def isMarko(v) { 4 | v.getProperty("name").equals("marko") 5 | } 6 | 7 | -------------------------------------------------------------------------------- /rexster-server/data/graph-example-1.ntriple: -------------------------------------------------------------------------------- 1 | . 2 | . 3 | . 4 | 5 | . 6 | . 7 | 8 | . 9 | 10 | "marko"^^ . 11 | "29"^^ . 12 | 13 | "vadas"^^ . 14 | "27"^^ . 15 | 16 | "lop"^^ . 17 | "java"^^ . 18 | 19 | "josh"^^ . 20 | "32"^^ . 21 | 22 | "ripple"^^ . 23 | "java"^^ . 24 | 25 | "peter"^^ . 26 | "35"^^ . -------------------------------------------------------------------------------- /rexster-server/data/graph-example-1/tinkergraph-metadata.dat: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rexster-server/data/graph-example-1/tinkergraph.json: -------------------------------------------------------------------------------- 1 | {"mode":"EXTENDED","vertices":[{"name":{"type":"string","value":"lop"},"lang":{"type":"string","value":"java"},"_id":"3","_type":"vertex"},{"name":{"type":"string","value":"vadas"},"age":{"type":"integer","value":27},"_id":"2","_type":"vertex"},{"name":{"type":"string","value":"marko"},"age":{"type":"integer","value":29},"_id":"1","_type":"vertex"},{"name":{"type":"string","value":"peter"},"age":{"type":"integer","value":35},"_id":"6","_type":"vertex"},{"name":{"type":"string","value":"ripple"},"lang":{"type":"string","value":"java"},"_id":"5","_type":"vertex"},{"name":{"type":"string","value":"josh"},"age":{"type":"integer","value":32},"_id":"4","_type":"vertex"}],"edges":[{"weight":{"type":"float","value":1.0},"_id":"10","_type":"edge","_outV":"4","_inV":"5","_label":"created"},{"weight":{"type":"float","value":0.5},"_id":"7","_type":"edge","_outV":"1","_inV":"2","_label":"knows"},{"weight":{"type":"float","value":0.4},"_id":"9","_type":"edge","_outV":"1","_inV":"3","_label":"created"},{"weight":{"type":"float","value":1.0},"_id":"8","_type":"edge","_outV":"1","_inV":"4","_label":"knows"},{"weight":{"type":"float","value":0.4},"_id":"11","_type":"edge","_outV":"4","_inV":"3","_label":"created"},{"weight":{"type":"float","value":0.2},"_id":"12","_type":"edge","_outV":"6","_inV":"3","_label":"created"}]} -------------------------------------------------------------------------------- /rexster-server/data/graph-example-2/tinkergraph-metadata.dat: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/namespaces.dat: -------------------------------------------------------------------------------- 1 | nnf+http://www.w3.org/1999/02/22-rdf-syntax-ns#rdf%http://www.w3.org/2000/01/rdf-schema#rdfshttp://www.w3.org/2002/07/owl#owl!http://www.w3.org/2001/XMLSchema#xsdhttp://xmlns.com/foaf/0.1/foaf -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/triples-posc.alloc: -------------------------------------------------------------------------------- 1 | anf@ -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/triples-spoc.alloc: -------------------------------------------------------------------------------- 1 | anf@ -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/triples.prop: -------------------------------------------------------------------------------- 1 | #triple indexes meta-data, DO NOT EDIT! 2 | #Fri Jul 08 11:38:28 EDT 2011 3 | version=10 4 | triple-indexes=spoc,posc 5 | -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/txn-status: -------------------------------------------------------------------------------- 1 | NONE -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/values.dat: -------------------------------------------------------------------------------- 1 | ndfhttp://tinkerpop.com#1 2 | knows24 created356 name!http://www.w3.org/2001/XMLSchema#  string  markoage int29  vadas27  lop lang 3 |  java 4 |  josh32  ripple  peter35 -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/values.hash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/data/sailgraph/values.hash -------------------------------------------------------------------------------- /rexster-server/data/sailgraph/values.id: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/data/sailgraph/values.id -------------------------------------------------------------------------------- /rexster-server/src/assembly/standalone.xml: -------------------------------------------------------------------------------- 1 | 2 | standalone 3 | 4 | dir 5 | 6 | false 7 | 8 | 9 | 10 | src/main/bin 11 | /bin 12 | 0755 13 | 14 | 15 | src/main/resources/com/tinkerpop/rexster 16 | /bin 17 | 18 | 19 | target/*.jar 20 | /lib 21 | 22 | 23 | src/main/ext 24 | /ext 25 | 26 | 27 | 28 | target/classes/public 29 | /public 30 | 31 | *.html 32 | favicon.ico 33 | img/** 34 | css/** 35 | javascript/** 36 | 37 | 38 | 39 | config 40 | /config 41 | 42 | 43 | data 44 | /data 45 | 46 | 47 | 48 | 49 | 50 | /lib 51 | false 52 | compile 53 | 54 | 55 | /lib 56 | false 57 | provided 58 | 59 | 60 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/GraphResourceIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import com.sun.jersey.api.client.ClientRequest; 4 | import com.sun.jersey.api.client.ClientResponse; 5 | import org.codehaus.jettison.json.JSONObject; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | public class GraphResourceIntegrationTest extends AbstractGraphResourceIntegrationTest { 10 | 11 | public GraphResourceIntegrationTest() throws Exception { 12 | super(); 13 | } 14 | 15 | @Test 16 | public void getGraph() { 17 | for (GraphTestHolder tg : this.testGraphs) { 18 | ClientRequest request = ClientRequest.create().build(createUri("/" + tg.getGraphName()), "GET"); 19 | ClientResponse response = this.client.handle(request); 20 | 21 | Assert.assertNotNull(response); 22 | Assert.assertEquals(ClientResponse.Status.OK, response.getClientResponseStatus()); 23 | 24 | JSONObject json = response.getEntity(JSONObject.class); 25 | Assert.assertNotNull(json); 26 | Assert.assertTrue(json.has("name")); 27 | Assert.assertEquals(tg.getGraphName(), json.optString("name")); 28 | Assert.assertTrue(json.has(Tokens.QUERY_TIME)); 29 | Assert.assertTrue(json.optDouble(Tokens.QUERY_TIME) > 0); 30 | Assert.assertTrue(json.has(Tokens.UP_TIME)); 31 | Assert.assertTrue(json.has(Tokens.READ_ONLY)); 32 | Assert.assertTrue(json.has("version")); 33 | Assert.assertTrue(json.has("type")); 34 | Assert.assertEquals(tg.getGraphType(), json.optString("type")); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/GraphTestHolder.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import com.tinkerpop.blueprints.Features; 4 | 5 | import java.lang.reflect.Field; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * Holds references and settings needed for a graph to be tested. 11 | *

12 | * This holder is created as a result of the configurations in the rexster-integration-test.xml file which 13 | * is used as configuration for the integration tests. The type of graph will play a role in the tests 14 | * that will execute. 15 | */ 16 | public class GraphTestHolder { 17 | 18 | private final String graphName; 19 | 20 | private final String graphType; 21 | 22 | private final Map vertexIdSet = new HashMap(); 23 | 24 | private final Map edgeIdSet = new HashMap(); 25 | 26 | private final Features features = new Features(); 27 | 28 | public GraphTestHolder(final String graphName, final String graphType, final Map graphFeatures) { 29 | this.graphName = graphName; 30 | this.graphType = graphType; 31 | 32 | for(Map.Entry entry : graphFeatures.entrySet()) { 33 | try { 34 | Field field = Features.class.getField(entry.getKey()); 35 | field.set(features, entry.getValue().booleanValue()); 36 | } catch (Exception e) { 37 | throw new RuntimeException("There is disparity between the features returned from Rexster and the Features class."); 38 | } 39 | } 40 | } 41 | 42 | public String getGraphName() { 43 | return graphName; 44 | } 45 | 46 | public String getGraphType() { 47 | return graphType; 48 | } 49 | 50 | public Features getFeatures() { 51 | return features; 52 | } 53 | 54 | public Map getVertexIdSet() { 55 | return this.vertexIdSet; 56 | } 57 | 58 | public Map getEdgeIdSet() { 59 | return edgeIdSet; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/json/RexsterClientIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.json; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.protocol.serializer.json.JSONSerializer; 6 | import com.tinkerpop.rexster.rexpro.AbstractRexsterClientIntegrationTest; 7 | 8 | public class RexsterClientIntegrationTest extends AbstractRexsterClientIntegrationTest { 9 | 10 | @Override 11 | public boolean supportsPrimitiveKeys() { 12 | return false; 13 | } 14 | 15 | @Override 16 | public RexsterClient getClient() throws Exception { 17 | RexsterClient client = RexsterClientFactory.open(); 18 | client.setSerializer(JSONSerializer.SERIALIZER_ID); 19 | return client; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/json/ScriptRequestIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.json; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.protocol.serializer.json.JSONSerializer; 6 | import com.tinkerpop.rexster.rexpro.AbstractScriptRequestIntegrationTest; 7 | 8 | public class ScriptRequestIntegrationTest extends AbstractScriptRequestIntegrationTest { 9 | 10 | @Override 11 | public RexsterClient getClient() throws Exception { 12 | RexsterClient client = RexsterClientFactory.open(); 13 | client.setSerializer(JSONSerializer.SERIALIZER_ID); 14 | return client; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/json/SessionRequestIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.json; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.protocol.serializer.json.JSONSerializer; 6 | import com.tinkerpop.rexster.rexpro.AbstractSessionRequestMessageTest; 7 | 8 | public class SessionRequestIntegrationTest extends AbstractSessionRequestMessageTest{ 9 | 10 | @Override 11 | public RexsterClient getClient() throws Exception { 12 | RexsterClient client = RexsterClientFactory.open(); 13 | client.setSerializer(JSONSerializer.SERIALIZER_ID); 14 | return client; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/msgpack/RexsterClientIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.msgpack; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.rexpro.AbstractRexsterClientIntegrationTest; 6 | 7 | public class RexsterClientIntegrationTest extends AbstractRexsterClientIntegrationTest { 8 | 9 | @Override 10 | public boolean supportsPrimitiveKeys() { 11 | return true; 12 | } 13 | 14 | @Override 15 | public RexsterClient getClient() throws Exception { 16 | return RexsterClientFactory.open(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/msgpack/ScriptRequestIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.msgpack; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.rexpro.AbstractScriptRequestIntegrationTest; 6 | 7 | public class ScriptRequestIntegrationTest extends AbstractScriptRequestIntegrationTest { 8 | 9 | @Override 10 | public RexsterClient getClient() throws Exception { 11 | return RexsterClientFactory.open(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /rexster-server/src/integration/java/com/tinkerpop/rexster/rexpro/msgpack/SessionRequestIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.rexpro.msgpack; 2 | 3 | import com.tinkerpop.rexster.client.RexsterClient; 4 | import com.tinkerpop.rexster.client.RexsterClientFactory; 5 | import com.tinkerpop.rexster.rexpro.AbstractSessionRequestMessageTest; 6 | 7 | public class SessionRequestIntegrationTest extends AbstractSessionRequestMessageTest { 8 | 9 | @Override 10 | public RexsterClient getClient() throws Exception { 11 | return RexsterClientFactory.open(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /rexster-server/src/main/bin/README.txt: -------------------------------------------------------------------------------- 1 | -= Rexster: A Graph Server =- 2 | 3 | Rexster is a multi-faceted graph server for Blueprints-enabled graphs. 4 | Rexster provides a flexible extensions model for server-side components. 5 | Rexster has a browser-based interface called The Dog House and a REPL console. 6 | 7 | -------------------------------------------------------------------------------- /rexster-server/src/main/bin/rexster.bat: -------------------------------------------------------------------------------- 1 | :: Windows launcher script for Rexster 2 | @echo off 3 | 4 | set work=%CD% 5 | 6 | if [%work:~-3%]==[bin] cd .. 7 | 8 | set LIBDIR=lib 9 | set EXTDIR=ext/* 10 | set PUBDIR=public 11 | 12 | set EXTRA= 13 | 14 | if "%1"=="-s" set EXTRA="-wr %PUBDIR%" 15 | 16 | cd ext 17 | 18 | FOR /D /r %%i in (*) do ( 19 | set EXTDIR=%EXTDIR%;%%i/* 20 | ) 21 | 22 | cd .. 23 | 24 | set JAVA_OPTIONS=-Xms32m -Xmx512m 25 | 26 | :: Launch the application 27 | java %JAVA_OPTIONS% %JAVA_ARGS% -cp %LIBDIR%/*;%EXTDIR%; com.tinkerpop.rexster.Application %* %EXTRA% -------------------------------------------------------------------------------- /rexster-server/src/main/bin/rexster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # From: http://stackoverflow.com/a/246128 4 | # - To resolve finding the directory after symlinks 5 | SOURCE="${BASH_SOURCE[0]}" 6 | while [ -h "$SOURCE" ]; do 7 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 8 | SOURCE="$(readlink "$SOURCE")" 9 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 10 | done 11 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 12 | 13 | CP=$( echo $DIR/../lib/*.jar . | sed 's/ /:/g') 14 | CP=$CP:$(find -L $DIR/../ext/ -name "*.jar" | tr '\n' ':') 15 | 16 | REXSTER_EXT=../ext 17 | 18 | PUBLIC=$DIR/../public/ 19 | EXTRA= 20 | 21 | if [ "$1" = "-s" ] ; then 22 | EXTRA="-wr $PUBLIC" 23 | fi 24 | 25 | # Find Java 26 | if [ "$JAVA_HOME" = "" ] ; then 27 | JAVA="java -server" 28 | else 29 | JAVA="$JAVA_HOME/bin/java -server" 30 | fi 31 | 32 | # Set Java options 33 | if [ "$JAVA_OPTIONS" = "" ] ; then 34 | JAVA_OPTIONS="-Xms32m -Xmx512m" 35 | fi 36 | 37 | # Execute the application and return its exit code 38 | exec $JAVA $JAVA_OPTIONS -cp $CP com.tinkerpop.rexster.Application $@ $EXTRA 39 | -------------------------------------------------------------------------------- /rexster-server/src/main/ext/README.txt: -------------------------------------------------------------------------------- 1 | Place all extension jars (and their dependencies) in this directory and they will be loaded when ReXster is started. 2 | Be sure that they are also activated in the rexster.xml configuration file and listed in com.tinkerpop.rexster.extension.RexsterExtension in main/resources/META-INF/services. 3 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/RexsterMediaType.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import javax.ws.rs.core.MediaType; 4 | 5 | /** 6 | * Custom media types for rexster. 7 | * 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | */ 10 | public class RexsterMediaType { 11 | public final static String APPLICATION_REXSTER_TYPED_JSON = "application/vnd.rexster-typed-v1+json"; 12 | public final static MediaType APPLICATION_REXSTER_TYPED_JSON_TYPE = new 13 | MediaType("application", "vnd.rexster-typed-v1+json"); 14 | 15 | public final static String APPLICATION_REXSTER_JSON = "application/vnd.rexster-v1+json"; 16 | public final static MediaType APPLICATION_REXSTER_JSON_TYPE = new 17 | MediaType("application", "vnd.rexster-v1+json"); 18 | } 19 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/RootResource.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import com.tinkerpop.rexster.extension.HttpMethod; 4 | import com.tinkerpop.rexster.server.RexsterApplication; 5 | 6 | import javax.ws.rs.GET; 7 | import javax.ws.rs.OPTIONS; 8 | import javax.ws.rs.Path; 9 | import javax.ws.rs.Produces; 10 | import javax.ws.rs.core.MediaType; 11 | import javax.ws.rs.core.Response; 12 | 13 | /** 14 | * The root resources for Rexster which shows the splash page for Rexster as HTML. 15 | * 16 | * @author Stephen Mallette (http://stephen.genoprime.com) 17 | */ 18 | @Path("/") 19 | public class RootResource extends BaseResource { 20 | public RootResource() { 21 | super(null); 22 | } 23 | 24 | public RootResource(final RexsterApplication ra) { 25 | super(ra); 26 | } 27 | 28 | @OPTIONS 29 | public Response optionsRoot() { 30 | return buildOptionsResponse(HttpMethod.GET.toString()); 31 | } 32 | 33 | @GET 34 | @Produces({MediaType.TEXT_HTML}) 35 | public Response getRoot() { 36 | StringBuffer sb = new StringBuffer(); 37 | sb.append(""); 38 | sb.append("Rexster"); 39 | sb.append(""); 40 | sb.append("

"); 41 | sb.append("
"); 42 | sb.append("

Rexster - " + Tokens.REXSTER_VERSION + "

"); 43 | sb.append("

The Dog House

"); 44 | sb.append("

REST API

"); 45 | sb.append("
"); 46 | sb.append(""); 47 | sb.append(""); 48 | 49 | return Response.ok(sb.toString()).build(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/LinkedDataSailGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | /** 4 | * @author Joshua Shinavier (http://fortytwo.net) 5 | */ 6 | public class LinkedDataSailGraphConfiguration extends AbstractSailGraphConfiguration { 7 | public LinkedDataSailGraphConfiguration() { 8 | this.sailType = AbstractSailGraphConfiguration.SAIL_TYPE_LINKED_DATA; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/MemoryStoreSailGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public class MemoryStoreSailGraphConfiguration extends AbstractSailGraphConfiguration { 7 | 8 | public MemoryStoreSailGraphConfiguration() { 9 | this.sailType = AbstractSailGraphConfiguration.SAIL_TYPE_MEMORY; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/NativeStoreSailGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public class NativeStoreSailGraphConfiguration extends AbstractSailGraphConfiguration { 7 | public NativeStoreSailGraphConfiguration() { 8 | this.sailType = AbstractSailGraphConfiguration.SAIL_TYPE_NATIVE; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/RexsterGraphGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.blueprints.impls.rexster.RexsterGraph; 5 | import com.tinkerpop.rexster.Tokens; 6 | 7 | /** 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | */ 10 | public class RexsterGraphGraphConfiguration implements GraphConfiguration { 11 | 12 | public static final int DEFAULT_BUFFER_SIZE = 100; 13 | 14 | public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { 15 | 16 | final String rexsterGraphUriToConnectTo; 17 | final int bufferSize; 18 | 19 | try { 20 | rexsterGraphUriToConnectTo = context.getProperties().getString(Tokens.REXSTER_GRAPH_LOCATION, null); 21 | bufferSize = context.getProperties().getInt(Tokens.REXSTER_GRAPH_BUFFER_SIZE, DEFAULT_BUFFER_SIZE); 22 | } catch (Exception ex) { 23 | throw new GraphConfigurationException(ex); 24 | } 25 | 26 | RexsterGraph graph = null; 27 | try { 28 | graph = new RexsterGraph(rexsterGraphUriToConnectTo, bufferSize); 29 | } catch (RuntimeException rte) { 30 | // if the remote server is down just ignore the error for the moment. let 31 | // Rexster think the graph configuration is good. the server may be up later. 32 | } 33 | 34 | return graph; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/SparkseeGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.blueprints.impls.sparksee.SparkseeGraph; 5 | import com.tinkerpop.rexster.Tokens; 6 | import org.apache.commons.configuration.HierarchicalConfiguration; 7 | import org.apache.commons.configuration.SubnodeConfiguration; 8 | 9 | /** 10 | * @author Stephen Mallette (http://stephen.genoprime.com) 11 | * @author Sergio Gomez Vilamor (https://github.com/sgomezvillamor) 12 | */ 13 | public class SparkseeGraphConfiguration implements GraphConfiguration { 14 | 15 | private final static String SPARKSEE_CONFIGURATION_PROPERTY = "config-file"; 16 | 17 | public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { 18 | 19 | final String graphFile = context.getProperties().getString(Tokens.REXSTER_GRAPH_LOCATION, null); 20 | 21 | if (graphFile == null || graphFile.length() == 0) { 22 | throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_LOCATION); 23 | } 24 | 25 | // get the section of the xml configuration 26 | final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) context.getProperties(); 27 | SubnodeConfiguration dexSpecificConfiguration; 28 | String sparkseeConfig; 29 | 30 | try { 31 | // allow the properties to be optional 32 | dexSpecificConfiguration = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); 33 | sparkseeConfig = dexSpecificConfiguration.getString(SPARKSEE_CONFIGURATION_PROPERTY, null); 34 | } catch (IllegalArgumentException iae) { 35 | sparkseeConfig = null; 36 | } 37 | 38 | try { 39 | return new SparkseeGraph(graphFile, sparkseeConfig); 40 | } catch (Exception ex) { 41 | throw new GraphConfigurationException(ex); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/config/SparqlRepositorySailGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | /** 4 | * @author Stephen Mallette (http://stephen.genoprime.com) 5 | */ 6 | public class SparqlRepositorySailGraphConfiguration extends AbstractSailGraphConfiguration { 7 | public SparqlRepositorySailGraphConfiguration() { 8 | this.sailType = AbstractSailGraphConfiguration.SAIL_TYPE_SPARQL; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/gremlin/GremlinEvaluationJob.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.gremlin; 2 | 3 | import java.io.StringWriter; 4 | import java.io.Writer; 5 | 6 | /** 7 | * Data structure keeping a script to be evaluated and its result/output together. 8 | *

9 | * Credit to Neo Technology (http://neotechnology.com/) for most of the code related to the 10 | * Gremlin in Rexster. Specifically, this code was borrowed from 11 | * https://github.com/neo4j/webadmin and re-purposed for Rexster's needs. 12 | *

13 | * Original author Jacob Hansson 14 | */ 15 | public class GremlinEvaluationJob { 16 | 17 | protected String script; 18 | protected Object result; 19 | protected volatile boolean complete = false; 20 | 21 | /** 22 | * The scriptengine error and out streams are directed into this string 23 | * writer. 24 | */ 25 | protected StringWriter outputWriter; 26 | 27 | public GremlinEvaluationJob(String script) { 28 | this.script = script; 29 | } 30 | 31 | public boolean isComplete() { 32 | return complete; 33 | } 34 | 35 | public void setResult(Object result) { 36 | this.result = result; 37 | this.complete = true; 38 | } 39 | 40 | public Object getResult() { 41 | return this.result; 42 | } 43 | 44 | public String getScript() { 45 | return this.script; 46 | } 47 | 48 | public Writer getOutputWriter() { 49 | if (this.outputWriter == null) { 50 | this.outputWriter = new StringWriter(); 51 | } 52 | 53 | return this.outputWriter; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/gremlin/GremlinFactory.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.gremlin; 2 | 3 | import com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine; 4 | 5 | import javax.script.Bindings; 6 | import javax.script.ScriptContext; 7 | import javax.script.ScriptEngine; 8 | import javax.script.SimpleBindings; 9 | import java.util.Map; 10 | 11 | /** 12 | * Builds Gremlin evaluators. 13 | *

14 | * Credit to Neo Technology (http://neotechnology.com/) for most of the code related to the 15 | * Gremlin in Rexster. Specifically, this code was borrowed from 16 | * https://github.com/neo4j/webadmin and re-purposed for Rexster's needs. 17 | *

18 | * Original author Jacob Hansson 19 | */ 20 | @SuppressWarnings("restriction") 21 | public class GremlinFactory { 22 | 23 | protected volatile static boolean initiated = false; 24 | 25 | public static ScriptEngine createGremlinScriptEngine(Map context) { 26 | try { 27 | ScriptEngine engine = new GremlinGroovyScriptEngine(); 28 | 29 | Bindings bindings = new SimpleBindings(); 30 | bindings.putAll(context); 31 | 32 | engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE); 33 | 34 | return engine; 35 | } catch (Throwable e) { 36 | // Pokemon catch b/c fails here get hidden until the server exits. 37 | e.printStackTrace(); 38 | return null; 39 | } 40 | } 41 | 42 | protected synchronized void ensureInitiated() { 43 | if (initiated == false) { 44 | new GremlinGarbageCollector(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/gremlin/GremlinGarbageCollector.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.gremlin; 2 | 3 | import java.util.Collection; 4 | 5 | /** 6 | * Remove Gremlin sessions that have been idle for too long. 7 | *

8 | * Credit to Neo Technology (http://neotechnology.com/) for most of the code related to the 9 | * Gremlin in Rexster. Specifically, this code was borrowed from 10 | * https://github.com/neo4j/webadmin and re-purposed for Rexster's needs. 11 | *

12 | * Based on Webling garbage collector by Pavel A. Yaskevich then re-purposed by 13 | * Jacob Hansson 14 | */ 15 | public class GremlinGarbageCollector extends Thread { 16 | 17 | long updateInterval = 3000000; // 50 minutes 18 | long maxIdleInterval = 1790000; // 29 minutes 19 | 20 | public GremlinGarbageCollector() { 21 | setDaemon(true); 22 | start(); 23 | } 24 | 25 | @Override 26 | public void run() { 27 | 28 | while (true) { 29 | try { 30 | Thread.sleep(updateInterval); 31 | } catch (InterruptedException e) { 32 | } 33 | 34 | Collection sessionKeys = GremlinSessions.getSessionKeys(); 35 | 36 | for (String sessionKey : sessionKeys) { 37 | // Make sure session exists (otherwise 38 | // GremlinSessions.getSession() will create it) 39 | if (GremlinSessions.hasSessionKey(sessionKey)) { 40 | // If idle time is above our threshold 41 | if (GremlinSessions.findSessionByKey(sessionKey).getIdleTime() > maxIdleInterval) { 42 | // Throw the GremlinSession instance to the wolves 43 | GremlinSessions.destroySession(sessionKey); 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/GrizzlyIoStrategyFactory.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | import org.glassfish.grizzly.IOStrategy; 4 | import org.glassfish.grizzly.strategies.LeaderFollowerNIOStrategy; 5 | import org.glassfish.grizzly.strategies.SameThreadIOStrategy; 6 | import org.glassfish.grizzly.strategies.SimpleDynamicNIOStrategy; 7 | import org.glassfish.grizzly.strategies.WorkerThreadIOStrategy; 8 | 9 | /** 10 | * Creates various IOStrategy implementations for Grizzly. Defaults to leader-follower. 11 | * 12 | * http://grizzly.java.net/nonav/docs/docbkx2.0/html/iostrategies.html 13 | * 14 | * @author Stephen Mallette (http://stephen.genoprime.com) 15 | */ 16 | public class GrizzlyIoStrategyFactory { 17 | 18 | private static final String WORKER = "worker"; 19 | private static final String SAME = "same"; 20 | private static final String DYNAMIC = "dynamic"; 21 | private static final String LEADER_FOLLOWER = "leader-follower"; 22 | 23 | public static IOStrategy createIoStrategy(final String strategy) { 24 | final IOStrategy ioStrategy; 25 | if (strategy.equals(WORKER)) { 26 | ioStrategy = WorkerThreadIOStrategy.getInstance(); 27 | } else if (strategy.equals(SAME)) { 28 | ioStrategy = SameThreadIOStrategy.getInstance(); 29 | } else if (strategy.equals(DYNAMIC)) { 30 | ioStrategy = SimpleDynamicNIOStrategy.getInstance(); 31 | } else if (strategy.equals(LEADER_FOLLOWER)) { 32 | ioStrategy = LeaderFollowerNIOStrategy.getInstance(); 33 | } else { 34 | ioStrategy = LeaderFollowerNIOStrategy.getInstance(); 35 | } 36 | 37 | return ioStrategy; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/RexsterCommandLine.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | 4 | import org.apache.commons.cli.CommandLine; 5 | import org.apache.commons.cli.Options; 6 | 7 | /** 8 | * Holds command line options and parameters. 9 | * 10 | * @author Stephen Mallette (http://stephen.genoprime.com) 11 | */ 12 | public class RexsterCommandLine { 13 | private CommandLine command; 14 | 15 | private CommandLine commandParameters; 16 | 17 | private Options commandOptions; 18 | 19 | public RexsterCommandLine(CommandLine command, CommandLine commandParameters, Options commandOptions) { 20 | this.command = command; 21 | this.commandParameters = commandParameters; 22 | this.commandOptions = commandOptions; 23 | } 24 | 25 | public Options getCommandOptions() { 26 | return commandOptions; 27 | } 28 | 29 | public CommandLine getCommand() { 30 | return command; 31 | } 32 | 33 | public CommandLine getCommandParameters() { 34 | return commandParameters; 35 | } 36 | 37 | public String getCommandOption(final String opt, final String defaultValue) { 38 | return hasCommandParameters() ? commandParameters.getOptionValue(opt, defaultValue) : defaultValue; 39 | } 40 | 41 | public boolean hasCommandOption(final String opt) { 42 | return hasCommandParameters() && commandParameters.hasOption(opt); 43 | } 44 | 45 | public boolean hasCommandParameters() { 46 | return this.commandParameters != null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/RexsterServer.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | /** 4 | * Interface for the various "servers" that Rexster exposes. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public interface RexsterServer { 9 | void stop() throws Exception; 10 | 11 | void start(final RexsterApplication application) throws Exception ; 12 | } 13 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/metrics/ConsoleReporterConfig.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server.metrics; 2 | 3 | import com.codahale.metrics.ConsoleReporter; 4 | import com.codahale.metrics.MetricRegistry; 5 | import org.apache.commons.configuration.HierarchicalConfiguration; 6 | import org.apache.log4j.Logger; 7 | 8 | /** 9 | * Configures a reporter that writes to the console. 10 | * 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | class ConsoleReporterConfig extends AbstractReporterConfig { 14 | private static final Logger logger = Logger.getLogger(ConsoleReporterConfig.class); 15 | 16 | private ConsoleReporter consoleReporter; 17 | 18 | public ConsoleReporterConfig(final HierarchicalConfiguration config, final MetricRegistry metricRegistry) { 19 | super(config, metricRegistry); 20 | 21 | logger.info("Configured Console Metric Reporter."); 22 | } 23 | 24 | @Override 25 | public boolean enable() { 26 | try 27 | { 28 | consoleReporter = ConsoleReporter.forRegistry(this.metricRegistry) 29 | .convertDurationsTo(this.getRealDurationTimeUnitConversion()) 30 | .convertRatesTo(this.getRealRateTimeUnitConversion()) 31 | .filter(new RegexMetricFilter(this.inclusion, this.exclusion)) 32 | .build(); 33 | consoleReporter.start(this.period, this.getRealTimeUnit()); 34 | } 35 | catch (Exception e) 36 | { 37 | logger.error("Failure while enabling console reporter", e); 38 | return false; 39 | } 40 | return true; 41 | } 42 | 43 | @Override 44 | public void disable() { 45 | consoleReporter.stop(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/metrics/HostPort.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server.metrics; 2 | 3 | /** 4 | * Represents a host and port combination. 5 | * 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | class HostPort { 9 | 10 | private final String host; 11 | 12 | private final int port; 13 | 14 | public HostPort(final String host, final int port) 15 | { 16 | this.host = host; 17 | this.port = port; 18 | } 19 | 20 | public String getHost() 21 | { 22 | return host; 23 | } 24 | 25 | public int getPort() 26 | { 27 | return port; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/metrics/HttpReporterConfig.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server.metrics; 2 | 3 | import org.apache.commons.configuration.HierarchicalConfiguration; 4 | import org.apache.log4j.Logger; 5 | 6 | /** 7 | * Configures the HTTP servlet that can be polled for metrics. 8 | * 9 | * Rexster HTTP server must be enabled for this to work. This config is unlike others because it merely acts as 10 | * a holder for configuration elements. It does not actually start a reporter on its own. 11 | * 12 | * @author Stephen Mallette (http://stephen.genoprime.com) 13 | */ 14 | class HttpReporterConfig extends AbstractReporterConfig { 15 | private static final Logger logger = Logger.getLogger(HttpReporterConfig.class); 16 | 17 | public HttpReporterConfig(final HierarchicalConfiguration config) { 18 | super(config, null); 19 | logger.info("Configured HTTP Metric Reporter."); 20 | } 21 | 22 | /** 23 | * Always returns true. No reporters are started by calling this method. 24 | */ 25 | @Override 26 | public boolean enable() 27 | { 28 | return true; 29 | } 30 | 31 | @Override 32 | public void disable() { } 33 | } 34 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/server/metrics/RegexMetricFilter.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server.metrics; 2 | 3 | import com.codahale.metrics.Metric; 4 | import com.codahale.metrics.MetricFilter; 5 | 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * A filter that includes or excludes metrics using regex. 10 | * 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | public class RegexMetricFilter implements MetricFilter { 14 | 15 | private final Pattern includes; 16 | private final Pattern excludes; 17 | 18 | public RegexMetricFilter(final String includes, final String excludes) { 19 | this.includes = includes == null ? null : Pattern.compile(includes); 20 | this.excludes = excludes == null ? null : Pattern.compile(excludes); 21 | } 22 | 23 | @Override 24 | public boolean matches(final String s, final Metric metric) { 25 | // the key must include and not exclude to match 26 | if (includes != null && excludes != null) { 27 | return includes.matcher(s).matches() && !excludes.matcher(s).matches(); 28 | } 29 | 30 | // the key must be in the inclusion list 31 | if (includes != null) { 32 | return includes.matcher(s).matches(); 33 | } 34 | 35 | // the key must not be in the exclusion 36 | if (excludes != null) { 37 | return !excludes.matcher(s).matches(); 38 | } 39 | 40 | // there were no inclusions/exclusions 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/servlet/DogHouseServlet.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.servlet; 2 | 3 | import com.sun.jersey.core.util.ReaderWriter; 4 | import com.tinkerpop.gremlin.Tokens; 5 | 6 | import javax.servlet.ServletContext; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.InputStreamReader; 12 | import java.net.URL; 13 | 14 | /** 15 | * Serves all content requested on "/main" context. 16 | *

17 | * Simply pushes main.html on all paths requested from the "/main" context. There might 18 | * be an easier and more direct way to do this. 19 | */ 20 | public class DogHouseServlet extends HttpServlet { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { 25 | 26 | String baseRexsterApiUri = this.getInitParameter("com.tinkerpop.rexster.config.rexsterApiBaseUri"); 27 | 28 | if (!baseRexsterApiUri.endsWith("/")) { 29 | baseRexsterApiUri = baseRexsterApiUri + "/"; 30 | } 31 | 32 | ServletContext ctx = this.getServletContext(); 33 | 34 | // set the MIME type of the response, "text/html" 35 | response.setContentType("text/html"); 36 | 37 | // no matter what this should always root from "public" 38 | URL resource = ctx.getResource("/public/main.html"); 39 | 40 | // kind of opens a bad door here. will probably rethink this a bit. 41 | String content = ReaderWriter.readFromAsString(new InputStreamReader(resource.openStream())); 42 | content = content.replace("{{inject}}", ""); 43 | response.getWriter().write(content); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/util/LogLevel.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.util; 2 | 3 | import java.util.logging.Level; 4 | 5 | /** 6 | * Logging level enum, used for switch statements. 7 | *
8 | * https://github.com/joshuadavis/yajul/blob/master/core/src/main/java/org/yajul/log/LogLevel.java 9 | */ 10 | public enum LogLevel { 11 | TRACE(Level.FINER.intValue()), 12 | DEBUG(Level.FINE.intValue()), 13 | INFO(Level.INFO.intValue()), 14 | WARN(Level.WARNING.intValue()), 15 | ERROR(Level.SEVERE.intValue()), 16 | OFF(Level.OFF.intValue()), 17 | ; 18 | private int juliPriority; 19 | 20 | LogLevel(int juliPriority) { 21 | this.juliPriority = juliPriority; 22 | } 23 | 24 | public static LogLevel toLogLevel(Level level) { 25 | int juliPriority = level.intValue(); 26 | LogLevel[] levels = LogLevel.values(); 27 | for (LogLevel logLevel : levels) { 28 | if (logLevel.juliPriority >= juliPriority) 29 | return logLevel; 30 | } 31 | return OFF; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/util/MockTinkerTransactionalGraph.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.util; 2 | 3 | import com.tinkerpop.blueprints.TransactionalGraph; 4 | import com.tinkerpop.blueprints.impls.tg.TinkerGraph; 5 | 6 | /** 7 | * Mocked transactional graph for testing purposes. 8 | *

9 | * This class doesn't really do anything Transactional. 10 | * 11 | * @author Marko A. Rodriguez (http://markorodriguez.com) 12 | */ 13 | public class MockTinkerTransactionalGraph extends TinkerGraph implements TransactionalGraph { 14 | 15 | public MockTinkerTransactionalGraph(final String directory, final FileType fileType) { 16 | super(directory, fileType); 17 | } 18 | 19 | public MockTinkerTransactionalGraph() { 20 | super(); 21 | } 22 | 23 | public void stopTransaction(final Conclusion conclusion) { 24 | 25 | } 26 | 27 | public void commit() { 28 | } 29 | 30 | public void rollback() { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rexster-server/src/main/java/com/tinkerpop/rexster/util/StatisticsHelper.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.util; 2 | 3 | /** 4 | * @author Marko A. Rodriguez (http://markorodriguez.com) 5 | * @author Stephen Mallette (http://stephen.genoprime.com) 6 | */ 7 | public class StatisticsHelper { 8 | 9 | private double time = -1.0d; 10 | 11 | public double stopWatch() { 12 | if (time == -1.0d) { 13 | time = System.nanoTime(); 14 | return time; 15 | } else { 16 | double temp = (System.nanoTime() - time) / 1000000d; 17 | time = -1.0d; 18 | return temp; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rexster-server/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension: -------------------------------------------------------------------------------- 1 | com.tinkerpop.rexster.gremlin.GremlinExtension -------------------------------------------------------------------------------- /rexster-server/src/main/resources/com/tinkerpop/rexster/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | #log4j.appender.stdout=org.apache.log4j.FileAppender 4 | #log4j.appender.stdout.file=recless.log 5 | #log4j.appender.stdout.append=true 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=[%p] %C{1} - %m%n -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_diagonals-thick_15_0b3e6f_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_diagonals-thick_15_0b3e6f_40x40.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-medium_30_0b58a2_4x4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-medium_30_0b58a2_4x4.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_20_333333_2x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_20_333333_2x2.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_30_a32d00_2x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_30_a32d00_2x2.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_40_00498f_2x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_dots-small_40_00498f_2x2.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_flat_40_292929_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_flat_40_292929_40x100.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_gloss-wave_20_111111_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-bg_gloss-wave_20_111111_500x100.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_00498f_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_00498f_256x240.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_98d2fb_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_98d2fb_256x240.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_9ccdfc_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_9ccdfc_256x240.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/dot-luv/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/elastic.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/css/elastic.css -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/css/elastic.print.css: -------------------------------------------------------------------------------- 1 | .print-only{display:none;}.no-print{display:none;}.no-print-content{visibility:hidden;}.print-only,div.print-only{display:block;}span.print-only,label.print-only{display:inline;}table.print-only{display:table;}tr.print-only{display:table-row;}td.print-only{display:table-cell;} -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/favicon.ico -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/ajax-loader.gif -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/bg.gif -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/rexster-corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/rexster-corner.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/rexster-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/rexster-logo.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/rexster-peek.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/rexster-peek.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/spinner.gif -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/img/tinkerpop-splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinkerpop/rexster/a649f4a6f06a37a8fd79d8d7206e64351fba860f/rexster-server/src/main/resources/public/img/tinkerpop-splash.png -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rexster 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/domReady.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS domReady 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | define(function(){function k(a){for(var b=0,c;c=a[b];b++)c(f)}function l(){var a=g,b=h;c&&(a.length&&(g=[],k(a)),d.resourcesDone&&b.length&&(h=[],k(b)))}function e(){c||(c=!0,i&&clearInterval(i),l())}function b(a){c?a(f):g.push(a);return b}var j=typeof window!=="undefined"&&window.document,c=!j,f=j?document:null,g=[],h=[],d=requirejs||require||{},m=d.resourcesReady,i;if("resourcesReady"in d)d.resourcesReady=function(a){m&&m(a);a&&l()};j&&(document.addEventListener?(document.addEventListener("DOMContentLoaded", 7 | e,!1),window.addEventListener("load",e,!1)):window.attachEvent&&(window.attachEvent("onload",e),self===self.top&&(i=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),e())}catch(a){}},30))),document.readyState==="complete"&&e());b.withResources=function(a){c&&d.resourcesDone?a(f):h.push(a);return b};b.version="1.0.0";b.load=function(a,c,d,e){e.isBuild?d(null):b(d)};return b}); -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | baseUrl: "/static/javascript", 3 | paths: { 4 | "jquery-ui": "lib/jquery-ui-1.8.7.custom", 5 | "jquery-url": "lib/jquery.url", 6 | "has":"lib/has", 7 | "has-detect-features":"lib/has-detect-features", 8 | "elastic":"lib/elastic-2.0.3", 9 | "json2" : "lib/json2", 10 | "jquery-history" :"lib/jquery-history", 11 | "jquery-url" : "lib/jquery-url", 12 | "jquery-jsonviewer" : "lib/jquery-jsonviewer", 13 | "underscore" : "lib/underscore", 14 | "jit":"lib/jit-yc" , 15 | "dust": "lib/dust-full-0.3.0.min" 16 | }, 17 | locale: "en-us" 18 | }); -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/order.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS order 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | (function(){function k(a){var b=a.currentTarget||a.srcElement,c;if(a.type==="load"||l.test(b.readyState)){a=b.getAttribute("data-requiremodule");j[a]=!0;for(a=0;c=g[a];a++)if(j[c.name])c.req([c.name],c.onLoad);else break;a>0&&g.splice(0,a);setTimeout(function(){b.parentNode.removeChild(b)},15)}}function m(a){var b,c;a.setAttribute("data-orderloaded","loaded");for(a=0;c=h[a];a++)if((b=i[c])&&b.getAttribute("data-orderloaded")==="loaded")delete i[c],require.addScriptToDom(b);else break;a>0&&h.splice(0, 7 | a)}var f=typeof document!=="undefined"&&typeof window!=="undefined"&&document.createElement("script"),n=f&&(f.async||window.opera&&Object.prototype.toString.call(window.opera)==="[object Opera]"||"MozAppearance"in document.documentElement.style),o=f&&f.readyState==="uninitialized",l=/^(complete|loaded)$/,g=[],j={},i={},h=[],f=null;define({version:"1.0.0",load:function(a,b,c,d){var e=b.nameToUrl(a,null);require.s.skipAsync[e]=!0;n||d.isBuild?b([a],c):o?(d=require.s.contexts._,!d.urlFetched[e]&&!d.loaded[a]&& 8 | (d.urlFetched[e]=!0,require.resourcesReady(!1),d.scriptCount+=1,e=require.attach(e,d,a,null,null,m),i[a]=e,h.push(a)),b([a],c)):b.specified(a)?b([a],c):(g.push({name:a,req:b,onLoad:c}),require.attach(e,null,a,k,"script/cache"))}})})(); -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/rexster.js: -------------------------------------------------------------------------------- 1 | require( 2 | [ 3 | "domReady", 4 | "rexster/history", 5 | "rexster/template/template", 6 | "rexster/ui/main-menu", 7 | "order!has", 8 | "order!has-detect-features" 9 | ], 10 | function (domReady, history, template, mainMenu) { 11 | domReady(function () { 12 | 13 | // only make this feature available to browsers that support it 14 | if (has("native-history-state")) { 15 | window.onpopstate = function(event) { 16 | var popped = ('state' in window.history), initialURL = location.href 17 | $(window).bind('popstate', function(event) { 18 | // Ignore inital popstate that some browsers fire on page load 19 | var initialPop = !popped && location.href == initialURL 20 | popped = true 21 | if ( initialPop ) return 22 | 23 | restoreApplication(); 24 | }); 25 | }; 26 | } 27 | 28 | function restoreApplication() { 29 | // compile the templates 30 | template.initTemplates(); 31 | 32 | // build the main menu. this action will initialize the 33 | // first enabled panel 34 | mainMenu.initMainMenu(); 35 | } 36 | 37 | 38 | // determine if the state is already established 39 | var state = history.getApplicationState(); 40 | if (!state.hasOwnProperty("menu")) { 41 | // since there is no menu selected initialized the graph page first. 42 | history.historyPush("/doghouse/main/graph"); 43 | } 44 | 45 | restoreApplication(); 46 | }); 47 | }); -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/rexster/server.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | ], 4 | function () { 5 | // public methods 6 | return { 7 | servers : [{ 8 | serverName : "localhost", 9 | uri : BASE_URI + "graphs/" 10 | }], 11 | getBaseUri : function(ix){ 12 | return this.servers[ix].uri; 13 | } 14 | }; 15 | }); -------------------------------------------------------------------------------- /rexster-server/src/main/resources/public/javascript/rexster/ui/info.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "elastic" 4 | ], 5 | function () { 6 | var infoContainer = new Info(); 7 | 8 | function Info(){ 9 | var container = $("#info"), 10 | containerIcon = container.find(".ui-icon"), 11 | containerStrong = container.find("strong"), 12 | containerMessage = container.find("#infoMessage"); 13 | 14 | this.clear = function() { 15 | container.hide(); 16 | container.removeAttr("class"); 17 | container.addClass("unit ui-corner-all"); 18 | containerIcon.removeAttr("class"); 19 | containerIcon.addClass("ui-icon"); 20 | containerStrong.text(""); 21 | containerMessage.text(""); 22 | 23 | container.unbind("click"); 24 | container.click(function() { 25 | container.fadeOut(); 26 | }); 27 | } 28 | 29 | this.display = function(strongText, message, icon, messageType) { 30 | this.clear(); 31 | container.addClass(messageType); 32 | containerIcon.addClass(icon); 33 | containerStrong.text(strongText); 34 | containerMessage.text(message); 35 | container.fadeIn(); 36 | 37 | Elastic.refresh(); 38 | } 39 | 40 | this.displayInfo = function(message) { 41 | this.display("Info:", message, "ui-icon-info", "ui-state-highlight"); 42 | } 43 | 44 | this.displayError = function(message) { 45 | this.display("Error:", message, "ui-icon-alert", "ui-state-error"); 46 | } 47 | } 48 | 49 | // public methods 50 | return { 51 | showMessageInfo : function(message){ 52 | infoContainer.displayInfo(message); 53 | }, 54 | 55 | showMessageError : function(message){ 56 | infoContainer.displayError(message); 57 | }, 58 | 59 | hideMessage : function() { 60 | infoContainer.clear(); 61 | } 62 | }; 63 | }); -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/GraphResourceTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import org.codehaus.jettison.json.JSONObject; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | import javax.ws.rs.core.Response; 8 | import javax.ws.rs.core.Response.Status; 9 | 10 | /** 11 | * @author Stephen Mallette (http://stephen.genoprime.com) 12 | */ 13 | public class GraphResourceTest extends BaseTest { 14 | 15 | @Test 16 | public void getGraphProducesJsonValid() { 17 | final GraphResource resource = constructGraphResourceWithToyGraph().getResource(); 18 | final Response response = resource.getGraphProducesJson(graphName); 19 | 20 | Assert.assertNotNull(response); 21 | Assert.assertEquals(Status.OK.getStatusCode(), response.getStatus()); 22 | Assert.assertNotNull(response.getEntity()); 23 | Assert.assertTrue(response.getEntity() instanceof JSONObject); 24 | 25 | final JSONObject json = (JSONObject) response.getEntity(); 26 | Assert.assertEquals(graphName, json.optString("name")); 27 | Assert.assertTrue(json.has(Tokens.QUERY_TIME)); 28 | Assert.assertTrue(json.has(Tokens.UP_TIME)); 29 | Assert.assertTrue(json.has(Tokens.READ_ONLY)); 30 | Assert.assertTrue(json.has(Tokens.VERSION)); 31 | Assert.assertTrue(json.has(Tokens.TYPE)); 32 | Assert.assertTrue(json.has(Tokens.FEATURES)); 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/MockEdge.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import com.tinkerpop.blueprints.Direction; 4 | import com.tinkerpop.blueprints.Edge; 5 | import com.tinkerpop.blueprints.Vertex; 6 | import com.tinkerpop.blueprints.util.ExceptionFactory; 7 | 8 | import java.util.Hashtable; 9 | import java.util.Set; 10 | 11 | public class MockEdge implements Edge { 12 | 13 | private String id; 14 | private String label; 15 | private Hashtable properties = new Hashtable(); 16 | private Vertex inVertex; 17 | private Vertex outVertex; 18 | 19 | public MockEdge(String id, String label, Hashtable properties, Vertex in, Vertex out) { 20 | this.id = id; 21 | this.label = label; 22 | this.properties = properties; 23 | this.inVertex = in; 24 | this.outVertex = out; 25 | } 26 | 27 | @Override 28 | public Object getId() { 29 | return this.id; 30 | } 31 | 32 | @Override 33 | public Object getProperty(String key) { 34 | return this.properties.get(key); 35 | } 36 | 37 | @Override 38 | public Set getPropertyKeys() { 39 | return this.properties.keySet(); 40 | } 41 | 42 | @Override 43 | public Object removeProperty(String key) { 44 | return this.properties.remove(key); 45 | } 46 | 47 | @Override 48 | public void remove() { 49 | throw new UnsupportedOperationException(); 50 | } 51 | 52 | @Override 53 | public void setProperty(String key, Object value) { 54 | this.properties.put(key, value); 55 | } 56 | 57 | @Override 58 | public String getLabel() { 59 | return this.label; 60 | } 61 | 62 | public Vertex getVertex(final Direction direction) throws IllegalArgumentException { 63 | if (direction.equals(Direction.IN)) 64 | return this.inVertex; 65 | else if (direction.equals(Direction.OUT)) 66 | return this.outVertex; 67 | else 68 | throw ExceptionFactory.bothIsNotSupported(); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/MockIndex.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import com.tinkerpop.blueprints.CloseableIterable; 4 | import com.tinkerpop.blueprints.Element; 5 | import com.tinkerpop.blueprints.Index; 6 | 7 | public class MockIndex implements Index { 8 | 9 | private String indexName; 10 | private Class clazz; 11 | private long count; 12 | 13 | public MockIndex(String indexName, Class clazz, long count) { 14 | this.indexName = indexName; 15 | this.clazz = clazz; 16 | this.count = count; 17 | } 18 | 19 | public long count(String arg0, Object arg1) { 20 | return count; 21 | } 22 | 23 | public CloseableIterable get(String arg0, Object arg1) { 24 | return null; 25 | } 26 | 27 | @Override 28 | public CloseableIterable query(String key, Object query) { 29 | return null; 30 | } 31 | 32 | public Class getIndexClass() { 33 | return this.clazz; 34 | } 35 | 36 | public String getIndexName() { 37 | return this.indexName; 38 | } 39 | 40 | public void put(String arg0, Object arg1, Element arg2) { 41 | } 42 | 43 | public void remove(String arg0, Object arg1, Element arg2) { 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/ResourceHolder.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster; 2 | 3 | import javax.ws.rs.core.Request; 4 | 5 | /** 6 | * @author Stephen Mallette (http://stephen.genoprime.com) 7 | */ 8 | public class ResourceHolder { 9 | private final T resource; 10 | private final Request request; 11 | 12 | public ResourceHolder(final T resource, final Request request) { 13 | this.resource = resource; 14 | this.request = request; 15 | } 16 | 17 | public T getResource() { 18 | return resource; 19 | } 20 | 21 | public Request getRequest() { 22 | return request; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/config/MockBadGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | 5 | public class MockBadGraphConfiguration implements GraphConfiguration { 6 | public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { 7 | throw new GraphConfigurationException("busted"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/config/MockIndexableGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.blueprints.impls.tg.TinkerGraph; 5 | 6 | public class MockIndexableGraphConfiguration implements GraphConfiguration { 7 | 8 | public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { 9 | return new TinkerGraph(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/config/MockSailGraphConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | public class MockSailGraphConfiguration extends AbstractSailGraphConfiguration { 4 | public void setSailType(String sailType) { 5 | this.sailType = sailType; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/config/SparkseeGraphConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.rexster.RexsterApplicationGraph; 4 | import org.apache.commons.configuration.Configuration; 5 | import org.apache.commons.configuration.HierarchicalConfiguration; 6 | import org.junit.Test; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class SparkseeGraphConfigurationTest { 12 | 13 | private GraphConfiguration configuration = new SparkseeGraphConfiguration(); 14 | 15 | @Test(expected = GraphConfigurationException.class) 16 | public void configureGraphInstanceMissingGraphFileConfig() throws GraphConfigurationException { 17 | Configuration graphConfig = new HierarchicalConfiguration(); 18 | Map graphs = new HashMap(); 19 | GraphConfigurationContext context = new GraphConfigurationContext(graphConfig, graphs); 20 | 21 | configuration.configureGraphInstance(context); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/config/TinkerGraphGraphConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.config; 2 | 3 | import com.tinkerpop.rexster.RexsterApplicationGraph; 4 | import org.apache.commons.configuration.Configuration; 5 | import org.apache.commons.configuration.HierarchicalConfiguration; 6 | import org.junit.Test; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class TinkerGraphGraphConfigurationTest { 12 | 13 | private GraphConfiguration configuration = new TinkerGraphGraphConfiguration(); 14 | 15 | @Test 16 | public void configureGraphInstanceNoFileConfig() throws GraphConfigurationException { 17 | Configuration graphConfig = new HierarchicalConfiguration(); 18 | Map graphs = new HashMap(); 19 | GraphConfigurationContext context = new GraphConfigurationContext(graphConfig, graphs); 20 | 21 | configuration.configureGraphInstance(context); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/server/DefaultRexsterApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | import com.tinkerpop.blueprints.impls.tg.TinkerGraph; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | /** 8 | * @author Stephen Mallette (http://stephen.genoprime.com) 9 | */ 10 | public class DefaultRexsterApplicationTest { 11 | 12 | @Test 13 | public void getGraphDoesNotExistReturnsNull() { 14 | final TinkerGraph g = new TinkerGraph(); 15 | final String graphName = "test"; 16 | 17 | final RexsterApplication ra = new DefaultRexsterApplication(graphName, g); 18 | 19 | Assert.assertNull(ra.getGraph("not-real")); 20 | } 21 | 22 | @Test 23 | public void shouldConfiguredSingleGraph() { 24 | final TinkerGraph g = new TinkerGraph(); 25 | final String graphName = "test"; 26 | 27 | final RexsterApplication ra = new DefaultRexsterApplication(graphName, g); 28 | 29 | Assert.assertEquals(graphName, ra.getGraphNames().toArray()[0]); 30 | Assert.assertSame(g, ra.getGraph(graphName)); 31 | Assert.assertSame(g, ra.getApplicationGraph(graphName).getGraph()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/server/RexsterSettingsTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * @author Stephen Mallette (http://stephen.genoprime.com) 11 | */ 12 | public class RexsterSettingsTest { 13 | @Test 14 | public void getPrimeCommands() { 15 | // don't specifically test -h as it autoprints help and 16 | final Map commands = new HashMap() {{ 17 | put("-s", RexsterSettings.COMMAND_START); 18 | put("-u", RexsterSettings.COMMAND_STATUS); 19 | put("-x", RexsterSettings.COMMAND_STOP); 20 | put("-v", RexsterSettings.COMMAND_VERSION); 21 | put("junk", RexsterSettings.COMMAND_HELP); 22 | }}; 23 | 24 | for (Map.Entry entry : commands.entrySet()) { 25 | final RexsterSettings settings = new RexsterSettings(new String [] { entry.getKey() }); 26 | 27 | Assert.assertEquals(entry.getValue(), settings.getPrimeCommand()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rexster-server/src/test/java/com/tinkerpop/rexster/server/XmlRexsterApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.tinkerpop.rexster.server; 2 | 3 | import com.tinkerpop.blueprints.Graph; 4 | import com.tinkerpop.blueprints.impls.tg.TinkerGraph; 5 | import com.tinkerpop.rexster.RexsterApplicationGraph; 6 | import com.tinkerpop.rexster.Tokens; 7 | import org.apache.commons.configuration.HierarchicalConfiguration; 8 | import org.apache.commons.configuration.XMLConfiguration; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | 12 | import java.io.Reader; 13 | import java.io.StringReader; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * @author Stephen Mallette (http://stephen.genoprime.com) 19 | */ 20 | public class XmlRexsterApplicationTest { 21 | private static final Reader rexsterXmlReader = new StringReader(RexsterXmlData.XML); 22 | 23 | @Test 24 | public void shouldConfiguredFromXmlConfiguration() throws Exception { 25 | final XMLConfiguration properties = new XMLConfiguration(); 26 | properties.load(rexsterXmlReader); 27 | final List graphConfigs = properties.configurationsAt(Tokens.REXSTER_GRAPH_PATH); 28 | 29 | final RexsterApplication ra = new XmlRexsterApplication(graphConfigs); 30 | 31 | Assert.assertEquals(2, ra.getGraphNames().size()); 32 | final List graphNames = new ArrayList(ra.getGraphNames()); 33 | Assert.assertTrue(graphNames.contains("emptygraph")); 34 | Assert.assertTrue(graphNames.contains("tinkergraph")); 35 | 36 | for (String graphName : ra.getGraphNames()) { 37 | final Graph g = ra.getGraph(graphName); 38 | Assert.assertNotNull(g); 39 | Assert.assertTrue(g instanceof TinkerGraph); 40 | 41 | final RexsterApplicationGraph rag = ra.getApplicationGraph(graphName); 42 | Assert.assertNotNull(rag); 43 | Assert.assertTrue(rag.getGraph() instanceof TinkerGraph); 44 | Assert.assertEquals(graphName, rag.getGraphName()); 45 | } 46 | } 47 | } 48 | --------------------------------------------------------------------------------