pax_global_header00006660000000000000000000000064126112305670014515gustar00rootroot0000000000000052 comment=38ee6059cbe2f1e17a8311b345f42d50668e3364 infomas-asl-infomas-asl-3.0.5/000077500000000000000000000000001261123056700161425ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/.gitignore000066400000000000000000000001331261123056700201270ustar00rootroot00000000000000/target/ /annotation-detector/target/ /nb-configuration.xml .settings/ .classpath .project infomas-asl-infomas-asl-3.0.5/.travis.yml000066400000000000000000000004161261123056700202540ustar00rootroot00000000000000# travis-ci (https://travis-ci.org) configuration for eu.infomas:infomas-asl language: java # http://blog.travis-ci.com/2013-11-26-test-your-java-libraries-on-java-8 jdk: - oraclejdk8 - oraclejdk7 - openjdk7 # batch mode / trigger checkstyle script: mvn -B verify infomas-asl-infomas-asl-3.0.5/LICENSE.txt000066400000000000000000000261641261123056700177760ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2011 XIAM Solutions B.V. The Netherlands (www.xiam.nl) 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. infomas-asl-infomas-asl-3.0.5/README.md000066400000000000000000000126401261123056700174240ustar00rootroot00000000000000# infomas-asl [![Build Status](https://secure.travis-ci.org/rmuller/infomas-asl.png)](http://travis-ci.org/rmuller/infomas-asl) INFOMAS ASL contains all open sourced code from the INFOMAS PCM Application Suite. All code is licensed by the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), so it can be used by both open source and commercial projects. The INFOMAS PCM Application Suite is a commercial Product Content Management (also known as PIM, Product Information Management) Application. For more information, visit http://www.xiam.nl. ## Warning: API Change!! Starting version 3.1.0-SNAPSHOT the API has been changed considerably and several new features have been added. Do not worry, we did not sacrifice the unique selling points of this library: simple API, small footprint and great performance. Performance is even improved by about 10%! The library size increased from 16 kB to 20 kB. This version is not (yet) released to Maven Central, so if you disagree with some changes or have better ideas, please let us know! See (git) branche "release 3.1". Changes (3.1.0-SNAPSHOT): + More fluent API, builder style + Made API Java 8 friendly (using Functional interfaces / SAM's) + Added standard logging (using standard `java.util.logging`), removed DEBUG logging + Some efficiency improvements + Simplified API for standard use cases (see issue #7) + Added possibility to filter scanned classes based on the file name (see issue #11) + Possibility to report types, fields, methods and annotations as `java.lang.Class`, `java.lang.reflect.Field`, `java.lang.reflect.Method` and `java.lang.annotation.Annotation` (see issue #6) ## Quick Facts + Simple builder style API + Very fast (on moderate hardware about 200 MB/s)! + Lightweight, no dependencies, only 20 kb jar + Language: Java 6 SE or better with Java 8 friendly API + Tested with Oracle JDK 6, 7, 8 and OpenJDK 6 and 7 (Last four VM's using [Travis CI Server](https://travis-ci.org/)) + OSGi Bundle artifact + Apache License, Version 2.0 + Build System: Maven 3 + Maven Artifacts are available from [Central Maven](http://search.maven.org/#search%7Cga%7C1%7Cinfomas) + [Project information generated by Maven](http://rmuller.github.io/infomas-asl/) ## Modules Currently INFOMAS ASL contains the following modules: + annotation-detector + More to come ... ### annotation-detector This library can be used to scan (part of) the class path for annotated classes, methods or instance variables. Main advantages of this library compared with similar solutions are: light weight (**no dependencies**, simple API, **20 kb jar file**) and **very fast** (fastest annotation detection library as far as I know). #### Maven configuration: ``` xml eu.infomas annotation-detector 3.0.4 ``` #### Example Usage (3.0.x versions): Put the `annotation-detector-3.0.x.jar` on the class path. No other dependencies are required! You can either scan the complete class path or only scan specified packages or Files (see [JavaDoc](http://rmuller.github.io/infomas-asl/annotation-detector/apidocs/index.html) for more details). ``` java // Scan all .class files on the class path // Report all .class files, with org.junit.Test annotated methods final MethodReporter reporter = new MethodReporter() { @SuppressWarnings("unchecked") @Override public Class[] annotations() { return new Class[]{Test.class}; } @Override public void reportMethodAnnotation(Class annotation, String className, String methodName) { // do something } }; final AnnotationDetector cf = new AnnotationDetector(reporter); cf.detect(); ``` That's all! #### Example Usage (3.1.x versions): Put the `annotation-detector-3.1.x.jar` on the class path. No other dependencies are required! You can either scan the complete class path or only scan specified packages or Files (see [JavaDoc](http://rmuller.github.io/infomas-asl/annotation-detector/apidocs/index.html) for more details). ``` java // Get a List with all classes annotated with @RuntimeVisibleTestAnnotation (Java 8 syntax) List> types = AnnotationDetector.scanClassPath() .forAnnotations(RuntimeVisibleTestAnnotation.class) .collect(AnnotationDetector::getType); assertEquals(1, types.size()); assertSame(NewApiTest.class, types.get(0)); // Get a List with all methods annotated with @RuntimeVisibleTestAnnotation, excluding // files ending with "Test.class" in the "eu.infomas" package and subpackages (Java 8 syntax) List methods = AnnotationDetector.scanClassPath("eu.infomas") // or: scanFiles(File... files) .forAnnotations(RuntimeVisibleTestAnnotation.class) // one or more annotations .on(ElementType.METHOD) // optional, default ElementType.TYPE. One ore more element types .filter((File dir, String name) -> !name.endsWith("Test.class")) // optional, default all *.class files .collect(AnnotationDetector::getMethod); assertEquals(1, methods.size()); assertEquals(void.class, methods.get(0).getReturnType()); ``` Even simpler, isn't it? ## License Copyright (c) 2011 - 2014 XIAM Solutions B.V. Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 [![Ohloh profile for ronaldmuller](https://www.ohloh.net/accounts/224392/widgets/account_tiny.gif)](https://www.ohloh.net/accounts/224392?ref=Tiny) infomas-asl-infomas-asl-3.0.5/annotation-detector/000077500000000000000000000000001261123056700221235ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/README.md000066400000000000000000000013541261123056700234050ustar00rootroot00000000000000README ====== Starting version 3.0.5 and 3.1.0 annotation-detector works fine in most Java EE Application Servers. Java EE Server | Version(s) tested | Comments --------------- | ----------------- | ---------------------- Jetty | 9.3.3 | No issues Apache Tomcat | 7.0.64 | No issues JBoss WildFly | 8.2.0, 9.0.1 | No issues. Support added in version 3.0.5 JBoss AS | - | Not tested yet, should not have issues (based on WildFly) GlassFish OSE | 4.0, 4.1 | No issues Oracle WebLogic | 12.1.3 | No issues. Support added in version 3.0.5 IBM WebSphere | - | Not tested (yet) Please let us know if there are any issues in other environments. infomas-asl-infomas-asl-3.0.5/annotation-detector/pom.xml000066400000000000000000000037141261123056700234450ustar00rootroot00000000000000 4.0.0 eu.infomas infomas-asl 3.0.5 ../ annotation-detector 3.0.5 bundle INFOMAS ASL :: Annotation Detector Fast, lightweight, OSGi compliant scanner for Java Annotations. org.jboss jboss-vfs 3.2.10.Final provided org.apache.felix maven-bundle-plugin true eu.infomas.annotation http://rmuller.github.io/${project.artifactId} com.github.github site-maven-plugin true annotation-detector infomas-asl-infomas-asl-3.0.5/annotation-detector/src/000077500000000000000000000000001261123056700227125ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/000077500000000000000000000000001261123056700236365ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/000077500000000000000000000000001261123056700245575ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/000077500000000000000000000000001261123056700251705ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/000077500000000000000000000000001261123056700266245ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/000077500000000000000000000000001261123056700307765ustar00rootroot00000000000000AnnotationDetector.java000066400000000000000000000573761261123056700354100ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* AnnotationDetector.java * * Created: 2011-10-10 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2011 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.DataInput; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.net.JarURLConnection; import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * {@code AnnotationDetector} reads Java Class File (".class") files and reports the * encountered annotations via a simple, developer friendly API. *

* A Java Class File consists of a stream of 8-bit bytes. All 16-bit, 32-bit, and 64-bit * quantities are constructed by reading in two, four, and eight consecutive 8-bit * bytes, respectively. Multi byte data items are always stored in big-endian order, * where the high bytes come first. In the Java and Java 2 platforms, this format is * supported by interfaces {@link java.io.DataInput} and {@link java.io.DataOutput}. *

