Examples of BeesClientConfiguration


Examples of com.cloudbees.api.BeesClientConfiguration

    BeesClientFactory bees;

    @Override
    public RemoteRepository decorate(RemoteRepository repo) {
        try {
            BeesClientConfiguration bcc = bees.get().getBeesClientConfiguration();

            if (bcc==nullreturn repo;

            if (bcc.getProxyHost() != null && bcc.getProxyPort() > 0) {
                String proxyType = Proxy.TYPE_HTTP;
                if (repo.getUrl().startsWith("https"))
                    proxyType = Proxy.TYPE_HTTPS;
                Proxy proxy = new Proxy(proxyType, bcc.getProxyHost(), bcc.getProxyPort(), null);
                if (bcc.getProxyUser() != null) {
                    Authentication authentication = new Authentication(bcc.getProxyUser(), bcc.getProxyPassword());
                    proxy.setAuthentication(authentication);
                }
                repo.setProxy(proxy);
            }
            return repo;
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

    public BeesClientBase get() throws IOException {
        return get(BeesClientBase.class);
    }
   
    public <T extends BeesClientBase> T get(Class<T> clientType) throws IOException {
        BeesClientConfiguration beesClientConfiguration = createConfigurations();

        try {
            T client = clientType.getConstructor(BeesClientConfiguration.class).newInstance(beesClientConfiguration);
            client.setVerbose(verbose.isVerbose());
            return  client;
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

        if (secret==null)   secret = properties.getProperty("bees.api.secret");
        initCredentials();

        String apiUrl = getApiUrl();

        BeesClientConfiguration beesClientConfiguration = new BeesClientConfiguration(apiUrl, key, secret, "xml", "1.0");

        // Set proxy information
        beesClientConfiguration.setProxyHost(properties.getProperty("bees.api.proxy.host", proxyHost));
        if (properties.getProperty("bees.api.proxy.port") != null || proxyPort != null)
            beesClientConfiguration.setProxyPort(Integer.parseInt(properties.getProperty("bees.api.proxy.port", proxyPort)));
        beesClientConfiguration.setProxyUser(properties.getProperty("bees.api.proxy.user", proxyUser));
        beesClientConfiguration.setProxyPassword(properties.getProperty("bees.api.proxy.password", proxyPassword));
        return beesClientConfiguration;
    }
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

    public BeesClientBase get() throws IOException {
        return get(BeesClientBase.class);
    }
   
    public <T extends BeesClientBase> T get(Class<T> clientType) throws IOException {
        BeesClientConfiguration beesClientConfiguration = createConfigurations();

        try {
            T client = clientType.getConstructor(BeesClientConfiguration.class).newInstance(beesClientConfiguration);
            client.setVerbose(verbose.isVerbose());
            return  client;
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

     * Creates a fully populated {@link BeesClientConfiguration} based on the current setting.
     */
    public BeesClientConfiguration createConfigurations() throws IOException {
        Properties properties = getConfigProperties();

        BeesClientConfiguration beesClientConfiguration = new BeesClientConfiguration(getApiUrl());

        String token = properties.getProperty("bees.api.oauth_token");
        if (token!=null) {
            // use OAuth token for authentication
            beesClientConfiguration.withOAuthToken(token);
        } else {
            // fallback to API key and secret
            if (key==null)      key = properties.getProperty("bees.api.key");
            if (secret==null)   secret = properties.getProperty("bees.api.secret");
            initCredentials();
            beesClientConfiguration.withApiKeyAndSecret(key,secret);
        }


        // Set proxy information
        beesClientConfiguration.setProxyHost(properties.getProperty("bees.api.proxy.host", proxyHost));
        if (properties.getProperty("bees.api.proxy.port") != null || proxyPort != null)
            beesClientConfiguration.setProxyPort(Integer.parseInt(properties.getProperty("bees.api.proxy.port", proxyPort)));
        beesClientConfiguration.setProxyUser(properties.getProperty("bees.api.proxy.user", proxyUser));
        beesClientConfiguration.setProxyPassword(properties.getProperty("bees.api.proxy.password", proxyPassword));
        return beesClientConfiguration;
    }
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

    /**
     * Creates a new {@link BeesClient} that uses the access token encapsulated in this {@link OauthToken}
     */
    public BeesClient createClient() {
        BeesClientConfiguration config = new BeesClientConfiguration();
        config.setOAuthToken(accessToken);
        return new BeesClient(config);
    }
View Full Code Here

Examples of com.cloudbees.api.BeesClientConfiguration

     * @param current
     *      The configuration parameter to inherit from. This method does not mutate this object.
     */
    public BeesClient createClient(BeesClientConfiguration current) {
        // TODO: there should be a copy constructor
        BeesClientConfiguration config = new BeesClientConfiguration(current.getServerApiUrl());
        config.setOAuthToken(accessToken);
        return new BeesClient(config);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.