All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xlcloud.config.openstack.OpenstackPropertiesFactory Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2012 AMG.lab, a Bull Group Company
 * 
 * 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
 * 
 *    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 org.xlcloud.config.openstack;

import java.util.Properties;

import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import org.xlcloud.config.ConfigParam;

*//**
 * Used only due to an awkward openstack-java-sdk interface that does not expose
 * any method for authentication (uses {@link Properties} instead)
 * 
 * @author Tomek Adamczewski, AMG.net
 *//*
public class OpenstackPropertiesFactory {

    @Inject
    @ConfigParam
    private String publicUrl;

    @Inject
    @ConfigParam
    private String adminUrl;

    @Inject
    @ConfigParam
    private String serviceUserName;

    @Inject
    @ConfigParam
    private String serviceUserPassword;

    @Inject
    @ConfigParam
    private String serviceUserTenantName;

    @Inject
    @ConfigParam
    private String superadminTokenId;

    @Inject
    @ConfigParam
    private String serviceUserRole;
    
    @Inject
    @ConfigParam
    private String platformAdminName;

    @Inject
    @ConfigParam
    private String platformAdminAccountName;

    @Inject
    @ConfigParam
    private String platformAdminPassword;

    private Properties properties;

    private OpenstackPropertiesFactory() {
        this.properties = new Properties();
    }

    private OpenstackPropertiesFactory add(String key, String value) {
        this.properties.setProperty(key, value);
        return this;
    }

    private Properties toProperties() {
        return properties;
    }

    public @Produces @OpenstackProperties Properties getProperties() {
        return new OpenstackPropertiesFactory().add("identity.endpoint.publicURL", publicUrl).add("identity.endpoint.adminURL", adminUrl)
                .add("auth.username", serviceUserName).add("auth.password", serviceUserPassword)
                .add("auth.tenantName", serviceUserTenantName).toProperties();
    }

    *//**
     * Gets the value of {@link #publicUrl}.
     * 
     * @return value of {@link #publicUrl}
     *//*
    public String getPublicUrl() {
        return publicUrl;
    }

    *//**
     * Sets the value of {@link #publicUrl}.
     * 
     * @param publicUrl
     *            - value
     *//*
    public void setPublicUrl(String publicUrl) {
        this.publicUrl = publicUrl;
    }

    *//**
     * Gets the value of {@link #adminUrl}.
     * 
     * @return value of {@link #adminUrl}
     *//*
    public String getAdminUrl() {
        return adminUrl;
    }

    *//**
     * Sets the value of {@link #adminUrl}.
     * 
     * @param adminUrl
     *            - value
     *//*
    public void setAdminUrl(String adminUrl) {
        this.adminUrl = adminUrl;
    }

    *//**
     * Gets the value of {@link #serviceUserName}.
     * 
     * @return value of {@link #serviceUserName}
     *//*
    public String getServiceUserName() {
        return serviceUserName;
    }

    *//**
     * Sets the value of {@link #serviceUserName}.
     * 
     * @param serviceUserName
     *            - value
     *//*
    public void setServiceUserName(String serviceUserName) {
        this.serviceUserName = serviceUserName;
    }

    *//**
     * Gets the value of {@link #serviceUserPassword}.
     * 
     * @return value of {@link #serviceUserPassword}
     *//*
    public String getServiceUserPassword() {
        return serviceUserPassword;
    }

    *//**
     * Sets the value of {@link #serviceUserPassword}.
     * 
     * @param serviceUserPassword
     *            - value
     *//*
    public void setServiceUserPassword(String serviceUserPassword) {
        this.serviceUserPassword = serviceUserPassword;
    }

    *//**
     * Gets the value of {@link #serviceUserTenantName}.
     * 
     * @return value of {@link #serviceUserTenantName}
     *//*
    public String getServiceUserTenantName() {
        return serviceUserTenantName;
    }

    *//**
     * Sets the value of {@link #serviceUserTenantName}.
     * 
     * @param serviceUserTenantName
     *            - value
     *//*
    public void setServiceUserTenantName(String serviceUserTenantName) {
        this.serviceUserTenantName = serviceUserTenantName;
    }

    *//**
     * Gets the value of {@link #superadminTokenId}.
     * 
     * @return value of {@link #superadminTokenId}
     *//*
    public String getSuperadminTokenId() {
        return superadminTokenId;
    }

    *//**
     * Sets the value of {@link #superadminTokenId}.
     * 
     * @param superadminTokenId
     *            - value
     *//*
    public void setSuperadminTokenId(String superadminTokenId) {
        this.superadminTokenId = superadminTokenId;
    }

    *//**
     * Gets the value of {@link #serviceUserRole}.
     * 
     * @return value of {@link #serviceUserRole}
     *//*
    public String getServiceUserRole() {
        return serviceUserRole;
    }

    *//**
     * Sets the value of {@link #serviceUserRole}.
     * 
     * @param serviceUserRole
     *            - value
     *//*
    public void setServiceUserRole(String serviceUserRole) {
        this.serviceUserRole = serviceUserRole;
    }

    *//**
     * Sets the value of {@link #platformAdminAccountName}.
     * 
     * @param platformAdminAccountName
     *            - value
     *//*
    public void setPlatformAdminAccountName(String platformAdminAccountName) {
    	this.platformAdminAccountName = platformAdminAccountName;
    }

    *//**
     * Gets the value of {@link #platformAdminAccountName}.
     * 
     * @return value of {@link #platformAdminAccountName}
     *//*
	public String getPlatformAdminAccountName() {
		return platformAdminAccountName;
	}
    
    *//**
     * Gets the value of {@link #platformAdminName}.
     * 
     * @return value of {@link #platformAdminName}
     *//*
    public String getPlatformAdminName() {
        return platformAdminName;
    }

    *//**
     * Sets the value of {@link #platformAdminName}.
     * 
     * @param platformAdminName
     *            - value
     *//*
    public void setPlatformAdminName(String platformAdminName) {
        this.platformAdminName = platformAdminName;
    }

    *//**
     * Gets the value of {@link #platformAdminPassword}.
     * 
     * @return value of {@link #platformAdminPassword}
     *//*
    public String getPlatformAdminPassword() {
        return platformAdminPassword;
    }

    *//**
     * Sets the value of {@link #platformAdminPassword}.
     * 
     * @param platformAdminPassword
     *            - value
     *//*
    public void setPlatformAdminPassword(String platformAdminPassword) {
        this.platformAdminPassword = platformAdminPassword;
    }

    *//**
     * Sets the value of {@link #properties}.
     * 
     * @param properties
     *            - value
     *//*
    public void setProperties(Properties properties) {
        this.properties = properties;
    }

}
*/




© 2015 - 2025 Weber Informatics LLC | Privacy Policy