本文整理汇总了Java中org.cloudfoundry.client.lib.archive.ApplicationArchive类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationArchive类的具体用法?Java ApplicationArchive怎么用?Java ApplicationArchive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationArchive类属于org.cloudfoundry.client.lib.archive包,在下文中一共展示了ApplicationArchive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uploadApplication
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Override
public void uploadApplication(String appName, ApplicationArchive archive, UploadStatusCallback callback) throws IOException {
Assert.notNull(appName, "AppName must not be null");
Assert.notNull(archive, "Archive must not be null");
UUID appId = getAppId(appName);
if (callback == null) {
callback = UploadStatusCallback.NONE;
}
CloudResources knownRemoteResources = getKnownRemoteResources(archive);
callback.onCheckResources();
callback.onMatchedFileNames(knownRemoteResources.getFilenames());
UploadApplicationPayload payload = new UploadApplicationPayload(archive, knownRemoteResources);
callback.onProcessMatchedResources(payload.getTotalUncompressedSize());
HttpEntity<?> entity = generatePartialResourceRequest(payload, knownRemoteResources);
ResponseEntity<Map<String, Object>> responseEntity = getRestTemplate().exchange(getUrl("/v2/apps/{guid}/bits?async=true"),
HttpMethod.PUT, entity, new ParameterizedTypeReference<Map<String, Object>>() {
}, appId);
processAsyncJob(responseEntity.getBody(), callback);
}
示例2: shouldPackOnlyMissingResources
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Test
public void shouldPackOnlyMissingResources() throws Exception {
ZipFile zipFile = new ZipFile(SampleProjects.springTravel());
try {
ApplicationArchive archive = new ZipApplicationArchive(zipFile);
CloudResources allResources = new CloudResources(archive);
List<CloudResource> resources = new ArrayList<CloudResource>(allResources.asList());
resources.remove(0);
CloudResources knownRemoteResources = new CloudResources(resources);
UploadApplicationPayload payload = new UploadApplicationPayload(archive, knownRemoteResources);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileCopyUtils.copy(payload.getInputStream(), bos);
assertThat(payload.getArchive(), is(archive));
assertThat(payload.getTotalUncompressedSize(), is(93));
assertThat(bos.toByteArray().length, is(2451));
} finally {
zipFile.close();
}
}
示例3: getKnownRemoteResources
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
private CloudResources getKnownRemoteResources(ApplicationArchive archive) throws IOException {
CloudResources archiveResources = new CloudResources(archive);
String json = JsonUtil.convertToJson(archiveResources);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(JsonUtil.JSON_MEDIA_TYPE);
HttpEntity<String> requestEntity = new HttpEntity<String>(json, headers);
ResponseEntity<String> responseEntity = getRestTemplate().exchange(getUrl("/v2/resource_match"), HttpMethod.PUT, requestEntity,
String.class);
List<CloudResource> cloudResources = JsonUtil.convertJsonToCloudResourceList(responseEntity.getBody());
return new CloudResources(cloudResources);
}
示例4: CloudResources
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
/**
* Create a new {@link CloudResources} instance for the specified {@link ApplicationArchive}.
*
* @param archive the application archive
*/
public CloudResources(ApplicationArchive archive) throws IOException {
Assert.notNull(archive, "Archive must not be null");
this.resources = new ArrayList<CloudResource>();
for (ApplicationArchive.Entry entry : archive.getEntries()) {
if (!entry.isDirectory()) {
String name = entry.getName();
long size = entry.getSize();
String sha1 = bytesToHex(entry.getSha1Digest());
CloudResource resource = new CloudResource(name, size, sha1);
resources.add(resource);
}
}
}
示例5: UploadApplicationPayload
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
/**
* Create a new {@link UploadApplicationPayload}.
*
* @param archive the source archive
* @param knownRemoteResources resources that are already known on the remote server
* @throws IOException
*/
public UploadApplicationPayload(ApplicationArchive archive, CloudResources knownRemoteResources) throws
IOException {
this.archive = archive;
this.totalUncompressedSize = 0;
Set<String> matches = knownRemoteResources.getFilenames();
this.entriesToUpload = new ArrayList<DynamicZipInputStream.Entry>();
for (ApplicationArchive.Entry entry : archive.getEntries()) {
if (entry.isDirectory() || !matches.contains(entry.getName())) {
entriesToUpload.add(new DynamicZipInputStreamEntryAdapter(entry));
totalUncompressedSize += entry.getSize();
}
}
}
示例6: shouldGetFromArchive
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Test
public void shouldGetFromArchive() throws Exception {
ZipFile zipFile = new ZipFile(SampleProjects.springTravel());
try {
ApplicationArchive archive = new ZipApplicationArchive(zipFile);
CloudResources o = new CloudResources(archive);
List<CloudResource> l = o.asList();
assertThat(l.size(), is(96));
assertThat(l.get(0).getFilename(), is("index.html"));
} finally {
zipFile.close();
}
}
示例7: getEntries
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Override
public Iterable<Entry> getEntries() {
Iterable<ArchiveEntry> cfEntries = cfArchive.getEntries();
List<ApplicationArchive.Entry> legacyEntries = new ArrayList<ApplicationArchive.Entry>();
if (cfEntries != null) {
for (ArchiveEntry entry : cfEntries) {
legacyEntries.add(new V1ArchiveEntry(entry));
}
}
return legacyEntries;
}
示例8: getEntries
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
public Iterable<Entry> getEntries() {
if (entries == null) {
entries = new ArrayList<ApplicationArchive.Entry>();
collectEntriesPriorToDeployment(entries, resources.toArray(new IModuleResource[0]));
}
return entries;
}
示例9: getApplicationArchive
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
public ApplicationArchive getApplicationArchive(DockerFoundryApplicationModule module,
DockerFoundryServer cloudServer, IModuleResource[] moduleResources, IProgressMonitor monitor)
throws CoreException {
// No need for application archive, as the CF plugin framework generates
// .war files for Java Web applications.
return null;
}
示例10: getIncrementalPublishArchive
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
protected ApplicationArchive getIncrementalPublishArchive(final ApplicationDeploymentInfo deploymentInfo,
IModule[] modules) {
IModuleResource[] allResources = getResources(modules);
IModuleResourceDelta[] deltas = getPublishedResourceDelta(modules);
List<IModuleResource> changedResources = getChangedResources(deltas);
ApplicationArchive moduleArchive = new CachingApplicationArchive(Arrays.asList(allResources), changedResources,
modules[0], deploymentInfo.getDeploymentName());
return moduleArchive;
}
示例11: uploadApplication
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Override
public void uploadApplication(String appName, ApplicationArchive archive) throws IOException {
cc.uploadApplication(appName, archive, null);
}
示例12: DynamicZipInputStreamEntryAdapter
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
public DynamicZipInputStreamEntryAdapter(ApplicationArchive.Entry entry) {
this.entry = entry;
}
示例13: uploadApplication
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
@Override
public void uploadApplication(String appName, ApplicationArchive archive) throws IOException {
}
示例14: asV1ApplicationArchive
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
public static ApplicationArchive asV1ApplicationArchive(CFApplicationArchive cfArchive) {
if (cfArchive != null) {
return new V1ApplicationArchiveAdapter(cfArchive);
}
return null;
}
示例15: getApplicationArchive
import org.cloudfoundry.client.lib.archive.ApplicationArchive; //导入依赖的package包/类
public ApplicationArchive getApplicationArchive(DockerFoundryApplicationModule module,
IModuleResource[] moduleResources) throws CoreException {
return new ModuleResourceApplicationArchive(module.getLocalModule(), Arrays.asList(moduleResources));
}