[124920] Create a tool that generates a report of adopters' usage of WTP code
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/plugin.xml b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/plugin.xml
index a7546eb..47dd6dd 100644
--- a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/plugin.xml
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/plugin.xml
@@ -46,4 +46,13 @@
</run>
</application>
</extension>
+ <extension
+ id="APIRefCompatibilityScanner"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run
+ class="org.eclipse.wtp.releng.tools.component.adopters.APIRefCompatibilityScanner">
+ </run>
+ </application>
+ </extension>
</plugin>
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/APIRefCompatibilityScanner.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/APIRefCompatibilityScanner.java
new file mode 100644
index 0000000..b2de5cf
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/APIRefCompatibilityScanner.java
@@ -0,0 +1,393 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.core.runtime.IPlatformRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wtp.releng.tools.component.ILocation;
+import org.eclipse.wtp.releng.tools.component.ILocationVisitor;
+import org.eclipse.wtp.releng.tools.component.api.API2ComponentAPI;
+import org.eclipse.wtp.releng.tools.component.api.ClassAPI;
+import org.eclipse.wtp.releng.tools.component.api.ComponentAPI;
+import org.eclipse.wtp.releng.tools.component.api.PackageAPI;
+import org.eclipse.wtp.releng.tools.component.internal.Location;
+import org.eclipse.wtp.releng.tools.component.java.Java2API;
+import org.eclipse.wtp.releng.tools.component.util.CommandOptionParser;
+import org.eclipse.wtp.releng.tools.component.xsl.XSLUtil;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class APIRefCompatibilityScanner implements IPlatformRunnable
+{
+ private String src;
+ private String use;
+ private String outputDir;
+
+ public String getOutputDir()
+ {
+ return outputDir;
+ }
+
+ public void setOutputDir(String outputDir)
+ {
+ this.outputDir = addTrailingSeperator(outputDir);
+ }
+
+ public String getSrc()
+ {
+ return src;
+ }
+
+ public void setSrc(String src)
+ {
+ this.src = src;
+ }
+
+ public String getUse()
+ {
+ return use;
+ }
+
+ public void setUse(String use)
+ {
+ this.use = use;
+ }
+
+ private Map pkg2APIInfo = new HashMap();
+ private References refs = new References();
+
+ public void execute()
+ {
+ ILocation apiInfoLoc = Location.createLocation(new File(outputDir + "_tmp_componentapi"));
+ apiInfoLoc.accept(
+ new ILocationVisitor()
+ {
+ public boolean accept(ILocation location)
+ {
+ if (location.getName().endsWith("api-info.xml"))
+ {
+ ComponentAPI compAPI = new ComponentAPI();
+ compAPI.setLocation(location);
+ try
+ {
+ compAPI.load();
+ for (Iterator it = compAPI.getPackageAPIs().iterator(); it.hasNext();)
+ {
+ pkg2APIInfo.put(((PackageAPI)it.next()).getName(), location);
+ }
+ }
+ catch (IOException ioe)
+ {
+ throw new RuntimeException(ioe);
+ }
+ }
+ return true;
+ }
+ }
+ );
+ ILocation useLoc = Location.createLocation(new File(use));
+ useLoc.accept(
+ new ILocationVisitor()
+ {
+ public boolean accept(ILocation location)
+ {
+ if (location.getName().endsWith(".xml"))
+ {
+ try
+ {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(false);
+ factory.setValidating(false);
+ SAXParser parser = factory.newSAXParser();
+ parser.parse(new InputSource(location.getInputStream()), new APIRefHandler(refs));
+ }
+ catch (ParserConfigurationException pce)
+ {
+ throw new RuntimeException(pce);
+ }
+ catch (SAXException saxe)
+ {
+ throw new RuntimeException(saxe);
+ }
+ catch (IOException ioe)
+ {
+ throw new RuntimeException(ioe);
+ }
+ }
+ return true;
+ }
+ }
+ );
+ try
+ {
+ save();
+ genHTML();
+ }
+ catch (IOException ioe)
+ {
+ throw new RuntimeException(ioe);
+ }
+ }
+
+ public void save() throws IOException
+ {
+ File file = new File(outputDir + "api-ref-compatibility.xml");
+ file.getParentFile().mkdirs();
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(refs.toString().getBytes());
+ fos.close();
+ }
+
+ private void genHTML()
+ {
+ try
+ {
+ XSLUtil.transform
+ (
+ Platform.getBundle("org.eclipse.wtp.releng.tools.component.core").getResource("org/eclipse/wtp/releng/tools/component/xsl/api-ref-compatibility.xsl").openStream(),
+ new ByteArrayInputStream(refs.toString().getBytes()),
+ new FileOutputStream(new File(outputDir + "api-ref-compatibility.html")),
+ outputDir
+ );
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected static String addTrailingSeperator(String s)
+ {
+ if (s != null && !s.endsWith("/") && !s.endsWith("\\"))
+ {
+ StringBuffer sb = new StringBuffer(s);
+ sb.append('/');
+ return sb.toString();
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ protected class APIRefHandler extends DefaultHandler
+ {
+ private References refs;
+ private ClassRef currClassRef;
+ private ClassAPI currClassAPI;
+
+ public APIRefHandler(References refs)
+ {
+ this.refs = refs;
+ }
+
+ public void startElement(String uri, String elementName, String qName, Attributes attributes) throws SAXException
+ {
+ if (elementName.equals("class") || qName.equals("class"))
+ {
+ String className = attributes.getValue("name");
+ int refCount = Integer.parseInt(attributes.getValue("ref"));
+ int subclassCount = Integer.parseInt(attributes.getValue("subclass"));
+ int implCount = Integer.parseInt(attributes.getValue("impl"));
+ int instantiateCount = Integer.parseInt(attributes.getValue("instantiate"));
+ currClassRef = new ClassRef();
+ currClassRef.setName(className);
+ currClassRef.setRefCount(refCount);
+ currClassRef.setSubclassCount(subclassCount);
+ currClassRef.setImplementCount(implCount);
+ currClassRef.setInstantiateCount(instantiateCount);
+ int i = className.lastIndexOf('.');
+ String pkgName = (i != -1) ? className.substring(0, i) : "";
+ String localName = (i != -1) ? className.substring(i + 1) : className;
+ ILocation location = (ILocation)pkg2APIInfo.get(pkgName);
+ if (location != null)
+ {
+ try
+ {
+ ComponentAPI compAPI = getComponentAPI(location);
+ if (compAPI != null)
+ {
+ PackageAPI pkgAPI = compAPI.getPackageAPI(pkgName);
+ if (pkgAPI != null)
+ {
+ ClassAPI classAPI = pkgAPI.getClassAPI(localName);
+ if (classAPI != null)
+ {
+ currClassAPI = classAPI;
+ return;
+ }
+ }
+ }
+ }
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ }
+ refs.addClassRef(currClassRef);
+ }
+ else if (elementName.equals("method") || qName.equals("method"))
+ {
+ String name = attributes.getValue("name");
+ String desc = attributes.getValue("desc");
+ if (currClassAPI != null && name != null && desc != null)
+ {
+ if (currClassAPI.getMethodAPI(name, desc) != null)
+ {
+ return;
+ }
+ }
+ int refCount = Integer.parseInt(attributes.getValue("ref"));
+ if (refs.getClassRef(currClassRef.getName()) == null)
+ refs.addClassRef(currClassRef);
+ MethodRef methodRef = new MethodRef();
+ methodRef.setName(name);
+ methodRef.setDescriptor(desc);
+ methodRef.setRefCount(refCount);
+ currClassRef.addMethodRef(methodRef);
+ }
+ else if (elementName.equals("field") || qName.equals("field"))
+ {
+ String name = attributes.getValue("name");
+ if (currClassAPI != null && name != null)
+ {
+ if (currClassAPI.getFieldAPI(name) != null)
+ {
+ return;
+ }
+ }
+ String desc = attributes.getValue("desc");
+ int refCount = Integer.parseInt(attributes.getValue("ref"));
+ if (refs.getClassRef(currClassRef.getName()) == null)
+ refs.addClassRef(currClassRef);
+ FieldRef fieldRef = new FieldRef();
+ fieldRef.setName(name);
+ fieldRef.setDescriptor(desc);
+ fieldRef.setRefCount(refCount);
+ currClassRef.addFieldRef(fieldRef);
+ }
+ }
+
+ public void endElement(String uri, String elementName, String qName, Attributes attributes) throws SAXException
+ {
+ if (elementName.equals("class") || qName.equals("class"))
+ {
+ currClassAPI = null;
+ currClassRef = null;
+ }
+ }
+
+ private int cacheSize = 20;
+ private List cachedIds = new ArrayList(cacheSize);
+ private List cachedCompAPIs = new ArrayList(cacheSize);
+
+ private ComponentAPI getComponentAPI(ILocation location) throws IOException
+ {
+ int index = cachedIds.indexOf(location);
+ if (index != -1)
+ {
+ ComponentAPI compAPI = (ComponentAPI)cachedCompAPIs.get(index);
+ if (index != 0)
+ {
+ cachedIds.remove(index);
+ cachedCompAPIs.remove(index);
+ cachedIds.add(0, location);
+ cachedCompAPIs.add(0, compAPI);
+ }
+ return compAPI;
+ }
+ ComponentAPI compAPI = new ComponentAPI();
+ compAPI.setLocation(location);
+ compAPI.load();
+ if (cachedCompAPIs.size() == cacheSize)
+ {
+ cachedIds.remove(cacheSize - 1);
+ cachedCompAPIs.remove(cacheSize - 1);
+ }
+ cachedIds.add(0, location);
+ cachedCompAPIs.add(0, compAPI);
+ return compAPI;
+ }
+ }
+
+ public Object run(Object arguments)
+ {
+ String src = System.getProperty("src");
+ String use = System.getProperty("use");
+ String outputDir = System.getProperty("outputDir");
+ try
+ {
+ main(new String[]{"-src", src, "-use", use, "-outputDir", outputDir});
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+ return IPlatformRunnable.EXIT_OK;
+ }
+
+ public static void main(String[] args)
+ {
+ CommandOptionParser optionParser = new CommandOptionParser(args);
+ Map options = optionParser.getOptions();
+ Collection src = (Collection)options.get("src");
+ Collection use = (Collection)options.get("use");
+ Collection outputDir = (Collection)options.get("outputDir");
+ if (src == null || use == null || outputDir == null || src.isEmpty() || use.isEmpty() || outputDir.isEmpty())
+ {
+ printUsage();
+ System.exit(-1);
+ }
+ String srcString = (String)src.iterator().next();
+ String outputDirString = addTrailingSeperator((String)outputDir.iterator().next());
+ String componentxml = outputDirString + "_tmp_componentxml";
+ String componentapi = outputDirString + "_tmp_componentapi";
+ Java2API java2API = new Java2API();
+ java2API.setSrc(srcString);
+ java2API.setOutputDir(componentxml);
+ //java2API.execute();
+ API2ComponentAPI api2CompAPI = new API2ComponentAPI();
+ api2CompAPI.setApi(componentxml);
+ api2CompAPI.setSrc(srcString);
+ api2CompAPI.setOutputDir(componentapi);
+ //api2CompAPI.execute();
+ APIRefCompatibilityScanner scanner = new APIRefCompatibilityScanner();
+ scanner.setSrc((String)src.iterator().next());
+ scanner.setUse((String)use.iterator().next());
+ scanner.setOutputDir(outputDirString);
+ scanner.execute();
+ }
+
+ private static void printUsage()
+ {
+ System.out.println("Usage: java org.eclipse.wtp.releng.tools.component.adopters.APIRefCompatibilityScanner -src <src> -use <use> -outputDir <outputDir> [-options]");
+ System.out.println("");
+ System.out.println("\t-src\t\t<src>\t\tlocation of your Eclipse-based product");
+ System.out.println("\t-use\t\t<use>\t\tlocation of adopters' API usage data");
+ System.out.println("\t-outputDir\t<outputDir>\toutput directory");
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/ClassRef.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/ClassRef.java
new file mode 100644
index 0000000..77458fe
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/ClassRef.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class ClassRef extends NamedRef
+{
+ private int implementCount;
+ private int subclassCount;
+ private int instantiateCount;
+ private Map methodRefs;
+ private Map fieldRefs;
+
+ public int getImplementCount()
+ {
+ return implementCount;
+ }
+ public void setImplementCount(int implementCount)
+ {
+ this.implementCount = implementCount;
+ }
+ public void incImplementCount()
+ {
+ this.implementCount++;
+ }
+ public int getInstantiateCount()
+ {
+ return instantiateCount;
+ }
+ public void setInstantiateCount(int instantiateCount)
+ {
+ this.instantiateCount = instantiateCount;
+ }
+ public void incInstantiateCount()
+ {
+ this.instantiateCount++;
+ }
+ public int getSubclassCount()
+ {
+ return subclassCount;
+ }
+ public void setSubclassCount(int subclassCount)
+ {
+ this.subclassCount = subclassCount;
+ }
+ public void incSubclassCount()
+ {
+ this.subclassCount++;
+ }
+
+ public Collection getMethodRefs()
+ {
+ if (methodRefs != null)
+ return new ArrayList(methodRefs.values());
+ else
+ return new ArrayList(0);
+ }
+
+ public MethodRef getMethodRef(String name, String descriptor)
+ {
+ if (methodRefs != null)
+ return (MethodRef)methodRefs.get(encode(name, descriptor));
+ else
+ return null;
+ }
+
+ public void addMethodRef(MethodRef methodRef)
+ {
+ if (methodRefs == null)
+ methodRefs = new HashMap();
+ methodRefs.put(encode(methodRef.getName(), methodRef.getDescriptor()), methodRef);
+ }
+
+ public Collection getFieldRefs()
+ {
+ if (fieldRefs != null)
+ return new ArrayList(fieldRefs.values());
+ else
+ return new ArrayList(0);
+ }
+
+ public FieldRef getFieldRef(String name, String descriptor)
+ {
+ if (fieldRefs != null)
+ return (FieldRef)fieldRefs.get(encode(name, descriptor));
+ else
+ return null;
+ }
+
+ public void addFieldRef(FieldRef fieldRef)
+ {
+ if (fieldRefs == null)
+ fieldRefs = new HashMap();
+ fieldRefs.put(encode(fieldRef.getName(), fieldRef.getDescriptor()), fieldRef);
+ }
+
+ private String encode(String name, String descriptor)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(name);
+ sb.append('#');
+ sb.append(descriptor);
+ return sb.toString();
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<class name=\"");
+ sb.append(getName());
+ sb.append("\" ref=\"");
+ sb.append(getRefCount());
+ sb.append("\" impl=\"");
+ sb.append(getImplementCount());
+ sb.append("\" subclass=\"");
+ sb.append(getSubclassCount());
+ sb.append("\" instantiate=\"");
+ sb.append(getInstantiateCount());
+ sb.append("\">");
+ for (Iterator it = getMethodRefs().iterator(); it.hasNext();)
+ sb.append(it.next().toString());
+ for (Iterator it = getFieldRefs().iterator(); it.hasNext();)
+ sb.append(it.next().toString());
+ sb.append("</class>");
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/FieldRef.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/FieldRef.java
new file mode 100644
index 0000000..bc43f84
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/FieldRef.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+public class FieldRef extends NamedRef
+{
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<field name=\"");
+ sb.append(getName());
+ sb.append("\" desc=\"");
+ sb.append(getDescriptor());
+ sb.append("\" ref=\"");
+ sb.append(getRefCount());
+ sb.append("\"/>");
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/MethodRef.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/MethodRef.java
new file mode 100644
index 0000000..8c26a04
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/MethodRef.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+public class MethodRef extends NamedRef
+{
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<method name=\"");
+ sb.append(getName());
+ sb.append("\" desc=\"");
+ sb.append(getDescriptor());
+ sb.append("\" ref=\"");
+ sb.append(getRefCount());
+ sb.append("\"/>");
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/NamedRef.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/NamedRef.java
new file mode 100644
index 0000000..d502b7d
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/NamedRef.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+public class NamedRef extends Ref
+{
+ private String name;
+ private String descriptor;
+
+ public String getDescriptor()
+ {
+ return descriptor;
+ }
+
+ public void setDescriptor(String descriptor)
+ {
+ this.descriptor = descriptor;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/Ref.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/Ref.java
new file mode 100644
index 0000000..8647b6b
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/Ref.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+public class Ref
+{
+ private int refCount;
+
+ public Ref()
+ {
+ refCount = 0;
+ }
+
+ public int getRefCount()
+ {
+ return refCount;
+ }
+
+ public void setRefCount(int refCount)
+ {
+ this.refCount = refCount;
+ }
+
+ public void incRefCount()
+ {
+ this.refCount++;
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/References.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/References.java
new file mode 100644
index 0000000..8650952
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/References.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class References
+{
+ private Map classRefs;
+ private String name;
+ private String includes;
+ private String excludes;
+ private String includePlugins;
+ private String excludePlugins;
+
+ public Collection getClassRefs()
+ {
+ if (classRefs != null)
+ return new ArrayList(classRefs.values());
+ else
+ return new ArrayList(0);
+ }
+
+ public ClassRef getClassRef(String name)
+ {
+ if (classRefs != null)
+ return (ClassRef)classRefs.get(name);
+ else
+ return null;
+ }
+
+ public void addClassRef(ClassRef classRef)
+ {
+ if (classRefs == null)
+ classRefs = new HashMap();
+ classRefs.put(classRef.getName(), classRef);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getExcludes()
+ {
+ return excludes;
+ }
+
+ public void setExcludes(String excludes)
+ {
+ this.excludes = excludes;
+ }
+
+ public String getIncludes()
+ {
+ return includes;
+ }
+
+ public void setIncludes(String includes)
+ {
+ this.includes = includes;
+ }
+
+ public String getExcludePlugins()
+ {
+ return excludePlugins;
+ }
+
+ public void setExcludePlugins(String excludePlugins)
+ {
+ this.excludePlugins = excludePlugins;
+ }
+
+ public String getIncludePlugins()
+ {
+ return includePlugins;
+ }
+
+ public void setIncludePlugins(String includePlugins)
+ {
+ this.includePlugins = includePlugins;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<references name=\"");
+ sb.append(getName());
+ sb.append("\" includes=\"");
+ sb.append(getIncludes());
+ sb.append("\" excludes=\"");
+ sb.append(getExcludes());
+ sb.append("\" includePlugins=\"");
+ sb.append(getIncludePlugins());
+ sb.append("\" excludePlugins=\"");
+ sb.append(getExcludePlugins());
+ sb.append("\">");
+ for (Iterator it = getClassRefs().iterator(); it.hasNext();)
+ sb.append(it.next().toString());
+ sb.append("</references>");
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/SimpleClass2Reference.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/SimpleClass2Reference.java
new file mode 100644
index 0000000..06d6e03
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/SimpleClass2Reference.java
@@ -0,0 +1,601 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wtp.releng.tools.component.adopters;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IClassFileReader;
+import org.eclipse.jdt.core.util.ICodeAttribute;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.IFieldInfo;
+import org.eclipse.jdt.core.util.ILineNumberAttribute;
+import org.eclipse.jdt.core.util.IMethodInfo;
+import org.eclipse.jdt.internal.core.util.ClassFileReader;
+import org.eclipse.wtp.releng.tools.component.ILocation;
+import org.eclipse.wtp.releng.tools.component.classes.IClassVisitor;
+import org.eclipse.wtp.releng.tools.component.classes.LibVisitor;
+import org.eclipse.wtp.releng.tools.component.internal.FieldRef;
+import org.eclipse.wtp.releng.tools.component.internal.InternalByteCodeVisitor;
+import org.eclipse.wtp.releng.tools.component.internal.Location;
+import org.eclipse.wtp.releng.tools.component.internal.MethodRef;
+import org.eclipse.wtp.releng.tools.component.util.CommandOptionParser;
+import org.eclipse.wtp.releng.tools.component.xsl.XSLUtil;
+
+public class SimpleClass2Reference implements IClassVisitor
+{
+ private String src;
+ private String output;
+ private String html;
+ private Collection includes;
+ private Collection excludes;
+ private Collection includePlugins;
+ private Collection excludePlugins;
+
+ public String getOutput()
+ {
+ return output;
+ }
+
+ public void setOutput(String output)
+ {
+ this.output = addTrailingSeperator(output);
+ }
+
+ public String getHTML()
+ {
+ return html;
+ }
+
+ public void setHTML(String html)
+ {
+ this.html = html;
+ }
+
+ public String getSrc()
+ {
+ return src;
+ }
+
+ public void setSrc(String src)
+ {
+ this.src = src;
+ }
+
+ public Collection getIncludes()
+ {
+ return includes;
+ }
+
+ public void setIncludes(Collection includes)
+ {
+ this.includes = includes;
+ }
+
+ public Collection getExcludes()
+ {
+ return excludes;
+ }
+
+ public void setExcludes(Collection excludes)
+ {
+ this.excludes = excludes;
+ }
+
+ public Collection getExcludePlugins()
+ {
+ return excludePlugins;
+ }
+
+ public void setExcludePlugins(Collection excludePlugins)
+ {
+ this.excludePlugins = excludePlugins;
+ }
+
+ public Collection getIncludePlugins()
+ {
+ return includePlugins;
+ }
+
+ public void setIncludePlugins(Collection includePlugins)
+ {
+ this.includePlugins = includePlugins;
+ }
+
+ private References refs;
+
+ public void execute()
+ {
+ refs = new References();
+ refs.setName(src);
+ if (includes != null)
+ refs.setIncludes(includes.toString());
+ if (excludes != null)
+ refs.setExcludes(excludes.toString());
+ if (includePlugins != null)
+ refs.setIncludePlugins(includePlugins.toString());
+ if (excludePlugins != null)
+ refs.setExcludePlugins(excludePlugins.toString());
+ ILocation srcLocation = Location.createLocation(new File(src));
+ LibVisitor libVisitor = new LibVisitor();
+ srcLocation.accept(libVisitor);
+ libVisitor.setClassVisitor(this);
+ srcLocation.accept(libVisitor);
+ try
+ {
+ save();
+ if (html != null)
+ genHTML();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void save() throws IOException
+ {
+ File file = new File(output);
+ file.getParentFile().mkdirs();
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(refs.toString().getBytes());
+ fos.close();
+ }
+
+ private void genHTML()
+ {
+ try
+ {
+ XSLUtil.transform
+ (
+ ClassLoader.getSystemResourceAsStream("org/eclipse/wtp/releng/tools/component/xsl/api-ref-compatibility.xsl"),
+ new ByteArrayInputStream(refs.toString().getBytes()),
+ new FileOutputStream(html)
+ );
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean visit(String pluginId, ILocation classLoc)
+ {
+ if (includePlugins(pluginId))
+ {
+ try
+ {
+ visit(classLoc);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (ClassFormatException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return true;
+ }
+
+ public References visit(ILocation classLoc) throws IOException, ClassFormatException
+ {
+ IClassFileReader reader = read(classLoc);
+ String className = new String(reader.getClassName()).replace('/', '.');
+ // use: reference
+ for (Iterator it = getReferencedTypes(reader).iterator(); it.hasNext();)
+ {
+ String refClassName = (String)it.next();
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ getClassRef(refClassName).incRefCount();
+ }
+ }
+ // method info & field info
+ setMethodAndFieldInfoUses(reader);
+ // method ref
+ List methodRefs = new ArrayList();
+ List fieldRefs = new ArrayList();
+ getRefs(reader, false, methodRefs, fieldRefs);
+ for (Iterator it = methodRefs.iterator(); it.hasNext();)
+ {
+ MethodRef methodRef = (MethodRef)it.next();
+ String refClassName = methodRef.getClassName();
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ String methodName = methodRef.getMethodName();
+ String methodDesc = methodRef.getMethodDescriptor();
+ if (methodRef.isConstructor())
+ {
+ // use: instantiate
+ getClassRef(refClassName).incInstantiateCount();
+ }
+ else
+ {
+ // use: reference
+ getMethodRef(getClassRef(refClassName), methodName, methodDesc).incRefCount();
+ }
+ }
+ }
+ methodRefs = null;
+ // field ref
+ for (Iterator it = fieldRefs.iterator(); it.hasNext();)
+ {
+ FieldRef fieldRef = (FieldRef)it.next();
+ String refClassName = fieldRef.getClassName();
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ getFieldRef(getClassRef(refClassName), fieldRef.getFieldName(), fieldRef.getFieldDescriptor()).incRefCount();
+ }
+ }
+ fieldRefs = null;
+ // use: subclass
+ String superClass = new String(reader.getSuperclassName()).replace('/', '.');
+ if (superClass != null && include(superClass))
+ {
+ getClassRef(superClass).incSubclassCount();
+ }
+ // use: implement
+ char[][] interfaceNames = reader.getInterfaceNames();
+ String[] interfaces = new String[interfaceNames.length];
+ for (int i = 0; i < interfaces.length; i++)
+ interfaces[i] = new String(interfaceNames[i]).replace('/', '.');
+ for (int i = 0; i < interfaces.length; i++)
+ if (include(interfaces[i]))
+ getClassRef(interfaces[i]).incImplementCount();
+ return refs;
+ }
+
+ private IClassFileReader read(ILocation classLoc) throws IOException, ClassFormatException
+ {
+ InputStream is = null;
+ ByteArrayOutputStream baos = null;
+ try
+ {
+ byte[] b = new byte[8192];
+ baos = new ByteArrayOutputStream(8192);
+ is = classLoc.getInputStream();
+ for (int read = is.read(b); read != -1; read = is.read(b))
+ {
+ baos.write(b, 0, read);
+ }
+ is.close();
+ baos.close();
+ return new ClassFileReader(baos.toByteArray(), IClassFileReader.CONSTANT_POOL | IClassFileReader.METHOD_INFOS | IClassFileReader.METHOD_BODIES | IClassFileReader.FIELD_INFOS | IClassFileReader.SUPER_INTERFACES);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ if (baos != null)
+ {
+ try
+ {
+ baos.close();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ }
+ }
+
+ private Set getReferencedTypes(IClassFileReader reader)
+ {
+ Set types = new HashSet();
+ IConstantPool constantPool = reader.getConstantPool();
+ int poolSize = constantPool.getConstantPoolCount();
+ for (int i = 0; i < poolSize; i++)
+ {
+ // Extract the constant's referenced class (if that is even relevant)
+ if (constantPool.getEntryKind(i) == IConstantPoolConstant.CONSTANT_Class)
+ {
+ IConstantPoolEntry classEntry = constantPool.decodeEntry(i);
+ String signature = new String(classEntry.getClassInfoName());
+ int index = signature.lastIndexOf('[');
+ if (index > -1)
+ {
+ // could be an array of a primitive type
+ if (signature.length() - (index + 1) == 1)
+ continue;
+ signature = Signature.toString(signature);
+ signature = signature.substring(0, signature.length() - 2 * (index + 1));
+ signature = signature.replace('.', '$');
+ }
+ String typeName = signature.replace('/', '.');
+ types.add(typeName);
+ }
+ }
+ return types;
+ }
+
+ private void getRefs(IClassFileReader reader, boolean debug, List methodRefs, List fieldRefs)
+ {
+ String className = new String(reader.getClassName()).replace('/', '.');
+ IConstantPoolEntry[] refs = getConstantPoolEntries(reader, IConstantPoolConstant.CONSTANT_Methodref);
+ for (int i = 0; i < refs.length; i++)
+ {
+ String refClassName = new String(refs[i].getClassName()).replace('/', '.');
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ MethodRef methodRef = new MethodRef();
+ methodRef.setPoolEntry(refs[i]);
+ methodRefs.add(methodRef);
+ }
+ }
+ refs = getConstantPoolEntries(reader, IConstantPoolConstant.CONSTANT_InterfaceMethodref);
+ for (int i = 0; i < refs.length; i++)
+ {
+ String refClassName = new String(refs[i].getClassName()).replace('/', '.');
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ MethodRef methodRef = new MethodRef();
+ methodRef.setPoolEntry(refs[i]);
+ methodRefs.add(methodRef);
+ }
+ }
+ refs = getConstantPoolEntries(reader, IConstantPoolConstant.CONSTANT_Fieldref);
+ for (int i = 0; i < refs.length; i++)
+ {
+ String refClassName = new String(refs[i].getClassName()).replace('/', '.');
+ if (!className.equals(refClassName) && include(refClassName))
+ {
+ FieldRef fieldRef = new FieldRef();
+ fieldRef.setPoolEntry(refs[i]);
+ fieldRefs.add(fieldRef);
+ }
+ }
+ if (debug)
+ {
+ IMethodInfo[] methodInfos = reader.getMethodInfos();
+ for (int i = 0; i < methodInfos.length; i++)
+ {
+ ICodeAttribute codeAttr = methodInfos[i].getCodeAttribute();
+ if (codeAttr != null)
+ {
+ ILineNumberAttribute lineNumAttr = codeAttr.getLineNumberAttribute();
+ if (lineNumAttr != null)
+ {
+ InternalByteCodeVisitor byteCodeVisitor = new InternalByteCodeVisitor(methodRefs, fieldRefs, lineNumAttr);
+ try
+ {
+ codeAttr.traverse(byteCodeVisitor);
+ }
+ catch (ClassFormatException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void setMethodAndFieldInfoUses(IClassFileReader reader)
+ {
+ String className = new String(reader.getClassName()).replace('/', '.');
+ IMethodInfo[] methodInfos = reader.getMethodInfos();
+ for (int i = 0; i < methodInfos.length; i++)
+ {
+ String desc = new String(methodInfos[i].getDescriptor());
+ String returnTypeDesc = Signature.getReturnType(desc);
+ String returnType = toFullyQualifiedName(returnTypeDesc);
+ if (Signature.getTypeSignatureKind(returnTypeDesc) != Signature.BASE_TYPE_SIGNATURE && !className.equals(returnType) && include(returnType))
+ {
+ getClassRef(returnType).incRefCount();
+ }
+ String[] params = Signature.getParameterTypes(desc);
+ for (int j = 0; j < params.length; j++)
+ {
+ String param = toFullyQualifiedName(params[j]);
+ if (Signature.getTypeSignatureKind(params[j]) != Signature.BASE_TYPE_SIGNATURE && !className.equals(param) && include(param))
+ {
+ getClassRef(param).incRefCount();
+ }
+ }
+ String[] throwTypes = Signature.getThrownExceptionTypes(desc);
+ for (int j = 0; j < throwTypes.length; j++)
+ {
+ String throwType = toFullyQualifiedName(throwTypes[j]);
+ if (Signature.getTypeSignatureKind(throwTypes[j]) != Signature.BASE_TYPE_SIGNATURE && !className.equals(throwType) && include(throwType))
+ {
+ getClassRef(throwType).incRefCount();
+ }
+ }
+ }
+ IFieldInfo[] fieldInfos = reader.getFieldInfos();
+ for (int i = 0; i < fieldInfos.length; i++)
+ {
+ String desc = new String(fieldInfos[i].getDescriptor());
+ String field = toFullyQualifiedName(desc);
+ if (Signature.getTypeSignatureKind(desc) != Signature.BASE_TYPE_SIGNATURE && !className.equals(field) && include(field))
+ {
+ getClassRef(field).incRefCount();
+ }
+ }
+ }
+
+ private String toFullyQualifiedName(String descriptor)
+ {
+ StringBuffer sb = new StringBuffer();
+ descriptor = descriptor.replace('/', '.');
+ sb.append(Signature.getSignatureQualifier(descriptor));
+ sb.append('.');
+ sb.append(Signature.getSignatureSimpleName(descriptor).replace('.', '$'));
+ return sb.toString();
+ }
+
+ private IConstantPoolEntry[] getConstantPoolEntries(IClassFileReader reader, int kind)
+ {
+ List entries = new Vector();
+ IConstantPool pool = reader.getConstantPool();
+ int poolSize = pool.getConstantPoolCount();
+ for (int i = 0; i < poolSize; i++)
+ if (pool.getEntryKind(i) == kind)
+ entries.add(pool.decodeEntry(i));
+ return (IConstantPoolEntry[])entries.toArray(new IConstantPoolEntry[0]);
+ }
+
+ private ClassRef getClassRef(String name)
+ {
+ ClassRef classRef = refs.getClassRef(name);
+ if (classRef == null)
+ {
+ classRef = new ClassRef();
+ classRef.setName(name);
+ refs.addClassRef(classRef);
+ }
+ return classRef;
+ }
+
+ private org.eclipse.wtp.releng.tools.component.adopters.MethodRef getMethodRef(ClassRef classRef, String name, String descriptor)
+ {
+ org.eclipse.wtp.releng.tools.component.adopters.MethodRef methodRef = classRef.getMethodRef(name, descriptor);
+ if (methodRef == null)
+ {
+ methodRef = new org.eclipse.wtp.releng.tools.component.adopters.MethodRef();
+ methodRef.setName(name);
+ methodRef.setDescriptor(descriptor);
+ classRef.addMethodRef(methodRef);
+ }
+ return methodRef;
+ }
+
+ private org.eclipse.wtp.releng.tools.component.adopters.FieldRef getFieldRef(ClassRef classRef, String name, String descriptor)
+ {
+ org.eclipse.wtp.releng.tools.component.adopters.FieldRef fieldRef = classRef.getFieldRef(name, descriptor);
+ if (fieldRef == null)
+ {
+ fieldRef = new org.eclipse.wtp.releng.tools.component.adopters.FieldRef();
+ fieldRef.setName(name);
+ fieldRef.setDescriptor(descriptor);
+ classRef.addFieldRef(fieldRef);
+ }
+ return fieldRef;
+ }
+
+ private boolean include(String name)
+ {
+ name = name.replace('/', '.');
+ name = name.replace('\\', '.');
+ if (excludes != null && !excludes.isEmpty())
+ for (Iterator it = excludes.iterator(); it.hasNext();)
+ if (name.matches((String)it.next()))
+ return false;
+ if (includes != null && !includes.isEmpty())
+ {
+ for (Iterator it = includes.iterator(); it.hasNext();)
+ if (name.matches((String)it.next()))
+ return true;
+ return false;
+ }
+ return true;
+ }
+
+ private boolean includePlugins(String id)
+ {
+ id = id.replace('/', '.');
+ id = id.replace('\\', '.');
+ if (excludePlugins != null && !excludePlugins.isEmpty())
+ for (Iterator it = excludePlugins.iterator(); it.hasNext();)
+ if (id.matches((String)it.next()))
+ return false;
+ if (includePlugins != null && !includePlugins.isEmpty())
+ {
+ for (Iterator it = includePlugins.iterator(); it.hasNext();)
+ if (id.matches((String)it.next()))
+ return true;
+ return false;
+ }
+ return true;
+ }
+
+ protected String addTrailingSeperator(String s)
+ {
+ if (s != null && !s.endsWith("/") && !s.endsWith("\\"))
+ {
+ StringBuffer sb = new StringBuffer(s);
+ sb.append('/');
+ return sb.toString();
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ CommandOptionParser optionParser = new CommandOptionParser(args);
+ Map options = optionParser.getOptions();
+ Collection src = (Collection)options.get("src");
+ Collection output = (Collection)options.get("output");
+ Collection html = (Collection)options.get("html");
+ Collection includes = (Collection)options.get("includes");
+ Collection excludes = (Collection)options.get("excludes");
+ Collection includePlugins = (Collection)options.get("includePlugins");
+ Collection excludePlugins = (Collection)options.get("excludePlugins");
+ if (src == null || output == null || src.isEmpty() || output.isEmpty())
+ {
+ printUsage();
+ System.exit(-1);
+ }
+ SimpleClass2Reference class2Ref = new SimpleClass2Reference();
+ class2Ref.setSrc((String)src.iterator().next());
+ class2Ref.setOutput((String)output.iterator().next());
+ class2Ref.setHTML((String)html.iterator().next());
+ class2Ref.setIncludes(includes);
+ class2Ref.setExcludes(excludes);
+ class2Ref.setIncludePlugins(includePlugins);
+ class2Ref.setExcludePlugins(excludePlugins);
+ class2Ref.execute();
+ }
+
+ private static void printUsage()
+ {
+ System.out.println("Usage: java org.eclipse.wtp.releng.tools.component.adopters.SimpleClass2Reference -src <src> -output <output> [-options]");
+ System.out.println("");
+ System.out.println("\t-src\t\t<src>\t\tlocation of a Eclipse-based product");
+ System.out.println("\t-output\t\t<output>\toutput file");
+ System.out.println("");
+ System.out.println("where options include:");
+ System.out.println("");
+ System.out.println("\t-includes\t<includes>\tspace seperated packages to include");
+ System.out.println("\t-excludes\t<excludes>\tspace seperated packages to exclude");
+ System.out.println("\t-includePlugins\t<includePlugins>\tspace seperated plugins to include");
+ System.out.println("\t-excludePlugins\t<excludePlugins>\tspace seperated plugins to exclude");
+ System.out.println("\t-genHTML\t\t\t\tgenerate HTML output");
+ }
+}
\ No newline at end of file
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/xsl/api-ref-compatibility.xsl b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/xsl/api-ref-compatibility.xsl
new file mode 100644
index 0000000..34a20bc
--- /dev/null
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/xsl/api-ref-compatibility.xsl
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="/">
+ <html>
+ <body>
+ <table border="1">
+ <tr>
+ <th>Name</th>
+ <th>Reference count</th>
+ <th>Subclass count</th>
+ <th>Implement count</th>
+ <th>Instantiate count</th>
+ </tr>
+ <xsl:for-each select="references/class">
+ <xsl:sort select="@name"/>
+ <xsl:apply-templates select="." />
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template match="class">
+ <tr>
+ <td><b><xsl:value-of select="@name"/></b></td>
+ <td><xsl:value-of select="@ref"/></td>
+ <td><xsl:value-of select="@subclass"/></td>
+ <td><xsl:value-of select="@impl"/></td>
+ <td><xsl:value-of select="@instantiate"/></td>
+ </tr>
+ <xsl:for-each select="method">
+ <xsl:sort select="@name"/>
+ <xsl:apply-templates select="." />
+ </xsl:for-each>
+ <xsl:for-each select="field">
+ <xsl:sort select="@name"/>
+ <xsl:apply-templates select="." />
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="method">
+ <tr>
+ <td>   <i><xsl:value-of select="@name"/>(...)</i></td>
+ <td><xsl:value-of select="@ref"/></td>
+ <td bgcolor="c8c8c8"> </td>
+ <td bgcolor="c8c8c8"> </td>
+ <td bgcolor="c8c8c8"> </td>
+ </tr>
+ </xsl:template>
+ <xsl:template match="field">
+ <tr>
+ <td>   <i><xsl:value-of select="@name"/></i></td>
+ <td><xsl:value-of select="@ref"/></td>
+ <td bgcolor="c8c8c8"> </td>
+ <td bgcolor="c8c8c8"> </td>
+ <td bgcolor="c8c8c8"> </td>
+ </tr>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file