Package org.apache.jackrabbit.vault.util.console

Examples of org.apache.jackrabbit.vault.util.console.ConsoleFile


    protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception {
        boolean forced = cl.hasOption(optForce);
        String jcrPath = (String) cl.getValue(argJcrPath);
        String name = (String) cl.getValue(argLocalPath);

        ConsoleFile wo = ctx.getFile(jcrPath, true);
        if (wo instanceof VaultFsCFile) {
            VaultFile file = (VaultFile) wo.unwrap();
            if (name == null) {
                name = file.getName();
            }
            File local = ctx.getVaultFsApp().getPlatformFile(name, false);
            doGet(file, local, forced);
View Full Code Here


        if (cmd.equals("getRelated")) {
            if (args.size()<1) {
                throw new ExecutionException("getRelated. needs path argument.");
            }
            String path = (String) args.get(0);
            ConsoleFile wo = ctx.getFile(path, true);
            if (wo instanceof VaultFsCFile) {
                VaultFile file = (VaultFile) wo.unwrap();
                Collection<? extends VaultFile> related = file.getRelated();
                if (related == null) {
                    System.out.println("(null)");                   
                } else {
                    for (VaultFile f: related) {
                        System.out.println(f.getPath());
                    }
                }
            } else {
                VaultFsApp.log.info("File not a jcrfs file.: {}", path);
            }

        }
        if (cmd.equals("test")) {
            if (args.size()<1) {
                throw new ExecutionException("test. needs path argument.");
            }
            String path = (String) args.get(0);
            ConsoleFile wo = ctx.getFile(path, true);
            if (wo instanceof PlatformFile) {
                File file = (File) wo.unwrap();
                DefaultWorkspaceFilter r = new DefaultWorkspaceFilter();
                try {
                    r.load(file);
                    DumpContext dCtx = new DumpContext(new PrintWriter(System.out));
                    r.dump(dCtx, false);
View Full Code Here

public class CmdInvalidate extends AbstractJcrFsCommand {

    protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception {
        String jcrPath = (String) cl.getValue(argJcrPath);

        ConsoleFile wo = ctx.getFile(jcrPath, true);
        if (wo instanceof VaultFsCFile) {
            VaultFile file = (VaultFile) wo.unwrap();
            file.invalidate();
        } else {
            throw new ExecutionException("'cat' only possible in jcr fs context");
        }
    }
View Full Code Here

        String jcrPath = (String) cl.getValue(argJcrPath);

        List added = cl.getValues(optAdd);
        List rems = cl.getValues(optRemove);

        ConsoleFile wo = ctx.getFile(jcrPath, true);
        if (wo instanceof RepositoryCFile) {
            Node node = (Node) wo.unwrap();
            try {
                for (Iterator it = added.iterator(); it.hasNext();) {
                    node.addMixin((String) it.next());
                }
                for (Iterator it = rems.iterator(); it.hasNext();) {
View Full Code Here

public class CmdRm extends AbstractJcrFsCommand {

    protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception {
        String path = (String) cl.getValue(argPath);
        boolean recursive = cl.hasOption(optRecursive);
        ConsoleFile file = ctx.getFile(path, true);
        if (file instanceof AggregateCFile) {
            AggregateImpl node = (AggregateImpl) file.unwrap();
            node.remove(recursive);
        } else {
            throw new ExecutionException("remove only allowed in afct mode.");
        }
    }
View Full Code Here

        VaultFileSystem fs = ctx.getVaultFsApp().getVaultFileSystem();
        if (fs == null) {
            VaultFsApp.log.info("Not mounted.");
        } else if (path != null && !path.equals("")) {
            if (cl.hasOption(optConfig) || cl.hasOption(optFilter)) {
                ConsoleFile f = ctx.getCurrentFile();
                File file;
                if (f instanceof PlatformFile) {
                    f = f.getFile(path, false);
                    file = (File) f.unwrap();
                } else {
                    file = ctx.getVaultFsApp().getPlatformFile(path, false);
                }
                if (cl.hasOption(optConfig)) {
                    IOUtils.copy(
View Full Code Here

            throws Exception {
        String jcrPath = (String) cl.getValue(argJcrPath);
        if (jcrPath == null) {
            jcrPath = "/";
        }
        ConsoleFile wo = ctx.getFile(jcrPath, true);
        if (wo instanceof RepositoryCFile) {
            Node node = (Node) wo.unwrap();
            try {
                node.refresh(cl.hasOption(optKeepChanges));
                System.out.println("Modifications refreshed.");
            } catch (RepositoryException e) {
                throw new ExecutionException("Error while refreshing: " + e);
View Full Code Here

public class CmdCat extends AbstractJcrFsCommand {

    protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception {
        String jcrPath = (String) cl.getValue(argJcrPath);

        ConsoleFile wo = ctx.getFile(jcrPath, true);
        if (wo instanceof VaultFsCFile) {
            VaultFile file = (VaultFile) wo.unwrap();
            try {
                String ct = file.getContentType();
                if (ct == null) {
                    ct = "application/octet-stream";
                }
View Full Code Here

        int depth = 0;
        if (cl.hasOption(optRecursive)) {
            depth = Integer.parseInt((String) cl.getValue(optRecursive, "10000"));
        }
        String path = (String) cl.getValue(argPath);
        ConsoleFile file = ctx.getFile(path, true);
        if (!(file instanceof PlatformFile)) {
            throw new ExecutionException("wrong file system.");
        }
        ls((PlatformFile) file, fmtFlag, depth);
    }
View Full Code Here

                                        .create();

    protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception {
        int fmtFlag = getFormatFlags(ctx, cl);
        String path = (String) cl.getValue(argPath);
        ConsoleFile file = ctx.getFile(path, true);
        ls(file, fmtFlag, 0);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.util.console.ConsoleFile

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.