spi model sketch

6.19.x
Yevhenii Voevodin 2017-03-31 11:59:15 +03:00
parent 73a3d2a431
commit 5adeff8968
23 changed files with 90 additions and 85 deletions

View File

@ -22,7 +22,7 @@ public interface MachineLogMessage {
String getContent();
/**
* Machine name
* OldMachine name
*/
String getMachineName();
}

View File

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.che.api.core.model.machine;
import org.eclipse.che.api.core.model.workspace.config.Command;
/**
* Describe process running in a machine
*

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.che.api.core.model.machine;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.commons.annotation.Nullable;
/**
@ -17,12 +18,14 @@ import org.eclipse.che.commons.annotation.Nullable;
*
* @author gazarenkov
* @author Alexander Garagatyi
*
* @deprecated
*/
public interface Machine {
public interface OldMachine {
/**
* Returns configuration used to create this machine
*/
MachineConfig getConfig();
OldMachineConfig getConfig();
/**
* Returns machine identifier. It is unique and mandatory.
@ -55,5 +58,5 @@ public interface Machine {
* Is available only when {@link #getStatus()} returns {@link MachineStatus#RUNNING}
*/
@Nullable
MachineRuntimeInfo getRuntime();
Machine getRuntime();
}

View File

@ -17,8 +17,9 @@ import java.util.Map;
/**
* @author gazarenkov
* @deprecated
*/
public interface MachineConfig {
public interface OldMachineConfig {
/**
* Display name.
@ -26,7 +27,7 @@ public interface MachineConfig {
String getName();
/**
* From where to create this Machine (Recipe/Snapshot).
* From where to create this OldMachine (OldRecipe/Snapshot).
*/
MachineSource getSource();
@ -36,12 +37,12 @@ public interface MachineConfig {
boolean isDev();
/**
* Machine type (i.e. "docker").
* OldMachine type (i.e. "docker").
*/
String getType();
/**
* Machine limits such as RAM size.
* OldMachine limits such as RAM size.
*/
@Nullable
MachineLimits getLimits();
@ -51,7 +52,7 @@ public interface MachineConfig {
*
* <p>Key is port/transport protocol, e.g. 8080/tcp or 100100/udp
*/
List<? extends ServerConf> getServers();
List<? extends OldServerConf> getServers();
/**
* Get predefined environment variables of machine.

View File

@ -11,11 +11,13 @@
package org.eclipse.che.api.core.model.machine;
/**
* Recipe to create new machine.
* OldRecipe to create new machine.
*
* @author Eugene Voevodin
*
* @deprecated
*/
public interface Recipe {
public interface OldRecipe {
/**
* Returns recipe type (i.e. 'Dockerfile')

View File

@ -18,7 +18,7 @@ import org.eclipse.che.commons.annotation.Nullable;
* @author gazarenkov
* @author Alexander Garagatyi
*/
public interface Server {
public interface OldServer {
/**
* Reference to this Che server
*/

View File

@ -16,8 +16,10 @@ import org.eclipse.che.commons.annotation.Nullable;
* Configuration of server that can be started inside of machine
*
* @author Alexander Garagatyi
*
* @deprecated
*/
public interface ServerConf {
public interface OldServerConf {
/**
* Reference to this server.
*/

View File

@ -13,7 +13,7 @@ package org.eclipse.che.api.core.model.machine;
import org.eclipse.che.commons.annotation.Nullable;
/**
* Not mandatory properties of a {@link Server}
* Not mandatory properties of a {@link OldServer}
*
* @author Mario Loriedo
*/

View File

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.che.api.core.model.project;
import org.eclipse.che.api.core.model.workspace.config.ProjectConfig;
import java.util.List;
import java.util.Map;
@ -17,6 +19,9 @@ import java.util.Map;
* Defines configuration for creating new project
*
* @author Roman Nikitenko
*
*
* @deprecated
*/
public interface NewProjectConfig extends ProjectConfig {
/** Sets project name */

View File

@ -11,6 +11,7 @@
package org.eclipse.che.api.core.model.project;
import org.eclipse.che.api.core.model.project.fs.Folder;
import org.eclipse.che.api.core.model.workspace.config.ProjectConfig;
/**
* @author gazarenkov

View File

@ -10,11 +10,10 @@
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
import org.eclipse.che.api.core.model.machine.Machine;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.core.model.machine.MachineStatus;
import org.eclipse.che.commons.annotation.Nullable;
import java.util.List;
import java.util.Map;
/**
* Defines a contract for workspace runtime.
@ -31,7 +30,7 @@ import java.util.List;
*
* @author Yevhenii Voevodin
*/
public interface WorkspaceRuntime {
public interface Runtime {
/**
* Returns an active environment name.
@ -40,28 +39,6 @@ public interface WorkspaceRuntime {
*/
String getActiveEnv();
/**
* Returns a workspace root folder.
* The base folder for the workspace projects.
*/
@Nullable
String getRootFolder();
/**
* Returns development machine only if its status is either {@link MachineStatus#RUNNING running}
* or {@link MachineStatus#DESTROYING destroying}, otherwise returns null
* which means that machine is starting or hasn't been started yet.
*
* <p>Returned machine used for extensions management.
* It is guaranteed that configuration of that machine exists
* in the active environment.
*
* <p>There is a contract between this method and {@link #getMachines()} method,
* if this method returns null then {@code getMachines()} method returns an empty list,
* if this method returns dev-machine then {@code getMachines()} method result includes dev-machine.
*/
@Nullable
Machine getDevMachine();
/**
* Returns all the machines which statuses are either {@link MachineStatus#RUNNING running}
@ -69,5 +46,12 @@ public interface WorkspaceRuntime {
*
* <p>Returned list always contains dev-machine.
*/
List<? extends Machine> getMachines();
Map<String, ? extends Machine> getMachines();
String getOwner();
// String getUserToken();
}

View File

@ -72,5 +72,5 @@ public interface Workspace {
* returned value is not null, otherwise it is.
*/
@Nullable
WorkspaceRuntime getRuntime();
Runtime getRuntime();
}

View File

@ -10,8 +10,9 @@
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
import org.eclipse.che.api.core.model.machine.Command;
import org.eclipse.che.api.core.model.project.ProjectConfig;
import org.eclipse.che.api.core.model.workspace.config.Command;
import org.eclipse.che.api.core.model.workspace.config.ProjectConfig;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.commons.annotation.Nullable;
import java.util.List;

View File

@ -13,7 +13,7 @@ package org.eclipse.che.api.core.model.workspace;
/**
* Defines the contract between workspace and its active environment.
*
* <p>Workspace is rather part of the {@link Workspace} than {@link WorkspaceRuntime} or {@link WorkspaceConfig},
* <p>Workspace is rather part of the {@link Workspace} than {@link Runtime} or {@link WorkspaceConfig},
* as it shows the state of <b>certain</b> user's workspace and exists <b>earlier</b> than runtime workspace instance
* e.g. UsersWorkspace may be considered as 'STARTING' before it becomes runtime('RUNNING').
*

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.machine;
package org.eclipse.che.api.core.model.workspace.config;
import java.util.Map;
@ -22,7 +22,6 @@ public interface Command {
/**
* Returns command name (i.e. 'start tomcat')
* <p>
* The name should be unique per user in one workspace,
* which means that user may create only one command with the same name in the same workspace
*/

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
package org.eclipse.che.api.core.model.workspace.config;
import java.util.Map;
@ -23,10 +23,10 @@ public interface Environment {
* Returns the recipe (the main script) to define this environment (compose, kubernetes pod).
* Type of this recipe defines engine for composing machines network runtime.
*/
EnvironmentRecipe getRecipe();
Recipe getRecipe();
/**
* Returns mapping of machine name to additional configuration of machine.
*/
Map<String, ? extends ExtendedMachine> getMachines();
Map<String, ? extends MachineConfig> getMachines();
}

View File

@ -8,26 +8,26 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
package org.eclipse.che.api.core.model.workspace.config;
import java.util.List;
import java.util.Map;
/**
* Additional information about machine which is needed for purposes of CHE.
* Machine configuration
*
* @author Alexander Garagatyi
*/
public interface ExtendedMachine {
public interface MachineConfig {
/**
* Returns list of agents that should be deployed into machine.
* Returns list of configured agents.
*/
List<String> getAgents();
/**
* Returns mapping of references to configurations of servers deployed into machine.
*/
Map<String, ? extends ServerConf2> getServers();
Map<String, ? extends ServerConfig> getServers();
/**
* Returns attributes of resources of machine.

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.project;
package org.eclipse.che.api.core.model.workspace.config;
import java.util.List;
import java.util.Map;

View File

@ -8,14 +8,14 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
package org.eclipse.che.api.core.model.workspace.config;
/**
* Describes recipe of workspace environment.
*
* @author Alexander Garagatyi
*/
public interface EnvironmentRecipe {
public interface Recipe {
/**
* Type of the environment, e.g. docker compose.
*/

View File

@ -8,27 +8,16 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace;
import java.util.Map;
package org.eclipse.che.api.core.model.workspace.config;
/**
* Configuration of server that can be started inside of machine.
*
* @author Alexander Garagatyi
*/
public interface ServerConf2 {
public interface ServerConfig {
/**
* Port used by server.
* <p>
* If udp transport protocol is used then port should include /udp.<br>
* If tcp is used /tcp is not required.<br>
* Example:
* <ul>
* <li>8080</li>
* <li>8080/tcp</li>
* <li>8080/udp</li>
* </ul>
*/
String getPort();
@ -48,7 +37,7 @@ public interface ServerConf2 {
String getProtocol();
/**
* Additional configuration that can be used to improve usage of machine servers.
* Path used by server.
*/
Map<String, String> getProperties();
String getPath();
}

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.project;
package org.eclipse.che.api.core.model.workspace.config;
import java.util.Map;

View File

@ -8,7 +8,9 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.machine;
package org.eclipse.che.api.core.model.workspace.runtime;
import org.eclipse.che.api.core.model.machine.OldServer;
import java.util.Map;
@ -17,24 +19,16 @@ import java.util.Map;
*
* @author Alexander Garagatyi
*/
public interface MachineRuntimeInfo {
/**
* Returns environment variables of machine.
*/
Map<String, String> getEnvVariables();
public interface Machine {
/**
* Returns machine specific properties.
*/
Map<String, String> getProperties();
/**
* It is supposed that this methods returns the same as {@code getEnvVariables().get("CHE_PROJECTS_ROOT")}.
*/
String projectsRoot();
/**
* Returns mapping of exposed ports to {@link Server}.
* Returns mapping of exposed ports to {@link OldServer}.
*
* <p>Key consist of port number and transport protocol - tcp or udp with slash between these parts.
* <br>Example:
@ -49,4 +43,6 @@ public interface MachineRuntimeInfo {
* </pre>
*/
Map<String, ? extends Server> getServers();
}

View File

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.workspace.runtime;
/**
* @author gazarenkov
*/
public interface Server {
String getUrl();
}