Package org.guvnor.structure.server.config

Examples of org.guvnor.structure.server.config.ConfigGroup


        rootDirectories.add(createPath("default://origin@uf-playground"));
        rootDirectories.add(createPath("default://master@uf-playground"));
        rootDirectories.add(createPath("default://branch1@uf-playground"));

        ConfigGroup configGroup = getConfigGroup();
        configGroup.setName("test");

        Repository repository = helper.newRepository(configGroup);

        assertEquals(3, repository.getBranches().size());
        assertEquals("master",repository.getCurrentBranch());
View Full Code Here


        rootDirectories.add(createPath("default://origin@uf-playground"));
        rootDirectories.add(createPath("default://master@uf-playground"));
        rootDirectories.add(createPath("default://branch1@uf-playground"));

        ConfigGroup configGroup = getConfigGroup();
        configGroup.setName("test");

        Repository repository = helper.newRepository(configGroup,"branch1");

        assertEquals(3, repository.getBranches().size());
        assertEquals("branch1",repository.getCurrentBranch());
View Full Code Here

        when(path.getFileSystem()).thenReturn(fileSystem);
        return path;
    }

    private ConfigGroup getConfigGroup() {
        ConfigGroup repoConfig = new ConfigGroup();
        ConfigItem configItem = new ConfigItem();
        configItem.setName(EnvironmentParameters.SCHEME);
        repoConfig.addConfigItem(configItem);
        return repoConfig;
    }
View Full Code Here

                                        final Map<String, Object> env ) {

        if ( configuredRepositories.containsKey( alias ) || SystemRepository.SYSTEM_REPO.getAlias().equals( alias ) ) {
            throw new RepositoryAlreadyExistsException( alias );
        }
        final ConfigGroup repositoryConfig = configurationFactory.newConfigGroup( REPOSITORY, alias, "" );
        repositoryConfig.addConfigItem( configurationFactory.newConfigItem( "security:roles", new ArrayList<String>() ) );

        if ( !env.containsKey( SCHEME ) ) {
            repositoryConfig.addConfigItem( configurationFactory.newConfigItem( SCHEME, scheme ) );
        }

        if ( env.containsKey( BRANCH ) ) {
            repositoryConfig.addConfigItem( configurationFactory.newConfigItem( BRANCH, env.get( BRANCH ) ) );
        }
        for ( final Map.Entry<String, Object> entry : env.entrySet() ) {
            if ( entry.getKey().startsWith( "crypt:" ) ) {
                repositoryConfig.addConfigItem( configurationFactory.newSecuredConfigItem( entry.getKey(),
                                                                                           entry.getValue().toString() ) );
            } else {
                repositoryConfig.addConfigItem( configurationFactory.newConfigItem( entry.getKey(),
                                                                                    entry.getValue() ) );
            }
        }

        final Repository repo = createRepository( repositoryConfig );
View Full Code Here

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public void addRole( Repository repository,
                         String role ) {
        final ConfigGroup thisRepositoryConfig = findRepositoryConfig( repository.getAlias() );

        if ( thisRepositoryConfig != null ) {
            final ConfigItem<List> roles = thisRepositoryConfig.getConfigItem( "security:roles" );
            roles.getValue().add( role );

            configurationService.updateConfiguration( thisRepositoryConfig );

            final Repository updatedRepo = repositoryFactory.newRepository( thisRepositoryConfig );
View Full Code Here

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public void removeRole( Repository repository,
                            String role ) {
        final ConfigGroup thisRepositoryConfig = findRepositoryConfig( repository.getAlias() );

        if ( thisRepositoryConfig != null ) {
            final ConfigItem<List> roles = thisRepositoryConfig.getConfigItem( "security:roles" );
            roles.getValue().remove( role );

            configurationService.updateConfiguration( thisRepositoryConfig );

            final Repository updatedRepo = repositoryFactory.newRepository( thisRepositoryConfig );
View Full Code Here

        return null;
    }

    @Override
    public void removeRepository( String alias ) {
        final ConfigGroup thisRepositoryConfig = findRepositoryConfig( alias );

        if ( thisRepositoryConfig != null ) {
            configurationService.removeConfiguration( thisRepositoryConfig );
            final Repository repo = configuredRepositories.remove( alias );
            if ( repo != null ) {
View Full Code Here

    }

    @Override
    public Repository updateRepository( Repository repository,
                                        Map<String, Object> config ) {
        final ConfigGroup thisRepositoryConfig = findRepositoryConfig( repository.getAlias() );

        if ( thisRepositoryConfig != null && config != null ) {

            for ( Map.Entry<String, Object> entry : config.entrySet() ) {

                ConfigItem configItem = thisRepositoryConfig.getConfigItem( entry.getKey() );
                if ( configItem == null ) {
                    thisRepositoryConfig.addConfigItem( configurationFactory.newConfigItem( entry.getKey(), entry.getValue() ) );
                } else {
                    configItem.setValue( entry.getValue() );
                }
            }
View Full Code Here

    }

    @Override
    public void addDeployment( String identifier,
                               Object deploymentUnit ) {
        ConfigGroup deploymentConfig = configurationFactory.newConfigGroup( ConfigType.DEPLOYMENT, identifier, "" );
        deploymentConfig.addConfigItem( configurationFactory.newConfigItem( "unit", deploymentUnit ) );

        configurationService.addConfiguration( deploymentConfig );

        DeploymentConfig deployment = deploymentFactory.newDeployment( deploymentConfig );
        registeredDeployments.put( deployment.getIdentifier(), deployment );
View Full Code Here

        registeredDeployments.put( deployment.getIdentifier(), deployment );
    }

    @Override
    public void removeDeployment( String identifier ) {
        ConfigGroup deploymentConfig = configurationFactory.newConfigGroup( ConfigType.DEPLOYMENT, identifier, "" );
        configurationService.removeConfiguration( deploymentConfig );

        registeredDeployments.remove( identifier );

    }
View Full Code Here

TOP

Related Classes of org.guvnor.structure.server.config.ConfigGroup

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.