View Javadoc

1   /*
2    * $Id: JenaRuntimeResolver.java,v 1.5 2004/09/20 14:21:38 jlerner Exp $
3    * Created on Apr 21, 2004
4    *
5    * Copyright (c) 1999-2004, BBN Technologies, LLC.
6    * All rights reserved.
7    * http://www.daml.org/legal/opensource/bbn_license.html
8    */
9   
10  package com.bbn.jena;
11  
12  import org.eclipse.core.runtime.CoreException;
13  import org.eclipse.core.runtime.Path;
14  import org.eclipse.debug.core.ILaunchConfiguration;
15  import org.eclipse.jdt.core.IClasspathEntry;
16  import org.eclipse.jdt.core.IJavaProject;
17  import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
18  import org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver;
19  import org.eclipse.jdt.launching.IVMInstall;
20  import org.eclipse.jdt.launching.JavaRuntime;
21  
22  /***
23   * Provides access to the Jena jars at runtime for projects using the Jena
24   * classpath container.
25   * @author tself
26   * @author jlerner
27   */
28  public class JenaRuntimeResolver implements IRuntimeClasspathEntryResolver
29  {
30  
31     /* (non-Javadoc)
32      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(
33      *       org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.debug.core.ILaunchConfiguration)
34      */
35     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(
36        IRuntimeClasspathEntry entry,
37        ILaunchConfiguration configuration)
38        throws CoreException
39     {
40        String[] jars = JenaPlugin.getJenaPlugin().getJenaLibraryLocations();
41        IRuntimeClasspathEntry[] rtVal = new IRuntimeClasspathEntry[jars.length];
42        for (int i = 0; i < jars.length; i++)
43        {
44           rtVal[i] =
45              JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(jars[i]));
46        }
47        return rtVal;
48     }
49  
50     /* (non-Javadoc)
51      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(
52      *       org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.jdt.core.IJavaProject)
53      */
54     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(
55        IRuntimeClasspathEntry entry,
56        IJavaProject project)
57        throws CoreException
58     {
59        String[] jars = JenaPlugin.getJenaPlugin().getJenaLibraryLocations();
60        IRuntimeClasspathEntry[] rtVal = new IRuntimeClasspathEntry[jars.length];
61        for (int i = 0; i < jars.length; i++)
62        {
63           rtVal[i] =
64              JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(jars[i]));
65        }
66        return rtVal;
67     }
68  
69     /* (non-Javadoc)
70      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveVMInstall(
71      *       org.eclipse.jdt.core.IClasspathEntry)
72      */
73     public IVMInstall resolveVMInstall(IClasspathEntry entry)
74        throws CoreException
75     {
76        return null;
77     }
78  
79  }