use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.
the class Ftp method doEndTag.
@Override
public int doEndTag() throws PageException {
pool = ((PageContextImpl) pageContext).getFTPPool();
AFTPClient client = null;
// retries
do {
try {
if (action.equals("open"))
client = actionOpen();
else if (action.equals("close"))
client = actionClose();
else if (action.equals("changedir"))
client = actionChangeDir();
else if (action.equals("createdir"))
client = actionCreateDir();
else if (action.equals("listdir"))
client = actionListDir();
else if (action.equals("removedir"))
client = actionRemoveDir();
else if (action.equals("getfile"))
client = actionGetFile();
else if (action.equals("putfile"))
client = actionPutFile();
else if (action.equals("rename"))
client = actionRename();
else if (action.equals("remove"))
client = actionRemove();
else if (action.equals("getcurrentdir"))
client = actionGetCurrentDir();
else if (action.equals("getcurrenturl"))
client = actionGetCurrentURL();
else if (action.equals("existsdir"))
client = actionExistsDir();
else if (action.equals("existsfile"))
client = actionExistsFile();
else if (action.equals("exists"))
client = actionExists();
else
throw new ApplicationException("attribute action has an invalid value [" + action + "]", "valid values are [open,close,listDir,createDir,removeDir,changeDir,getCurrentDir," + "getCurrentURL,existsFile,existsDir,exists,getFile,putFile,rename,remove]");
} catch (IOException ioe) {
if (count++ < retrycount)
continue;
throw Caster.toPageException(ioe);
}
if (client == null || !checkCompletion(client))
break;
} while (true);
return EVAL_PAGE;
}
use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.
the class Ftp method actionRemove.
/**
* removes a file on the server
* @return FTPCLient
* @throws IOException
* @throws PageException
*/
private AFTPClient actionRemove() throws IOException, PageException {
required("item", item);
AFTPClient client = getClient();
client.deleteFile(item);
writeCfftp(client);
return client;
}
use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.
the class Ftp method actionCreateDir.
/**
* create a remote directory
* @return FTPCLient
* @throws IOException
* @throws PageException
*/
private AFTPClient actionCreateDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
client.makeDirectory(directory);
writeCfftp(client);
return client;
}
use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.
the class Ftp method actionClose.
/**
* close a existing ftp connection
* @return FTPCLient
* @throws PageException
*/
private AFTPClient actionClose() throws PageException {
FTPConnection conn = _createConnection();
AFTPClient client = pool.remove(conn);
Struct cfftp = writeCfftp(client);
cfftp.setEL("succeeded", Caster.toBoolean(client != null));
return client;
}
use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.
the class Ftp method actionExistsDir.
/**
* check if a directory exists or not
* @return FTPCLient
* @throws PageException
* @throws IOException
*/
private AFTPClient actionExistsDir() throws PageException, IOException {
required("directory", directory);
AFTPClient client = getClient();
boolean res = existsDir(client, directory);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(res));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
stoponerror = false;
return client;
}
Aggregations