public static void main(String[] args) { try { // First , we create a new Xenon using the XenonFactory (without providing any properties). Xenon xenon = XenonFactory.newXenon(null); // Next, we retrieve the Files and Credentials interfaces Files files = xenon.files(); Credentials credentials = xenon.credentials(); // To create a new FileSystem we need a Credential that enable us to access the location. Credential c = credentials.getDefaultCredential("file"); // We need to know the OS to determine the root of the file system String root; if (Utils.isWindows()) { root = "C:"; } else { root = "/"; } // Now we can create a FileSystem (we don't provide any properties). FileSystem fs = files.newFileSystem("file", root, c, null); // We can now uses the FileSystem to access files! // .... // If we are done we need to close the FileSystem and the credential credentials.close(c); files.close(fs); // Finally, we end Xenon to release all resources XenonFactory.endXenon(xenon); } catch (XenonException e) { System.out.println("CreateLocalFileSystem example failed: " + e.getMessage()); e.printStackTrace(); } }
@SuppressWarnings("unused") public static void main(String[] args) { try { // We create a new Xenon using the XenonFactory (without providing any properties). Xenon xenon = XenonFactory.newXenon(null); // Next, we retrieve the Files, Jobs and Credentials API Files files = xenon.files(); Jobs jobs = xenon.jobs(); Credentials credentials = xenon.credentials(); // We can now uses the interfaces to get some work done! // .... // Finally, we end Xenon to release all resources XenonFactory.endXenon(xenon); } catch (XenonException e) { System.out.println("CreatingXenon example failed: " + e.getMessage()); e.printStackTrace(); } }
protected static Files getFiles() throws XenonException { // class synchronization: synchronized (AbstractFileTests.class) { // init xenon singleton instance: if (xenon == null) { xenon = XenonFactory.newXenon(null); } return xenon.files(); } }