Package com.tinkerpop.rexster.extension

Examples of com.tinkerpop.rexster.extension.ExtensionConfiguration


            }
        }).build());
    }

    private ElementIdHandler getElementIdHandler(final RexsterApplicationGraph rag) {
        final ExtensionConfiguration configuration = rag.findExtensionConfiguration(EXTENSION_NAMESPACE, EXTENSION_NAME);
        if (configuration == null) {
            return DEFAULT_ID_HANDLER;
        }

        final Map<String, String> map = configuration.tryGetMapFromConfiguration();
        final String idHandlerName = map.get(CONFIG_ID_HANDLER);

        if (idHandlerName.equals("orientdb"))
            return new OrientElementIdHandler();
        else if (idHandlerName.equals("titan-berkeleyje"))
View Full Code Here


        final ExtensionMethod extensionMethod = rexsterResourceContext.getExtensionMethod();
        Map configurationMap = null;

        Iterator<String> scriptsToRun = null;
        try {
            final ExtensionConfiguration extensionConfiguration = rag != null ? rag.findExtensionConfiguration(EXTENSION_NAMESPACE, EXTENSION_NAME) : null;
            if (extensionConfiguration != null) {
                configurationMap = extensionConfiguration.tryGetMapFromConfiguration();
                scriptsToRun = getScriptsToRun(requestObject, configurationMap);
            }
        } catch (IOException ioe) {
            return ExtensionResponse.error(ioe,
                    generateErrorJson(extensionMethod.getExtensionApiAsJson()));
View Full Code Here

    @ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH)
    @ExtensionDescriptor(description = "returns the configuration as JSON.")
    public ExtensionResponse doConfiguredWork(@RexsterContext RexsterApplicationGraph rag) {

        // finds the configuration settings from the configured graph
        ExtensionConfiguration configuration = rag.findExtensionConfiguration(EXTENSION_NAMESPACE, EXTENSION_NAME);
        Map<String, String> map = configuration.tryGetMapFromConfiguration();

        return ExtensionResponse.ok(map);
    }
View Full Code Here

        }

        ExtensionResponse extensionResponse;
        FramedGraph framedGraph = factory.create(graph);

        ExtensionConfiguration extensionConfig = rexsterResourceContext.getRexsterApplicationGraph()
                .findExtensionConfiguration(EXTENSION_NAMESPACE, EXTENSION_NAME);
        Map<String, String> mapFrames = extensionConfig.tryGetMapFromConfiguration();

        if (mapFrames != null && !mapFrames.isEmpty()) {
            UriInfo uriInfo = rexsterResourceContext.getUriInfo();
            List<PathSegment> pathSegmentList = uriInfo.getPathSegments();
View Full Code Here

        allowables.add("tp:*");
        rag.loadAllowableExtensions(allowables);

        rag.loadExtensionsConfigurations(list);

        ExtensionConfiguration extConfig = rag.findExtensionConfiguration("tp", "extensionname");
        Assert.assertNotNull(extConfig);
        Assert.assertEquals("extensionname", extConfig.getExtensionName());
        Assert.assertEquals("tp", extConfig.getNamespace());

        Assert.assertNotNull(extConfig.getConfiguration());

        Map map = extConfig.tryGetMapFromConfiguration();
        Assert.assertNotNull(map);
        Assert.assertTrue(map.containsKey("test"));
        Assert.assertEquals("1", map.get("test"));
    }
View Full Code Here

    }

    @Test
    public void isConfigurationValidEmptyConfiguration() {
        HierarchicalConfiguration xmlConfig = new HierarchicalConfiguration();
        ExtensionConfiguration configuration = new ExtensionConfiguration("ns", "name", xmlConfig);
        Assert.assertFalse(this.framesExtension.isConfigurationValid(configuration));
    }
View Full Code Here

    @Test
    public void isConfigurationValidNiceConfiguration() {
        HierarchicalConfiguration hc = new HierarchicalConfiguration();
        hc.addProperty("key1", "value1");
        hc.addProperty("key2", "value2");
        ExtensionConfiguration configuration = new ExtensionConfiguration("ns", "name", hc);
        Assert.assertTrue(this.framesExtension.isConfigurationValid(configuration));
    }
View Full Code Here

    /**
     * Gets an extension configuration given a namespace and extension name.
     */
    public ExtensionConfiguration findExtensionConfiguration(final String namespace, final String extensionName) {
        ExtensionConfiguration extensionConfigurationFound = null;

        if (this.extensionConfigurations != null) {
            for (ExtensionConfiguration extensionConfiguration : this.extensionConfigurations) {
                if (extensionConfiguration.getExtensionName().equals(extensionName)
                        && extensionConfiguration.getNamespace().equals(namespace)) {
View Full Code Here

                final String namespace = configuration.getString("namespace", "");
                final String name = configuration.getString("name", "");
                final HierarchicalConfiguration extensionConfig = configuration.configurationAt("configuration");

                if (!namespace.isEmpty() && !name.isEmpty() && extensionConfig != null) {
                    this.extensionConfigurations.add(new ExtensionConfiguration(namespace, name, extensionConfig));
                } else {
                    logger.warn("Graph [" + graphName + "] - Extension [" + namespace + ":" + name + "] does not have a valid configuration.  Please check rexster.xml");
                }
            }
View Full Code Here

            // test the configuration to see if the extension should even be available
            final ExtensionSegmentSet extensionSegmentSet = new ExtensionSegmentSet(
                    currentExtensionNamespace, currentExtensionName);

            if (this.isExtensionAllowed(extensionSegmentSet)) {
                final ExtensionConfiguration extensionConfig = this.findExtensionConfiguration(
                        currentExtensionNamespace, currentExtensionName);
                RexsterExtension rexsterExtension = null;
                try {
                    rexsterExtension = (RexsterExtension) clazz.newInstance();
                } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.tinkerpop.rexster.extension.ExtensionConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.