Package org.uberfire.java.nio.file

Examples of org.uberfire.java.nio.file.FileSystem


            public FileSystem create( CreationalContext<FileSystem> ctx ) {
                final Bean<IOService> bean = (Bean<IOService>) bm.getBeans( "configIO" ).iterator().next();
                final CreationalContext<IOService> _ctx = bm.createCreationalContext( bean );
                final IOService ioService = (IOService) bm.getReference( bean, IOService.class, _ctx );

                FileSystem systemFS;
                try {
                    systemFS = ioService.newFileSystem( URI.create( "git://system" ),
                                                        new HashMap<String, Object>() {{
                                                            put( "init", Boolean.TRUE );
                                                        }} );
View Full Code Here


    public void run() {
        try {
            final Repository repository = openRepository( repositoryName );
            if ( repository != null ) {
                final FileSystem fileSystem = repositoryResolver.resolveFileSystem( repository );

                if ( authorizationManager.authorize( fileSystem, user ) ) {
                    execute( user, repository, in, out, err );
                } else {
                    err.write( "Invalid credentials.".getBytes() );
View Full Code Here

    @Test
    public void testNewFileSystemUnsupportedOp() {
        final URI newRepo = URI.create("git://someunsup-repo-name");

        final FileSystem fs = PROVIDER.newFileSystem(newRepo, EMPTY_ENV);

        final Path path = JGitPathImpl.create( (JGitFileSystem) fs, "", "repo2-name", false );

        try {
            PROVIDER.newFileSystem(path, EMPTY_ENV);
View Full Code Here

        final Map<String, Object> env = new HashMap<String, Object>() {{
            put( JGitFileSystemProvider.GIT_DEFAULT_REMOTE_NAME, "git://localhost:9418/encoding-origin-name" );
            put( "listMode", "ALL" );
        }};

        final FileSystem fs = PROVIDER.newFileSystem( newRepo, env );

        assertThat( fs ).isNotNull();

        fs.getPath( "file+name.txt" ).toUri();

        PROVIDER.getPath( fs.getPath( "file+name.txt" ).toUri() );

        assertThat( PROVIDER.getPath( fs.getPath( "file+name.txt" ).toUri() ) ).isEqualTo( fs.getPath( "file+name.txt" ) );

        assertThat( PROVIDER.getPath( fs.getPath( "file name.txt" ).toUri() ) ).isEqualTo( fs.getPath( "file name.txt" ) );

        assertThat( fs.getPath( "file.txt" ).toUri() );

        assertThat( PROVIDER.getPath( fs.getPath( "file.txt" ).toUri() ) ).isEqualTo( fs.getPath( "file.txt" ) );
    }
View Full Code Here

                        env.put( entry.getKey(), entry.getValue() );
                    }
                }

                final URI uri = URI.create( _uri );
                final FileSystem fs;
                fs = service.newFileSystem( uri, env );

                newFileSystemListener.execute( fs, uri.getScheme(), ( (FileSystemId) fs ).id(), env );
            }
            return null;
View Full Code Here

        final Map<String, ?> env = new HashMap<String, Object>() {{
            put( "init", Boolean.TRUE );
        }};

        FileSystem fs = PROVIDER.newFileSystem( newRepo, env );

        WatchService ws = null;
        ws = fs.newWatchService();
        final Path path = fs.getRootDirectories().iterator().next();
        path.register( ws, StandardWatchEventKind.ENTRY_CREATE, StandardWatchEventKind.ENTRY_MODIFY, StandardWatchEventKind.ENTRY_DELETE, StandardWatchEventKind.ENTRY_RENAME );

        final WatchKey k = ws.take();

        final List<WatchEvent<?>> events = k.pollEvents();
View Full Code Here

    @Test
    public void testNewFileSystem() {
        final URI newRepo = URI.create( "git://repo-name" );

        final FileSystem fs = PROVIDER.newFileSystem( newRepo, EMPTY_ENV );

        assertThat( fs ).isNotNull();

        final DirectoryStream<Path> stream = PROVIDER.newDirectoryStream( PROVIDER.getPath( newRepo ), null );
        assertThat( stream ).isNotNull().hasSize( 0 );
View Full Code Here

        final Map<String, ?> env = new HashMap<String, Object>() {{
            put( "init", Boolean.TRUE );
        }};

        final FileSystem fs = PROVIDER.newFileSystem( newRepo, env );

        assertThat( fs ).isNotNull();

        final DirectoryStream<Path> stream = PROVIDER.newDirectoryStream( PROVIDER.getPath( newRepo ), null );
        assertThat( stream ).isNotNull().hasSize( 1 );
View Full Code Here

        final Map<String, Object> env = new HashMap<String, Object>() {{
            put( JGitFileSystemProvider.GIT_DEFAULT_REMOTE_NAME, "git://localhost:9418/my-simple-test-origin-name" );
            put( "listMode", "ALL" );
        }};

        final FileSystem fs = PROVIDER.newFileSystem( newRepo, env );

        assertThat( fs ).isNotNull();

        assertThat( fs.getRootDirectories() ).hasSize( 2 );

        assertThat( fs.getPath( "file.txt" ).toFile() ).isNotNull().exists();

        commit( origin.gitRepo(), "master", "user1", "user1@example.com", "commitx", null, null, false, new HashMap<String, File>() {{
            put( "fileXXXXX.txt", tempFile( "temp" ) );
        }} );

        PROVIDER.getFileSystem( URI.create( "git://my-repo-name?sync=git://localhost:9418/my-simple-test-origin-name&force" ) );

        assertThat( fs ).isNotNull();

        assertThat( fs.getRootDirectories() ).hasSize( 3 );

        for ( final Path root : fs.getRootDirectories() ) {
            if ( root.toAbsolutePath().toUri().toString().contains( "upstream" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            } else if ( root.toAbsolutePath().toUri().toString().contains( "origin" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 1 );
            } else {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            }
        }

        commit( origin.gitRepo(), "master", "user1", "user1@example.com", "commitx", null, null, false, new HashMap<String, File>() {{
            put( "fileYYYY.txt", tempFile( "tempYYYY" ) );
        }} );

        PROVIDER.getFileSystem( URI.create( "git://my-repo-name?sync=git://localhost:9418/my-simple-test-origin-name&force" ) );

        assertThat( fs.getRootDirectories() ).hasSize( 3 );

        for ( final Path root : fs.getRootDirectories() ) {
            if ( root.toAbsolutePath().toUri().toString().contains( "upstream" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 3 );
            } else if ( root.toAbsolutePath().toUri().toString().contains( "origin" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 1 );
            } else {
View Full Code Here

        final Map<String, Object> env = new HashMap<String, Object>() {{
            put( JGitFileSystemProvider.GIT_DEFAULT_REMOTE_NAME, "git://localhost:9418/my-simple-test-origin-repo" );
            put( "listMode", "ALL" );
        }};

        final FileSystem fs = PROVIDER.newFileSystem( newRepo, env );

        assertThat( fs ).isNotNull();

        assertThat( fs.getRootDirectories() ).hasSize( 2 );

        assertThat( fs.getPath( "file.txt" ).toFile() ).isNotNull().exists();

        commit( ( (JGitFileSystem) fs ).gitRepo(), "master", "user1", "user1@example.com", "commitx", null, null, false, new HashMap<String, File>() {{
            put( "fileXXXXX.txt", tempFile( "temp" ) );
        }} );

        PROVIDER.getFileSystem( URI.create( "git://my-repo?push=git://localhost:9418/my-simple-test-origin-repo&force" ) );

        assertThat( fs ).isNotNull();

        assertThat( fs.getRootDirectories() ).hasSize( 2 );

        for ( final Path root : fs.getRootDirectories() ) {
            if ( root.toAbsolutePath().toUri().toString().contains( "upstream" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            } else if ( root.toAbsolutePath().toUri().toString().contains( "origin" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 1 );
            } else {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            }
        }

        final URI newRepo2 = URI.create( "git://my-repo2" );

        final Map<String, Object> env2 = new HashMap<String, Object>() {{
            put( JGitFileSystemProvider.GIT_DEFAULT_REMOTE_NAME, "git://localhost:9418/my-simple-test-origin-repo" );
            put( "listMode", "ALL" );
        }};

        final FileSystem fs2 = PROVIDER.newFileSystem( newRepo2, env2 );

        PROVIDER.getFileSystem( URI.create( "git://my-repo?sync=git://localhost:9418/my-simple-test-origin-repo&force" ) );

        assertThat( fs2.getRootDirectories() ).hasSize( 2 );

        for ( final Path root : fs2.getRootDirectories() ) {
            if ( root.toAbsolutePath().toUri().toString().contains( "upstream" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            } else if ( root.toAbsolutePath().toUri().toString().contains( "origin" ) ) {
                assertThat( PROVIDER.newDirectoryStream( root, null ) ).isNotEmpty().hasSize( 2 );
            } else {
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.file.FileSystem

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.