1 17 package org.apache.servicemix.jbi.management.task; 18 19 import java.io.File ; 20 21 import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean; 22 import org.apache.tools.ant.BuildException; 23 24 28 public class InstallSharedLibraryTask extends JbiTask { 29 30 private String file; 32 35 public String getFile() { 36 return file; 37 } 38 41 public void setFile(String file) { 42 this.file = file; 43 } 44 45 49 public void doExecute(AdminCommandsServiceMBean acs) throws Exception { 50 if (file == null){ 51 throw new BuildException("null file - file should be an archive"); 52 } 53 if (!file.endsWith(".zip") && !file.endsWith(".jar")) { 54 throw new BuildException("file: " + file + " is not an archive"); 55 } 56 File archive = new File (file); 57 String location = archive.getAbsolutePath(); 58 if (!archive.isFile()) { 59 location = file; 61 } 62 acs.installSharedLibrary(location); 63 } 64 65 } | Popular Tags |