Android Open Source - Jockey App Engine






From Project

Back to project page Jockey.

License

The source code is released under:

Apache License

If you think the Android project Jockey listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2013 Clarion Media, LLC
 */*w ww  .ja v a  2 s.co m*/
 * 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 com.clarionmedia.jockey.authentication.impl.appengine;

import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import com.clarionmedia.jockey.authentication.AuthenticationProvider;
import com.clarionmedia.jockey.authentication.Authenticator;
import org.apache.http.impl.client.AbstractHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

public class AppEngine extends AuthenticationProvider {

    private Account mAccount;
    private Activity mActivity;

    public AppEngine(String url) {
        super(url);
        mHttpClient = new DefaultHttpClient();
    }

    @Override
    public AppEngine promptConfirmationFrom(Activity activity) {
        mActivity = activity;
        return this;
    }

    @Override
    protected Authenticator buildAuthenticator(Context context) {
        return new AppEngineAuthenticator(context.getApplicationContext(), mAccount, mHttpClient, mUrl, mActivity);
    }

    public AppEngine withCredentials(Account account) {
        mAccount = account;
        return this;
    }

    public AppEngine using(AbstractHttpClient httpClient) {
        mHttpClient = httpClient;
        return this;
    }

    @Override
    protected void checkPreconditions(Context context) {
        super.checkPreconditions(context);
        if (mAccount == null) {
            throw new RuntimeException("Account must not be null");
        }
    }

}




Java Source Code List

com.clarionmedia.jockey.HttpClientProxy.java
com.clarionmedia.jockey.Jockey.java
com.clarionmedia.jockey.authentication.AuthenticationProvider.java
com.clarionmedia.jockey.authentication.Authenticator.java
com.clarionmedia.jockey.authentication.OnAuthenticationListener.java
com.clarionmedia.jockey.authentication.impl.appengine.AppEngineAuthFuture.java
com.clarionmedia.jockey.authentication.impl.appengine.AppEngineAuthenticator.java
com.clarionmedia.jockey.authentication.impl.appengine.AppEngine.java