/** * @throws FtpException * always, operation not supported * @see org.apache.ftpserver.ftplet.UserManager#save(org.apache.ftpserver.ftplet.User) */ public void save(User user) throws FtpException { throw new FtpException("No custom user handling on this instance"); }
/** * Get the root cause. * @return The root cause * @deprecated Use {@link Exception#getCause()} instead */ @Deprecated public Throwable getRootCause() { return getCause(); } }
/** * @see org.apache.ftpserver.ftplet.UserManager#getAdminName() */ public String getAdminName() throws FtpException { throw new FtpException("No custom user handling on this instance"); }
/** * @see org.apache.ftpserver.ftplet.UserManager#getAllUserNames() */ public String[] getAllUserNames() throws FtpException { throw new FtpException("No custom user handling on this instance"); }
/** * @throws FtpException * always, operation not supported. * @see org.apache.ftpserver.ftplet.UserManager#delete(java.lang.String) */ public void delete(String username) throws FtpException { throw new FtpException("No custom user handling on this instance"); }
/** * Get long value. */ public long getLong(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return Long.parseLong(value); } catch (NumberFormatException ex) { throw new FtpException("BaseProperties.getLong()", ex); } }
/** * Get <code>InetAddress</code>. */ public InetAddress getInetAddress(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return InetAddress.getByName(value); } catch (UnknownHostException ex) { throw new FtpException("Host " + value + " not found"); } }
/** * Get <code>Date</code> object. */ public Date getDate(final String str, final DateFormat fmt) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return fmt.parse(value); } catch (ParseException ex) { throw new FtpException("BaseProperties.getdate()", ex); } }
/** * Get integer value. */ public int getInteger(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return Integer.parseInt(value); } catch (NumberFormatException ex) { throw new FtpException("BaseProperties.getInteger()", ex); } }
/** * Get double value. */ public double getDouble(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return Double.parseDouble(value); } catch (NumberFormatException ex) { throw new FtpException("BaseProperties.getDouble()", ex); } }
/** * Get <code>Class</code> object */ public Class<?> getClass(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return Class.forName(value); } catch (ClassNotFoundException ex) { throw new FtpException("BaseProperties.getClass()", ex); } }
/** * Get <code>DateFormat</code> object. */ public SimpleDateFormat getDateFormat(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return new SimpleDateFormat(value); } catch (IllegalArgumentException e) { throw new FtpException("Date format was incorrect: " + value, e); } }
/** * Get boolean value. */ public boolean getBoolean(final String str) throws FtpException { String prop = getProperty(str); if (prop == null) { throw new FtpException(str + " not found"); } return prop.toLowerCase().equals("true"); }
/** * Get <code>String</code>. */ public String getString(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } return value; }
/** * Get <code>File</code> object. */ public File getFile(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } return new File(value); }
@Override public FileSystemView createFileSystemView( User user ) throws FtpException { MiltonUser mu = (MiltonUser) user; Resource root; try { root = resourceFactory.getResource( mu.domain, "/" ); } catch (NotAuthorizedException ex) { throw new FtpException(ex); } catch (BadRequestException ex) { throw new FtpException(ex); } return new MiltonFsView( Path.root, mu.domain, resourceFactory, (MiltonUser) user ); }
/** * Get <code>TimeZone</code> */ public TimeZone getTimeZone(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } return TimeZone.getTimeZone(value); }
private CollectionResource getWorkingDir() throws FtpException { try { Resource working = resourceFactory.getResource(host, currentPath.toString()); if (working instanceof CollectionResource) { return (CollectionResource) working; } return null; } catch (NotAuthorizedException e) { throw new FtpException(e); } catch (BadRequestException e) { throw new FtpException(e); } }
@Override public FtpFile getHomeDirectory() throws FtpException { try { Resource home = resourceFactory.getResource(host, homePath.toString()); return wrap(homePath, home); } catch (NotAuthorizedException ex) { throw new FtpException(ex); } catch (BadRequestException ex) { throw new FtpException(ex); } }
/** * Create the appropriate user file system view. */ public FileSystemView createFileSystemView(User user) throws FtpException { synchronized (user) { // create home if does not exist if (createHome) { String homeDirStr = user.getHomeDirectory(); File homeDir = new File(homeDirStr); if (homeDir.isFile()) { LOG.warn("Not a directory :: " + homeDirStr); throw new FtpException("Not a directory :: " + homeDirStr); } if ((!homeDir.exists()) && (!homeDir.mkdirs())) { LOG.warn("Cannot create user home :: " + homeDirStr); throw new FtpException("Cannot create user home :: " + homeDirStr); } } FileSystemView fsView = new NativeFileSystemView(user, caseInsensitive); return fsView; } }