当前位置: 首页>>代码示例>>Java>>正文


Java SshjSshClientModule类代码示例

本文整理汇总了Java中org.jclouds.sshj.config.SshjSshClientModule的典型用法代码示例。如果您正苦于以下问题:Java SshjSshClientModule类的具体用法?Java SshjSshClientModule怎么用?Java SshjSshClientModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SshjSshClientModule类属于org.jclouds.sshj.config包,在下文中一共展示了SshjSshClientModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildContext

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public static ContextBuilder buildContext(NovaCredentials credentials) {
  Properties properties = new Properties();
  properties.setProperty(NovaProperties.AUTO_ALLOCATE_FLOATING_IPS, "true");
  Iterable<Module> modules = ImmutableSet.<Module>of(
          new SshjSshClientModule(),
          new SLF4JLoggingModule(),
          new EnterpriseConfigurationModule());

  ContextBuilder build = ContextBuilder.newBuilder("aws-ec2")
          .credentials(credentials.getAccountName(), credentials.getAccountPass())
          .endpoint(credentials.getEndpoint())
          .modules(modules)
          .overrides(properties);

  return build;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:17,代码来源:NovaContext.java

示例2: buildDefaultComputeService

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public static ComputeService buildDefaultComputeService(IaasProvider iaasProvider) {

        Properties properties = new Properties();

        // load properties
        for (Map.Entry<String, String> entry : iaasProvider.getProperties().entrySet()) {
            properties.put(entry.getKey(), entry.getValue());
        }

        // set modules
        Iterable<Module> modules =
                ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(),
                        new EnterpriseConfigurationModule());

        // build context
        ContextBuilder builder =
                ContextBuilder.newBuilder(iaasProvider.getProvider())
                        .credentials(iaasProvider.getIdentity(), iaasProvider.getCredential()).modules(modules)
                        .overrides(properties);

        return builder.buildView(ComputeServiceContext.class).getComputeService();
    }
 
开发者ID:apache,项目名称:stratos,代码行数:23,代码来源:ComputeServiceBuilderUtil.java

示例3: getComputeApiFromCarinaDirectory

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public static ComputeServiceContext getComputeApiFromCarinaDirectory(String path) throws IOException {
   // docker.ps1 contains the endpoint
   String endpoint = "https://" +
         Files.readFirstLine(new File(joinPath(path, "docker.ps1")),
               Charset.forName("UTF-8")).split("=")[1].replace("\"", "").substring(6);

   // enable logging and sshj
   Iterable<Module> modules = ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule());
   Properties overrides = new Properties();

   // disable certificate checking for Carina
   overrides.setProperty("jclouds.trust-all-certs", "true");

   return ContextBuilder.newBuilder("docker")
         .credentials(joinPath(path, "cert.pem"), joinPath(path, "key.pem"))
         .modules(modules)
         .overrides(overrides)
         .endpoint(endpoint)
         .buildView(ComputeServiceContext.class);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:21,代码来源:Utils.java

示例4: CloudServersPublish

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public CloudServersPublish(List<String> args) {
   String username = args.get(0);
   String apiKey = args.get(1);
   numServers = args.size() == 3 ? Integer.valueOf(args.get(2)) : 1;

   Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule());

   // These properties control how often jclouds polls for a status update
   Properties overrides = new Properties();
   overrides.setProperty(POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS);
   overrides.setProperty(POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS);

   ComputeServiceContext context = ContextBuilder.newBuilder(PROVIDER)
         .credentials(username, apiKey)
         .overrides(overrides)
         .modules(modules)
         .buildView(ComputeServiceContext.class);
   computeService = context.getComputeService();
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:20,代码来源:CloudServersPublish.java

示例5: CreateServerWithKeyPair

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public CreateServerWithKeyPair(String username, String apiKey) {
   Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule());

   // These properties control how often jclouds polls for a status update
   Properties overrides = new Properties();
   overrides.setProperty(POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS);
   overrides.setProperty(POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS);

   ComputeServiceContext context = ContextBuilder.newBuilder(PROVIDER)
         .credentials(username, apiKey)
         .overrides(overrides)
         .modules(modules)
         .buildView(ComputeServiceContext.class);

   computeService = context.getComputeService();
   novaApi = context.unwrapApi(NovaApi.class);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:18,代码来源:CreateServerWithKeyPair.java

