本文整理了Java中org.jclouds.Context
类的一些代码示例,展示了Context
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context
类的具体详情如下:
包路径:org.jclouds.Context
类名称:Context
[英]Represents an authenticated context to the cloud. Note Please issue #close() when you are finished with this context in order to release resources.
[中]表示云的经过身份验证的上下文。注意:完成此上下文后,请发出#close(),以释放资源。
代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds
void bindComputeService(ComputeService computeService) {
String name = computeService.getContext().unwrap().getName();
if (name != null) {
computeServiceMap.put(name, computeService);
}
}
代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
delegate.getStrings().clear();
if (computeServices != null && !computeServices.isEmpty()) {
for(ComputeService computeService:computeServices) {
delegate.getStrings().add(computeService.getContext().unwrap().getId());
}
}
return delegate.complete(buffer, cursor, candidates);
}
代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds
public String getProviderName() {
return computeService != null ? computeService.getContext().unwrap().getProviderMetadata().getId() : providerName;
}
代码示例来源:origin: io.cloudsoft.jclouds.labs.representations/representations-codec
@Override
public Context apply(@Nullable org.jclouds.Context input) {
if (input == null) {
return null;
}
return Context.builder().name(input.getName()).identity(input.getIdentity())
.providerId(input.getProviderMetadata() != null ? input.getProviderMetadata().getId() : null).build();
}
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
protected void printComputeApis(Iterable<ApiMetadata> apis, List<ComputeService> computeServices, String indent,
PrintStream out) {
out.println(String.format(PROVIDERFORMAT, "[id]", "[type]", "[service]"));
for (ApiMetadata api : apis) {
StringBuilder sb = new StringBuilder();
sb.append("[ ");
for (ComputeService computeService : computeServices) {
String contextName = (String) computeService.getContext().unwrap().getName();
if (computeService.getContext().unwrap().getId().equals(api.getId()) && contextName != null) {
sb.append(contextName).append(" ");
}
}
sb.append("]");
out.println(String.format(PROVIDERFORMAT, api.getId(), "compute", sb.toString()));
}
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
protected void printBlobStoreApis(Iterable<ApiMetadata> apis, List<BlobStore> blobStores, String indent,
PrintStream out) {
out.println(String.format(PROVIDERFORMAT, "[id]", "[type]", "[service]"));
for (ApiMetadata api : apis) {
StringBuilder sb = new StringBuilder();
sb.append("[ ");
for (BlobStore blobStore : blobStores) {
String contextName = (String) blobStore.getContext().unwrap().getName();
if (blobStore.getContext().unwrap().getId().equals(api.getId())) {
sb.append(contextName).append(" ");
}
}
sb.append("]");
out.println(String.format(PROVIDERFORMAT, api.getId(), "blobstore", sb.toString()));
}
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
client = view.utils().injector().getInstance(ElasticStackClient.class);
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
}
代码示例来源:origin: jclouds/legacy-jclouds-chef
@AfterClass(groups = { "integration", "live" })
@Override
protected void tearDownContext() {
if (computeContext != null) {
computeContext.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
}
if (context != null) {
view.getChefService().cleanupStaleNodesAndClients(group + "-", 1);
ChefApi api = view.getApi(ChefApi.class);
if (clientName != null && api.clientExists(clientName)) {
api.deleteClient(clientName);
}
context.close();
}
super.tearDownContext();
}
代码示例来源:origin: jclouds/legacy-jclouds
protected void buildSocketTester() {
SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
socketTester = retry(socketOpen, 60, 1, SECONDS);
// wait a maximum of 60 seconds for port 8080 to open.
openSocketFinder = context.utils().injector().getInstance(OpenSocketFinder.class);
}
代码示例来源:origin: apache/jclouds
@Override
protected void initializeContext() {
super.initializeContext();
resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
publicIpAvailable = context.utils().injector().getInstance(PublicIpAvailablePredicateFactory.class);
resourceAvailable = context.utils().injector()
.getInstance(Key.get(new TypeLiteral<Predicate<Supplier<Provisionable>>>() {
}));
api = view.unwrapApi(AzureComputeApi.class);
}
代码示例来源:origin: apache/jclouds
@Override
public void initializeContext() {
super.initializeContext();
resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
}
代码示例来源:origin: Nextdoor/bender
public static Module linkContext(Context context) {
return linkContext(context.getId(), Suppliers.ofInstance(context));
}
代码示例来源:origin: org.apache.jclouds.labs.management/management-core
/**
* {@inheritDoc}
*/
@Override
public <V extends View> void register(V view) {
views.put(view.unwrap().getName(), view);
}
代码示例来源:origin: bouncestorage/swiftproxy
org.jclouds.Context c = getBlobStore(authToken).get().getContext().unwrap();
resp.access.serviceCatalog[0].name += String.format(" (%s %s)",
c.getId(), c.getProviderMetadata().getEndpoint());
return Response.ok(resp).build();
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void close() {
delegate().close();
}
代码示例来源:origin: gaul/s3proxy
private static String getBlobStoreType(BlobStore blobStore) {
return blobStore.getContext().unwrap().getProviderMetadata().getId();
}
代码示例来源:origin: apache/jclouds
@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
client = view.utils().injector().getInstance(ElasticStackApi.class);
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
protected void printComputeProviders(Iterable<ProviderMetadata> providers, List<ComputeService> computeServices,
String indent, PrintStream out) {
out.println(String.format(PROVIDERFORMAT, "[id]", "[type]", "[service]"));
for (ProviderMetadata provider : providers) {
StringBuilder sb = new StringBuilder();
sb.append("[ ");
for (ComputeService computeService : computeServices) {
String contextName = (String) computeService.getContext().unwrap().getName();
if (computeService.getContext().unwrap().getId().equals(provider.getId()) && contextName != null) {
sb.append(contextName).append(" ");
}
}
sb.append("]");
out.println(String.format(PROVIDERFORMAT, provider.getId(), "compute", sb.toString()));
}
}
代码示例来源:origin: apache/jclouds
protected void buildSocketTester() {
SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
socketTester = retry(socketOpen, 60, 1, SECONDS);
// wait a maximum of 60 seconds for port 8080 to open.
openSocketFinder = context.utils().injector().getInstance(OpenSocketFinder.class);
}
代码示例来源:origin: apache/jclouds
@Override
protected void initializeContext() {
super.initializeContext();
resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
api = view.unwrapApi(AzureComputeApi.class);
}
内容来源于网络,如有侵权,请联系作者删除!