* A class file consists of a single ClassFile structure: *

 * ClassFile {
 *   u4 magic;
 *   u2 minor_version;
 *   u2 major_version;
 *   u2 constant_pool_count;
 *   cp_info constant_pool[constant_pool_count-1];
 *   u2 access_flags;
 *   u2 this_class;
 *   u2 super_class;
 *   u2 interfaces_count;
 *   u2 interfaces[interfaces_count];
 *   u2 fields_count;
 *   field_info fields[fields_count];
 *   u2 methods_count;
 *   method_info methods[methods_count];
 *   u2 attributes_count;
 *   attribute_info attributes[attributes_count];
 * }
 *
 * Where:
 * u1 unsigned byte {@link java.io.DataInput#readUnsignedByte()}
 * u2 unsigned short {@link java.io.DataInput#readUnsignedShort()}
 * u4 unsigned int {@link java.io.DataInput#readInt()}
 *
 * Annotations are stored as Attributes (i.e. "RuntimeVisibleAnnotations" and
 * "RuntimeInvisibleAnnotations").
 * 
* References: * *

* Similar projects / libraries: *

*

* All above mentioned projects make use of a byte code manipulation library (like BCEL, * ASM or Javassist). * * @author Ronald K. Muller * @since annotation-detector 3.0.0 */ public final class AnnotationDetector { /** * {@code Reporter} is the base interface, used to report the detected annotations. * Every category of annotations (i.e. Type, Field and Method) has its own specialized * interface. This enables an efficient way of reporting the detected annotations. */ public interface Reporter { /** * Return the {@code Annotation} classes which must be reported (all other * annotations are skipped). */ Class[] annotations(); } /** * A {@code Reporter} for type annotations. */ public interface TypeReporter extends Reporter { /** * This call back method is used to report an type level {@code Annotation}. * Only {@code Annotation}s, specified by {@link #annotations()} are reported! */ void reportTypeAnnotation(Class annotation, String className); } /** * A {@code Reporter} for field annotations. */ public interface FieldReporter extends Reporter { /** * This call back method is used to report an field level {@code Annotation}. * Only {@code Annotation}s, specified by {@link #annotations()} are reported! */ void reportFieldAnnotation(Class annotation, String className, String fieldName); } /** * A {@code Reporter} for method annotations. */ public interface MethodReporter extends Reporter { /** * This call back method is used to report an method level {@code Annotation}. * Only {@code Annotation}s, specified by {@link #annotations()} are reported! */ void reportMethodAnnotation(Class annotation, String className, String methodName); } // Only used during development. If set to "true" debug messages are displayed. private static final boolean DEBUG = false; // Constant Pool type tags private static final int CP_UTF8 = 1; private static final int CP_INTEGER = 3; private static final int CP_FLOAT = 4; private static final int CP_LONG = 5; private static final int CP_DOUBLE = 6; private static final int CP_CLASS = 7; private static final int CP_STRING = 8; private static final int CP_REF_FIELD = 9; private static final int CP_REF_METHOD = 10; private static final int CP_REF_INTERFACE = 11; private static final int CP_NAME_AND_TYPE = 12; private static final int CP_METHOD_HANDLE = 15; private static final int CP_METHOD_TYPE = 16; private static final int CP_INVOKE_DYNAMIC = 18; // AnnotationElementValue private static final int BYTE = 'B'; private static final int CHAR = 'C'; private static final int DOUBLE = 'D'; private static final int FLOAT = 'F'; private static final int INT = 'I'; private static final int LONG = 'J'; private static final int SHORT = 'S'; private static final int BOOLEAN = 'Z'; // used for AnnotationElement only private static final int STRING = 's'; private static final int ENUM = 'e'; private static final int CLASS = 'c'; private static final int ANNOTATION = '@'; private static final int ARRAY = '['; // The buffer is reused during the life cycle of this AnnotationDetector instance private final ClassFileBuffer cpBuffer = new ClassFileBuffer(); // the annotation types to report, see {@link #annotations()} private final Map> annotations; private TypeReporter typeReporter; private FieldReporter fieldReporter; private MethodReporter methodReporter; // the 'raw' name of this interface or class (using '/' instead of '.' in package name) private String typeName; // Reusing the constantPool is not needed for better performance private Object[] constantPool; private String memberName; /** * Create a new {@code AnnotationDetector}, reporting the detected annotations * to the specified {@code Reporter}. */ public AnnotationDetector(final Reporter reporter) { final Class[] a = reporter.annotations(); annotations = new HashMap>(a.length); // map "raw" type names to Class object for (int i = 0; i < a.length; ++i) { annotations.put("L" + a[i].getName().replace('.', '/') + ";", a[i]); } if (reporter instanceof TypeReporter) { typeReporter = (TypeReporter)reporter; } if (reporter instanceof FieldReporter) { fieldReporter = (FieldReporter)reporter; } if (reporter instanceof MethodReporter) { methodReporter = (MethodReporter)reporter; } if (typeReporter == null && fieldReporter == null && methodReporter == null) { throw new AssertionError("No reporter defined"); } } /** * Report all Java ClassFile files available on the class path. * * @see #detect(File...) */ public void detect() throws IOException { detect(new ClassFileIterator()); } /** * Report all Java ClassFile files available on the class path within * the specified packages and sub packages. * * @see #detect(File...) */ public void detect(final String... packageNames) throws IOException { final String[] pkgNameFilter = new String[packageNames.length]; for (int i = 0; i < pkgNameFilter.length; ++i) { pkgNameFilter[i] = packageNames[i].replace('.', '/'); if (!pkgNameFilter[i].endsWith("/")) { pkgNameFilter[i] = pkgNameFilter[i].concat("/"); } } final Set files = new HashSet(); final ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (final String packageName : pkgNameFilter) { final Enumeration resourceEnum = loader.getResources(packageName); while (resourceEnum.hasMoreElements()) { URL url = resourceEnum.nextElement(); if ("file".equals(url.getProtocol())) { final File dir = toFile(url); if (dir.isDirectory()) { files.add(dir); } else { throw new AssertionError("Not a recognized file URL: " + url); } } else if (url.getProtocol().startsWith("vfs")) { detect(new VfsResourceIterator(url)); } else { if ("zip".equals(url.getProtocol())) { // WebLogic returns URL with "zip" protocol, returning a // weblogic.utils.zip.ZipURLConnection when opened // Easy fix is to convert this URL to jar URL url = new URL(url.toExternalForm().replace("zip:/", "jar:file:/")); } final File jarFile = toFile(((JarURLConnection)url.openConnection()).getJarFileURL()); if (jarFile.isFile()) { files.add(jarFile); } else { throw new AssertionError("Not a File: " + jarFile); } } } } if (DEBUG) { print("Files to scan: %s", files); } if (!files.isEmpty()) { detect(new ClassFileIterator(files.toArray(new File[files.size()]), pkgNameFilter)); } } /** * Scan all Java ClassFile ({@code *.class}) files available in the specified files * and/or directories. *

* In Java, the * * Class path contains directories (top level directory as package root) and/or * jar files (including zip files). *

* Note that non-class files (files, not starting with the magic number * {@code CAFEBABE} are silently ignored. * * @param filesOrDirectories Valid files are: jar files, Java *.class files (all other * files are silently ignored) and directories which are package root directories */ public void detect(final File... filesOrDirectories) throws IOException { if (DEBUG) { print("detectFilesOrDirectories: %s", (Object)filesOrDirectories); } detect(new ClassFileIterator(filesOrDirectories, null)); } // private private File toFile(final URL url) { // only correct way to convert the URL to a File object, also see issue #16 // Do not use URLDecoder try { return new File(url.toURI().getPath()); } catch (URISyntaxException ex) { // we do not expect an URISyntaxException here throw new AssertionError("Unable to convert URI to File: " + url); } } @SuppressWarnings("illegalcatch") private void detect(final ResourceIterator iterator) throws IOException { InputStream stream; while ((stream = iterator.next()) != null) { try { cpBuffer.readFrom(stream); if (hasCafebabe(cpBuffer)) { detect(cpBuffer); } // else ignore } catch (Throwable t) { // catch all errors if (!(stream instanceof FileInputStream)) { // in case of an error we close the ZIP File here stream.close(); } } finally { // closing InputStream from ZIP Entry is handled by ZipFileIterator if (stream instanceof FileInputStream) { stream.close(); } } } } private boolean hasCafebabe(final ClassFileBuffer buffer) throws IOException { return buffer.size() > 4 && buffer.readInt() == 0xCAFEBABE; } /** * Inspect the given (Java) class file in streaming mode. */ private void detect(final DataInput di) throws IOException { readVersion(di); readConstantPoolEntries(di); readAccessFlags(di); readThisClass(di); readSuperClass(di); readInterfaces(di); readFields(di); readMethods(di); readAttributes(di, 'T', typeReporter == null); } private void readVersion(final DataInput di) throws IOException { // sequence: minor version, major version (argument_index is 1-based) if (DEBUG) { print("Java Class version %2$d.%1$d", di.readUnsignedShort(), di.readUnsignedShort()); } else { di.skipBytes(4); } } private void readConstantPoolEntries(final DataInput di) throws IOException { final int count = di.readUnsignedShort(); constantPool = new Object[count]; for (int i = 1; i < count; ++i) { if (readConstantPoolEntry(di, i)) { // double slot ++i; } } } /** * Return {@code true} if a double slot is read (in case of Double or Long constant). */ private boolean readConstantPoolEntry(final DataInput di, final int index) throws IOException { final int tag = di.readUnsignedByte(); switch (tag) { case CP_METHOD_TYPE: di.skipBytes(2); // readUnsignedShort() return false; case CP_METHOD_HANDLE: di.skipBytes(3); return false; case CP_INTEGER: case CP_FLOAT: case CP_REF_FIELD: case CP_REF_METHOD: case CP_REF_INTERFACE: case CP_NAME_AND_TYPE: case CP_INVOKE_DYNAMIC: di.skipBytes(4); // readInt() / readFloat() / readUnsignedShort() * 2 return false; case CP_LONG: case CP_DOUBLE: di.skipBytes(8); // readLong() / readDouble() return true; case CP_UTF8: constantPool[index] = di.readUTF(); return false; case CP_CLASS: case CP_STRING: // reference to CP_UTF8 entry. The referenced index can have a higher number! constantPool[index] = di.readUnsignedShort(); return false; default: throw new ClassFormatError( "Unkown tag value for constant pool entry: " + tag); } } private void readAccessFlags(final DataInput di) throws IOException { di.skipBytes(2); // u2 } private void readThisClass(final DataInput di) throws IOException { typeName = resolveUtf8(di); if (DEBUG) { print("read type '%s'", typeName); } } private void readSuperClass(final DataInput di) throws IOException { di.skipBytes(2); // u2 } private void readInterfaces(final DataInput di) throws IOException { final int count = di.readUnsignedShort(); di.skipBytes(count * 2); // count * u2 } private void readFields(final DataInput di) throws IOException { final int count = di.readUnsignedShort(); if (DEBUG) { print("field count = %d", count); } for (int i = 0; i < count; ++i) { readAccessFlags(di); memberName = resolveUtf8(di); final String descriptor = resolveUtf8(di); readAttributes(di, 'F', fieldReporter == null); if (DEBUG) { print("Field: %s, descriptor: %s", memberName, descriptor); } } } private void readMethods(final DataInput di) throws IOException { final int count = di.readUnsignedShort(); if (DEBUG) { print("method count = %d", count); } for (int i = 0; i < count; ++i) { readAccessFlags(di); memberName = resolveUtf8(di); final String descriptor = resolveUtf8(di); readAttributes(di, 'M', methodReporter == null); if (DEBUG) { print("Method: %s, descriptor: %s", memberName, descriptor); } } } private void readAttributes(final DataInput di, final char reporterType, final boolean skipReporting) throws IOException { final int count = di.readUnsignedShort(); if (DEBUG) { print("attribute count (%s) = %d", reporterType, count); } for (int i = 0; i < count; ++i) { final String name = resolveUtf8(di); // in bytes, use this to skip the attribute info block final int length = di.readInt(); if (!skipReporting && ("RuntimeVisibleAnnotations".equals(name) || "RuntimeInvisibleAnnotations".equals(name))) { readAnnotations(di, reporterType); } else { if (DEBUG) { print("skip attribute %s", name); } di.skipBytes(length); } } } private void readAnnotations(final DataInput di, final char reporterType) throws IOException { // the number of Runtime(In)VisibleAnnotations final int count = di.readUnsignedShort(); if (DEBUG) { print("annotation count (%s) = %d", reporterType, count); } for (int i = 0; i < count; ++i) { final String rawTypeName = readAnnotation(di); final Class type = annotations.get(rawTypeName); if (type == null) { continue; } final String externalTypeName = typeName.replace('/', '.'); switch (reporterType) { case 'T': typeReporter.reportTypeAnnotation(type, externalTypeName); break; case 'F': fieldReporter.reportFieldAnnotation(type, externalTypeName, memberName); break; case 'M': methodReporter.reportMethodAnnotation(type, externalTypeName, memberName); break; default: throw new AssertionError("reporterType=" + reporterType); } } } private String readAnnotation(final DataInput di) throws IOException { final String rawTypeName = resolveUtf8(di); // num_element_value_pairs final int count = di.readUnsignedShort(); if (DEBUG) { print("annotation elements count: %d", count); } for (int i = 0; i < count; ++i) { if (DEBUG) { print("element '%s'", resolveUtf8(di)); } else { di.skipBytes(2); } readAnnotationElementValue(di); } return rawTypeName; } private void readAnnotationElementValue(final DataInput di) throws IOException { final int tag = di.readUnsignedByte(); if (DEBUG) { print("tag='%c'", (char)tag); } switch (tag) { case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case BOOLEAN: case STRING: di.skipBytes(2); break; case ENUM: di.skipBytes(4); // 2 * u2 break; case CLASS: di.skipBytes(2); break; case ANNOTATION: readAnnotation(di); break; case ARRAY: final int count = di.readUnsignedShort(); for (int i = 0; i < count; ++i) { readAnnotationElementValue(di); } break; default: throw new ClassFormatError("Not a valid annotation element type tag: 0x" + Integer.toHexString(tag)); } } /** * Look up the String value, identified by the u2 index value from constant pool * (direct or indirect). */ private String resolveUtf8(final DataInput di) throws IOException { final int index = di.readUnsignedShort(); final Object value = constantPool[index]; final String s; if (value instanceof Integer) { s = (String)constantPool[(Integer)value]; if (DEBUG) { print("resolveUtf8(%d): %d --> %s", index, value, s); } } else { s = (String)value; if (DEBUG) { print("resolveUtf8(%d): %s", index, s); } } return s; } /** * Helper method for simple (debug) logging. */ @SuppressWarnings("regexpsinglelinejava") private static void print(final String message, final Object... args) { if (DEBUG) { final String logMessage; if (args.length == 0) { logMessage = message; } else { for (int i = 0; i < args.length; ++i) { // arguments may be null if (args[i] == null) { continue; } if (args[i].getClass().isArray()) { // cast back to array! Note that primitive arrays are not supported args[i] = Arrays.toString((Object[])args[i]); } else if (args[i] == Class.class) { args[i] = ((Class)args[i]).getName(); } } logMessage = String.format(message, args); } System.out.println(logMessage); } } } ClassFileBuffer.java000066400000000000000000000154171261123056700345710ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* ClassFileBuffer.java * * Created: 2011-10-10 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2011 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.DataInput; import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; /** * {@code ClassFileBuffer} is used by {@link AnnotationDetector} to efficiently read Java * ClassFile files from an {@link InputStream} and parse the content via the {@link DataInput} * interface. *

* Note that Java ClassFile files can grow really big, * {@code com.sun.corba.se.impl.logging.ORBUtilSystemException} is 128.2 kb! * * @author Ronald K. Muller * @since annotation-detector 3.0.0 */ final class ClassFileBuffer implements DataInput { private byte[] buffer; private int size; // the number of significant bytes read private int pointer; // the "read pointer" /** * Create a new, empty {@code ClassFileBuffer} with the default initial capacity (8 kb). */ ClassFileBuffer() { this(8 * 1024); } /** * Create a new, empty {@code ClassFileBuffer} with the specified initial capacity. * The initial capacity must be greater than zero. The internal buffer will grow * automatically when a higher capacity is required. However, buffer resizing occurs * extra overhead. So in good initial capacity is important in performance critical * situations. */ ClassFileBuffer(final int initialCapacity) { if (initialCapacity < 1) { throw new IllegalArgumentException("initialCapacity < 1: " + initialCapacity); } this.buffer = new byte[initialCapacity]; } /** * Clear and fill the buffer of this {@code ClassFileBuffer} with the * supplied byte stream. * The read pointer is reset to the start of the byte array. */ public void readFrom(final InputStream in) throws IOException { pointer = 0; size = 0; int n; do { n = in.read(buffer, size, buffer.length - size); if (n > 0) { size += n; } resizeIfNeeded(); } while (n >= 0); } /** * Sets the file-pointer offset, measured from the beginning of this file, * at which the next read or write occurs. */ public void seek(final int position) throws IOException { if (position < 0) { throw new IllegalArgumentException("position < 0: " + position); } if (position > size) { throw new EOFException(); } this.pointer = position; } /** * Return the size (in bytes) of this Java ClassFile file. */ public int size() { return size; } // DataInput @Override public void readFully(final byte[] bytes) throws IOException { readFully(bytes, 0, bytes.length); } @Override public void readFully(final byte[] bytes, final int offset, final int length) throws IOException { if (length < 0 || offset < 0 || offset + length > bytes.length) { throw new IndexOutOfBoundsException(); } if (pointer + length > size) { throw new EOFException(); } System.arraycopy(buffer, pointer, bytes, offset, length); pointer += length; } @Override public int skipBytes(final int n) throws IOException { seek(pointer + n); return n; } @Override public byte readByte() throws IOException { if (pointer >= size) { throw new EOFException(); } return buffer[pointer++]; } @Override public boolean readBoolean() throws IOException { return readByte() != 0; } @Override public int readUnsignedByte() throws IOException { if (pointer >= size) { throw new EOFException(); } return read(); } @Override public int readUnsignedShort() throws IOException { if (pointer + 2 > size) { throw new EOFException(); } return (read() << 8) + read(); } @Override public short readShort() throws IOException { return (short)readUnsignedShort(); } @Override public char readChar() throws IOException { return (char)readUnsignedShort(); } @Override public int readInt() throws IOException { if (pointer + 4 > size) { throw new EOFException(); } return (read() << 24) + (read() << 16) + (read() << 8) + read(); } @Override public long readLong() throws IOException { if (pointer + 8 > size) { throw new EOFException(); } return ((long)read() << 56) + ((long)read() << 48) + ((long)read() << 40) + ((long)read() << 32) + (read() << 24) + (read() << 16) + (read() << 8) + read(); } @Override public float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } @Override public double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } /** * This methods throws an {@link UnsupportedOperationException} because the method * is deprecated and not used in the context of this implementation. * * @deprecated Does not support UTF-8, use readUTF() instead */ @Override @Deprecated public String readLine() throws IOException { throw new UnsupportedOperationException("readLine() is deprecated and not supported"); } @Override public String readUTF() throws IOException { return DataInputStream.readUTF(this); } // private private int read() { return buffer[pointer++] & 0xff; } private void resizeIfNeeded() { if (size >= buffer.length) { final byte[] newBuffer = new byte[buffer.length * 2]; System.arraycopy(buffer, 0, newBuffer, 0, buffer.length); buffer = newBuffer; } } } ClassFileIterator.java000066400000000000000000000121551261123056700351450ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* ClassFileIterator.java * * Created: 2011-10-10 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2011 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipFile; /** * {@code ClassFileIterator} is used to iterate over all Java ClassFile files available within * a specific context. *

* For every Java ClassFile ({@code .class}) an {@link InputStream} is returned. * * @author Ronald K. Muller * @since annotation-detector 3.0.0 */ final class ClassFileIterator implements ResourceIterator { private final FileIterator fileIterator; private final String[] pkgNameFilter; private ZipFileIterator zipIterator; /** * Create a new {@code ClassFileIterator} returning all Java ClassFile files available * from the class path ({@code System.getProperty("java.class.path")}). */ ClassFileIterator() throws IOException { this(classPath(), null); } /** * Create a new {@code ClassFileIterator} returning all Java ClassFile files available * from the specified files and/or directories, including sub directories. *

* If the (optional) package filter is defined, only class files staring with one of the * defined package names are returned. * NOTE: package names must be defined in the native format (using '/' instead of '.'). */ ClassFileIterator(final File[] filesOrDirectories, final String[] pkgNameFilter) throws IOException { this.fileIterator = new FileIterator(filesOrDirectories); this.pkgNameFilter = pkgNameFilter; } /** * Return the name of the Java ClassFile returned from the last call to {@link #next()}. * The name is either the path name of a file or the name of an ZIP/JAR file entry. */ public String getName() { // Both getPath() and getName() are very light weight method calls return zipIterator == null ? fileIterator.getFile().getPath() : zipIterator.getEntry().getName(); } @Override public InputStream next() throws IOException { while (true) { if (zipIterator == null) { final File file = fileIterator.next(); // not all specified Files exists! if (file == null || !file.isFile()) { return null; } else { final String name = file.getName(); if (name.endsWith(".class")) { return new FileInputStream(file); } else if (fileIterator.isRootFile() && (endsWithIgnoreCase(name, ".jar") || isZipFile(file))) { zipIterator = new ZipFileIterator(new ZipFile(file), pkgNameFilter); } // else just ignore } } else { final InputStream is = zipIterator.next(); if (is == null) { zipIterator = null; } else { return is; } } } } // private private boolean isZipFile(final File file) { DataInputStream in = null; try { in = new DataInputStream(new FileInputStream(file)); final int n = in.readInt(); return n == 0x504b0304; } catch (IOException ex) { // silently ignore read exceptions return false; } finally { if (in != null) { try { in.close(); } catch (IOException ex) { // ignore } } } } /** * Returns the class path of the current JVM instance as an array of {@link File} objects. */ private static File[] classPath() { final String[] fileNames = System.getProperty("java.class.path").split(File.pathSeparator); final File[] files = new File[fileNames.length]; for (int i = 0; i < files.length; ++i) { files[i] = new File(fileNames[i]); } return files; } private static boolean endsWithIgnoreCase(final String value, final String suffix) { final int n = suffix.length(); return value.regionMatches(true, value.length() - n, suffix, 0, n); } } FileIterator.java000066400000000000000000000070761261123056700341650ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* FileIterator.java * * Created: 2011-10-10 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2011 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.File; import java.io.IOException; import java.util.Deque; import java.util.LinkedList; import java.util.NoSuchElementException; /** * {@code FileIterator} enables iteration over all files in a directory and all its sub * directories. *

* Usage: *

 * FileIterator iter = new FileIterator(new File("./src"));
 * File f;
 * while ((f = iter.next()) != null) {
 *     // do something with f
 *     assert f == iter.getCurrent();
 * }
 * 
* * @author Ronald K. Muller * @since annotation-detector 3.0.0 */ final class FileIterator { private final Deque stack = new LinkedList(); private int rootCount; private File current; /** * Create a new {@code FileIterator} using the specified 'filesOrDirectories' as root. *

* If 'filesOrDirectories' contains a file, the iterator just returns that single file. * If 'filesOrDirectories' contains a directory, all files in that directory * and its sub directories are returned (depth first). * * @param filesOrDirectories Zero or more {@link File} objects, which are iterated * in the specified order (depth first) */ FileIterator(final File... filesOrDirectories) { addReverse(filesOrDirectories); rootCount = stack.size(); } /** * Return the last returned file or {@code null} if no more files are available. * * @see #next() */ public File getFile() { return current; } /** * Return {@code true} if the current file is one of the files originally * specified as one of the constructor file parameters, i.e. is a root file * or directory. */ public boolean isRootFile() { if (current == null) { throw new NoSuchElementException(); } return stack.size() < rootCount; } /** * Return the next {@link File} object or {@code null} if no more files are * available. * * @see #getFile() */ public File next() throws IOException { if (stack.isEmpty()) { current = null; return null; } else { current = stack.removeLast(); if (current.isDirectory()) { if (stack.size() < rootCount) { rootCount = stack.size(); } addReverse(current.listFiles()); return next(); } else { return current; } } } /** * Add the specified files in reverse order. */ private void addReverse(final File[] files) { for (int i = files.length - 1; i >= 0; --i) { stack.add(files[i]); } } } ResourceIterator.java000066400000000000000000000025401261123056700350640ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* ResourceIterator.java * * Created: 2015-10-17 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2015 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.IOException; import java.io.InputStream; /** * {@code ResourceIterator} is an abstraction for an iterator of (Java) Class Files, provided * as {@link InputStream}. * * @author Ronald K. Muller * @since INFOMAS NG 3.0 */ interface ResourceIterator { /** * Return the next Java ClassFile as an {@code InputStream}. *

* NOTICE: Client code MUST close the returned {@code InputStream}! */ InputStream next() throws IOException; } VfsResourceIterator.java000066400000000000000000000044521261123056700355470ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* VfsResourceIterator.java * * Created: 2015-10-17 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2015 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.List; import org.jboss.vfs.VirtualFile; /** * {@code VfsResourceIterator} is a {@link ResourceIterator} for the JBoss Virtual File System * (VFS) as used by JBoss AS and JBoss WildFly. * * VFS URL's look like: * * vfs:/foo/bar/website.war/WEB-INF/classes/nl/dvelop/ * vfs:/foo/bar/website.war/WEB-INF/lib/dwebcore-0.0.1.jar/nl/dvelop/ * * * Known VFS protocols are "vfs", "vfsfile", "vfszip", "vfsjar", and "vfsmemory". * * Also see *

  • https://github.com/rmuller/infomas-asl/issues/29 *
  • https://github.com/jersey/jersey/pull/100 * * NOTICE: Only tested with WildFly 8.2.0.Final and 9.0.1.Final. * * @since annotation-detector 3.0.5 */ final class VfsResourceIterator implements ResourceIterator { private final List files; private int index = -1; VfsResourceIterator(final URL url) throws IOException { final VirtualFile vFile = (VirtualFile)url.getContent(); files = vFile.getChildrenRecursively(); } @Override public InputStream next() throws IOException { while (true) { if (++index >= files.size()) { // no files return null; } final VirtualFile f = files.get(index); if (f.isFile() && f.getName().endsWith(".class")) { return f.openStream(); } } } } ZipFileIterator.java000066400000000000000000000062001261123056700346340ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* ZipFileIterator.java * * Created: 2011-10-10 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2011 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.annotation; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; /** * {@code ZipFileIterator} is used to iterate over all entries in a given {@code zip} or * {@code jar} file and returning the {@link InputStream} of these entries. *

    * It is possible to specify an (optional) entry name filter. *

    * The most efficient way of iterating is used, see benchmark in test classes. * * @author Ronald K. Muller * @since annotation-detector 3.0.0 */ final class ZipFileIterator { private final ZipFile zipFile; private final String[] entryNameFilter; private final Enumeration entries; private ZipEntry current; /** * Create a new {@code ZipFileIterator} instance. * * @param zipFile The ZIP file used to iterate over all entries * @param entryNameFilter (optional) file name filter. Only entry names starting with * one of the specified names in the filter are returned */ ZipFileIterator(final ZipFile zipFile, final String[] entryNameFilter) throws IOException { this.zipFile = zipFile; this.entryNameFilter = entryNameFilter; this.entries = zipFile.entries(); } public ZipEntry getEntry() { return current; } @SuppressWarnings("emptyblock") public InputStream next() throws IOException { while (entries.hasMoreElements()) { current = entries.nextElement(); if (accept(current)) { return zipFile.getInputStream(current); } } // no more entries in this ZipFile, so close ZipFile try { // zipFile is never null here zipFile.close(); } catch (IOException ex) { // suppress IOException, otherwise close() is called twice } return null; } private boolean accept(final ZipEntry entry) { if (entry.isDirectory()) { return false; } if (entryNameFilter == null) { return true; } for (final String filter : entryNameFilter) { if (entry.getName().startsWith(filter)) { return true; } } return false; } } package-info.java000066400000000000000000000021141261123056700341040ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/main/java/eu/infomas/annotation/* package-info.java * * Created: 2013-07-09 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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. */ /** * This library can be used to scan (part of) the class path for annotated classes, * methods or instance variables. *

    * For more information see * Github site. */ package eu.infomas.annotation; infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/000077500000000000000000000000001261123056700236715ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/000077500000000000000000000000001261123056700246125ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/000077500000000000000000000000001261123056700252235ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/000077500000000000000000000000001261123056700266575ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotation/000077500000000000000000000000001261123056700310315ustar00rootroot00000000000000AnnotationDetectorTest.java000066400000000000000000000144161261123056700362670ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static eu.infomas.util.TestSupport.*; @RuntimeInvisibleTestAnnotation // This annotation is only used to test a complex annotation type @RuntimeVisibleTestAnnotations({ @RuntimeVisibleTestAnnotation(name="a"), @RuntimeVisibleTestAnnotation(name="b") }) public final class AnnotationDetectorTest { private static final boolean DEBUG = false; @SuppressWarnings("unused") // used for testing only @RuntimeVisibleTestAnnotation private String fieldWithAnnotation; static class CountingReporter implements AnnotationDetector.TypeReporter, AnnotationDetector.MethodReporter, AnnotationDetector.FieldReporter { private final Class[] annotations; private int typeCount; private int fieldCount; private int methodCount; CountingReporter(Class... annotations) { this.annotations = annotations; } public final Class[] annotations() { return annotations; } public final void reportTypeAnnotation(Class annotation, String className) { ++typeCount; if (DEBUG) System.out.printf("%d reportTypeAnnotation on type '%s': @%s\n", typeCount, className, annotation.getName()); } @Override public void reportFieldAnnotation(Class annotation, String className, String fieldName) { ++fieldCount; if (DEBUG) System.out.printf("%d reportFieldAnnotation on field '%s#%s': @%s\n", fieldCount, className, fieldName, annotation.getName()); } public final void reportMethodAnnotation(Class annotation, String className, String methodName) { ++methodCount; if (DEBUG) System.out.printf("%d reportMethodAnnotation on method '%s#%s': @%s\n", methodCount, className, methodName, annotation.getName()); } public final int getTypeCount() { return typeCount; } public int getFieldCount() { return fieldCount; } public final int getMethodCount() { return methodCount; } } // rt.jar is our test file: always available when running the unit tests // and BIG (about 50MB). Number of .class files: 17436 @ Java 6 update 26 private static final File RT_JAR = new File(new File(System.getProperty("java.home")), "lib/rt.jar"); // Mainly used as benchmark (timing) method @Test public void testClassPathScannerRT() throws IOException { for (int i = 0; i < 6; ++i) { final long time = System.currentTimeMillis(); final CountingReporter counter = new CountingReporter(Deprecated.class); final AnnotationDetector cf = new AnnotationDetector(counter); // Scan all Java Class Files in the specified files (i.e. rt.jar) cf.detect(RT_JAR); // scan specific files and directories if (i == 5) { // report, first 5 iterations where for warming up VM // java-6-oracle (u26): Time: 255 ms. Type Count: 66, Method Count: 395 // java-7-oracle (u7): Time: 315 ms. Type Count: 83, Method Count: 435 // java-7-openjdk (u7): Time: 994 ms. Type Count: 70, Method Count: 427 log("Time: %d ms. Type Count: %d, Method Count: %d", System.currentTimeMillis() - time, counter.getTypeCount(), counter.methodCount); // we cannot use the returned count as useful value, because it differs from // JDK version to JDK version, but The Deprecated class must be detected assertTrue(counter.getTypeCount() > 0); } } } @Test public void testMethodAnnotationsOnCompleteClasspath() throws IOException { final long time = System.currentTimeMillis(); final CountingReporter counter = new CountingReporter(Test.class); final AnnotationDetector cf = new AnnotationDetector(counter); cf.detect(); // complete class path is scanned // 120 ms if (DEBUG) log("Time: %d ms.", System.currentTimeMillis() - time); assertEquals(0, counter.getTypeCount()); assertEquals(0, counter.getFieldCount()); assertEquals(15, counter.getMethodCount()); } @Test public void testMethodAnnotationsPackageOnly() throws IOException { final long time = System.currentTimeMillis(); @SuppressWarnings("unchecked") final CountingReporter counter = new CountingReporter(Test.class); final AnnotationDetector cf = new AnnotationDetector(counter); cf.detect("eu.infomas"); // only this package and sub package(s) are scanned // 6 ms if (DEBUG) log("Time: %d ms.", System.currentTimeMillis() - time); assertEquals(0, counter.getTypeCount()); assertEquals(0, counter.getFieldCount()); assertEquals(15, counter.getMethodCount()); } /** * Test the more complex annotation on this class (RuntimeVisibleTestAnnotations). * Ensure that both visible and invisible annotations are reported. */ @Test @RuntimeVisibleTestAnnotation @RuntimeInvisibleTestAnnotation public void testTestComplexAnnotations() throws IOException { @SuppressWarnings("unchecked") final CountingReporter counter = new CountingReporter( RuntimeVisibleTestAnnotations.class, RuntimeVisibleTestAnnotation.class, RuntimeInvisibleTestAnnotation.class); // only in this package == only this class! new AnnotationDetector(counter).detect("eu.infomas.annotation"); assertEquals(2, counter.getTypeCount()); assertEquals(1, counter.getFieldCount()); assertEquals(2, counter.getMethodCount()); } } ClassFileIteratorTest.java000066400000000000000000000010251261123056700360320ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import org.junit.Test; import static org.junit.Assert.assertNotNull; import java.io.File; import java.io.IOException; import java.io.InputStream; public class ClassFileIteratorTest { @Test public void testJarFile() throws IOException { File [] f = {new File("./src/test/resources/test.jar.extension")}; String [] s = {"eu/infomas/annotation"}; InputStream stream = new ClassFileIterator(f, s).next(); assertNotNull(stream); stream.close(); } } FileIteratorTest.java000066400000000000000000000067301261123056700350540ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import eu.infomas.annotation.FileIterator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import org.junit.Test; public final class FileIteratorTest { @Test public void testNoFile() throws IOException { FileIterator iter = new FileIterator(); assertEquals(0, countFiles(iter)); } @Test public void testSingleFile() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/annotation/FileIteratorTest.java")); assertEquals(1, countFiles(iter)); } @Test public void testSingleDirectory1() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/annotation")); assertEquals(7, countFiles(iter)); } @Test public void testSingleDirectory4() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas")); // 5 in annotation and 2 in util assertEquals(8, countFiles(iter)); } @Test public void testMixed() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/util/TestSupport.java"), new File("./src/test/java/eu/infomas/annotation/")); assertEquals(8, countFiles(iter)); } @Test public void testIsRoot1() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/util/FileIteratorTest.java")); assertNotNull(iter.next()); assertTrue(iter.isRootFile()); assertNull(iter.next()); } @Test public void testIsRoot2() throws IOException { FileIterator iter = new FileIterator(new File("./src/test/java/eu/infomas/util/")); assertNotNull(iter.next()); assertFalse(iter.isRootFile()); assertNull(iter.next()); } @Test public void testIsRoot3() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/util/TestSupport.java"), new File("./src/test/java/eu/infomas/annotation/") ); while (iter.next() != null) { if ("TestSupport.java".equals(iter.getFile().getName())) { assertTrue(iter.isRootFile()); } else { assertFalse(iter.getFile().toString(), iter.isRootFile()); } } } @Test public void testIsRoot4() throws IOException { FileIterator iter = new FileIterator( new File("./src/test/java/eu/infomas/annotation/"), new File("./src/test/java/eu/infomas/util/TestSupport.java") ); while (iter.next() != null) { if ("TestSupport.java".equals(iter.getFile().getName())) { assertTrue(iter.isRootFile()); } else { assertFalse(iter.getFile().toString(), iter.isRootFile()); } } } private int countFiles(final FileIterator iter) throws IOException { int counter = 0; while (iter.next() != null) { ++counter; //System.out.println(iter.getName()); } return counter; } } RuntimeInvisibleTestAnnotation.java000066400000000000000000000004361261123056700400030ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; // default retention policy creates a "RuntimeInvisibleAnnotation" attribute @Retention(RetentionPolicy.CLASS) public @interface RuntimeInvisibleTestAnnotation { } RuntimeVisibleTestAnnotation.java000066400000000000000000000004261261123056700374530ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; // see RuntimeVisibleTestAnnotations @Retention(RetentionPolicy.RUNTIME) public @interface RuntimeVisibleTestAnnotation { String name() default ""; } RuntimeVisibleTestAnnotations.java000066400000000000000000000004471261123056700376410ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; // see RuntimeVisibleTestAnnotation @Retention(RetentionPolicy.RUNTIME) public @interface RuntimeVisibleTestAnnotations { RuntimeVisibleTestAnnotation[] value(); } ZipFileIteratorTest.java000066400000000000000000000103661261123056700355370ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/annotationpackage eu.infomas.annotation; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import org.junit.Test; import static eu.infomas.util.TestSupport.*; /** * This class is used for simple benchmarking different ways to read a ZIP file in Java. * {@code rt.jar} is our test file. Always available and BIG (about 50MB). * When using an Oracle JVM using ZipFile is (considerable) faster. * Note that when using OpenJDK this is not the case. Also note that the OpenJDK * is (also in this case) MUCH slower than the Oracle JVM's. *
    * Some example timings (on same hardware, Ubuntu 12.04 LTS x64): *

     * java version "1.6.0_26" (/usr/lib/jvm/java-6-sun-1.6.0.26/jre)
     * Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
     * Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
     * Timing using ZipFile: 78 ms, using ZipInputStream: 176 ms.
     * 
     * java version "1.7.0_07" (/usr/lib/jvm/jdk1.7.0_07/jre)
     * Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
     * Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
     * Timing using ZipFile: 120 ms, using ZipInputStream: 154 ms.
     * 
     * java version "1.7.0_07" (/usr/lib/jvm/java-7-openjdk-amd64/jre)
     * OpenJDK Runtime Environment (build 1.7.0_07-b30)
     * OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
     * Timing using ZipFile: 797 ms, using ZipInputStream: 724 ms.
     * 
    */ public final class ZipFileIteratorTest { private static final boolean DEBUG = false; // count=17436, bytes=49115087 @ Java 6 update 26 (Oracle) // count=19002, bytes=59124405 @ Java 7 update 7 (Oracle) // count=18322, bytes=63983889 @ OpenJDK 7 update 7 private static final File RT_JAR = new File(new File(System.getProperty("java.home")), "lib/rt.jar"); @Test public void benchmarkReadZip() throws IOException { // warm up VM for (int i = 0; i < 5; ++i) { testReadZipUsingZipFile(); // about up to 3 times faster! 60 ms versus 170 ms testReadZipUsingZipInputStream(); } log(javaVersion()); log("Timing using ZipFile: %d ms, using ZipInputStream: %d ms.", testReadZipUsingZipFile(), testReadZipUsingZipInputStream()); } private long testReadZipUsingZipFile() throws IOException { ClassFileBuffer buffer = new ClassFileBuffer(128 * 1024); long time = System.currentTimeMillis(); int count = 0; long bytes = 0; final ZipFile zf = new ZipFile(RT_JAR); // open in OPEN_READ mode try { final Enumeration e = zf.entries(); while (e.hasMoreElements()) { final ZipEntry ze = e.nextElement(); if (ze.isDirectory()) { continue; } final InputStream is = zf.getInputStream(ze); buffer.readFrom(is); bytes += buffer.size(); ++count; } } finally { zf.close(); } time = System.currentTimeMillis() - time; if (DEBUG) { log("Time: %d ms, count=%d, bytes=%d ZipFile", time, count, bytes); } return time; } private long testReadZipUsingZipInputStream() throws IOException { ClassFileBuffer buffer = new ClassFileBuffer(128 * 1024); long time = System.currentTimeMillis(); int count = 0; long bytes = 0; final ZipInputStream zi = new ZipInputStream(new FileInputStream(RT_JAR)); try { ZipEntry ze; while ((ze = zi.getNextEntry()) != null) { if (ze.isDirectory()) { continue; } final InputStream is = zi; buffer.readFrom(is); bytes += buffer.size(); ++count; } } finally { zi.close(); } time = System.currentTimeMillis() - time; if (DEBUG) { log("Time: %d ms, count=%d, bytes=%d ZipInputStream", time, count, bytes); } return time; } } infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/util/000077500000000000000000000000001261123056700276345ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/java/eu/infomas/util/TestSupport.java000066400000000000000000000052501261123056700330150ustar00rootroot00000000000000/* TestSupport.java * * Created: 2012-10-01 (Year-Month-Day) * Character encoding: UTF-8 * ****************************************** LICENSE ******************************************* * * Copyright (c) 2012 - 2013 XIAM Solutions B.V. (http://www.xiam.nl) * * 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 eu.infomas.util; /** * {@code TestSupport} offers some simple utility methods useful during development and * testing. * * @author Ronald K. Muller * @since annotation-detector 3.0.2 */ public final class TestSupport { // utility class private TestSupport() { } /** * Return detailed information about the current Java VM. * Output should more or less the same as running the 'java' command in your OS shell: *
         * $ java -version
         * java version "1.7.0_07"
         * Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
         * Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
         * 
    */ public static String javaVersion() { return String.format("java version \"%s\" (%s)\n%s (build %s)\n%s (build %s, %s)", System.getProperty("java.version"), System.getProperty("java.home"), System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"), System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), System.getProperty("java.vm.info")); } /** * Minimalistic logger: log the String value of the supplied argument or print the * stack trace if it is an {@link Throwable}. */ public static void log(final Object log) { if (log instanceof Throwable) { ((Throwable)log).printStackTrace(System.err); } else { System.out.println(String.valueOf(log)); } } /** * Minimalistic logger: format the supplied message using * {@link String#format(java.lang.String, java.lang.Object[]) }. */ public static void log(final String msg, final Object... args) { System.out.println(args.length == 0 ? msg : String.format(msg, args)); } } infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/resources/000077500000000000000000000000001261123056700257035ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/annotation-detector/src/test/resources/test.jar.extension000066400000000000000000000355771261123056700314140ustar00rootroot00000000000000PK$EMETA-INF/MANIFEST.MFSMo0  z]%J6i-E6%Cω3X{{s-7vh-l-fb{9]lr"oC2 G㐌nZ@#U#߄ l b@I8Dd0 njtP& l(%׃%ҹNԙ;o\eMBfJIZX |!=8~P㗺&c`\łmG,M{ʅ3'e&t-z~ǼV`c@u:nd(&\ϏMԂm~G Dw$i;vD`75ZXfQ Qi:0k s7h_dnNoN!;#J5Ծ7=T:/km K*kuRN-C-˩1(n/= C:B!4PK&PAPK$E META-INF/PKPK$EMETA-INF/maven/PKPK$EMETA-INF/maven/eu.infomas/PKPK$E.META-INF/maven/eu.infomas/annotation-detector/PKPK$E<META-INF/maven/eu.infomas/annotation-detector/pom.properties 0aÙA >DDRӁmcE}8=& 4b& }吽Y0.yrEulC8_t/J5}0.n'+/ҷgٔBwa3H,1xhA‘BPKF}cCPKJ$E5META-INF/maven/eu.infomas/annotation-detector/pom.xmlUn@}آ>ƻi GT)m*$U_`wRv Rۙ!e)ـRa{бTɰ8>nˋ07G찷v.0 (s.@I|6eiLlno ޻~Nh@*VVlNஈUgcg fCf:GyTY97\eW >#Tθ Yh8!ZnӐBt|1d&j l`:TqN͕Үqjs$3*֐mc=ƪN?PKVFPK$Eeu/PKPK$E eu/infomas/PKPK$Eeu/infomas/annotation/PKPKx$E<eu/infomas/annotation/AnnotationDetector$FieldReporter.classQJ1W릻Z x.z"RO^b}.)k"٬׃G1)y3I^>>1"X~5MWOZ'2p:7WRe%zD*]` iJ-]c`y OUv;9cUۄnr͋WH*VpZk)\^s@8j]{'BךUX(d~ $PK^^PKx$E=eu/infomas/annotation/AnnotationDetector$MethodReporter.classJ1u]k= x.zQhJEO^bה5lևPb\aCf~f/8@`M'Aزldh'Z'2p<R鴐e9Z2gΗ(78SLg3[P/1 IcTL,N5%I8*U:ucݟ3A7}~PK&HVPKx$E7eu/infomas/annotation/AnnotationDetector$Reporter.class;o>#~v.v^FļĒbF hIJDļt}bkFĒҢTF ,JlD;™v@cKS2s#$]RKRK@312g&c7E%( $K-;-+4YX|V , R PKZnhPKx$E;eu/infomas/annotation/AnnotationDetector$TypeReporter.classJ1EԺUkӊ PW|e\R֤dև~% b0d0 /!%Mص<1=ORkSFwc&R"*eUe YՖ KBEaTvqڎFy/x=S;3S_̫ϯ|heKC6ksE腭Ǟ'<(vB:X5]&UU Gblt&FOЋ/PKrd$iPKx$E.eu/infomas/annotation/AnnotationDetector.classZ |T?e2o2yYHHpBd jԬ͂Y d $3qf`ֽ֖Zܥjw#ViUO|m~Z.. fy߽{g? <{h1椳خ$ittc4;8S,'N*iLn:ONZȋ^,s ||:UKeDu^&2pJa B$kk\'gehQUj$O-Njj**kpV8;tReZNa 2.zΐLJ Q=^A +Cq69OXΛe ò~deDLACtΣ[|*{9\E%cl}ޑ@0 2M~7X7 !FwȺܹmu>_LoZħ`] {ᵞQo |5:bK TSkgêv 0m5CmLeJXU C`dpg 74654 .M3q- ɔA ?5utZҰ~Cg7LI`j,eAq|tw64%ڶS6w\S,0j;զZ׭QcŬrc:idJڄQݜ=BVP* bv5vȻb=jZ[:k:\^-z(wv_;Z=J{¾RNokn\Ɣ_Y͛<[`|SAk \*z~߹޾!\;K52a~cdO(~h1Q~ 7-$yJ0xWޞq:Þd[m >`^QS{EouA6 ܸ:s}0Hw 2S}ky"f#A Cy~ fJ)<7u7=%[$@Ȓh.A.J6#4A Hj}޵%̂Za}Dt" 5M_ OU-0F}pA&WKK# Km5_PI@# |cZS;eQ6Y\/7I-c*;\sk^|_tXI5v$z+ 1k+mRgdcHR/t7lu :oxD)hZh'qҦOzX<2{d " 7H1I CT4J)%|0T` B*C:= =ۤ L%7$ pu0v@bZi"F5gSXĭj΃ۺG;yU"Psovj%i1 8و7UkV3F?+,M)q xJ$z%epL-gWݩ#!dIlY4 K$ڸjhK&/Bv:L* /bŀ/_ WZo -Հ|&7[[jowZ1wYc|AY?b xO~O~] $ȧB(sO,%5Gh Ռ~T/*xξD/c ϡT`qҺ'(e7ܓj 0&Gʢ򽻨1r4t椏Q^x2ɮL9Y)IBHCϹ^G9)8}7̏iOtL3S:;=#)ec5x7O9;r =>lzқe|\HoÁ  . f#NsЙ/^Y UJ>(J)0@T5[qb+!>_._oCt}[":-//r-˙5N%SfyQ8Ci=4i-l{RSy]Z6Nc,I$ aXhr'r2X/0I:I*j'6bCӣkddp*g; x ḓq:md|A!Τ9.\Gs>M .zgҋ\@p!E6<l:sq1/J^K븜7"a' |6W|ҵ}:K?CHr_[䳐uNtNT?Z#*\@P}@"^_Tss\SoFU "Ђh*p7&=]>N&hS*ɠ3k@T%Y]҈"K9F\u#_pe2AHb1_e'1hz4Wf+6VK.qw*bjSs*Ts3ٔR4>z*3h.h1EF8f?5׌ ެ-"9:٢ӟe8a4-Ao!j,֚S6Sso%6FbEW7y'qWŻ!C ]24-eN3swNx\_GQWϡ,Jy\*/ގ%Z)ܤ%)33-K/1ET' $urE ; (q!jL+ vʢ]W.;ɎR;qQa*KI ߠY|%{)_KpF 'p.Qπʢ{HwBZBPyH'jT:S52RR:cOIǑ8a )U<[.OXTǁ n?"v}?B}ٕǠ Uyl=/Ux:̑:ⲻ _0k;ƼiB6㸰M(rP8m;lPRg\I4 k9 m:-\˧J(ZhV@Z!) YC;fu\z&Jqe Jzh^rs?Sy- HVohso?Xf2k唡-|x*֪hjK_}BbWxQ \F.n3 ͊Bp)Կ1Oٺ?O{Ԛ332w%#1:+Zƨ#]/_b̸%o87VjMzWkVXkOSٮsYZhK[dzn^B[ϋ3Uۨ,OiMv:>"ZմtPGً[+sw q}T\|V^\~2Mm F(H;H Yg$TIqV.aSȥBZQ*p,}/TvA%{M|>_| PKKZ:(PKx$E+eu/infomas/annotation/ClassFileBuffer.class}Vs${ڑ;1N4D q*FIZ* \ÝLg:iN3&<\i}GGhs}w;GW܎5܂_iŒ3*f50Y!D<0! XT 3RqNC7XF%+<<8~DhoWy]CwH2C3t8nuxG.NLS NZ[#}I_jiIhYFξxGh{3܌VgYz`=L cBV1@3ǩ!.*K4].ɶ-&a?E% O*?E <9&MdWOS52~G+W3Bgz5ukl& -1vΘlfdqL ' H#U2~cAޭBx 1!!R nT?hd37Zh[sghvGmNp'YH2MGs:eHȁreW6*Xu,%C\\2)tm1UA S0ۣ7E=Q ܣw.ѐ6cfst;4l|;!NVw]G>3_5 ?,y+wp_פz9Q{UN1,}U0Mo[ZGPO0NÿPK!v\# PKx$E-eu/infomas/annotation/ClassFileIterator.classVkSU~ lXpkijl(Z)hVR]lZ*m?#wHxsrsvߞi}}u /y ʬУ+)pfPOG sZR4-Gs ˌXu T amQ'1 j;Z$Ș48YU3$pg/^`)Jz8vu5Q܆#]Z֭_U4Q:'q ^D|k{g8`dCp'*nE hA;GvlSX-d#Iw]FLPvQ'.NPDdzQRgp'uW4zzlyB KcJ|id RcP>vIU9szSU~n^Gi?ݣzU3aO |- J-IWPKŏQ PKx$E(eu/infomas/annotation/FileIterator.classeTKSY=7Цi$5|P(Fg$WlLʅš )JY5e~ev Bf|$˛w1c (хCV1GTq@>q' ԓ* :geN8!FrD ]r\;|)|?ZO8^qʩʑ3p܋P@L :o/hu\'<#Е.C@*왙u\y9K=_eF_1 'Jd.?'VRf/m\B:JY.:x+rYkeYTt(};ê^ww9:Ah;MЧ㬉s8ob7؋}r+EUY< 2&.`8&̭ÙTShM\Qqy5;(ڮ녶)neLb./2nBO_i&)Y<uR'Ue[v@M3!N0{>_TH (k.پ$Mؙ?R~CfCHr)]PxOGf"uZ"qk5hVa)kA*{#nG?\ _nرx'g0Q Uo& }973 hɿIT;%F7?OfTg~ Xoߩ #ο>g3 ]úB`3aDvI%z=pO@!_u6-6.z!n3La༉N(Vl37qM\¨@G&1qWL_fr-&U Lj 5qzjٮ!\LN=%VM+:R Zjx@Nqϗp~a@"i>  Xiµ^*{Ubou#ϰZyR%H|5z tI.ү(? j•=vkkg#DwL<hH`'etʓ.hm9 Cra3[ g(bW\#JW Yd2MWSG$fQ)}[hcbQ ,G(0nPF.;aO8 Ȏ<_QMD]j^sSbWfG1qt-T Gk) RZv@c{rzF߅L(d FEu ]ze !~0RPK{Vk3PK$E&PAMETA-INF/MANIFEST.MFPK$E META-INF/PK$EBMETA-INF/maven/PK$EMETA-INF/maven/eu.infomas/PK$E.META-INF/maven/eu.infomas/annotation-detector/PK$EF}cC<)META-INF/maven/eu.infomas/annotation-detector/pom.propertiesPKJ$EVF5 META-INF/maven/eu.infomas/annotation-detector/pom.xmlPK$Eeu/PK$E ;eu/infomas/PK$Eveu/infomas/annotation/PKx$E^^<eu/infomas/annotation/AnnotationDetector$FieldReporter.classPKx$E&HV= eu/infomas/annotation/AnnotationDetector$MethodReporter.classPKx$EZnh7 eu/infomas/annotation/AnnotationDetector$Reporter.classPKx$Erd$i; eu/infomas/annotation/AnnotationDetector$TypeReporter.classPKx$EKZ:(. eu/infomas/annotation/AnnotationDetector.classPKx$E!v\# +W!eu/infomas/annotation/ClassFileBuffer.classPKx$EŏQ -(eu/infomas/annotation/ClassFileIterator.classPKx$E =;(-eu/infomas/annotation/FileIterator.classPKx$E{Vk3+j1eu/infomas/annotation/ZipFileIterator.classPK;.5infomas-asl-infomas-asl-3.0.5/development/000077500000000000000000000000001261123056700204645ustar00rootroot00000000000000infomas-asl-infomas-asl-3.0.5/development/README.md000066400000000000000000000036101261123056700217430ustar00rootroot00000000000000# README This directory contains configuration files and information for setting up a local development environment, compliant with the coding style and rules in use at XIAM Solutions B.V. ## Recommended local development environment This is the development software stack we are using ourselves. This stack is battle tested and guaranteed to work. + Ubuntu Desktop 12.04.04 LTS (x64) + Oracle JDK, version 6u45 for building the open source artifacts + Oracle JDK, version 7u51 (for all other purposes) + Maven 3 (3.1.1) and Git 1.7 (1.7.9.5) available from shell + Netbeans IDE 8.0 ## Target runtime environment (PRODUCTION) Starting early 2010 all our server (production) environments are based on this stack. Currently (April 2014) this stack consists of: + Primary (and preferred) OS is Debian 7, also when using AWS EC2. + 64 bit + Oracle JDK, version 7 + Tomcat 7 Both the local developments and the server environments are setup and managed by [ansible](http://ansible.cc). A highly recommended Software Configuration Management (SCM) tool. ## Checkstyle configuration Checkstyle configuration files can be found in this directory and are referenced from the parent Maven POM. If you are using Eclipse, you have to configure Eclipse using these files. Note that Checkstyle warnings should be minimized. Checkstyle errors are always forbidden and will make the build fail. ## Netbeans configuration + Both Oracle JDK version 6 and 7 should be installed + Install Netbeans (installation directory is references by $NETBEANS_HOME) + Run Netbeans using the Oracle JDK version 7. Add the following line in $NETBEANS_HOME/etc/netbeans.conf ``` netbeans_jdkhome="/usr/lib/jvm/java-7-oracle" ``` + Import the standard configuration from this directory (netbeans-options.zip) ``` Tools > Options > Import > Select netbeans-options.zip > Select all options to import > OK ``` infomas-asl-infomas-asl-3.0.5/development/checkstyle-config.xml000066400000000000000000000354241261123056700246170ustar00rootroot00000000000000 infomas-asl-infomas-asl-3.0.5/development/checkstyle-header.txt000066400000000000000000000015431261123056700246140ustar00rootroot00000000000000^/\* ([A-Z][a-zA-Z0-9]*|package-info)\.java$ ^ \*$ ^ \* Created: \d{4}-\d{2}-\d{2} \(Year-Month-Day\)$ ^ \* Character encoding: UTF-8$ ^ \*$ ^ \*{42} LICENSE \*{43}$ ^ \*$ ^ \* Copyright \(c\) \d{4}( - \d{4})? XIAM Solutions B\.V\. \(http://www.xiam.nl\)$ ^ \*$ ^ \* 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\.$ ^ \*/$ ^.+infomas-asl-infomas-asl-3.0.5/development/netbeans-options.zip000066400000000000000000000124541261123056700245060ustar00rootroot00000000000000PKBW^E`config/Editors/text/x-jsp/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xml]k01MnHhNXۣh:wںM` 9GEN*0Vj5}֣TSCg=f5%JW8Jd<,BB=Η& <#2mjp>]RB3)pisK-o;osarB^D%K CZtZ(Q`HX$'JW0H0LldnhhqSeYk L$#unUoxCUkzv^ cS;`=^T %|Ӑ56څ_PKBvҺaconfig/Editors/text/x-java/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xml͔Mk0[-졭|u ,M a)$Q%1d ’yyf$lUN9gS)er\I|: LyEXR&86_LGB܁Nq2f6r;{{-D]סԨBk̉Ny .Cʼn5BcϲB7QK!δ,h=5+]JO=OuF()w֭}%h]RB3)pisK-o;osarB^D%K CZtZ(Q`HX$'JW0H0LldnhhqSeYk L$#unUoxCUkzv^ cS;`=^T %|Ӑ56څ_PKBi<Uconfig/Editors/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xmlQk0wE{ 6 ¦Շ!2ڴ$A&S\ZRR62W]vZXK~60x֠1 /ɐPB'c.bGSJڢyUU\'PKBlj.config/Templates/Licenses/license-apache20.txtSQo@ ~WX)e0qCEZ4&BW8S]ϡ6o=)9l?۳ʡ$=Y} fS 泌a,eP -=BdՄ hy FAЪIWp'PCAN%%@)I(P_S w^`oR4g2u=2IzP%:Td a"1=A[EyU[<!8ZXafԌʮ:B S5 AB-J4!>-q~f4X fC%L8eBQVįn!wNV ay|kay|6RpfGr?7#ƙH W1Jc1imx#Ǹǒ lʟ+<ˋHiڗ*XQXO`KJM"KWh+Gp)}PKBB M*config/Templates/Classes/package-info.javaQk0+Ҽoehv>1$ךMSI2Hnm]B87$|LjggG<^fJ߼-1`P'tiI-|7*YUZ`:Ȫ$zO:h0zXrIs}S~X|Ϝ7LQ$~ ']DL@("_>WmuEaAu/,WZ_PKB{xgZu#config/Templates/Classes/Class.javaRMo0 Wx!tnC R 8혵nV*I'P>ӏN۬*u9Ӂ0F 221x\pfwaX)qƥ[3p郕Fa1~ØyJΕ C/I 7 seOދN"UTuC?z\Ϧް*t]bIp[m>E9FH;J귄zcSfL\[Kgax)1Q?!r}%HՂnVuͻ9-DiOxiPMk~sGo7Bѓ葠b -hƐH%20VXl{థ1m7fPKBW^E`config/Editors/text/x-jsp/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xmlPKBvҺaconfig/Editors/text/x-java/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xmlPKBW^E`config/Editors/text/x-tag/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xmlPKBi<Uconfig/Editors/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xmlPKBlj.config/Templates/Licenses/license-apache20.txtPKBlGLR+ config/Templates/Properties/User.propertiesPKB2L config/Templates/UnitTests/JUnit3Suite.java_hiddenPKB6 config/Templates/UnitTests/JUnit3TestClass.java_hiddenPKB1 config/Templates/UnitTests/TestNGSuite.xml_hiddenPKB6E config/Templates/UnitTests/EmptyTestNGTest.java_hiddenPKBy;/ config/Templates/UnitTests/JUnit4TestClass.javaPKBB M* config/Templates/Classes/package-info.javaPKB{xgZu# config/Templates/Classes/Class.javaPK pinfomas-asl-infomas-asl-3.0.5/development/proprietary-checkstyle-header.txt000066400000000000000000000011101261123056700271600ustar00rootroot00000000000000^/\* ([A-Z][a-zA-Z0-9]*|package-info)\.java$ ^ \*$ ^ \* Created: \d{4}-\d{2}-\d{2} \(Year-Month-Day\)$ ^ \* Character encoding: UTF-8$ ^ \*$ ^ \*{42} LICENSE \*{43}$ ^ \*$ ^ \* Copyright \(c\) \d{4}( - \d{4})? XIAM Solutions B\.V\. \(http://www.xiam.nl\)$ ^ \*$ ^ \* This software is the confidential and proprietary information of$ ^ \* XIAM Solutions B\.V\. \("Confidential Information"\)\. You shall not disclose$ ^ \* such Confidential Information and shall use it only in accordance$ ^ \* with the terms of the license agreement you entered into with XIAM Solutions\.$ ^ \*/$ ^.+infomas-asl-infomas-asl-3.0.5/pom.xml000066400000000000000000000312131261123056700174570ustar00rootroot00000000000000 4.0.0 org.sonatype.oss oss-parent 9 eu.infomas infomas-asl 3.0.5 pom INFOMAS ASL :: Parent Parent POM for open source projects of XIAM Solutions B.V. http://rmuller.github.io/infomas-asl/annotation-detector/ https://github.com/rmuller/infomas-asl scm:git:https://github.com/rmuller/infomas-asl scm:git:https://github.com/rmuller/infomas-asl infomas-asl-3.0.5 GitHub Issues https://github.com/rmuller/infomas-asl/issues Travis-CI https://travis-ci.org/#!/rmuller/infomas-asl annotation-detector 2011 XIAM Solutions B.V. http://www.xiam.nl The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo rmuller Ronald Muller Owner Lead Developer +1 XIAM Solutions B.V. 1.6 yyyy-MM-dd'T'HH:mm:ssZ ${maven.build.timestamp} https://raw.github.com/rmuller/infomas-asl/master/development checkstyle-header.txt info apache20 github junit junit 4.12 test org.mockito mockito-all 1.10.19 test maven-assembly-plugin 2.6 maven-dependency-plugin 2.10 maven-javadoc-plugin 2.10.3 ${project.build.sourceEncoding} true true true http://docs.oracle.com/javase/8/docs/api/ -Xdoclint:none maven-release-plugin 2.5.2 maven-resources-plugin 2.7 maven-surefire-plugin 2.18.1 org.apache.felix maven-bundle-plugin 2.5.4 true maven-site-plugin 3.4 maven-checkstyle-plugin 2.15 false false eu/infomas/**/*.java checkstyle.console.severity=${checkstyle.console.severity} ${checkstyle.baseLocation}/checkstyle-config.xml ${checkstyle.baseLocation}/${checkstyle.header} true true false org.apache.maven.plugins maven-shade-plugin 2.4.1 com.github.github site-maven-plugin 0.12 Creating gh-pages for ${project.artifactId}-${project.version} target/site infomas-asl rmuller false site site maven-enforcer-plugin 1.4.1 [3.1.1,) [1.6.0-45,) maven-compiler-plugin 3.3 ${java.version} ${java.version} -Xlint:all,-rawtypes true true true false maven-jar-plugin 2.6 ${timestamp} rmuller@xiam.nl true maven-checkstyle-plugin checkstyle-main verify check com.github.github site-maven-plugin maven-project-info-reports-plugin 2.8.1 maven-javadoc-plugin javadoc maven-surefire-report-plugin 2.18.1 maven-checkstyle-plugin maven-pmd-plugin 3.5 ${java.version} org.codehaus.mojo findbugs-maven-plugin 3.0.2