示例6: DetachVolume

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public DetachVolume(String username, String apiKey) {
   // The provider configures jclouds To use the Rackspace Cloud (US)
   // To use the Rackspace Cloud (UK) set the system property or default value to "rackspace-cloudservers-uk"
   String provider = System.getProperty("provider.cs", "rackspace-cloudservers-us");

   Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule());

   ComputeServiceContext context = ContextBuilder.newBuilder(provider)
         .credentials(username, apiKey)
         .modules(modules)
         .buildView(ComputeServiceContext.class);
   computeService = context.getComputeService();
   NovaApi novaApi = context.unwrapApi(NovaApi.class);
   serverApi = novaApi.getServerApi(REGION);
   volumeAttachmentApi = novaApi.getVolumeAttachmentApi(REGION).get();

   cinderApi = ContextBuilder.newBuilder(PROVIDER)
         .credentials(username, apiKey)
         .buildApi(CinderApi.class);
   volumeApi = cinderApi.getVolumeApi(REGION);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:22,代码来源:DetachVolume.java

示例7: CreateVolumeAndAttach

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public CreateVolumeAndAttach(String username, String apiKey) {
   // The provider configures jclouds To use the Rackspace Cloud (US)
   // To use the Rackspace Cloud (UK) set the system property or default value to "rackspace-cloudservers-uk"
   String provider = System.getProperty("provider.cs", "rackspace-cloudservers-us");

   // These properties control how often jclouds polls for a status udpate
   Properties overrides = new Properties();
   overrides.setProperty(POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS);
   overrides.setProperty(POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS);

   Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule());

   ComputeServiceContext context = ContextBuilder.newBuilder(provider)
         .credentials(username, apiKey)
         .modules(modules)
         .overrides(overrides)
         .buildView(ComputeServiceContext.class);
   computeService = context.getComputeService();
   novaApi = context.unwrapApi(NovaApi.class);
   volumeAttachmentApi = novaApi.getVolumeAttachmentApi(REGION).get();

   cinderApi = ContextBuilder.newBuilder(PROVIDER)
         .credentials(username, apiKey)
         .buildApi(CinderApi.class);
   volumeApi = cinderApi.getVolumeApi(REGION);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:27,代码来源:CreateVolumeAndAttach.java

示例8: initComputeService

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
private static ComputeService initComputeService(final String provider, final String identity,
                                                 final String credential) {
    // example of specific properties, in this case optimizing image list to
    // only amazon supplied
    Properties properties = new Properties();
    long scriptTimeout = TimeUnit.MILLISECONDS.convert(20, TimeUnit.MINUTES);
    properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + "");

    // example of injecting a ssh implementation
    Iterable<Module> modules =
            ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(),
                    new EnterpriseConfigurationModule());

    ContextBuilder builder =
            ContextBuilder.newBuilder(provider).credentials(identity, credential).modules(modules)
                    .overrides(properties);

    System.out.printf(">> initializing %s%n", builder.getApiMetadata());

    return builder.buildView(ComputeServiceContext.class).getComputeService();
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:22,代码来源:MainApp.java

示例9: JCloudsConnector

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public JCloudsConnector(String provider,String login,String secretKey){
    journal.log(Level.INFO, ">> Connecting to "+provider+" ...");
    Properties overrides = new Properties();
    if(provider.equals("aws-ec2")){
        // choose only amazon images that are ebs-backed
        //overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_AMI_OWNERS,"107378836295");
        overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY,
                "owner-id=137112412989,107378836295,099720109477;state=available;image-type=machine;root-device-type=ebs");
    }
    overrides.setProperty(PROPERTY_CONNECTION_TIMEOUT, 0 + "");
    overrides.setProperty(PROPERTY_SO_TIMEOUT, 0 + "");
    overrides.setProperty(PROPERTY_REQUEST_TIMEOUT, 0 + "");
    overrides.setProperty(PROPERTY_RETRY_DELAY_START, 0 + "");
    Iterable<Module> modules = ImmutableSet.<Module> of(
            new SshjSshClientModule(),
            new NullLoggingModule());
    ContextBuilder builder = ContextBuilder.newBuilder(provider).credentials(login, secretKey).modules(modules).overrides(overrides);
    journal.log(Level.INFO, ">> Authenticating ...");
    computeContext=builder.buildView(ComputeServiceContext.class);
    ec2api=builder.buildApi(EC2Api.class);
    //loadBalancerCtx=builder.buildView(LoadBalancerServiceContext.class);

    compute=computeContext.getComputeService();
    this.provider = provider;
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:26,代码来源:JCloudsConnector.java

