List of usage examples for org.apache.commons.vfs FileSystemException getMessage
public String getMessage()
From source file:org.cfeclipse.cfml.views.explorer.vfs.view.VFSView.java
/** * Creates the Drag & Drop DropTarget for items being dropped onto the tree. * /*from ww w .j a v a 2 s. co m*/ * @return the DropTarget for the tree */ private DropTarget createTreeDropTarget(final Tree tree) { DropTarget dropTarget = new DropTarget(tree, DND.DROP_COPY); // | DND.DROP_MOVE dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() }); // Transfer data type is text //dropTarget.setTransfer(new Transfer[] { RTFTransfer.getInstance()} ); System.out.println("createTreeDropTarget"); dropTarget.addDropListener(new DropTargetAdapter() { public void dragEnter(DropTargetEvent event) { isDropping = true; } public void dragLeave(DropTargetEvent event) { isDropping = false; //TODO try { // handleDeferredRefresh(); // } catch (Exception e) { // debug("createTreeDropTarget.dragLeave " + e); // } } public void dragOver(DropTargetEvent event) { dropTargetValidate(event, getTargetFile(event)); event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL; } public void drop(DropTargetEvent event) { FileAndConnectionId targetFile = getTargetFile(event); try { System.out.println("createTreeDropTarget.drop targetFile=" + targetFile.file); if (dropTargetValidate(event, targetFile)) dropTargetHandleDrop(event, targetFile); } catch (FileSystemException e) { VFSUtil.MessageBoxError(e.getMessage()); } catch (Exception e1) { debug(e1); // "createTreeDropTarget.drop " + } } private FileAndConnectionId getTargetFile(DropTargetEvent event) { // Determine the target FileObject for the drop TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y))); FileObject targetFile = null; String connectionId = ""; if (item != null) { // We are over a particular item in the tree, use the item's file //targetFile = (FileObject) item.getData(TREEITEMDATA_FILE); String uri = (String) item.getData(TREEITEMDATA_URI); connectionId = (String) item.getData(TREEITEMDATA_CONNECTIONID); try { targetFile = resolveURI(uri, connectionId); } catch (Exception e) { debug(e); //"createTreeDropTarget.getTargetFile " + } } return new FileAndConnectionId(targetFile, connectionId); } }); return dropTarget; }
From source file:org.cfeclipse.cfml.views.explorer.vfs.view.VFSView.java
/** * Updates the table's contents//from www . ja va 2 s . c o m */ private void workerExecute() { FileObject[] dirList; // Clear existing information display.syncExec(new Runnable() { public void run() { tabFileItems.setText(VFSView.getResourceString("details.ContentsOf.text", new Object[] { VFSUtil.stripUserTokens(workerStateDir.toString()) })); table.removeAll(); table.setData(TABLEDATA_DIR, workerStateDir); table.setData(TABLEDATA_CONNECTIONID, workerStateConnectionId); } }); try { dirList = getDirectoryList(workerStateDir); for (int i = 0; (!workerCancelled) && (i < dirList.length); i++) { workerAddFileDetails(dirList[i], workerStateConnectionId); } } catch (FileSystemException e) { VFSUtil.MessageBoxError(e.getMessage()); } }
From source file:org.jahia.services.content.impl.external.vfs.VFSDataSource.java
public void setRoot(String root) { this.root = root; try {// w w w .j a v a 2 s. c o m manager = VFS.getManager(); rootPath = getFile("/").getName().getPath(); } catch (FileSystemException e) { logger.error(e.getMessage(), e); } }
From source file:org.jahia.services.content.impl.vfs.VFSRepositoryImpl.java
public VFSRepositoryImpl(String root, VFSAccessControlManager accessControlManager) { initDescriptors();//from w w w . jav a 2 s. c om this.root = root; this.accessControlManager = accessControlManager; try { manager = VFS.getManager(); rootPath = getFile("/").getName().getPath(); } catch (FileSystemException e) { logger.error(e.getMessage(), e); } }
From source file:org.josso.tooling.gshell.install.installer.JEEInstaller.java
@Override public void validatePlatform() throws InstallException { boolean valid = true; try {// w w w .j av a 2s. co m if (!targetDir.exists() || !targetDir.getType().getName().equals(FileType.FOLDER.getName())) { getPrinter().printErrStatus("Target", "folder does not exist or is not a directory:" + targetDir.getName().getFriendlyURI()); valid = false; } if (!valid) throw new InstallException("Invalid Target Platform"); getPrinter().printOkStatus(getTargetPlatform().getDescription(), "Directory Layout"); } catch (FileSystemException e) { log.error(e.getMessage(), e); throw new InstallException("Invalid Target Platform"); } }
From source file:org.josso.tooling.gshell.install.installer.VFSInstaller.java
public void validatePlatform() throws InstallException { boolean valid = true; try {/*from w ww.j a v a2s.co m*/ if (!targetDir.exists() || !targetDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target", "folder does not exist or is not a directory:" + targetDir.getName().getFriendlyURI()); valid = false; } if (!targetLibDir.exists() || !targetLibDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target lib", "folder does not exist or is not a directory:" + targetLibDir.getName().getFriendlyURI()); valid = false; } if (!targetBinDir.exists() || !targetBinDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target bin", "folder does not exist or is not a directory:" + targetBinDir.getName().getFriendlyURI()); valid = false; } if (!targetConfDir.exists() || !targetConfDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target conf", "folder does not exist or is not a directory:" + targetConfDir.getName().getFriendlyURI()); valid = false; } if (!targetEndorsedLibDir.exists() || !targetEndorsedLibDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target endorsed lib", "folder does not exist or is not a directory:" + targetEndorsedLibDir.getName().getFriendlyURI()); valid = false; } if (!targetJOSSOSharedLibDir.exists() || !targetJOSSOSharedLibDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target JOSSO shared lib", "folder does not exist or is not a directory:" + targetJOSSOSharedLibDir.getName().getFriendlyURI()); valid = false; } if (!targetJOSSOLibDir.exists() || !targetJOSSOLibDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target JOSSO lib", "folder does not exist or is not a directory:" + targetJOSSOLibDir.getName().getFriendlyURI()); valid = false; } if (!targetJOSSOConfDir.exists() || !targetJOSSOConfDir.getType().getName().equals(FileType.FOLDER.getName())) { printer.printErrStatus("Target JOSSO conf", "folder does not exist or is not a directory:" + targetJOSSOConfDir.getName().getFriendlyURI()); valid = false; } if (!valid) throw new InstallException("Invalid Target Platform"); printer.printOkStatus(getTargetPlatform().getDescription(), "Directory Layout"); } catch (FileSystemException e) { log.error(e.getMessage(), e); throw new InstallException("Invalid Target Platform"); } }
From source file:org.josso.tooling.gshell.install.installer.VFSInstaller.java
public boolean installJar(FileObject srcFile, FileObject destFolder, String newName, boolean explode, boolean replace) throws IOException { try {// ww w . ja v a 2s. c o m if (explode) { FileObject jarFile = getFileSystemManager() .resolveFile("jar:" + srcFile.getName().getFriendlyURI()); if (log.isDebugEnabled()) log.debug("Exploding JAR [" + srcFile.getName().getFriendlyURI() + "] to [" + destFolder.getName().getFriendlyURI() + "]"); installFolder(jarFile, destFolder, newName, replace); } else { installFile(srcFile, destFolder, newName, replace); } getPrinter().printActionOkStatus("Unjar", srcFile.getName().getBaseName(), destFolder.getName().getFriendlyURI()); return true; } catch (FileSystemException e) { log.error("Cannot unjar file " + srcFile.getName().getFriendlyURI() + " : " + e.getMessage(), e); getPrinter().printActionErrStatus("Unjar", srcFile.getName().getBaseName(), e.getMessage()); } return false; }
From source file:org.josso.tooling.gshell.install.installer.VFSInstaller.java
protected FileSystemManager getFileSystemManager() { if (fsManager == null) { try {//from w ww .ja v a 2 s. c o m fsManager = VFS.getManager(); } catch (FileSystemException e) { log.error(e.getMessage(), e); throw new RuntimeException(e); } } return fsManager; }
From source file:org.josso.tooling.gshell.install.installer.WasceInstaller.java
@Override public void performAdditionalTasks(FileObject libsDir) throws InstallException { try {//from w w w .j a va 2 s . co m // undeploy wasce tomcat6 module if exists FileObject tomcatModule = targetDir.resolveFile("repository/org/apache/geronimo/configs/tomcat6"); if (tomcatModule.exists()) { getPrinter().printMsg("Undeploying tomcat6 module"); int status = undeploy("tomcat6"); if (status == 0) { getPrinter().printOkStatus("Undeploy tomcat6 module", "Successful"); } else { getPrinter().printErrStatus("Undeploy tomcat6 module", "Error"); throw new InstallException("Error undeploying tomcat6 module!!!"); } } // undeploy old josso wasce agent if exists FileObject jossoWasceAgentModule = targetDir.resolveFile("repository/org/josso/josso-wasce-agent"); if (jossoWasceAgentModule.exists()) { getPrinter().printMsg("Undeploying old josso wasce agent"); int status = undeploy("josso-wasce-agent"); if (status == 0) { getPrinter().printOkStatus("Undeploy josso wasce agent", "Successful"); } else { getPrinter().printErrStatus("Undeploy josso wasce agent", "Error"); throw new InstallException("Error undeploying josso wasce agent!!!"); } } // install jars to wasce repository try { getPrinter().printMsg("Installing new jars to WASCE repository"); FileObject wasceRepo = targetDir.resolveFile("repository"); FileObject wasceRepoFolder = libsDir.resolveFile("repository"); wasceRepo.copyFrom(wasceRepoFolder, Selectors.SELECT_ALL); getPrinter().printOkStatus("Install new jars", "Successful"); } catch (FileSystemException e) { getPrinter().printErrStatus("Install new jars", "Error"); throw new InstallException("Error copying jars to wasce repository!!!"); } // deploy josso wasce agent getPrinter().printMsg("Deploying josso wasce agent"); FileObject jossoWasceCarFile = null; FileObject[] agentBins = libsDir.getChildren(); for (int i = 0; i < agentBins.length; i++) { FileObject agentBin = agentBins[i]; if (agentBin.getName().getBaseName().startsWith("josso-wasce")) { jossoWasceCarFile = agentBin; break; } } if (jossoWasceCarFile == null) { throw new InstallException("Josso wasce agent car file doesn't exist!!!"); } int status = installPlugin(jossoWasceCarFile); if (status == 0) { getPrinter().printOkStatus("Install josso wasce agent", "Successful"); } else { getPrinter().printErrStatus("Install josso wasce agent", "Error"); throw new InstallException("Error installing josso wasce agent!!!"); } // start stopped services getPrinter().printMsg("Starting tomcat related services"); status = startTomcatRelatedServices(); if (status == 0) { getPrinter().printOkStatus("Start tomcat related services", "Successful"); } else { getPrinter().printErrStatus("Start tomcat related services", "Error"); throw new InstallException("Error starting tomcat related services!!!"); } } catch (IOException e) { throw new InstallException(e.getMessage(), e); } }
From source file:org.josso.tooling.gshell.install.installer.WeblogicInstaller.java
@Override public void init() throws InstallException { try {/* w w w . j av a2 s.c om*/ log.debug("Init Weblogic installer"); String weblogicDomain = getProperty("weblogicDomain"); if (weblogicDomain == null) throw new InstallException("Weblogic Domain path not specified"); log.debug("Weblogic Domain : " + weblogicDomain); registerVarResolution("domain", weblogicDomain); // Initialize installer, this will initialize standar folders. super.init(); targetJOSSOMBeansDir = targetLibDir.resolveFile("mbeantypes"); } catch (FileSystemException e) { throw new InstallException(e.getMessage(), e); } }