org.jclouds.Context.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.jclouds.Context.getName()方法的一些代码示例,展示了Context.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getName()方法的具体详情如下:
包路径:org.jclouds.Context
类名称:Context
方法名:getName

Context.getName介绍

[英]Identifies the Context. This is a unique name optionally specified by the user and safe to index on. The purpose of this property is to provide means to distinct between multiple contexts, without having to check multiple properties or have explicit knowledge of how the context was created.
[中]标识上下文。这是用户可以选择指定的唯一名称,可以安全地进行索引。此属性的目的是提供区分多个上下文的方法,而无需检查多个属性或明确了解上下文是如何创建的。

代码示例

代码示例来源: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: org.apache.jclouds.labs.management/management-core

/**
* {@inheritDoc}
*/
@Override
public <V extends View> void unregister(V view) {
 views.remove(view.unwrap().getName());
}

代码示例来源: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

void unbindComputeService(ComputeService computeService) {
    String serviceId = computeService.getContext().unwrap().getName();
    if (serviceId != null) {
      computeServiceMap.remove(serviceId);
    }
  }
}

代码示例来源:origin: apache/attic-whirr

public synchronized void unbind(ComputeService computeService) {
  if (computeService != null) {
   serviceContextMap.remove(computeService.getContext().unwrap().getName());
  }
 }
}

代码示例来源:origin: org.apache.whirr/whirr-core

public synchronized void unbind(ComputeService computeService) {
  if (computeService != null) {
   serviceContextMap.remove(computeService.getContext().unwrap().getName());
  }
 }
}

代码示例来源:origin: org.apache.jclouds.karaf/commands

@Override
  public String getCacheableKey(ComputeService type) {
    return type.getContext().unwrap().getName();
  }
}

代码示例来源:origin: org.apache.jclouds.karaf/commands

@Override
public String getCacheableKey(BlobStore type) {
  return type.getContext().unwrap().getName();
}

代码示例来源: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: apache/attic-whirr

public synchronized void bind(ComputeService computeService) {
 if (computeService != null) {
  serviceContextMap.put(computeService.getContext().unwrap().getName(), computeService.getContext());
 }
}

代码示例来源:origin: org.apache.whirr/whirr-core

public synchronized void bind(ComputeService computeService) {
 if (computeService != null) {
  serviceContextMap.put(computeService.getContext().unwrap().getName(), computeService.getContext());
 }
}

代码示例来源:origin: com.netflix.archaius/archaius-jclouds

public BlobStoreConfigurationSource(BlobStoreContext ctx) {
 this.ctx = checkNotNull(ctx, "ctx");
 String container = containerName.get();
 checkState(ctx.getBlobStore().containerExists(container), "%s: container %s doesn't exist", ctx.unwrap()
    .getName(), container);
}

代码示例来源:origin: com.netflix.archaius/archaius-jclouds

@Override
public PollResult poll(boolean initial, Object checkPoint) throws Exception {
 String container = containerName.get();
 BlobMap blobs = ctx.createBlobMap(container);
 Map<String, Object> props = ImmutableMap.copyOf(filterValues(transformEntries(blobs, toStringOrNull), notNull()));
 log.info("{}: {} properties in container {}", new Object[] { ctx.unwrap().getName(), props.size(), container });
 return PollResult.createFull(props);
}

代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds

void unbindComputeService(ComputeService computeService) {
    String name = computeService.getContext().unwrap().getName();
    if (!Strings.isEmpty(name)) {
      DynamicReference<ComputeService> ref = computeServices.get(name);
      if (ref != null) {
        ref.unbind(computeService);
      }
    }
  }
}

代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds

void bindComputeService(ComputeService computeService) {
  String name = computeService.getContext().unwrap().getName();
  if (!Strings.isEmpty(name)) {
    computeServices.putIfAbsent(name, new DynamicReference<ComputeService>(name, COMPUTE_SERVICE_WAIT, TimeUnit.MILLISECONDS));
    computeServices.get(name).bind(computeService);
  }
}

代码示例来源:origin: org.apache.jclouds.karaf/commands

@Override
public int complete(String buffer, int cursor, List<String> candidates) {
 try {
   if (computeServices != null) {
    for (ComputeService computeService : computeServices) {
      String id = (String) computeService.getContext().unwrap().getName();
      if (id != null) {
       delegate.getStrings().add(id);
      }
    }
   }
 } catch (Exception ex) {
   // noop
 }
 return delegate.complete(buffer, cursor, candidates);
}

代码示例来源: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: jclouds/legacy-jclouds

@Test
public void testContextName() {
 ContextBuilder withNoName = testContextBuilder().endpoint("http://${jclouds.identity}.service.com").name("mytest")
     .credentials("foo", "bar");
 Context context = withNoName.build();
 assertEquals(context.getName(), "mytest");
}

代码示例来源:origin: apache/jclouds

@Test
public void testContextName() {
 ContextBuilder withNoName = testContextBuilder().endpoint("http://${jclouds.identity}.service.com").name("mytest")
     .credentials("foo", "bar");
 Context context = withNoName.build();
 assertEquals(context.getName(), "mytest");
}

相关文章