示例10: configure

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
@Override
protected void configure() {
    String sshImpl = System.getProperty("clouds.ssh");

    if ("sshj".equalsIgnoreCase(sshImpl)) {
        logOnce("SSHJ");
        install(new SshjSshClientModule());
    } else {
        // default
        logOnce("JSCH");
        install(new JschSshClientModule());
    }
}
 
开发者ID:wildfly-extras,项目名称:sunstone,代码行数:14,代码来源:DynamicSshClientModule.java

示例11: testVSphereContext

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public void testVSphereContext() throws RunNodesException {
      ImmutableSet modules = ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()), new SshjSshClientModule());
      ComputeServiceContext context = ContextBuilder.newBuilder("vsphere")
//                .credentials("root", "master1234")
//                .endpoint("https://10.56.161.100/sdk")
              .credentials("root", "vmware")
              .endpoint("https://10.45.7.70/sdk")
              .modules(modules)
              .buildView(ComputeServiceContext.class);

      TemplateBuilder b = context.getComputeService().templateBuilder();
      TemplateOptions o = context.getComputeService().templateOptions();
      ((VSphereTemplateOptions) o).isoFileName("ISO/UCSInstall_UCOS_3.1.0.0-9914.iso");
      ((VSphereTemplateOptions) o).flpFileName("ISO/image.flp");
      ((VSphereTemplateOptions) o).postConfiguration(false);
      o.tags(ImmutableSet.of("from UnitTest"))
              .nodeNames(ImmutableSet.of("first-vm12"))
              .networks("VLAN537");
//        b.imageId("Cisco Centos 6.5").smallest();
//        b.imageId("Cisco Centos 6.5.0").smallest().options(o);
      //b.imageId("Cisco Centos 6.5").locationId("default").smallest().options(o);
      b.imageId("conductor-mgt").locationId("default").minRam(6000).options(o);

      // Set images = context.getComputeService().listNodesByIds(ImmutableSet.of("junit-test-9b7"));
      Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup("junit-test", 1, b.build());

      System.out.print("");
   }
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:29,代码来源:ContextBuilderTest.java

示例12: testOpenVmTools

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public void testOpenVmTools() throws Exception {
   ImmutableSet modules = ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()), new SshjSshClientModule());
   Properties p = new Properties();
   p.put("jclouds.vsphere.vm.password", "Nat0d12");
   ComputeServiceContext context = ContextBuilder.newBuilder("vsphere")
           .credentials("root", "vmware")
           .endpoint("https://10.63.120.120/sdk")

           .modules(modules)
           .overrides(p)
           .buildView(ComputeServiceContext.class);

   NodeMetadata nodeMetadata = context.getComputeService().getNodeMetadata("zenit-ccp0");
   System.out.print(nodeMetadata);
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:16,代码来源:ContextBuilderTest.java

示例13: testPhenixVsphere

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public void testPhenixVsphere() throws Exception {
      ImmutableSet modules = ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()), new SshjSshClientModule());
      Properties p = new Properties();
      p.put("jclouds.vsphere.vm.password", "Nat0d12");
      ComputeServiceContext context = ContextBuilder.newBuilder("vsphere")
              .credentials("root", "vmware")
              .endpoint("https://10.63.120.120/sdk")
//              .credentials("[email protected]", "c1-Scope")
//              .endpoint("https://vcte-vcenter.cisco.com/sdk")
              .modules(modules)
              .overrides(p)
              .buildView(ComputeServiceContext.class);

      TemplateBuilder b = context.getComputeService().templateBuilder();
      TemplateOptions o = context.getComputeService().templateOptions();
      ((VSphereTemplateOptions) o).postConfiguration(true);
      ((VSphereTemplateOptions) o).distributedVirtualSwitch(true);
      ((VSphereTemplateOptions) o).vmFolder("campnou");
      ((VSphereTemplateOptions) o).datacenterName("PHOENIX");

      o.tags(ImmutableSet.of("from UnitTest"))
              .nodeNames(ImmutableSet.of("first-vm12"))
              .networks("BVLAN_293");
