Package org.uberfire.java.nio.file

Examples of org.uberfire.java.nio.file.Path.toUri()


                final Path resource = Paths.convert( pathCollectionEntry.getKey() );

                checkNotNull( "type", type );
                checkNotNull( "resource", resource );

                final String destinationPath = resource.toUri().toString().substring( projectPrefix.length() + 1 );
                changedFilesKieBuilderPaths.add( destinationPath );
                switch ( type ) {
                    case ADD:
                    case UPDATE:
                        //Only files can be processed
View Full Code Here


                    final Path resource = Paths.convert( pathCollectionEntry.getKey() );

                    checkNotNull( "type", type );
                    checkNotNull( "resource", resource );

                    final String destinationPath = resource.toUri().toString().substring( projectPrefix.length() + 1 );
                    changedFilesKieBuilderPaths.add( destinationPath );
                    switch ( type ) {
                        case ADD:
                        case UPDATE:
                            //Only files can be processed
View Full Code Here

        });
        Collection<Directory> foundDirectories = new ArrayList<Directory>();
        Iterator<Path> it = directories.iterator();
        while (it.hasNext()) {
            Path dir = it.next();
            String uniqueId = encodeUniqueId(dir.toUri().toString());
            foundDirectories.add(new Directory(uniqueId, dir.getFileName().toString(), trimLocation(dir)));
        }

        return foundDirectories;
    }
View Full Code Here

    public Directory createDirectory(String location) {
        location = UriUtils.encode(location);
        Path path = descriptor.getFileSystem().provider().getPath(URI.create(descriptor.getStringRepositoryRoot() + location));

        path = ioService.createDirectories(path);
        String uniqueId = encodeUniqueId(path.toUri().toString());
        Directory directory = new Directory(uniqueId, path.getFileName().toString(), trimLocation(path));
        return directory;
    }

    public boolean directoryExists(String directory) {
View Full Code Here

    public Asset loadAssetFromPath(String location) throws AssetNotFoundException {
        location = UriUtils.encode(location);
        Path path = descriptor.getFileSystem().provider().getPath(URI.create(descriptor.getStringRepositoryRoot() + location));

        if (ioService.exists(path)) {
            return loadAsset(path.toUri().toString());
        } else {
            throw new AssetNotFoundException();
        }

    }
View Full Code Here

            pathURI = URI.create(descriptor.getStringRepositoryRoot() + (asset.getAssetLocation().equals("/")?"":asset.getAssetLocation()) + "/" +asset.getFullName());
        }

        Path filePath = fileSystem.provider().getPath(pathURI);

        if (assetExists(filePath.toUri().toString())) {
            throw new org.uberfire.java.nio.file.FileAlreadyExistsException( pathURI.toString() );
        }
        createIfNotExists(filePath);
        try {
            CommentedOption commentedOption = new CommentedOption(getIdentity(), "Created asset " + asset.getFullName());
View Full Code Here

            }
            outputStream.close();
        } catch (java.io.IOException e) {
            throw new RuntimeException("Error when creating asset", e);
        }
        return encodeUniqueId(filePath.toUri().toString());
    }

    public String updateAsset(Asset asset, String commitMessage) throws AssetNotFoundException {
        encodeAsset(asset);
        String uniqueId = decodeUniqueId(asset.getUniqueId());
View Full Code Here

    public boolean deleteAssetFromPath(String path) {
        path = UriUtils.encode(path);
        Path filePath = descriptor.getFileSystem().provider().getPath(URI.create(descriptor.getStringRepositoryRoot() + path));

        return deleteAsset(filePath.toUri().toString());
    }

    public boolean assetExists(String assetUniqueId) {
        String uniqueId = decodeUniqueId(assetUniqueId);
        try {
View Full Code Here

                final Path resource = Paths.convert( pathCollectionEntry.getKey() );

                checkNotNull( "type", type );
                checkNotNull( "resource", resource );

                final String destinationPath = resource.toUri().toString().substring( projectPrefix.length() + 1 );
                changedFilesKieBuilderPaths.add( destinationPath );
                switch ( type ) {
                    case ADD:
                    case UPDATE:
                        //Only files can be processed
View Full Code Here

                checkNotNull( "type", type );
                checkNotNull( "resource", resource );

                final BuildValidationHelper validator = getBuildValidationHelper( resource );
                final String destinationPath = resource.toUri().toString().substring( projectPrefix.length() + 1 );
                changedFilesKieBuilderPaths.add( destinationPath );
                switch ( type ) {
                    case ADD:
                    case UPDATE:
                        //Only files can be processed
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.