< prev index next >

functional/appBundlerTestsJDK9/appBundlerTestsJDK9/src/com/oracle/appbundlers/utils/BundlingManager.java

Print this page




  13 import java.util.logging.Logger;
  14 
  15 import com.oracle.appbundlers.utils.installers.AbstractBundlerUtils;
  16 import com.oracle.tools.packager.Bundler;
  17 import com.oracle.tools.packager.ConfigException;
  18 import com.oracle.tools.packager.UnsupportedPlatformException;
  19 
  20 /**
  21  *
  22  * @author Andrei Eremeev &lt;andrei.eremeev@oracle.com&gt;
  23  */
  24 public abstract class BundlingManager implements Constants {
  25 
  26     private static final Logger LOG = Logger
  27             .getLogger(BundlingManager.class.getName());
  28 
  29     private boolean installed = false;
  30 
  31     private final AbstractBundlerUtils bundlerUtils;
  32     protected AppWrapper app;
  33     protected ExtensionType extensionType;
  34 
  35     public BundlingManager(AbstractBundlerUtils bundlerUtils) {
  36         this.bundlerUtils = bundlerUtils;
  37     }
  38 
  39     public abstract boolean validate(Map<String, Object> params)
  40             throws UnsupportedPlatformException, ConfigException;
  41 
  42     public abstract File execute(Map<String, Object> params, File file)
  43             throws IOException;
  44 
  45     public Path execute(Map<String, Object> params, AppWrapper app)
  46             throws IOException {
  47         this.app = app;
  48         LOG.log(Level.INFO, "Bundling with params: {0}.", params);
  49         Path bundlesDir = app.getBundlesDir();
  50         return execute(params, bundlesDir.toFile()).toPath();
  51     }
  52 
  53     public Bundler getBundler() {
  54         return bundlerUtils.getBundler();
  55     }
  56 
  57     public void verifyOption(String name, Object value, AppWrapper app2,
  58             String applicationTitle) {
  59         bundlerUtils.verifyOption(name, value, app2, applicationTitle);
  60     }
  61 
  62     public Path getInstalledAppRootLocation(AppWrapper app,
  63             String applicationTitle) {
  64         return bundlerUtils.getInstalledAppRootLocation(app, applicationTitle);
  65     }
  66 
  67     public ProcessOutput runInstalledExecutable(AppWrapper app,
  68             String applicationTitle) throws IOException, ExecutionException {
  69         return bundlerUtils.runInstalledExecutable(app, applicationTitle);
  70     }


 107      * @param applicationTitle
 108      *            application title
 109      * @throws java.io.IOException
 110      */
 111     public void uninstall(AppWrapper app, String applicationTitle)
 112             throws IOException {
 113         if (installed) {
 114             bundlerUtils.uninstall(app, applicationTitle);
 115             installed = false;
 116         }
 117     }
 118 
 119     public String getAppName(Map<String, Object> params) {
 120         return bundlerUtils.getAppName(params);
 121     }
 122 
 123     public abstract String getShortName();
 124 
 125     @Override
 126     public String toString() {
 127         return getShortName() + "-" + getExtensionType() + "-"
 128                 + getBundler().getID();
 129     }
 130 
 131     public Path getAppCDSCacheFile(AppWrapper app, String appName) {
 132         return bundlerUtils.getAppCDSCacheFile(app, appName);
 133     }
 134 
 135     public AbstractBundlerUtils getBundlerUtils() {
 136         return bundlerUtils;
 137     }
 138 
 139     public ExtensionType getExtensionType() {
 140         return this.extensionType;
 141     }
 142 
 143     public void setExtensionType(ExtensionType extensionType) {
 144         this.extensionType = extensionType;
 145     }
 146 }


  13 import java.util.logging.Logger;
  14 
  15 import com.oracle.appbundlers.utils.installers.AbstractBundlerUtils;
  16 import com.oracle.tools.packager.Bundler;
  17 import com.oracle.tools.packager.ConfigException;
  18 import com.oracle.tools.packager.UnsupportedPlatformException;
  19 
  20 /**
  21  *
  22  * @author Andrei Eremeev &lt;andrei.eremeev@oracle.com&gt;
  23  */
  24 public abstract class BundlingManager implements Constants {
  25 
  26     private static final Logger LOG = Logger
  27             .getLogger(BundlingManager.class.getName());
  28 
  29     private boolean installed = false;
  30 
  31     private final AbstractBundlerUtils bundlerUtils;
  32     protected AppWrapper app;

  33 
  34     public BundlingManager(AbstractBundlerUtils bundlerUtils) {
  35         this.bundlerUtils = bundlerUtils;
  36     }
  37 
  38     public abstract boolean validate(Map<String, Object> params)
  39             throws UnsupportedPlatformException, ConfigException;
  40 
  41     public abstract File execute(Map<String, Object> params, File file)
  42             throws IOException;
  43 
  44     public Path execute(Map<String, Object> params, AppWrapper app)
  45             throws IOException {
  46         this.app = app;
  47         LOG.log(Level.INFO, "Bundling with params: {0}.", params);
  48         return execute(params, app.getBundlesDir().toFile()).toPath();

  49     }
  50 
  51     public Bundler getBundler() {
  52         return bundlerUtils.getBundler();
  53     }
  54 
  55     public void verifyOption(String name, Object value, AppWrapper app2,
  56             String applicationTitle) {
  57         bundlerUtils.verifyOption(name, value, app2, applicationTitle);
  58     }
  59 
  60     public Path getInstalledAppRootLocation(AppWrapper app,
  61             String applicationTitle) {
  62         return bundlerUtils.getInstalledAppRootLocation(app, applicationTitle);
  63     }
  64 
  65     public ProcessOutput runInstalledExecutable(AppWrapper app,
  66             String applicationTitle) throws IOException, ExecutionException {
  67         return bundlerUtils.runInstalledExecutable(app, applicationTitle);
  68     }


 105      * @param applicationTitle
 106      *            application title
 107      * @throws java.io.IOException
 108      */
 109     public void uninstall(AppWrapper app, String applicationTitle)
 110             throws IOException {
 111         if (installed) {
 112             bundlerUtils.uninstall(app, applicationTitle);
 113             installed = false;
 114         }
 115     }
 116 
 117     public String getAppName(Map<String, Object> params) {
 118         return bundlerUtils.getAppName(params);
 119     }
 120 
 121     public abstract String getShortName();
 122 
 123     @Override
 124     public String toString() {
 125         return getBundler().getID() + "-" + getShortName();

 126     }
 127 
 128     public Path getAppCDSCacheFile(AppWrapper app, String appName) {
 129         return bundlerUtils.getAppCDSCacheFile(app, appName);
 130     }
 131 
 132     public AbstractBundlerUtils getBundlerUtils() {
 133         return bundlerUtils;








 134     }
 135 }
< prev index next >