@Test public void saveZippedApp() throws IOException { InputStream stream = getClass().getResourceAsStream("app.zip"); ApplicationDescription app = aar.saveApplication(stream); validate(app); stream.close(); }
public synchronized ApplicationDescription saveApplication(InputStream stream) { try (InputStream ais = stream) { byte[] cache = toByteArray(ais); InputStream bis = new ByteArrayInputStream(cache); boolean plainXml = isPlainXml(cache); ApplicationDescription desc = plainXml ? parsePlainAppDescription(bis) : parseZippedAppDescription(bis); checkState(!appFile(desc.name(), APP_XML).exists(), "Application %s already installed", desc.name()); if (plainXml) { expandPlainApplication(cache, desc); } else { bis.reset(); expandZippedApplication(bis, desc); bis.reset(); saveApplication(bis, desc); } installArtifacts(desc); return desc; } catch (IOException e) { throw new ApplicationException("Unable to save application", e); } }
ApplicationArchive extends AbstractStore<ApplicationEvent, ApplicationStoreDelegate> { public synchronized ApplicationDescription saveApplication(InputStream stream) { try (InputStream ais = stream) { byte[] cache = toByteArray(ais); InputStream bis = new ByteArrayInputStream(cache); boolean plainXml = isPlainXml(cache); ApplicationDescription desc = plainXml ? parsePlainAppDescription(bis) : parseZippedAppDescription(bis); checkState(!appFile(desc.name(), APP_XML).exists(), "Application %s already installed", desc.name()); if (plainXml) { expandPlainApplication(cache, desc); } else { bis.reset(); expandZippedApplication(bis, desc); bis.reset(); saveApplication(bis, desc); } installArtifacts(desc); return desc; } catch (IOException e) { throw new ApplicationException("Unable to save application", e); } } }
ApplicationArchive extends AbstractStore<ApplicationEvent, ApplicationStoreDelegate> { public synchronized ApplicationDescription saveApplication(InputStream stream) { try (InputStream ais = stream) { byte[] cache = toByteArray(ais); InputStream bis = new ByteArrayInputStream(cache); boolean plainXml = isPlainXml(cache); ApplicationDescription desc = plainXml ? parsePlainAppDescription(bis) : parseZippedAppDescription(bis); checkState(!appFile(desc.name(), APP_XML).exists(), "Application %s already installed", desc.name()); if (plainXml) { expandPlainApplication(cache, desc); } else { bis.reset(); expandZippedApplication(bis, desc); bis.reset(); saveApplication(bis, desc); } installArtifacts(desc); return desc; } catch (IOException e) { throw new ApplicationException("Unable to save application", e); } }  }
ApplicationArchive extends AbstractStore<ApplicationEvent, ApplicationStoreDelegate> { public synchronized ApplicationDescription saveApplication(InputStream stream) { try (InputStream ais = stream) { byte[] cache = toByteArray(ais); InputStream bis = new ByteArrayInputStream(cache); boolean plainXml = isPlainXml(cache); ApplicationDescription desc = plainXml ? parsePlainAppDescription(bis) : parseZippedAppDescription(bis); checkState(!appFile(desc.name(), APP_XML).exists(), "Application %s already installed", desc.name()); if (plainXml) { expandPlainApplication(cache, desc); } else { bis.reset(); expandZippedApplication(bis, desc); bis.reset(); saveApplication(bis, desc); } installArtifacts(desc); return desc; } catch (IOException e) { throw new ApplicationException("Unable to save application", e); } }  String getRootPath(); Set<String> getApplicationNames(); long getUpdateTime(String appName); ApplicationDescription getApplicationDescription(String appName); synchronized ApplicationDescription saveApplication(InputStream stream); synchronized void purgeApplication(String appName); synchronized InputStream getApplicationInputStream(String appName); ApplicationRole getRole(String value); }
ApplicationArchive extends AbstractStore<ApplicationEvent, ApplicationStoreDelegate> { public synchronized ApplicationDescription saveApplication(InputStream stream) { try (InputStream ais = stream) { byte[] cache = toByteArray(ais); InputStream bis = new ByteArrayInputStream(cache); boolean plainXml = isPlainXml(cache); ApplicationDescription desc = plainXml ? parsePlainAppDescription(bis) : parseZippedAppDescription(bis); checkState(!appFile(desc.name(), APP_XML).exists(), "Application %s already installed", desc.name()); if (plainXml) { expandPlainApplication(cache, desc); } else { bis.reset(); expandZippedApplication(bis, desc); bis.reset(); saveApplication(bis, desc); } installArtifacts(desc); return desc; } catch (IOException e) { throw new ApplicationException("Unable to save application", e); } }  String getRootPath(); Set<String> getApplicationNames(); long getUpdateTime(String appName); ApplicationDescription getApplicationDescription(String appName); synchronized ApplicationDescription saveApplication(InputStream stream); synchronized void purgeApplication(String appName); synchronized InputStream getApplicationInputStream(String appName); ApplicationRole getRole(String value);  }