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 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,
         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();
         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);
         return config;
     public ManagedCartridgeConfig() {
         this(new Properties());
    public ManagedCartridgeConfig(Properties properties) {
        this. = properties;
    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) {
    public String getPassword() {
        return Maps.stringValue();
    public void setPassword(String password) {
    public String getServerUrl() {
        return Maps.stringValue();
    public void setServerUrl(String serverUrl) {
    public String getDomain() {
        return Maps.stringValue();
    public void setDomain(String serverUrl) {
New to GrepCode? Check out our FAQ X