harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r792853 - in /harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments: AccessRuleParticipant.java Activator.java ExecutionEnvironmentAnalyzer.java
Date Fri, 10 Jul 2009 09:30:06 GMT
Author: tellison
Date: Fri Jul 10 09:30:06 2009
New Revision: 792853

URL: http://svn.apache.org/viewvc?rev=792853&view=rev
Log:
Add comments and logging.

Modified:
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java

Modified: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java?rev=792853&r1=792852&r2=792853&view=diff
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
(original)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
Fri Jul 10 09:30:06 2009
@@ -37,14 +37,22 @@
 
     static String[] packages = null;
 
+    /**
+     * Returns an array of access rules to be applied to the specified runtime
+     * libraries and execution environment in the context of the given project.
+     * 
+     * An array of access rules is returned for each library specified by
+     * libraries.
+     */
     public IAccessRule[][] getAccessRules(IExecutionEnvironment environment,
             IVMInstall vm, LibraryLocation[] libraries, IJavaProject project) {
 
-        // Read list of packages
+        // Read list of packages in our definition
         if (packages == null) {
             try {
                 packages = getPackages();
             } catch (IOException e) {
+                Activator.getDefault().log("Unable to read package definition", e);
                 return new IAccessRule[0][];
             }
         }
@@ -66,9 +74,15 @@
         for (int i = 0; i < allRules.length; i++) {
             allRules[i] = packageRules;
         }
+
         return allRules;
     }
 
+    /*
+     * Read the list of packages that make up the execution environment from a resource file.
+     * 
+     * Ignores blank lines and lines that start with a #. 
+     */
     private String[] getPackages() throws IOException {
         InputStream is = this.getClass().getResourceAsStream("/Harmony-Select-1.0");
         BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
@@ -76,9 +90,9 @@
         ArrayList<String> pkgs = new ArrayList<String>(50);
         String line = br.readLine();
         while (line != null) {
-            line = line.trim();
-            if (line.length() != 0 && line.charAt(0) != '#') {
-                pkgs.add(line + "/*");
+            String trimLine = line.trim();
+            if (trimLine.length() != 0 && line.charAt(0) != '#') {
+                pkgs.add(trimLine + "/*");
             }
             line = br.readLine();
         }

Modified: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java?rev=792853&r1=792852&r2=792853&view=diff
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
(original)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
Fri Jul 10 09:30:06 2009
@@ -17,7 +17,10 @@
 
 package org.apache.harmony.eclipse.jdt.launching.environments;
 
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -25,43 +28,82 @@
  */
 public class Activator extends Plugin {
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.apache.harmony.eclipse.jdt.launching.environments";
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.apache.harmony.eclipse.jdt.launching.environments";
 
-	// The shared instance
-	private static Activator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public Activator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static Activator getDefault() {
-		return plugin;
-	}
+    // The shared instance
+    private static Activator plugin;
+
+    /**
+     * The constructor
+     */
+    public Activator() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+     */
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        plugin = this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop(BundleContext context) throws Exception {
+        plugin = null;
+        super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     * 
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return plugin;
+    }
+
+    /**
+     * Convenience method to write status information to the platform log.
+     * 
+     * @param msg
+     *            information to be written to the platform log.
+     */
+    public void log(String msg) {
+        log(msg, null);
+    }
+
+    /**
+     * Convenience method to write problem information to the platform log.
+     * 
+     * @param msg
+     *            additional information about the event
+     * @param e
+     *            exception encapsulating any non-fatal problem
+     */
+    public void log(String msg, Exception e) {
+        getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
+    }
+
+    /**
+     * Convenience method to write error information to the platform log.
+     * 
+     * @param msg
+     *            additional information about the event
+     * @param e
+     *            exception encapsulating the error
+     */
+    public void logError(String msg, Exception e) {
+        getLog().log(
+                new Status(IStatus.INFO, PLUGIN_ID, IStatus.ERROR, msg, e));
+    }
 
 }

Modified: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java?rev=792853&r1=792852&r2=792853&view=diff
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java
(original)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java
Fri Jul 10 09:30:06 2009
@@ -30,16 +30,25 @@
 public class ExecutionEnvironmentAnalyzer implements
         IExecutionEnvironmentAnalyzerDelegate {
 
+    /**
+     * Analyzes the given vm install and returns a collection of compatible
+     * Select execution environments, possibly empty.
+     * 
+     * For Select we may match on a subset of SE installs.
+     */
     public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
             throws CoreException {
 
         // Get the Java version string from the VM
-        if (!(vm instanceof IVMInstall2))
+        if (!(vm instanceof IVMInstall2)) {
+            Activator.getDefault().log("VM is not a v2 installation : " + vm.getName());
             return new CompatibleEnvironment[0];
+        }
         IVMInstall2 vm2 = (IVMInstall2) vm;
 
         String javaVersion = vm2.getJavaVersion();
         if (javaVersion == null) {
+            Activator.getDefault().log("VM does not report version string");
             return new CompatibleEnvironment[0];
         }
 
@@ -52,6 +61,8 @@
             IExecutionEnvironment env = manager.getEnvironment("Harmony-Select-1.0");
             if (env != null) {
                 CompatibleEnvironment[] result = new CompatibleEnvironment[1];
+                // SE is not a perfect match
+                // TODO: figure out how we detect a real Select runtime
                 result[0] = new CompatibleEnvironment(env, false);
                 return result;
             }



Mime
View raw message