Examples of FtpConfig


Examples of org.exoplatform.services.ftp.config.FtpConfig

      try
      {
         ArrayList<String> newPath = clientSession().getFullPath(fileName);
        
         FtpConfig ftpConfig = clientSession().getFtpServer().getConfiguration();
         if (ftpConfig.isReplaceForbiddenChars())
         {
            String fName = newPath.get(newPath.size()-1);
            String newfName =
                     FtpTextUtils.replaceForbiddenChars(fName, ftpConfig.getForbiddenChars(), ftpConfig
                              .getReplaceChar());
           
            fileName  = fileName.substring(0, fileName.indexOf(fName)) + newfName;
         }
        
View Full Code Here

Examples of org.exoplatform.services.ftp.config.FtpConfig

            }
         }

         Node parentNode = (Node)curSession.getItem(onlyPath);

         FtpConfig configuration = clientSession().getFtpServer().getConfiguration();

         String fileNodeType = configuration.getDefFileNodeType();

         Node fileNode = parentNode.addNode(onlyName, fileNodeType);
         Node dataNode = fileNode.addNode(FtpConst.NodeTypes.JCR_CONTENT, FtpConst.NodeTypes.NT_RESOURCE);

         MimeTypeResolver mimeTypeResolver = new MimeTypeResolver();
         mimeTypeResolver.setDefaultMimeType(configuration.getDefFileMimeType());
         String mimeType = mimeTypeResolver.getMimeType(onlyName);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_MIMETYPE, mimeType);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_LASTMODIFIED, Calendar.getInstance());
View Full Code Here

Examples of org.exoplatform.services.ftp.config.FtpConfig

      try
      {
         ArrayList<String> newPath = clientSession().getFullPath(fileName);
        
         FtpConfig ftpConfig = clientSession().getFtpServer().getConfiguration();
         if (ftpConfig.isReplaceForbiddenChars())
         {
            String fName = newPath.get(newPath.size()-1);
            String newfName = FtpTextUtils.replaceForbiddenChars(fName, ftpConfig.getForbiddenChars(), ftpConfig.getReplaceChar());
           
            fileName  = fileName.substring(0, fileName.indexOf(fName)) + newfName;
         }
        
         Session curSession = clientSession().getSession(newPath.get(0));
View Full Code Here

Examples of org.exoplatform.services.ftp.config.FtpConfig

            }
         }

         Node parentNode = (Node)curSession.getItem(onlyPath);

         FtpConfig configuration = clientSession().getFtpServer().getConfiguration();

         String fileNodeType = configuration.getDefFileNodeType();

         Node fileNode = parentNode.addNode(onlyName, fileNodeType);
         Node dataNode = fileNode.addNode(FtpConst.NodeTypes.JCR_CONTENT, FtpConst.NodeTypes.NT_RESOURCE);

         MimeTypeResolver mimeTypeResolver = new MimeTypeResolver();
         mimeTypeResolver.setDefaultMimeType(configuration.getDefFileMimeType());
         String mimeType = mimeTypeResolver.getMimeType(onlyName);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_MIMETYPE, mimeType);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_LASTMODIFIED, Calendar.getInstance());
View Full Code Here

Examples of org.exoplatform.services.ftp.config.FtpConfig

            }
         }

         Node parentNode = (Node)curSession.getItem(onlyPath);

         FtpConfig configuration = clientSession().getFtpServer().getConfiguration();

         String fileNodeType = configuration.getDefFileNodeType();

         Node fileNode = parentNode.addNode(onlyName, fileNodeType);
         Node dataNode = fileNode.addNode(FtpConst.NodeTypes.JCR_CONTENT, FtpConst.NodeTypes.NT_RESOURCE);

         MimeTypeResolver mimeTypeResolver = new MimeTypeResolver();
         mimeTypeResolver.setDefaultMimeType(configuration.getDefFileMimeType());
         String mimeType = mimeTypeResolver.getMimeType(onlyName);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_MIMETYPE, mimeType);

         dataNode.setProperty(FtpConst.NodeTypes.JCR_LASTMODIFIED, Calendar.getInstance());
View Full Code Here

Examples of ua.pp.bizon.cripto.utils.FtpConfig

    @Test
    public void testFile() throws Exception {
        LOG.info("*****test file started******");
        IPath from = FileFactory.getLocalFile(prefix + "1.pdf");
        FtpConfig readConfig = FtpConfig.readConfig(HOST);
        IPath to = FileFactory.getRemoteFile(readConfig.getUrl(), readConfig.getLogin(), readConfig.getPass(), "backup/1/1.pdf");
        CryptoUtil cryptoUtil = new CryptoUtil(credentials);
        Configuration c = new Configuration();
        c.setDirection(Direction.ENCODE);
        c.setFrom(from);
        c.setTo(to);
        cryptoUtil.process(c);
        LOG.info("*****write to server done******");
        IPath response = FileFactory.getLocalFile(prefix + "2.pdf");
        c.setDirection(Direction.DECODE);
        c.setFrom(to);
        c.setTo(response);
        cryptoUtil.process(c);
        LOG.info("*****load from server done******");
        assertTrue(FileUtils.contentEquals(new File(from.getPath()), new File(response.getPath())));
        LOG.info("*****assert files done******");
        new File(prefix + "2.pdf").delete();
        FTPClient client = new FTPClient();
        client.connect(readConfig.getUrl());
        client.login(readConfig.getLogin(), readConfig.getPass());
        client.deleteFile("~/backup/1/1.pdf");
        client.disconnect();
        LOG.info("*****clean directories done******\n");
    }
View Full Code Here

Examples of ua.pp.bizon.cripto.utils.FtpConfig

    @Test
    public void testDirectory() throws Exception {
        LOG.info("*****test directory started******");
        IPath from = FileFactory.getLocalFile(prefix + "directory");
        FtpConfig readConfig = FtpConfig.readConfig(HOST);
        IPath to = FileFactory.getRemoteFile(readConfig.getUrl(), readConfig.getLogin(), readConfig.getPass(), "backup/2/");
        CryptoUtil cryptoUtil = new CryptoUtil(credentials);
        Configuration c = new Configuration();
        c.setDirection(Direction.ENCODE);
        c.setFrom(from);
        c.setTo(to);
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.