Package org.neo4j.webadmin.domain

Examples of org.neo4j.webadmin.domain.ServerPropertyRepresentation


            json = dodgeStartingUnicodeMarker( json );
            Collection<Object> newProperties = (Collection<Object>) JsonHelper.jsonToSingleValue( json );

            // Validate all properties
            Map<String, Object> currentPropMap;
            ServerPropertyRepresentation currentPropObj;

            boolean hasJvmChanges = false;
            boolean hasCreationChanges = false;
            boolean hasDbConfigChanges = false;

            for ( Object property : newProperties )
            {
                if ( !( property instanceof Map<?, ?> ) )
                {
                    throw new IllegalArgumentException(
                            "'"
                                    + property
                                    + "' is not a valid configuration directive." );
                }

                currentPropMap = (Map<String, Object>) property;
                currentPropObj = properties.get( (String) currentPropMap.get( "key" ) );

                if ( !currentPropObj.isValidValue( (String) currentPropMap.get( "value" ) ) )
                {
                    throw new IllegalArgumentException(
                            "'" + (String) currentPropMap.get( "value" )
                                    + "' is not a valid value for property '"
                                    + (String) currentPropMap.get( "key" )
                                    + "'." );
                }

                // Keep track of what type of changes we are making
                switch ( currentPropObj.getType() )
                {
                case APP_ARGUMENT:
                case JVM_ARGUMENT:
                    hasJvmChanges = true;
                    break;
View Full Code Here


            gcs.put( "Serial GC", "-XX:+UseSerialGC" );
            gcs.put( "Throughput GC", "-XX:+UseParallelGC" );
            gcs.put( "Concurrent Low Pause GC", "-XX:+UseConcMarkSweepGC" );
            gcs.put( "Incremental Low Pause GC", "-Xincgc" );

            properties.add( new ServerPropertyRepresentation(
                    "jvm.garbagecollector", "Garbage collector",
                    "-XX:+UseSerialGC", PropertyType.JVM_ARGUMENT,
                    new ValueDefinition( "", "", gcs ) ) );

            // Min heap size
            properties.add( new ServerPropertyRepresentation(
                    "jvm.min_heap_size", "Min heap size", "512m",
                    PropertyType.JVM_ARGUMENT, new ValueDefinition( "-Xms", "" ) ) );

            // Max heap size
            properties.add( new ServerPropertyRepresentation(
                    "jvm.max_heap_size", "Max heap size", "512m",
                    PropertyType.JVM_ARGUMENT, new ValueDefinition( "-Xmx", "" ) ) );

            // JVM server mode
            if ( PlatformUtils.jvmServerModeIsAvailable() )
            {
                properties.add( new ServerPropertyRepresentation( "jvm.server",
                        "JVM server mode", "", PropertyType.JVM_ARGUMENT,
                        new ValueDefinition( "", "", "-server" ) ) );
            }
        }

        //
        // APP ARGS
        //

        // Static web content folder
        properties.add( new HiddenServerPropertyRepresentation( "web.root",
                "Web root", AdminServer.INSTANCE.getStaticPath(),
                PropertyType.APP_ARGUMENT,
                new ValueDefinition( "-webRoot=", "" ) ) );

        // Database folder
        properties.add( new ServerPropertyRepresentation( "db.root",
                "Database location", DatabaseLocator.getDatabaseLocation(),
                PropertyType.APP_ARGUMENT, new ValueDefinition( "-dbPath=", "" ) ) );

        //
        // CONFIG FILE ARGS
        //

        if ( DatabaseLocator.isLocalDatabase() )
        {

            // Logical logs
            properties.add( new ServerPropertyRepresentation(
                    "keep_logical_logs", "Enable logical logs", "false",
                    PropertyType.CONFIG_PROPERTY, new ValueDefinition( "", "",
                            "true", "false" ) ) );

            // Remote shell
            properties.add( new ServerPropertyRepresentation(
                    "enable_remote_shell", "Enable remote shell", "false",
                    PropertyType.CONFIG_PROPERTY, new ValueDefinition( "", "",
                            "true", "false" ) ) );

            // DB CREATION ARGS

            properties.add( new ServerPropertyRepresentation(
                    "create.array_block_size", "Array block size", "133",
                    PropertyType.DB_CREATION_PROPERTY ) );

            properties.add( new ServerPropertyRepresentation(
                    "create.string_block_size", "String block size", "133",
                    PropertyType.DB_CREATION_PROPERTY ) );
        }
        else
        {

            // JMX URI
            properties.add( new ServerPropertyRepresentation(
                    "general.jmx.uri", "JMX URI", "",
                    PropertyType.GENERAL_PROPERTY ) );

        }

        //
        // GENERAL SETTINGS
        // Used directly by webadmin

        // Backup path
        properties.add( new ServerPropertyRepresentation(
                "general.backup.path", "Backup path", "",
                PropertyType.GENERAL_PROPERTY ) );

        // Properties to list in data browser
        properties.add( new ServerPropertyRepresentation(
                "general.data.listfields", "Data browser list fields", "name",
                PropertyType.GENERAL_PROPERTY ) );

        return properties;
    }
View Full Code Here

     * @throws NoSuchPropertyException if no property with the given key exists.
     * @throws IllegalArgumentException if trying to set an invalid value
     */
    public synchronized void set( String key, String value ) throws IOException
    {
        ServerPropertyRepresentation prop = this.get( key );

        if ( !prop.isValidValue( value ) )
        {
            throw new IllegalArgumentException(
                    "'" + value + "' is not a valid value for property '" + key
                            + "'." );
        }

        prop.setValue( value );

        switch ( prop.getType() )
        {
        case CONFIG_PROPERTY:
            if ( DatabaseLocator.isLocalDatabase() )
            {
                dbConfig.put( key, prop.getFullValue() );
                saveProperties( dbConfig, ConfigFileFactory.getDbConfigFile() );
            }
            break;
        default:
            generalConfig.put( key, prop.getFullValue() );
            saveProperties( generalConfig,
                    ConfigFileFactory.getGeneralConfigFile() );
            writeJvmAndAppArgs();
        }
    }
View Full Code Here

TOP

Related Classes of org.neo4j.webadmin.domain.ServerPropertyRepresentation

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.