Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2014 Red Hat, Inc. Red Hat licenses this file to you under the Apache License, version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package io.fabric8.openshift;
 
 import java.util.Date;
 
 
Represents the configuration of a Fabric managed OpenShift cartridge so that the io.fabric8.openshift.agent.OpenShiftDeployAgent can keep the cartridge's git repository up to date with the deployment units defined in the Profile configuration.
 
 public class ManagedCartridgeConfig {
     private static final transient Logger LOG = LoggerFactory.getLogger(ManagedCartridgeConfig.class);
 
     private static final String KEY_DOMAIN = "domain";
     private static final String KEY_LOGIN = "login";
     private static final String KEY_PASSWORD = "password";
     private static final String KEY_SERVER_URL = "serverUrl";
 
     private static boolean substitutedStringValue = false;
 
     private final Properties properties;

    
Loads the managed cartridge configuration for the given containerId
 
     public static ManagedCartridgeConfig loadConfig(FabricService fabricServiceString containerId)
             throws IOException {
         String propertiesText = fabricService.getDataStore().getContainerAttribute(containerId,
                 ..""false);
 
         if (propertiesText == null) {
             return null;
         }
         Properties properties = new Properties();
         properties.load(new StringReader(propertiesText));
         ManagedCartridgeConfig answer = new ManagedCartridgeConfig(properties);
 
         .info("Loaded managed cartridge configuration " + answer);
         return answer;
     }

    
Saves the managed cartridge configuration data
 
     public static ManagedCartridgeConfig saveConfig(FabricService fabricService,
                                                     String containerId,
                                                     CreateOpenshiftContainerOptions options,
                                                     IApplication applicationthrows IOException {
 
         ManagedCartridgeConfig config = new ManagedCartridgeConfig();
         config.setServerUrl(options.getServerUrl());
         config.setLogin(options.getLogin());
         config.setPassword(options.getPassword());
 
 
         StringWriter writer = new StringWriter();
         config.getProperties().store(writer"Saved by " + config.getClass() + " at " + new Date());
         String propertiesText = writer.toString();
 
         .info("Saved managed cartridge configuration: " + propertiesText);
 
         fabricService.getDataStore().setContainerAttribute(containerId,
                 ..propertiesText);
         return config;
     }
 
 
     public ManagedCartridgeConfig() {
         this(new Properties());
     }
 
    public ManagedCartridgeConfig(Properties properties) {
        this. = properties;
    }
    @Override
    public String toString() {
        return "ManagedCartridgeConfig(serverUrl: " + getServerUrl() + "; login: " + getLogin() + ")";
    }
    public Properties getProperties() {
        return ;
    }


    
Returns a newly created connection to openshift for this configuration
        return new OpenShiftConnectionFactory()
                .getConnection("fabric"getLogin(), getPassword(), getServerUrl());
    }
    // Properties
    //-------------------------------------------------------------------------
    public String getLogin() {
        return Maps.stringValue();
    }
    public void setLogin(String login) {
        Maps.setValue(login);
    }
    public String getPassword() {
        return Maps.stringValue();
    }
    public void setPassword(String password) {
        Maps.setValue(password);
    }
    public String getServerUrl() {
        return Maps.stringValue();
    }
    public void setServerUrl(String serverUrl) {
        Maps.setValue(serverUrl);
    }
    public String getDomain() {
        return Maps.stringValue();
    }
    public void setDomain(String serverUrl) {
        Maps.setValue(serverUrl);
    }
New to GrepCode? Check out our FAQ X