Search in sources :

Example 1 with IEnvironmentVariable

use of com.openshift.restclient.model.IEnvironmentVariable in project jbosstools-openshift by jbosstools.

the class CreateApplicationFromImageJob method createEnvVars.

private List<IEnvironmentVariable> createEnvVars() {
    List<IEnvironmentVariable> list = new ArrayList<>();
    buildConfigModel.getEnvVariablesModel().getEnvironmentVariables().forEach(v -> list.add(new IEnvironmentVariable() {

        @Override
        public String getName() {
            return v.getKey();
        }

        @Override
        public String getValue() {
            return v.getValue();
        }

        @Override
        public IEnvVarSource getValueFrom() {
            return null;
        }

        @Override
        public String toJson() {
            ModelNode node = new ModelNode();
            node.get("name").set(getName());
            node.get("value").set(getValue());
            return node.toJSONString(true);
        }
    }));
    return list;
}
Also used : ArrayList(java.util.ArrayList) IEnvironmentVariable(com.openshift.restclient.model.IEnvironmentVariable) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with IEnvironmentVariable

use of com.openshift.restclient.model.IEnvironmentVariable in project jbosstools-openshift by jbosstools.

the class OpenshiftJMXConnectionProvider method getJolokiaPort.

protected String getJolokiaPort(IPod pod) {
    String port = "8778";
    IReplicationController rc = ResourceUtils.getDeploymentConfigOrReplicationControllerFor(pod);
    if (rc != null) {
        Optional<IEnvironmentVariable> envPort = rc.getEnvironmentVariables().stream().filter(env -> env.getName().equals("AB_JOLOKIA_PORT")).findFirst();
        if (envPort.isPresent()) {
            port = envPort.get().getValue();
        }
    }
    return port;
}
Also used : IResource(com.openshift.restclient.model.IResource) ResourceKind(com.openshift.restclient.ResourceKind) MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) IServer(org.eclipse.wst.server.core.IServer) IConnectionProvider(org.jboss.tools.jmx.core.IConnectionProvider) JolokiaConnectionWrapper(org.jboss.tools.jmx.jolokia.JolokiaConnectionWrapper) ResourceUtils(org.jboss.tools.openshift.internal.core.util.ResourceUtils) HashMap(java.util.HashMap) AbstractJBossJMXConnectionProvider(org.jboss.ide.eclipse.as.jmx.integration.AbstractJBossJMXConnectionProvider) OpenShiftCoreActivator(org.jboss.tools.openshift.internal.core.OpenShiftCoreActivator) Connection(org.jboss.tools.openshift.core.connection.Connection) ExtensionManager(org.jboss.tools.jmx.core.ExtensionManager) IPod(com.openshift.restclient.model.IPod) List(java.util.List) IEnvironmentVariable(com.openshift.restclient.model.IEnvironmentVariable) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) Map(java.util.Map) IConnectionWrapper(org.jboss.tools.jmx.core.IConnectionWrapper) Optional(java.util.Optional) IReplicationController(com.openshift.restclient.model.IReplicationController) IEnvironmentVariable(com.openshift.restclient.model.IEnvironmentVariable) IReplicationController(com.openshift.restclient.model.IReplicationController)

Example 3 with IEnvironmentVariable

use of com.openshift.restclient.model.IEnvironmentVariable in project jbosstools-openshift by jbosstools.

the class ResourceMocks method createEnvironmentVariable.

public static IEnvironmentVariable createEnvironmentVariable(String name, String value) {
    IEnvironmentVariable var = mock(IEnvironmentVariable.class);
    doReturn(name).when(var).getName();
    doReturn(value).when(var).getValue();
    return var;
}
Also used : IEnvironmentVariable(com.openshift.restclient.model.IEnvironmentVariable)

Aggregations

IEnvironmentVariable (com.openshift.restclient.model.IEnvironmentVariable)3 ResourceKind (com.openshift.restclient.ResourceKind)1 IPod (com.openshift.restclient.model.IPod)1 IReplicationController (com.openshift.restclient.model.IReplicationController)1 IResource (com.openshift.restclient.model.IResource)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IServer (org.eclipse.wst.server.core.IServer)1 ModelNode (org.jboss.dmr.ModelNode)1 AbstractJBossJMXConnectionProvider (org.jboss.ide.eclipse.as.jmx.integration.AbstractJBossJMXConnectionProvider)1 ExtensionManager (org.jboss.tools.jmx.core.ExtensionManager)1 IConnectionProvider (org.jboss.tools.jmx.core.IConnectionProvider)1 IConnectionWrapper (org.jboss.tools.jmx.core.IConnectionWrapper)1 JolokiaConnectionWrapper (org.jboss.tools.jmx.jolokia.JolokiaConnectionWrapper)1