Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2009, MTV Networks. All rights reserved. This program is licensed to you under the Apache License Version 2.0, and you may not use this file except in compliance with the Apache License Version 2.0. You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the Apache License Version 2.0 is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
 
 
 package com.mtvnet.boxspring.crowd.osgi.configuration.internal;
 
 import java.util.Map;
 
 import  org.springframework.beans.BeanWrapper;
 import  org.springframework.beans.BeansException;
 import  org.springframework.beans.PropertyAccessorFactory;
 import  org.springframework.beans.factory.BeanFactory;
 import  org.springframework.beans.factory.BeanFactoryAware;
 import  org.springframework.beans.factory.support.AbstractBeanFactory;
 
Implementation of Crowd's ClientProperties interface which allows for the Crowd client to be configured via the OSGi configuration admin service. Has an unfortunate dependency upon Spring due to OSGI-762.

Author(s):
edelsonj
 
 public class ConfigAdminBackedClientPropertiesImpl implements ClientProperties, BeanFactoryAware {
 
     private BeanFactory beanFactory;
 
     private String applicationName = null;
     private String applicationPassword = null;
     private String applicationAuthenticationURL = null;
     private String securityServerURL = null;
     private String cookieTokenKey = null;
     private String sessionIsAuthenticated = null;
     private String sessionTokenKey = null;
     private String sessionLastValidation = null;
     private long sessionValidationInterval = 0;
     private String baseURL = null;
 
     private String httpProxyPort = null;
     private String httpProxyHost = null;
     private String httpProxyUsername = null;
     private String httpProxyPassword = null;
 
     private String httpMaxConnections = null;
     private String httpTimeout = null;
 
Taken from org.springframework.osgi.compendium.internal.cm.CMUtils
 
     private static void applyMapOntoInstance(Object instanceMap<String, ?> properties,
             AbstractBeanFactory beanFactory) {
         if (properties != null && !properties.isEmpty()) {
             BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(instance);
             // configure bean wrapper (using method from Spring 2.5.6)
             if (beanFactory != null) {
                 beanFactory.copyRegisteredEditorsTo(beanWrapper);
             }
             for (String propertyName : properties.keySet()) {
                 if (beanWrapper.isWritableProperty(propertyName)) {
                     beanWrapper.setPropertyValue(propertyNameproperties.get(propertyName));
                 }
             }
         }
     }
 
         ApplicationAuthenticationContext applicationAuthenticationContext = new ApplicationAuthenticationContext();
         PasswordCredential credentials = new PasswordCredential();
         applicationAuthenticationContext.setName();
         applicationAuthenticationContext.setCredential(credentials);
         return applicationAuthenticationContext;
     }
 
         return ;
     }
 
     public String getApplicationName() {
         return ;
    }
    public String getApplicationPassword() {
        return ;
    }
    public String getBaseURL() {
        return ;
    }
    public String getCookieTokenKey() {
        return ;
    }
    public String getHttpMaxConnections() {
        return ;
    }
    public String getHttpProxyHost() {
        return ;
    }
    public String getHttpProxyPassword() {
        return ;
    }
    public String getHttpProxyPort() {
        return ;
    }
    public String getHttpProxyUsername() {
        return ;
    }
    public String getHttpTimeout() {
        return ;
    }
    public String getSecurityServerURL() {
        return ;
    }
    public String getSessionIsAuthenticated() {
        return ;
    }
    public String getSessionLastValidation() {
        return ;
    }
    public String getSessionTokenKey() {
        return ;
    }
    public long getSessionValidationInterval() {
        return ;
    }
    public void setApplicationAuthenticationURL(final String applicationAuthenticationURL) {
        this. = applicationAuthenticationURL;
    }
    public void setApplicationName(final String applicationName) {
        this. = applicationName;
    }
    public void setApplicationPassword(final String applicationPassword) {
        this. = applicationPassword;
    }
    public void setBaseURL(final String baseURL) {
        this. = baseURL;
    }
    public void setBeanFactory(BeanFactory beanFactorythrows BeansException {
        this. = beanFactory;
    }
    public void setCookieTokenKey(final String cookieTokenKey) {
        this. = cookieTokenKey;
        if (this. == null) {
            this. = .;
        }
    }
    public void setHttpMaxConnections(final String httpMaxConnections) {
        this. = httpMaxConnections;
    }
    public void setHttpProxyHost(final String httpProxyHost) {
        this. = httpProxyHost;
    }
    public void setHttpProxyPassword(final String httpProxyPassword) {
        this. = httpProxyPassword;
    }
    public void setHttpProxyPort(final String httpProxyPort) {
        this. = httpProxyPort;
    }
    public void setHttpProxyUsername(final String httpProxyUsername) {
        this. = httpProxyUsername;
    }
    public void setHttpTimeout(final String httpTimeout) {
        this. = httpTimeout;
    }
    public void setSecurityServerClient(OsgiSecurityServerClientImpl securityServerClient) {
        this. = securityServerClient;
    }
    public void setSecurityServerURL(final String securityServerURL) {
        if (securityServerURL != null && !securityServerURL.endsWith("/")) {
            this. = new StringBuilder().append(securityServerURL).append("/")
                    .toString();
        } else {
            this. = securityServerURL;
        }
    }
    public void setSessionIsAuthenticated(final String sessionIsAuthenticated) {
        this. = sessionIsAuthenticated;
    }
    public void setSessionLastValidation(final String sessionLastValidation) {
        this. = sessionLastValidation;
    }
    public void setSessionTokenKey(final String sessionTokenKey) {
        this. = sessionTokenKey;
    }
    public void setSessionValidationInterval(final long sessionValidationInterval) {
        this. = sessionValidationInterval;
    }
    public void updateCallback(Map<String, ?> properties) {
        applyMapOntoInstance(thisproperties,
                (AbstractBeanFactory) ( instanceof AbstractBeanFactory ? 
                        : null));
        if ( != null) {
            .propertiesUpdated();
        }
    }

    
Unsupported operation.
    public void updateProperties(Properties properties) {
        throw new UnsupportedOperationException(
                "ConfigAdminBackedClientPropertiesImpl doesn't support updating via a Properties object.");
    }
New to GrepCode? Check out our FAQ X