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;
@Component(name = "io.fabric8.openshift",
        description = "Fabric Openshift Connection",
        policy = .,
        immediate = true, metatype = true)
    private static final String SERVER_URL = "serverUrl";
    private static final String LOGIN = "login";
    private static final String PASSWORD = "password";
    private static final String FABRIC_CLIENT_ID = "fabric";
    @Reference
    private Configurer configurer;
    @Property(name = "serverUrl", label = "Openshift Server URL", description = "The URL to the Openshift server", value = "openshift.redhat.com")
    @Property(name = "login", label = "Login", description = "The openshift account login")
    String login;
    @Property(name = "password", label = "Password", description = "The openshift account password")
    String password;
    @Property(name="default.cartridge.url", label = "Default Cartridge URL", value = "${default.cartridge.url}")
    private String defaultCartridgeUrl;
    @Activate
    public void activate(BundleContext bundleContextMap<StringStringpropertiesthrows Exception {
        if (isConfigurationValid(properties)) {
            .configure(propertiesthis);
            if ( != null &&  != null &&  != null) {
                 = bundleContext.registerService(IOpenShiftConnection.classnull);
            }
        }
    }
    @Deactivate
    public void deactivate() {
        if ( != null) {
            .unregister();
             = null;
        }
    }
    private boolean isConfigurationValid(Map<StringStringproperties) {
        return properties != null
                && properties.containsKey() && Strings.isNotBlank(properties.get())
                && properties.containsKey() && Strings.isNotBlank(properties.get())
                && properties.containsKey() && Strings.isNotBlank(properties.get());
    }
New to GrepCode? Check out our FAQ X