Search in sources :

Example 1 with MachineId

use of org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl.MachineId in project che-server by eclipse-che.

the class JpaKubernetesMachineCache method doUpdateMachineStatus.

@Transactional
protected void doUpdateMachineStatus(String workspaceId, String machineName, MachineStatus status) throws InfrastructureException {
    EntityManager entityManager = managerProvider.get();
    KubernetesMachineImpl machine = entityManager.find(KubernetesMachineImpl.class, new MachineId(workspaceId, machineName));
    if (machine == null) {
        throw new InfrastructureException(format("Machine '%s:%s' was not found", workspaceId, machineName));
    }
    machine.setStatus(status);
    entityManager.flush();
}
Also used : MachineId(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl.MachineId) EntityManager(javax.persistence.EntityManager) KubernetesMachineImpl(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) Transactional(com.google.inject.persist.Transactional)

Example 2 with MachineId

use of org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl.MachineId in project devspaces-images by redhat-developer.

the class JpaKubernetesMachineCache method doUpdateMachineStatus.

@Transactional
protected void doUpdateMachineStatus(String workspaceId, String machineName, MachineStatus status) throws InfrastructureException {
    EntityManager entityManager = managerProvider.get();
    KubernetesMachineImpl machine = entityManager.find(KubernetesMachineImpl.class, new MachineId(workspaceId, machineName));
    if (machine == null) {
        throw new InfrastructureException(format("Machine '%s:%s' was not found", workspaceId, machineName));
    }
    machine.setStatus(status);
    entityManager.flush();
}
Also used : MachineId(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl.MachineId) EntityManager(javax.persistence.EntityManager) KubernetesMachineImpl(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) Transactional(com.google.inject.persist.Transactional)

Aggregations

Transactional (com.google.inject.persist.Transactional)2 EntityManager (javax.persistence.EntityManager)2 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)2 KubernetesMachineImpl (org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl)2 MachineId (org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl.MachineId)2