[jboss-cvs] JBossAS SVN: r103960 - in projects/scanning/trunk/indexer: src/main/java/org/jboss/scanning/indexer and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 14 08:26:19 EDT 2010
Author: alesj
Date: 2010-04-14 08:26:18 -0400 (Wed, 14 Apr 2010)
New Revision: 103960
Modified:
projects/scanning/trunk/indexer/pom.xml
projects/scanning/trunk/indexer/src/main/java/org/jboss/scanning/indexer/Main.java
Log:
Support plugins in Main.
Modified: projects/scanning/trunk/indexer/pom.xml
===================================================================
--- projects/scanning/trunk/indexer/pom.xml 2010-04-14 12:01:18 UTC (rev 103959)
+++ projects/scanning/trunk/indexer/pom.xml 2010-04-14 12:26:18 UTC (rev 103960)
@@ -23,10 +23,6 @@
<artifactId>scanning-impl</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.scanning</groupId>
- <artifactId>scanning-plugins</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</dependency>
Modified: projects/scanning/trunk/indexer/src/main/java/org/jboss/scanning/indexer/Main.java
===================================================================
--- projects/scanning/trunk/indexer/src/main/java/org/jboss/scanning/indexer/Main.java 2010-04-14 12:01:18 UTC (rev 103959)
+++ projects/scanning/trunk/indexer/src/main/java/org/jboss/scanning/indexer/Main.java 2010-04-14 12:26:18 UTC (rev 103960)
@@ -24,7 +24,10 @@
import java.io.File;
import java.net.URL;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,14 +41,26 @@
*/
public class Main
{
- private static Logger log = Logger.getLogger(Main.class.getName());
+ private static final Logger log = Logger.getLogger(Main.class.getName());
+ /** Alias to plugin (provider) shortcut */
+ private static final Map<String, String> aliases = new HashMap<String, String>();
+
+ static
+ {
+ aliases.put("@", "org.jboss.scanning.annotations.plugins.AnnotationsScanningPlugin");
+ aliases.put("ann", "org.jboss.scanning.annotations.plugins.AnnotationsScanningPlugin");
+ aliases.put("annotations", "org.jboss.scanning.annotations.plugins.AnnotationsScanningPlugin");
+ aliases.put("h", "org.jboss.scanning.hierarchy.plugins.HierarchyIndexScanningPlugin");
+ aliases.put("hierarchy", "org.jboss.scanning.hierarchy.plugins.HierarchyIndexScanningPlugin");
+ }
+
/**
* Usage
*/
private static void usage()
{
- System.out.println("Usage: Indexer <input-jar> <classpath?>");
+ System.out.println("Usage: Indexer <input-jar> <scanning-plugins> <classpath*>");
}
/**
@@ -58,17 +73,25 @@
{
try
{
- if (args.length < 1)
+ int offset = 2;
+ if (args.length < offset)
{
File input = new File(args[0]);
+ String[] providers = args[1].split(",");
+ // change aliases
+ for (int i = 0; i < providers.length; i++)
+ {
+ String alias = aliases.get(providers[i]);
+ if (alias != null)
+ providers[i] = alias;
+ }
- URL[] urls = new URL[args.length - 1];
+ URL[] urls = new URL[args.length - offset];
// add the rest of classpath
- for (int i = 0; i < args.length - 1; i++)
- urls[i] = new File(args[i + 1]).toURI().toURL();
+ for (int i = 0; i < urls.length; i++)
+ urls[i] = new File(args[i + offset]).toURI().toURL();
- // TODO -- add scanning plugins
- ScanUtils.scan(input, urls, Collections.<String>emptySet());
+ ScanUtils.scan(input, urls, new HashSet<String>(Arrays.asList(providers)));
}
else
{
More information about the jboss-cvs-commits
mailing list