Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) FuseSource, Inc. Licensed 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  io.fabric8.api.scr.AbstractComponent;
import  io.fabric8.api.scr.Configurer;
import  org.apache.felix.scr.annotations.*;
import  org.osgi.framework.BundleContext;
import  org.osgi.framework.ServiceRegistration;
@Component(name = "io.fabric8.openshift",
        description = "Fabric Openshift Connection",
        policy = ConfigurationPolicy.REQUIRE,
        immediate = true, metatype = true)
public class ManagedOpenshiftConnection extends AbstractComponent {
    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";
    private ServiceRegistration<IOpenShiftConnectionregistration;
    private Configurer configurer;
    @Property(name = "serverUrl", label = "Openshift Server URL", description = "The URL to the Openshift server", value = "")
    @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;
    public void activate(BundleContext bundleContextMap<StringStringpropertiesthrows Exception {
        if (isConfigurationValid(properties)) {
            if ( != null &&  != null &&  != null) {
                 = bundleContext.registerService(IOpenShiftConnection.classnull);
    public void deactivate() {
        if ( != null) {
             = 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