Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.googlecode.androidannotations.annotations.FragmentByTag;
import com.googlecode.androidannotations.annotations.FromHtml;
import com.googlecode.androidannotations.annotations.Fullscreen;
import com.googlecode.androidannotations.annotations.HttpsClient;
import com.googlecode.androidannotations.annotations.InstanceState;
import com.googlecode.androidannotations.annotations.ItemClick;
import com.googlecode.androidannotations.annotations.ItemLongClick;
Expand Down Expand Up @@ -132,6 +133,7 @@
import com.googlecode.androidannotations.processing.FragmentByTagProcessor;
import com.googlecode.androidannotations.processing.FromHtmlProcessor;
import com.googlecode.androidannotations.processing.FullscreenProcessor;
import com.googlecode.androidannotations.processing.HttpsClientProcessor;
import com.googlecode.androidannotations.processing.InstanceStateProcessor;
import com.googlecode.androidannotations.processing.ItemClickProcessor;
import com.googlecode.androidannotations.processing.ItemLongClickProcessor;
Expand Down Expand Up @@ -188,6 +190,7 @@
import com.googlecode.androidannotations.validation.FragmentByTagValidator;
import com.googlecode.androidannotations.validation.FromHtmlValidator;
import com.googlecode.androidannotations.validation.FullscreenValidator;
import com.googlecode.androidannotations.validation.HttpsClientValidator;
import com.googlecode.androidannotations.validation.InstanceStateValidator;
import com.googlecode.androidannotations.validation.ItemClickValidator;
import com.googlecode.androidannotations.validation.ItemLongClickValidator;
Expand Down Expand Up @@ -288,7 +291,8 @@
FragmentByTag.class, //
BeforeTextChange.class, //
TextChange.class, //
AfterTextChange.class //
AfterTextChange.class, //
HttpsClient.class //
})
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class AndroidAnnotationProcessor extends AnnotatedAbstractProcessor {
Expand Down Expand Up @@ -456,6 +460,7 @@ private ModelValidator buildModelValidator(IRClass rClass, AndroidSystemServices
modelValidator.register(new BeforeTextChangeValidator(processingEnv, rClass));
modelValidator.register(new TextChangeValidator(processingEnv, rClass));
modelValidator.register(new AfterTextChangeValidator(processingEnv, rClass));
modelValidator.register(new HttpsClientValidator(processingEnv, rClass));
return modelValidator;
}

Expand Down Expand Up @@ -533,6 +538,7 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
modelProcessor.register(new TextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new BeforeTextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new AfterTextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new HttpsClientProcessor(rClass));
return modelProcessor;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* Copyright (C) 2010-2011 eBusiness Information, Excilys Group
*
* 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.googlecode.androidannotations.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Use this annotation to get an HttpClient instance with the specified KeyStore
* and TrustStore configured to perform an <b>HTTPS</b> request <br/>
* <br/>
*
* All the parameters are optional<br/>
* <br/>
*
* <i>trustStore</i>: int, Resource id of your trust store file ex
* <code>R.raw.cacerts.bks</code> Typically your servers trusted certificates
* (public key, Root Chain Authority etc) <br/>
* <br/>
*
* <i>trustStorePwd</i>: String, Your trust store password (default is
* <code>changeit</code>) <br/>
* <br/>
*
* <i>keyStore</i>: int, Resource id of your keystore Usually your private key
* (client certificate) <br/>
* <br/>
*
* <i>keyStorePwd</i>: String, Your KeyStore password (default is
* <code>changeit</code>) <br/>
* <br/>
*
* <i>allowAllHostnames</i>: boolean, if true, authorizes any TLS/SSL hostname
* (default <code>true</code>) If false, Hostname in certificate (DN) must match
* the URL.<br/>
* <br/>
*
* <b>Note</b>:
* <tt>Prior to ICS, Android accepts [Key|Trust]store only in BKS format
* (Bouncycastle Key Store)</tt>
*
* @author Nabil Hachicha
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.FIELD)
public @interface HttpsClient {
public static final String DEFAULT_PASSWD = "changeit";

int trustStore() default Id.DEFAULT_VALUE;

String trustStorePwd() default DEFAULT_PASSWD;

int keyStore() default Id.DEFAULT_VALUE;

String keyStorePwd() default DEFAULT_PASSWD;

boolean allowAllHostnames() default true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public final class CanonicalNameConstants {

/*
* Java classes
* Java
*/
public static final String URI = URI.class.getCanonicalName();
public static final String SET = Set.class.getCanonicalName();
Expand All @@ -31,7 +31,7 @@ public final class CanonicalNameConstants {
public static final String CHAR_SEQUENCE = CharSequence.class.getCanonicalName();

/*
* Android classes
* Android
*/
public static final String LOG = "android.util.Log";
public static final String PARCELABLE = "android.os.Parcelable";
Expand Down Expand Up @@ -74,16 +74,17 @@ public final class CanonicalNameConstants {
public static final String BROADCAST_RECEIVER = "android.content.BroadcastReceiver";
public static final String CONTENT_PROVIDER = "android.content.ContentProvider";
public static final String SQLITE_DATABASE = "android.database.sqlite.SQLiteDatabase";
public static final String KEY_STORE = "java.security.KeyStore";

/*
* Sherlock classes
* Sherlock
*/
public static final String SHERLOCK_MENU = "com.actionbarsherlock.view.Menu";
public static final String SHERLOCK_MENU_ITEM = "com.actionbarsherlock.view.MenuItem";
public static final String SHERLOCK_MENU_INFLATER = "com.actionbarsherlock.view.MenuInflater";

/*
* SpringFramework classes
* SpringFramework
*/
public static final String RESPONSE_ENTITY = "org.springframework.http.ResponseEntity";
public static final String HTTP_HEADERS = "org.springframework.http.HttpHeaders";
Expand Down Expand Up @@ -113,6 +114,16 @@ public final class CanonicalNameConstants {
public static final String ON_CONTENT_VIEW_AVAILABLE_EVENT = "roboguice.activity.event.OnContentViewAvailableEvent";
public static final String ON_CREATE_EVENT = "roboguice.activity.event.OnCreateEvent";

/*
* HttpClient
*/
public static final String CLIENT_CONNECTION_MANAGER = "org.apache.http.conn.ClientConnectionManager";
public static final String DEFAULT_HTTP_CLIENT = "org.apache.http.impl.client.DefaultHttpClient";
public static final String SSL_SOCKET_FACTORY = "org.apache.http.conn.ssl.SSLSocketFactory";
public static final String SCHEME = "org.apache.http.conn.scheme.Scheme";
public static final String SCHEME_REGISTRY = "org.apache.http.conn.scheme.SchemeRegistry";
public static final String SINGLE_CLIENT_CONN_MANAGER = "org.apache.http.impl.conn.SingleClientConnManager";

private CanonicalNameConstants() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public void idExists(Element element, Res res, boolean defaultUseName, boolean a
idExists(element, res, defaultUseName, allowDefault, valid, idValue);
}

public void idExists(Element element, Res res, boolean defaultUseName, boolean allowDefault, IsValid valid, String methodName) {

Integer idValue = annotationHelper.extractAnnotationValue(element, methodName);

idExists(element, res, defaultUseName, allowDefault, valid, idValue);
}

public void idsExists(Element element, Res res, IsValid valid) {

int[] idsValues = annotationHelper.extractAnnotationValue(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ public TargetAnnotationHelper(ProcessingEnvironment processingEnv, Class<? exten
this.target = target;
}

@SuppressWarnings("unchecked")
public <T> T extractAnnotationValue(Element element) {
return extractAnnotationValue(element, "value");
}

@SuppressWarnings("unchecked")
public <T> T extractAnnotationValue(Element element, String methodName) {
Annotation annotation = element.getAnnotation(target);

Method method;
try {
method = annotation.getClass().getMethod("value");
method = annotation.getClass().getMethod(methodName);
return (T) method.invoke(annotation);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.sun.codemodel.JBlock;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JExpr;
import com.sun.codemodel.JExpression;
import com.sun.codemodel.JFieldRef;
import com.sun.codemodel.JInvocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package com.googlecode.androidannotations.processing;

import java.io.FileInputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -30,17 +32,20 @@ public class EBeansHolder {
public class Classes {

/*
* Java classes
* Java
*/
public final JClass RUNTIME_EXCEPTION = refClass(RuntimeException.class);
public final JClass EXCEPTION = refClass(Exception.class);
public final JClass CHAR_SEQUENCE = refClass(CharSequence.class);
public final JClass CLASS_CAST_EXCEPTION = refClass(ClassCastException.class);
public final JClass SERIALIZABLE = refClass(Serializable.class);
public final JClass STRING = refClass(String.class);
public final JClass SYSTEM = refClass(System.class);
public final JClass INPUT_STREAM = refClass(InputStream.class);
public final JClass FILE_INPUT_STREAM = refClass(FileInputStream.class);

/*
* Android classes
* Android
*/
public final JClass LOG = refClass(CanonicalNameConstants.LOG);
public final JClass BUNDLE = refClass(CanonicalNameConstants.BUNDLE);
Expand Down Expand Up @@ -76,9 +81,10 @@ public class Classes {
public final JClass MOTION_EVENT = refClass(CanonicalNameConstants.MOTION_EVENT);
public final JClass ON_TOUCH_LISTENER = refClass(CanonicalNameConstants.ON_TOUCH_LISTENER);
public final JClass HANDLER = refClass(CanonicalNameConstants.HANDLER);
public final JClass KEY_STORE = refClass(CanonicalNameConstants.KEY_STORE);

/*
* Sherlock classes
* Sherlock
*/
public final JClass SHERLOCK_MENU = refClass(CanonicalNameConstants.SHERLOCK_MENU);
public final JClass SHERLOCK_MENU_ITEM = refClass(CanonicalNameConstants.SHERLOCK_MENU_ITEM);
Expand All @@ -105,6 +111,16 @@ public class Classes {
public final JClass ON_CONTENT_VIEW_AVAILABLE_EVENT = refClass(CanonicalNameConstants.ON_CONTENT_VIEW_AVAILABLE_EVENT);
public final JClass ON_CREATE_EVENT = refClass(CanonicalNameConstants.ON_CREATE_EVENT);

/*
* HttpClient
*/
public final JClass CLIENT_CONNECTION_MANAGER = refClass(CanonicalNameConstants.CLIENT_CONNECTION_MANAGER);
public final JClass DEFAULT_HTTP_CLIENT = refClass(CanonicalNameConstants.DEFAULT_HTTP_CLIENT);
public final JClass SSL_SOCKET_FACTORY = refClass(CanonicalNameConstants.SSL_SOCKET_FACTORY);
public final JClass SCHEME = refClass(CanonicalNameConstants.SCHEME);
public final JClass SCHEME_REGISTRY = refClass(CanonicalNameConstants.SCHEME_REGISTRY);
public final JClass SINGLE_CLIENT_CONN_MANAGER = refClass(CanonicalNameConstants.SINGLE_CLIENT_CONN_MANAGER);

}

private final Map<Element, EBeanHolder> EBeanHolders = new HashMap<Element, EBeanHolder>();
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.