Search in sources :

Example 1 with ServerId

use of org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl.ServerId in project che-server by eclipse-che.

the class JpaKubernetesMachineCache method getServer.

@Transactional(rollbackOn = InfrastructureException.class)
@Override
public KubernetesServerImpl getServer(RuntimeIdentity runtimeIdentity, String machineName, String serverName) throws InfrastructureException {
    try {
        String workspaceId = runtimeIdentity.getWorkspaceId();
        KubernetesServerImpl server = managerProvider.get().find(KubernetesServerImpl.class, new ServerId(workspaceId, machineName, serverName));
        if (server == null) {
            throw new InfrastructureException(format("Server with name '%s' was not found", serverName));
        }
        return server;
    } catch (RuntimeException e) {
        throw new InfrastructureException(e.getMessage(), e);
    }
}
Also used : KubernetesServerImpl(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl) ServerId(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl.ServerId) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) Transactional(com.google.inject.persist.Transactional)

Example 2 with ServerId

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

the class JpaKubernetesMachineCache method getServer.

@Transactional(rollbackOn = InfrastructureException.class)
@Override
public KubernetesServerImpl getServer(RuntimeIdentity runtimeIdentity, String machineName, String serverName) throws InfrastructureException {
    try {
        String workspaceId = runtimeIdentity.getWorkspaceId();
        KubernetesServerImpl server = managerProvider.get().find(KubernetesServerImpl.class, new ServerId(workspaceId, machineName, serverName));
        if (server == null) {
            throw new InfrastructureException(format("Server with name '%s' was not found", serverName));
        }
        return server;
    } catch (RuntimeException e) {
        throw new InfrastructureException(e.getMessage(), e);
    }
}
Also used : KubernetesServerImpl(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl) ServerId(org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl.ServerId) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) Transactional(com.google.inject.persist.Transactional)

Aggregations

Transactional (com.google.inject.persist.Transactional)2 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)2 KubernetesServerImpl (org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl)2 ServerId (org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesServerImpl.ServerId)2