Package org.platformlayer.core.model

Examples of org.platformlayer.core.model.InstanceBase


    //
    // return null;
  }

  public Machine findMachine(ItemBase item) throws OpsException {
    InstanceBase instance = findInstance(item);
    if (instance == null) {
      return null;
    }

    return cloudHelpers.toMachine(instance);
View Full Code Here


  public void terminateMachine(Machine machine) throws OpsException {
    if (machine == null) {
      throw new IllegalArgumentException();
    }

    InstanceBase instance = toInstance(machine);
    if (instance == null) {
      throw new IllegalStateException();
    }

    platformLayer.deleteItem(instance.getKey());
  }
View Full Code Here

    // throw new UnsupportedOperationException();
  }

  public Machine putInstanceByTag(MachineCreationRequest request, PlatformLayerKey parent, Tag uniqueTag)
      throws OpsException {
    InstanceBase machine = buildInstanceTemplate(request, parent);

    machine = platformLayer.putItemByTag(machine, uniqueTag);

    return toMachine(machine);
  }
View Full Code Here

  }

  InstanceBase buildInstanceTemplate(MachineCreationRequest request, PlatformLayerKey parent) throws OpsException {
    MachineProvider targetCloud = scheduler.pickCloud(request);

    InstanceBase machine = targetCloud.buildInstanceTemplate(request);

    machine.sshPublicKey = SshKeys.serialize(request.sshPublicKey);

    machine.recipeId = request.recipeId;

    if (request.publicPorts != null) {
      if (machine.publicPorts == null) {
        machine.publicPorts = Lists.newArrayList();
      }
      machine.publicPorts.addAll(request.publicPorts);
    }

    machine.getTags().addAll(request.tags);

    if (parent != null) {
      machine.getTags().add(Tag.buildParentTag(parent));
    }
    machine.cloud = targetCloud.getModel().getKey();
    machine.hostPolicy = request.hostPolicy;

    String id = request.hostname;
    if (Strings.isNullOrEmpty(id)) {
      id = UUID.randomUUID().toString();
    }

    machine.setKey(PlatformLayerKey.fromId(id));
    return machine;
  }
View Full Code Here

  public StorageConfiguration getStorageConfiguration(MachineProvider targetCloud) throws OpsException {
    return targetCloud.getStorageConfiguration();
  }

  public StorageConfiguration getStorageConfiguration(Machine machine) throws OpsException {
    InstanceBase instance = toInstance(machine);

    PlatformLayerKey cloudKey = instance.cloud;

    MachineProvider cloud = getCloud(cloudKey);
View Full Code Here

  @Inject
  PlatformLayerCloudHelpers platformLayerCloudHelpers;

  @Override
  protected PublicEndpointBase buildItemTemplate() throws OpsException {
    InstanceBase instance = OpsContext.get().getInstance(InstanceBase.class);

    PlatformLayerKey instanceKey = instance.getKey();

    PublicEndpointBase publicEndpoint = platformLayerCloudHelpers.createPublicEndpoint(instance, parentItem);
    // publicEndpoint.network = network;
    publicEndpoint.publicPort = publicPort;
    publicEndpoint.publicPortCluster = publicPortCluster;
    publicEndpoint.backendPort = backendPort;
    publicEndpoint.instance = instanceKey;
    publicEndpoint.key = PlatformLayerKey.fromId(instance.getId() + "_" + publicPort);

    if (transport != null) {
      publicEndpoint.transport = transport.toString();
    }
    // publicEndpoint.getTags().add(OpsSystem.get().createParentTag(instance));
View Full Code Here

    persistentInstanceTemplate.getTags().add(parentTag);

    // Set during doOperation
    Machine machine = null;
    PersistentInstance persistentInstance = null;
    InstanceBase instance = null;
    OpsTarget target = null;

    persistentInstance = getOrCreate(parentTag, persistentInstanceTemplate);

    if (persistentInstance != null) {
View Full Code Here

  @Override
  public InstanceBase findInstanceByInstanceKey(PlatformLayerKey instanceKey) throws OpsException {
    ModelClass<?> modelClass = serviceProviders.getModelClass(instanceKey);

    InstanceBase machine = (InstanceBase) platformLayerClient.getItem(instanceKey, modelClass.getJavaClass());
    return machine;
  }
View Full Code Here

  }

  @Override
  public Machine refreshMachine(Machine machine) throws OpsException {
    PlatformLayerKey key = machine.getKey();
    InstanceBase refreshed = findInstanceByInstanceKey(key);
    return cloudHelpers.toMachine(refreshed);

  }
View Full Code Here

TOP

Related Classes of org.platformlayer.core.model.InstanceBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.