//        b.imageId("Cisco Centos 6.5").smallest();
//        b.imageId("Cisco Centos 6.5.0").smallest().options(o);
      //b.imageId("Cisco Centos 6.5").locationId("default").smallest().options(o);
      b.imageId("SCOPE-TMP-DB").locationId("PHOENIX").minRam(10000).options(o);

      // Set images = context.getComputeService().listNodesByIds(ImmutableSet.of("junit-test-9b7"));
      Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup("junit-test", 1, b.build());

//      ServiceInstance serviceInstance = new ServiceInstance(new URL("https://10.63.120.120/sdk"), "root", "vmware", true);
//
//      ManagedEntity entity = new InventoryNavigator(serviceInstance.getRootFolder()).searchManagedEntity("DistributedVirtualPortgroup", "VLAN_283");
//      ManagedEntity entity1 = new InventoryNavigator(serviceInstance.getRootFolder()).searchManagedEntity("Folder", "GADWALL");

      System.out.print("");
   }
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:39,代码来源:ContextBuilderTest.java

示例14: GceContext

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public GceContext(Credentials credentials) {
  ComputeServiceContext context = ContextBuilder.newBuilder("google-compute-engine")
      .modules(Arrays.asList(
              new SshjSshClientModule(),
              new EnterpriseConfigurationModule(),
              new SLF4JLoggingModule()))
      .credentials(credentials.identity, credentials.credential)
      .buildView(ComputeServiceContext.class);
  computeService = context.getComputeService();
  gceApi = context.unwrapApi(GoogleComputeEngineApi.class);
  fireWallApi = gceApi.firewalls();
  networkApi = gceApi.networks();
  routeApi = gceApi.routes();
  this.credentials = credentials;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:16,代码来源:GceContext.java

示例15: Ec2Context

import org.jclouds.sshj.config.SshjSshClientModule; //导入依赖的package包/类
public Ec2Context(Ec2Credentials credentials) {
  this.credentials = credentials;
  Properties properties = new Properties();
  long scriptTimeout = TimeUnit.MILLISECONDS.convert(50, TimeUnit.MINUTES);
  properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + "");
  properties.setProperty(TIMEOUT_PORT_OPEN, scriptTimeout + "");
  properties.setProperty(PROPERTY_CONNECTION_TIMEOUT, scriptTimeout + "");
  properties.setProperty(PROPERTY_EC2_AMI_QUERY, "owner-id=137112412989;state=available;image-type=machine");
  properties.setProperty(PROPERTY_EC2_CC_AMI_QUERY, "");
  properties.setProperty(Constants.PROPERTY_MAX_RETRIES, Settings.JCLOUDS_PROPERTY_MAX_RETRIES + "");
  properties.setProperty(Constants.PROPERTY_RETRY_DELAY_START, Settings.JCLOUDS_PROPERTY_RETRY_DELAY_START + "");

  Iterable<Module> modules = ImmutableSet.<Module>of(
      new SshjSshClientModule(),
      new SLF4JLoggingModule(),
      new EnterpriseConfigurationModule());

  ContextBuilder build = ContextBuilder.newBuilder("aws-ec2")
      .credentials(credentials.getAccessKey(), credentials.getSecretKey())
      .modules(modules)
      .overrides(properties);
  ComputeServiceContext context = build.buildView(ComputeServiceContext.class);
  this.computeService = (AWSEC2ComputeService) context.getComputeService();
  this.ec2api = computeService.getContext().unwrapApi(EC2Api.class);
  this.securityGroupApi = ec2api.getSecurityGroupApi().get();
  this.keypairApi = (AWSKeyPairApi) ec2api.getKeyPairApi().get();

  vmBatchSize = Settings.AWS_VM_BATCH_SIZE();
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:30,代码来源:Ec2Context.java


注:本文中的org.jclouds.sshj.config.SshjSshClientModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。