Skip to content

Instantly share code, notes, and snippets.

@dajester2013
Last active February 18, 2021 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dajester2013/e22eb4044ed1af149741 to your computer and use it in GitHub Desktop.
Save dajester2013/e22eb4044ed1af149741 to your computer and use it in GitHub Desktop.
Railo CFML-based filesystem interfaces

The following are the two interfaces needed to implement a cfml-based filesystem in Railo.

Steps:

  1. Build implementations of the ResourceProvider and Resource interfaces
  2. Add your ResourceProvider to the Railo config for the application you are working on:
  • <resource-provider arguments="arg1:value1;arg2:value2" component="path.to.YourResourceProvider" scheme="yourscheme"/>
  • Note: the arguments set in the above configuration are passed as a struct to the "args" argument in the ResourceProvider's constructor.
interface {
public boolean function isReadable();
public boolean function isWriteable();
public void function remove(boolean force);
public boolean function exists();
public String function getName();
public String function getParent();
public Resource function getParentResource();
public Resource function getRealResource(String realpath);
public String function getPath();
public boolean function isAbsolute();
public boolean function isDirectory();
public boolean function isFile();
public date function lastModified();
public numeric function length();
public Resource[] function listResources();
public boolean function setLastModified(date time);
public boolean function setWritable(boolean writable);
public boolean function setReadable(boolean readable);
public void function createFile(boolean createParentWhenNotExists);
public void function createDirectory(boolean createParentWhenNotExists);
public /*java.io.InputStream*/ function getInputStream();
public /*java.io.OutputStream*/ function getOutputStream(boolean append);
public void function setBinary(byteArray);
public binary function getBinary();
public numeric function getMode();
public void function setMode(numeric mode);
}
interface {
public ResourceProvider function init(String scheme, Struct args);
public Resource function getResource(String path);
public boolean function isCaseSensitive();
public boolean function isModeSupported();
public boolean function isAttributesSupported();
}
@zspitzer
Copy link

zspitzer commented Feb 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment