diff options
author | rbrooks | 2010-07-24 17:38:31 +0000 |
---|---|---|
committer | rbrooks | 2010-07-24 17:38:31 +0000 |
commit | 4081f04850d3eff9eb1bd7241763707bfbb43a45 (patch) | |
tree | 258620df94d4b24077ff103a6c4dea9cb78493fb /plugins/org.eclipse.osee.ote.runtimeManager | |
parent | 4ed8bddc791fda93940f238c5135556a07041dc0 (diff) | |
download | org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.gz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.xz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.zip |
applied Eclipse source cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.ote.runtimeManager')
14 files changed, 625 insertions, 642 deletions
diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/EarlyStartup.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/EarlyStartup.java index 6eca8102076..0d04f34dd19 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/EarlyStartup.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/EarlyStartup.java @@ -23,22 +23,22 @@ import org.osgi.framework.BundleException; */ public class EarlyStartup implements IStartup { - private SafeWorkspaceTracker workspaceTracker; + private SafeWorkspaceTracker workspaceTracker; - @Override - public void earlyStartup() { - Displays.ensureInDisplayThread(new Runnable() { - @Override - public void run() { - try { - Bundle bundle = Platform.getBundle("org.eclipse.osee.ote.runtimeManager"); - bundle.start(); - workspaceTracker = new SafeWorkspaceTracker(bundle.getBundleContext()); - workspaceTracker.open(true); - } catch (BundleException ex) { - OseeLog.log(RuntimeManager.class, Level.SEVERE, ex); - } - } - }); - } + @Override + public void earlyStartup() { + Displays.ensureInDisplayThread(new Runnable() { + @Override + public void run() { + try { + Bundle bundle = Platform.getBundle("org.eclipse.osee.ote.runtimeManager"); + bundle.start(); + workspaceTracker = new SafeWorkspaceTracker(bundle.getBundleContext()); + workspaceTracker.open(true); + } catch (BundleException ex) { + OseeLog.log(RuntimeManager.class, Level.SEVERE, ex); + } + } + }); + } } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/JarListenerStub.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/JarListenerStub.java index 512c42e548e..61952492cae 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/JarListenerStub.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/JarListenerStub.java @@ -24,7 +24,6 @@ import org.eclipse.osee.ote.core.BundleInfo; /** * @author Robert A. Fisher - * */ public class JarListenerStub<T extends JarCollectionNature> implements IJarChangeListener<T> { @@ -39,7 +38,7 @@ public class JarListenerStub<T extends JarCollectionNature> implements IJarChang this.changedBundles = new HashSet<String>(); this.removedBundles = new HashSet<String>(); } - + @Override public void handleBundleAdded(URL url) { try { @@ -94,7 +93,7 @@ public class JarListenerStub<T extends JarCollectionNature> implements IJarChang public void handlePostChange() { System.out.println("Bunch of changes just finished"); } - + private <S extends Object> Set<S> duplicateAndClear(Set<S> set) { synchronized (bundleSynchronizer) { Set<S> returnBundles = new HashSet<S>(set); @@ -133,7 +132,7 @@ public class JarListenerStub<T extends JarCollectionNature> implements IJarChang File file; try { file = new File(url.toURI()); - } catch(URISyntaxException ex) { + } catch (URISyntaxException ex) { file = new File(url.getPath()); } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/LibJarListener.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/LibJarListener.java index 130b12457f0..612e4a99f80 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/LibJarListener.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/LibJarListener.java @@ -18,7 +18,6 @@ import java.util.HashSet; import java.util.Set; import java.util.jar.JarFile; import java.util.jar.Manifest; - import org.eclipse.core.resources.IProject; import org.eclipse.osee.framework.ui.workspacebundleloader.FileChangeDetector; import org.eclipse.osee.framework.ui.workspacebundleloader.IJarChangeListener; @@ -29,143 +28,140 @@ import org.eclipse.osee.ote.runtimemanager.container.OteClasspathContainer; /** * @author Robert A. Fisher */ -public class LibJarListener<T extends JarCollectionNature> implements - IJarChangeListener<T> { - - private static final boolean VERBOSE_DEBUG = true; - - private FileChangeDetector detector = new FileChangeDetector(); - - private final Object bundleSynchronizer; - private final Set<URL> newBundles; - private final Set<URL> changedBundles; - private final Set<URL> removedBundles; - - - - public LibJarListener() { - this.bundleSynchronizer = new Object(); - this.newBundles = new HashSet<URL>(); - this.changedBundles = new HashSet<URL>(); - this.removedBundles = new HashSet<URL>(); - } - - @Override - public void handleBundleAdded(URL url) { - synchronized (bundleSynchronizer) { - if (detector.isChanged(url)) { - newBundles.add(url); - changedBundles.remove(url); - removedBundles.remove(url); - debugEcho(url); - } - } - } - - @Override - public void handleBundleChanged(URL url) { - synchronized (bundleSynchronizer) { - if (detector.isChanged(url)) { - changedBundles.add(url); - newBundles.remove(url); - removedBundles.remove(url); - debugEcho(url); - } - } - } - - @Override - public void handleBundleRemoved(URL url) { - synchronized (bundleSynchronizer) { - detector.remove(url); - removedBundles.add(url); - newBundles.remove(url); - changedBundles.remove(url); - } - debugEcho(url); - } - - /** - * @param url - */ - private void debugEcho(URL url) { - if (VERBOSE_DEBUG) { - try { - String bundleName = getBundleNameFromJar(url); - System.out.println("Bundle changed:" + bundleName); - } catch (IOException ex) { - } - } - } - - @Override - public void handleNatureClosed(T nature) { - IProject project = nature.getProject(); - System.out.println("Project closed: " + project.getName()); - for (URL url : nature.getBundles()) { - handleBundleRemoved(url); - } - - nature.setClosing(true); - updateContainers(); - nature.setClosing(false); - } - - private void updateContainers() { - OteClasspathContainer.refreshAll(); - } - - @Override - public void handlePostChange() { - updateContainers(); - System.out.println("Bunch of changes just finished"); - } - - private <S extends Object> Set<S> duplicateAndClear(Set<S> set) { - synchronized (bundleSynchronizer) { - Set<S> returnBundles = new HashSet<S>(set); - set.clear(); - return returnBundles; - } - } - - /** - * @return the newBundles - */ - public Set<URL> consumeNewBundles() { - return duplicateAndClear(newBundles); - } - - /** - * @return the changedBundles - */ - public Set<URL> consumeChangedBundles() { - return duplicateAndClear(changedBundles); - } - - /** - * @return the removedBundles - */ - public Set<URL> consumeRemovedBundles() { - return duplicateAndClear(removedBundles); - } - - /** - * @param url - * @return - * @throws IOException - */ - private String getBundleNameFromJar(URL url) throws IOException { - File file; - try { - file = new File(url.toURI()); - } catch (URISyntaxException ex) { - file = new File(url.getPath()); - } - - JarFile jarFile = new JarFile(file); - Manifest jarManifest = jarFile.getManifest(); - return BundleInfo.generateBundleName(jarManifest); - } +public class LibJarListener<T extends JarCollectionNature> implements IJarChangeListener<T> { + + private static final boolean VERBOSE_DEBUG = true; + + private final FileChangeDetector detector = new FileChangeDetector(); + + private final Object bundleSynchronizer; + private final Set<URL> newBundles; + private final Set<URL> changedBundles; + private final Set<URL> removedBundles; + + public LibJarListener() { + this.bundleSynchronizer = new Object(); + this.newBundles = new HashSet<URL>(); + this.changedBundles = new HashSet<URL>(); + this.removedBundles = new HashSet<URL>(); + } + + @Override + public void handleBundleAdded(URL url) { + synchronized (bundleSynchronizer) { + if (detector.isChanged(url)) { + newBundles.add(url); + changedBundles.remove(url); + removedBundles.remove(url); + debugEcho(url); + } + } + } + + @Override + public void handleBundleChanged(URL url) { + synchronized (bundleSynchronizer) { + if (detector.isChanged(url)) { + changedBundles.add(url); + newBundles.remove(url); + removedBundles.remove(url); + debugEcho(url); + } + } + } + + @Override + public void handleBundleRemoved(URL url) { + synchronized (bundleSynchronizer) { + detector.remove(url); + removedBundles.add(url); + newBundles.remove(url); + changedBundles.remove(url); + } + debugEcho(url); + } + + /** + * @param url + */ + private void debugEcho(URL url) { + if (VERBOSE_DEBUG) { + try { + String bundleName = getBundleNameFromJar(url); + System.out.println("Bundle changed:" + bundleName); + } catch (IOException ex) { + } + } + } + + @Override + public void handleNatureClosed(T nature) { + IProject project = nature.getProject(); + System.out.println("Project closed: " + project.getName()); + for (URL url : nature.getBundles()) { + handleBundleRemoved(url); + } + + nature.setClosing(true); + updateContainers(); + nature.setClosing(false); + } + + private void updateContainers() { + OteClasspathContainer.refreshAll(); + } + + @Override + public void handlePostChange() { + updateContainers(); + System.out.println("Bunch of changes just finished"); + } + + private <S extends Object> Set<S> duplicateAndClear(Set<S> set) { + synchronized (bundleSynchronizer) { + Set<S> returnBundles = new HashSet<S>(set); + set.clear(); + return returnBundles; + } + } + + /** + * @return the newBundles + */ + public Set<URL> consumeNewBundles() { + return duplicateAndClear(newBundles); + } + + /** + * @return the changedBundles + */ + public Set<URL> consumeChangedBundles() { + return duplicateAndClear(changedBundles); + } + + /** + * @return the removedBundles + */ + public Set<URL> consumeRemovedBundles() { + return duplicateAndClear(removedBundles); + } + + /** + * @param url + * @return + * @throws IOException + */ + private String getBundleNameFromJar(URL url) throws IOException { + File file; + try { + file = new File(url.toURI()); + } catch (URISyntaxException ex) { + file = new File(url.getPath()); + } + + JarFile jarFile = new JarFile(file); + Manifest jarManifest = jarFile.getManifest(); + return BundleInfo.generateBundleName(jarManifest); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteSystemLibsNature.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteSystemLibsNature.java index 3ed696e7340..9d945b0ffe6 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteSystemLibsNature.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteSystemLibsNature.java @@ -17,11 +17,11 @@ import org.eclipse.osee.framework.ui.workspacebundleloader.JarCollectionNature; public class OteSystemLibsNature extends JarCollectionNature { public static final String NATURE_ID = "org.eclipse.osee.ote.runtimeManager.OteSystemLibsNature"; private static final String BUNDLE_PATH_ATTRIBUTE = "OteBundlePath"; - + public OteSystemLibsNature() { super(BUNDLE_PATH_ATTRIBUTE); } - + public static Collection<OteSystemLibsNature> getWorkspaceProjects() throws CoreException { return getWorkspaceProjects(NATURE_ID, OteSystemLibsNature.class); } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteUserLibsNature.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteUserLibsNature.java index 8e01f5f69db..f4334c43631 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteUserLibsNature.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/OteUserLibsNature.java @@ -17,11 +17,11 @@ import org.eclipse.osee.framework.ui.workspacebundleloader.JarCollectionNature; public class OteUserLibsNature extends JarCollectionNature { public static final String NATURE_ID = "org.eclipse.osee.ote.runtimeManager.OteUserLibsNature"; private static final String BUNDLE_PATH_ATTRIBUTE = "OteBundlePath"; - + public OteUserLibsNature() { super(BUNDLE_PATH_ATTRIBUTE); } - + public static Collection<OteUserLibsNature> getWorkspaceProjects() throws CoreException { return getWorkspaceProjects(NATURE_ID, OteUserLibsNature.class); } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/RuntimeManager.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/RuntimeManager.java index 86b31178265..4a37a72cb28 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/RuntimeManager.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/RuntimeManager.java @@ -17,28 +17,28 @@ import org.osgi.framework.BundleContext; * @author Robert A. Fisher */ public class RuntimeManager implements BundleActivator { - public static final String BUNDLE_ID = "org.eclipse.osee.ote.runtimeManager"; - private static RuntimeManager instance; - private BundleContext context; + public static final String BUNDLE_ID = "org.eclipse.osee.ote.runtimeManager"; + private static RuntimeManager instance; + private BundleContext context; - public static RuntimeManager getDefault() { - return instance; - } + public static RuntimeManager getDefault() { + return instance; + } - @Override - public void start(BundleContext context) throws Exception { - instance = this; - this.context = context; - } + @Override + public void start(BundleContext context) throws Exception { + instance = this; + this.context = context; + } - @Override - public void stop(BundleContext context) throws Exception { - instance = null; - this.context = null; - } + @Override + public void stop(BundleContext context) throws Exception { + instance = null; + this.context = null; + } - public BundleContext getContext() { - return context; - } + public BundleContext getContext() { + return context; + } } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/SafeWorkspaceTracker.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/SafeWorkspaceTracker.java index c77364a80bc..7151e7e63c9 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/SafeWorkspaceTracker.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/SafeWorkspaceTracker.java @@ -48,236 +48,236 @@ import org.osgi.util.tracker.ServiceTracker; */ public class SafeWorkspaceTracker extends ServiceTracker implements OteBundleLocator { - private JarChangeResourceListener<OteSystemLibsNature> systemLibResourceListener; - private JarChangeResourceListener<OteUserLibsNature> userLibResourceListener; - private LibJarListener<OteSystemLibsNature> systemLibListener; - private LibJarListener<OteUserLibsNature> userLibListener; - private ProjectChangeResourceListener projectChangeResourceListener; - private RuntimeBundleServer bundleServer; - private SafeWorkspaceAccess service; - private final BundleContext context; - - /** - * @param context - * @param filter - * @param customizer - */ - public SafeWorkspaceTracker(BundleContext context) { - super(context, SafeWorkspaceAccess.class.getName(), null); - this.context = context; - } - - @Override - public Object addingService(ServiceReference reference) { - this.systemLibListener = new LibJarListener<OteSystemLibsNature>(); - this.userLibListener = new LibJarListener<OteUserLibsNature>(); - this.systemLibResourceListener = - new JarChangeResourceListener<OteSystemLibsNature>(OteSystemLibsNature.NATURE_ID, systemLibListener); - this.userLibResourceListener = - new JarChangeResourceListener<OteUserLibsNature>(OteUserLibsNature.NATURE_ID, userLibListener); - this.projectChangeResourceListener = new ProjectChangeResourceListener(); - service = (SafeWorkspaceAccess) context.getService(reference); - slowLoadingJars(); - - return super.addingService(reference); - } - - /** + private JarChangeResourceListener<OteSystemLibsNature> systemLibResourceListener; + private JarChangeResourceListener<OteUserLibsNature> userLibResourceListener; + private LibJarListener<OteSystemLibsNature> systemLibListener; + private LibJarListener<OteUserLibsNature> userLibListener; + private ProjectChangeResourceListener projectChangeResourceListener; + private RuntimeBundleServer bundleServer; + private SafeWorkspaceAccess service; + private final BundleContext context; + + /** + * @param context + * @param filter + * @param customizer + */ + public SafeWorkspaceTracker(BundleContext context) { + super(context, SafeWorkspaceAccess.class.getName(), null); + this.context = context; + } + + @Override + public Object addingService(ServiceReference reference) { + this.systemLibListener = new LibJarListener<OteSystemLibsNature>(); + this.userLibListener = new LibJarListener<OteUserLibsNature>(); + this.systemLibResourceListener = + new JarChangeResourceListener<OteSystemLibsNature>(OteSystemLibsNature.NATURE_ID, systemLibListener); + this.userLibResourceListener = + new JarChangeResourceListener<OteUserLibsNature>(OteUserLibsNature.NATURE_ID, userLibListener); + this.projectChangeResourceListener = new ProjectChangeResourceListener(); + service = (SafeWorkspaceAccess) context.getService(reference); + slowLoadingJars(); + + return super.addingService(reference); + } + + /** * */ - private void slowLoadingJars() { - Jobs.runInJob(new LocateWorkspaceBundles("Locating Workspace Bundles", RuntimeManager.BUNDLE_ID), false); - - } - - private class LocateWorkspaceBundles extends AbstractOperation { - /** - * @param operationName - * @param pluginId - */ - public LocateWorkspaceBundles(String operationName, String pluginId) { - super(operationName, pluginId); - } - - @SuppressWarnings("rawtypes") - @Override - protected void doWork(IProgressMonitor monitor) throws Exception { - IWorkspace workspace = service.getWorkspace(); - try { - scrapeAllLibs(); - } catch (CoreException ex) { - OseeLog.log(RuntimeManager.class, Level.SEVERE, ex); - } - workspace.addResourceChangeListener(systemLibResourceListener); - workspace.addResourceChangeListener(userLibResourceListener); - - SafeWorkspaceTracker.this.bundleServer = new RuntimeBundleServer(SafeWorkspaceTracker.this); - - context.registerService(OteBundleLocator.class.getName(), SafeWorkspaceTracker.this, new Hashtable()); - OteClasspathContainer.refreshAll(); - } - } - - private void scrapeAllLibs() throws CoreException { - for (OteSystemLibsNature nature : OteSystemLibsNature.getWorkspaceProjects()) { - for (URL url : nature.getBundles()) { - systemLibListener.handleBundleAdded(url); - } - - projectChangeResourceListener.addProject(nature.getProject()); - } - for (OteUserLibsNature nature : OteUserLibsNature.getWorkspaceProjects()) { - for (URL url : nature.getBundles()) { - userLibListener.handleBundleAdded(url); - } - - projectChangeResourceListener.addProject(nature.getProject()); - } - } - - @Override - public synchronized void close() { - IWorkspace workspace = service.getWorkspace(); - if (workspace != null) { - workspace.removeResourceChangeListener(systemLibResourceListener); - workspace.removeResourceChangeListener(userLibResourceListener); - } - super.close(); - } - - /** - * Returns a list of URL's to workspace jars to be used for the test server. The collection returned is a combination - * of all the user libraries and any system libraries that weren't already supplied in the user libraries. The - * workspace is considered to have runtime libraries only if there are system libraries present. Subsequently, if no - * system libraries are in the workspace then this method will return an empty collection. - * - * @return runtime library bundle infos - * @throws IOException - * @throws CoreException - */ - @Override - public Collection<BundleInfo> getRuntimeLibs() throws IOException, CoreException { - Collection<URL> userLibUrls = getUserLibUrls(); - Collection<URL> systemLibUrls = getSystemLibUrls(); - // If there are no system libs, then claim no runtime libs - if (!systemLibUrls.isEmpty()) { - return getRuntimeLibs(systemLibUrls, userLibUrls); - } else { - return Collections.emptyList(); - } - } - - private Collection<BundleInfo> getRuntimeLibs(Collection<URL> systemLibUrls, Collection<URL> userLibUrls) throws IOException { - Map<String, BundleInfo> runtimeMap = new HashMap<String, BundleInfo>(); - Collection<BundleInfo> runtimeInfos = new LinkedList<BundleInfo>(); - - // First add all of the system libraries to the map - for (URL url : systemLibUrls) { - String symbolicName = getBundleNameFromJar(url); - - runtimeMap.put(symbolicName, new BundleInfo(url, bundleServer.getClassServerPath(), true)); - } - - // Now add the user libraries so any system library with the same name - // gets replaced - for (URL url : userLibUrls) { - String symbolicName = getBundleNameFromJar(url); - - runtimeMap.put(symbolicName, new BundleInfo(url, bundleServer.getClassServerPath(), false)); - } - - runtimeInfos.addAll(runtimeMap.values()); - - return runtimeInfos; - } - - /** - * Returns a list of URL's to all system libraries in the workspace regardless of ones that are supplied in user - * libraries. - * - * @return system library URL's - * @throws CoreException - */ - public Collection<URL> getSystemLibUrls() throws CoreException { - Collection<URL> libs = new LinkedList<URL>(); - for (OteSystemLibsNature systemNature : OteSystemLibsNature.getWorkspaceProjects()) { - libs.addAll(systemNature.getBundles()); - } - - return libs; - } - - /** - * Returns a list of URL's to all user libraries in the workspace. - * - * @return user library URL's - * @throws CoreException - */ - public Collection<URL> getUserLibUrls() throws CoreException { - Collection<URL> libs = new LinkedList<URL>(); - for (OteUserLibsNature userNature : OteUserLibsNature.getWorkspaceProjects()) { - libs.addAll(userNature.getBundles()); - } - - return libs; - } - - /** - * @param url - * @return - * @throws IOException - */ - private String getBundleNameFromJar(URL url) throws IOException { - File file; - try { - file = new File(url.toURI()); - } catch (URISyntaxException ex) { - file = new File(url.getPath()); - } - - JarFile jarFile = new JarFile(file); - Manifest jarManifest = jarFile.getManifest(); - return BundleInfo.generateBundleName(jarManifest); - } - - /** - * Returns a list of all bundles that have been modified since the last time this was called. - * - * @throws CoreException - * @throws IOException - */ - @Override - public Collection<BundleInfo> consumeModifiedLibs() throws IOException { - // Collection<BundleInfo> modifiedLibs = new LinkedList<BundleInfo>(); - - Set<URL> sysNewBundles = systemLibListener.consumeNewBundles(); - Set<URL> sysChangedBundles = systemLibListener.consumeChangedBundles(); - // Set<URL> sysRemovedBundles = - systemLibListener.consumeRemovedBundles(); - - Set<URL> userNewBundles = userLibListener.consumeNewBundles(); - Set<URL> userChangedBundles = userLibListener.consumeChangedBundles(); - // Set<URL> userRemovedBundles = - userLibListener.consumeRemovedBundles(); - - Collection<URL> sysNewModLibs = new ArrayList<URL>(sysNewBundles.size() + sysChangedBundles.size()); - sysNewModLibs.addAll(sysNewBundles); - sysNewModLibs.addAll(sysChangedBundles); - - Collection<URL> userNewModLibs = new ArrayList<URL>(userNewBundles.size() + userChangedBundles.size()); - userNewModLibs.addAll(userNewBundles); - userNewModLibs.addAll(userChangedBundles); - - // TODO what about removed libs? - return getRuntimeLibs(sysNewModLibs, userNewModLibs); - - // // For now, return all user libs - // for (BundleInfo info : getRuntimeLibs()) { - // if (!info.isSystemLibrary()) { - // modifiedLibs.add(info); - // } - // } - // - // return modifiedLibs; - } + private void slowLoadingJars() { + Jobs.runInJob(new LocateWorkspaceBundles("Locating Workspace Bundles", RuntimeManager.BUNDLE_ID), false); + + } + + private class LocateWorkspaceBundles extends AbstractOperation { + /** + * @param operationName + * @param pluginId + */ + public LocateWorkspaceBundles(String operationName, String pluginId) { + super(operationName, pluginId); + } + + @SuppressWarnings("rawtypes") + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + IWorkspace workspace = service.getWorkspace(); + try { + scrapeAllLibs(); + } catch (CoreException ex) { + OseeLog.log(RuntimeManager.class, Level.SEVERE, ex); + } + workspace.addResourceChangeListener(systemLibResourceListener); + workspace.addResourceChangeListener(userLibResourceListener); + + SafeWorkspaceTracker.this.bundleServer = new RuntimeBundleServer(SafeWorkspaceTracker.this); + + context.registerService(OteBundleLocator.class.getName(), SafeWorkspaceTracker.this, new Hashtable()); + OteClasspathContainer.refreshAll(); + } + } + + private void scrapeAllLibs() throws CoreException { + for (OteSystemLibsNature nature : OteSystemLibsNature.getWorkspaceProjects()) { + for (URL url : nature.getBundles()) { + systemLibListener.handleBundleAdded(url); + } + + projectChangeResourceListener.addProject(nature.getProject()); + } + for (OteUserLibsNature nature : OteUserLibsNature.getWorkspaceProjects()) { + for (URL url : nature.getBundles()) { + userLibListener.handleBundleAdded(url); + } + + projectChangeResourceListener.addProject(nature.getProject()); + } + } + + @Override + public synchronized void close() { + IWorkspace workspace = service.getWorkspace(); + if (workspace != null) { + workspace.removeResourceChangeListener(systemLibResourceListener); + workspace.removeResourceChangeListener(userLibResourceListener); + } + super.close(); + } + + /** + * Returns a list of URL's to workspace jars to be used for the test server. The collection returned is a combination + * of all the user libraries and any system libraries that weren't already supplied in the user libraries. The + * workspace is considered to have runtime libraries only if there are system libraries present. Subsequently, if no + * system libraries are in the workspace then this method will return an empty collection. + * + * @return runtime library bundle infos + * @throws IOException + * @throws CoreException + */ + @Override + public Collection<BundleInfo> getRuntimeLibs() throws IOException, CoreException { + Collection<URL> userLibUrls = getUserLibUrls(); + Collection<URL> systemLibUrls = getSystemLibUrls(); + // If there are no system libs, then claim no runtime libs + if (!systemLibUrls.isEmpty()) { + return getRuntimeLibs(systemLibUrls, userLibUrls); + } else { + return Collections.emptyList(); + } + } + + private Collection<BundleInfo> getRuntimeLibs(Collection<URL> systemLibUrls, Collection<URL> userLibUrls) throws IOException { + Map<String, BundleInfo> runtimeMap = new HashMap<String, BundleInfo>(); + Collection<BundleInfo> runtimeInfos = new LinkedList<BundleInfo>(); + + // First add all of the system libraries to the map + for (URL url : systemLibUrls) { + String symbolicName = getBundleNameFromJar(url); + + runtimeMap.put(symbolicName, new BundleInfo(url, bundleServer.getClassServerPath(), true)); + } + + // Now add the user libraries so any system library with the same name + // gets replaced + for (URL url : userLibUrls) { + String symbolicName = getBundleNameFromJar(url); + + runtimeMap.put(symbolicName, new BundleInfo(url, bundleServer.getClassServerPath(), false)); + } + + runtimeInfos.addAll(runtimeMap.values()); + + return runtimeInfos; + } + + /** + * Returns a list of URL's to all system libraries in the workspace regardless of ones that are supplied in user + * libraries. + * + * @return system library URL's + * @throws CoreException + */ + public Collection<URL> getSystemLibUrls() throws CoreException { + Collection<URL> libs = new LinkedList<URL>(); + for (OteSystemLibsNature systemNature : OteSystemLibsNature.getWorkspaceProjects()) { + libs.addAll(systemNature.getBundles()); + } + + return libs; + } + + /** + * Returns a list of URL's to all user libraries in the workspace. + * + * @return user library URL's + * @throws CoreException + */ + public Collection<URL> getUserLibUrls() throws CoreException { + Collection<URL> libs = new LinkedList<URL>(); + for (OteUserLibsNature userNature : OteUserLibsNature.getWorkspaceProjects()) { + libs.addAll(userNature.getBundles()); + } + + return libs; + } + + /** + * @param url + * @return + * @throws IOException + */ + private String getBundleNameFromJar(URL url) throws IOException { + File file; + try { + file = new File(url.toURI()); + } catch (URISyntaxException ex) { + file = new File(url.getPath()); + } + + JarFile jarFile = new JarFile(file); + Manifest jarManifest = jarFile.getManifest(); + return BundleInfo.generateBundleName(jarManifest); + } + + /** + * Returns a list of all bundles that have been modified since the last time this was called. + * + * @throws CoreException + * @throws IOException + */ + @Override + public Collection<BundleInfo> consumeModifiedLibs() throws IOException { + // Collection<BundleInfo> modifiedLibs = new LinkedList<BundleInfo>(); + + Set<URL> sysNewBundles = systemLibListener.consumeNewBundles(); + Set<URL> sysChangedBundles = systemLibListener.consumeChangedBundles(); + // Set<URL> sysRemovedBundles = + systemLibListener.consumeRemovedBundles(); + + Set<URL> userNewBundles = userLibListener.consumeNewBundles(); + Set<URL> userChangedBundles = userLibListener.consumeChangedBundles(); + // Set<URL> userRemovedBundles = + userLibListener.consumeRemovedBundles(); + + Collection<URL> sysNewModLibs = new ArrayList<URL>(sysNewBundles.size() + sysChangedBundles.size()); + sysNewModLibs.addAll(sysNewBundles); + sysNewModLibs.addAll(sysChangedBundles); + + Collection<URL> userNewModLibs = new ArrayList<URL>(userNewBundles.size() + userChangedBundles.size()); + userNewModLibs.addAll(userNewBundles); + userNewModLibs.addAll(userChangedBundles); + + // TODO what about removed libs? + return getRuntimeLibs(sysNewModLibs, userNewModLibs); + + // // For now, return all user libs + // for (BundleInfo info : getRuntimeLibs()) { + // if (!info.isSystemLibrary()) { + // modifiedLibs.add(info); + // } + // } + // + // return modifiedLibs; + } } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/UserLibResourceFinder.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/UserLibResourceFinder.java index 03d67ff59b3..d24c0a8ba07 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/UserLibResourceFinder.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/UserLibResourceFinder.java @@ -22,10 +22,10 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.osee.framework.plugin.core.server.ResourceFinder; -/** - * Finds resources that +/** + * Finds resources that + * * @author Robert A. Fisher - * */ public class UserLibResourceFinder extends ResourceFinder { @@ -37,19 +37,21 @@ public class UserLibResourceFinder extends ResourceFinder { try { for (OteUserLibsNature userLibsNature : OteUserLibsNature.getWorkspaceProjects()) { IProject project = userLibsNature.getProject(); - + IProjectDescription description; try { description = project.getDescription(); if (description.hasNature("org.eclipse.jdt.core.javanature")) { - + IJavaProject javaProject = JavaCore.create(project); - + // Projects don't have to be stored in the workspace, so make sure to use the project.getLocation as the starting point - IPath candidate = project.getLocation().removeLastSegments(1).append(javaProject.getOutputLocation().makeAbsolute()).append(path); + IPath candidate = + project.getLocation().removeLastSegments(1).append(javaProject.getOutputLocation().makeAbsolute()).append( + path); if (candidate.toFile().exists()) { File file = candidate.toFile(); - + try { return getBytes(new FileInputStream(file), file.length()); } catch (FileNotFoundException e) { diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainer.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainer.java index 6f2ed894999..2f2ea41089c 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainer.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainer.java @@ -14,7 +14,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; - import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IClasspathContainer; @@ -29,199 +28,193 @@ import org.osgi.util.tracker.ServiceTracker; /** * @author Andrew M. Finkbeiner - * */ public class OteClasspathContainer implements IClasspathContainer { - public final static Path ID = new Path("OTE Library"); - private ServiceTracker tracker; - private OteBundleLocator locator; - private IJavaProject javaProject; - private IPath containerPath; - - private static final List<OteClasspathContainer> activeContainers = new ArrayList<OteClasspathContainer>(); - - private static boolean classpathEnabled; - static { - classpathEnabled = System.getProperty("ote.container.activate") != null; - } - - public OteClasspathContainer(IPath path, IJavaProject javaProject) { - this.javaProject = javaProject; - this.containerPath = path; - - try { - BundleContext context = RuntimeManager.getDefault().getContext(); - tracker = new ServiceTracker(context, OteBundleLocator.class - .getName(), null); - tracker.open(true); - initializeBundleLocator(); - - } catch (Exception ex) { - ex.printStackTrace(); - } - - activeContainers.add(this); - } - - /** - * @throws InterruptedException - */ - private void initializeBundleLocator() throws InterruptedException { - Object obj = tracker.waitForService(1); - locator = (OteBundleLocator) obj; - } - - /** - * @param oteClasspathContainer - */ - public OteClasspathContainer(OteClasspathContainer oteClasspathContainer) { - this(oteClasspathContainer.containerPath, - oteClasspathContainer.javaProject); - } - - /** - * @param fileForPath - * @return - */ - private File recursivelyFindProjectFile(File file) { - - if (file == null) - return file; - - if (fileIsDirectoryWithBin(file)) { - return file; - } else { - return recursivelyFindProjectFile(file.getParentFile()); - } - } - - /** - * @param file - * @return - */ - private boolean fileIsDirectoryWithBin(File file) { - if (file.isDirectory()) { - File binChildFile = new File(file.getAbsoluteFile() + "/bin"); - if (binChildFile.exists()) - return true; - } - return false; - } - - @Override - public IClasspathEntry[] getClasspathEntries() { - List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>(); - Collection<BundleInfo> runtimeLibUrls; - if (classpathEnabled) { - try { - lazyLoadLocator(); - if (locator == null) - return entries.toArray(new IClasspathEntry[0]); - - runtimeLibUrls = locator.getRuntimeLibs(); - for (BundleInfo info : runtimeLibUrls) { - String binaryFilePath = info.getFile().getCanonicalPath(); - - if (info.isSystemLibrary()) { - entries.add(JavaCore.newLibraryEntry(new Path( - binaryFilePath), new Path(binaryFilePath), - new Path("/"))); - } else { - File projectFilePath = recursivelyFindProjectFile(new File( - binaryFilePath)); - if (!projectMatchesClasspathFile(projectFilePath)) { - binaryFilePath = "/" + projectFilePath.getName(); - - entries.add(JavaCore.newProjectEntry(new Path( - binaryFilePath))); - } - } - } - - } catch (Exception ex) { - ex.printStackTrace(); - } - } - IClasspathEntry[] retVal = new IClasspathEntry[entries.size()]; - return entries.toArray(retVal); - } - - /** - * @throws InterruptedException - */ - private void lazyLoadLocator() throws InterruptedException { - if (locator == null) - initializeBundleLocator(); - } - - /** - * @param projectFilePath - * @return - */ - private boolean projectMatchesClasspathFile(File projectFilePath) { - String projectBeingResolvedName = javaProject.getPath().toString(); - String classpathFilePath = projectFilePath.getName(); - if (projectBeingResolvedName.contains(classpathFilePath)) - return true; - - return false; - } - - @Override - public String getDescription() { - return ID.segment(0); - } - - @Override - public int getKind() { - return IClasspathContainer.K_APPLICATION; - } - - @Override - public IPath getPath() { - return ID; - } - - public static void refreshAll() { - if (classpathEnabled) { - for (OteClasspathContainer container : activeContainers - .toArray(new OteClasspathContainer[0])) { - container.refresh(); - } - } - } - - public void refresh() { - if (classpathEnabled) { - try { - activeContainers.remove(this); - if (javaProject.isOpen()) { - JavaCore - .setClasspathContainer( - containerPath, - new IJavaProject[] { javaProject }, - new IClasspathContainer[] { new OteClasspathContainer( - this) }, null); - } - // new Thread(new Runnable() { - // - // @Override - // public void run() { - // try { - // Thread.sleep(10000); - // } - // catch (InterruptedException ex) { - // ex.printStackTrace(); - // } - // catch (Exception ex) { - // ex.printStackTrace(); - // } - // } - // - // }).start(); - } catch (Exception ex) { - } - } - } + public final static Path ID = new Path("OTE Library"); + private ServiceTracker tracker; + private OteBundleLocator locator; + private final IJavaProject javaProject; + private final IPath containerPath; + + private static final List<OteClasspathContainer> activeContainers = new ArrayList<OteClasspathContainer>(); + + private static boolean classpathEnabled; + static { + classpathEnabled = System.getProperty("ote.container.activate") != null; + } + + public OteClasspathContainer(IPath path, IJavaProject javaProject) { + this.javaProject = javaProject; + this.containerPath = path; + + try { + BundleContext context = RuntimeManager.getDefault().getContext(); + tracker = new ServiceTracker(context, OteBundleLocator.class.getName(), null); + tracker.open(true); + initializeBundleLocator(); + + } catch (Exception ex) { + ex.printStackTrace(); + } + + activeContainers.add(this); + } + + /** + * @throws InterruptedException + */ + private void initializeBundleLocator() throws InterruptedException { + Object obj = tracker.waitForService(1); + locator = (OteBundleLocator) obj; + } + + /** + * @param oteClasspathContainer + */ + public OteClasspathContainer(OteClasspathContainer oteClasspathContainer) { + this(oteClasspathContainer.containerPath, oteClasspathContainer.javaProject); + } + + /** + * @param fileForPath + * @return + */ + private File recursivelyFindProjectFile(File file) { + + if (file == null) { + return file; + } + + if (fileIsDirectoryWithBin(file)) { + return file; + } else { + return recursivelyFindProjectFile(file.getParentFile()); + } + } + + /** + * @param file + * @return + */ + private boolean fileIsDirectoryWithBin(File file) { + if (file.isDirectory()) { + File binChildFile = new File(file.getAbsoluteFile() + "/bin"); + if (binChildFile.exists()) { + return true; + } + } + return false; + } + + @Override + public IClasspathEntry[] getClasspathEntries() { + List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>(); + Collection<BundleInfo> runtimeLibUrls; + if (classpathEnabled) { + try { + lazyLoadLocator(); + if (locator == null) { + return entries.toArray(new IClasspathEntry[0]); + } + + runtimeLibUrls = locator.getRuntimeLibs(); + for (BundleInfo info : runtimeLibUrls) { + String binaryFilePath = info.getFile().getCanonicalPath(); + + if (info.isSystemLibrary()) { + entries.add(JavaCore.newLibraryEntry(new Path(binaryFilePath), new Path(binaryFilePath), + new Path("/"))); + } else { + File projectFilePath = recursivelyFindProjectFile(new File(binaryFilePath)); + if (!projectMatchesClasspathFile(projectFilePath)) { + binaryFilePath = "/" + projectFilePath.getName(); + + entries.add(JavaCore.newProjectEntry(new Path(binaryFilePath))); + } + } + } + + } catch (Exception ex) { + ex.printStackTrace(); + } + } + IClasspathEntry[] retVal = new IClasspathEntry[entries.size()]; + return entries.toArray(retVal); + } + + /** + * @throws InterruptedException + */ + private void lazyLoadLocator() throws InterruptedException { + if (locator == null) { + initializeBundleLocator(); + } + } + + /** + * @param projectFilePath + * @return + */ + private boolean projectMatchesClasspathFile(File projectFilePath) { + String projectBeingResolvedName = javaProject.getPath().toString(); + String classpathFilePath = projectFilePath.getName(); + if (projectBeingResolvedName.contains(classpathFilePath)) { + return true; + } + + return false; + } + + @Override + public String getDescription() { + return ID.segment(0); + } + + @Override + public int getKind() { + return IClasspathContainer.K_APPLICATION; + } + + @Override + public IPath getPath() { + return ID; + } + + public static void refreshAll() { + if (classpathEnabled) { + for (OteClasspathContainer container : activeContainers.toArray(new OteClasspathContainer[0])) { + container.refresh(); + } + } + } + + public void refresh() { + if (classpathEnabled) { + try { + activeContainers.remove(this); + if (javaProject.isOpen()) { + JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {javaProject}, + new IClasspathContainer[] {new OteClasspathContainer(this)}, null); + } + // new Thread(new Runnable() { + // + // @Override + // public void run() { + // try { + // Thread.sleep(10000); + // } + // catch (InterruptedException ex) { + // ex.printStackTrace(); + // } + // catch (Exception ex) { + // ex.printStackTrace(); + // } + // } + // + // }).start(); + } catch (Exception ex) { + } + } + } } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainerInitializer.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainerInitializer.java index 050b39f4dd8..88c4fc5f2eb 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainerInitializer.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteClasspathContainerInitializer.java @@ -17,8 +17,7 @@ import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; -public class OteClasspathContainerInitializer extends -ClasspathContainerInitializer { +public class OteClasspathContainerInitializer extends ClasspathContainerInitializer { public OteClasspathContainerInitializer() { } @@ -27,7 +26,8 @@ ClasspathContainerInitializer { public void initialize(IPath containerPath, IJavaProject project) throws CoreException { OteClasspathContainer oteClasspathContainer = new OteClasspathContainer(containerPath, project); - JavaCore.setClasspathContainer(containerPath, new IJavaProject[]{project}, new IClasspathContainer[] {oteClasspathContainer}, null); + JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, + new IClasspathContainer[] {oteClasspathContainer}, null); } } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteContainerPage.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteContainerPage.java index 242417d9a39..b8313c47fa3 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteContainerPage.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/container/OteContainerPage.java @@ -20,14 +20,12 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -public class OteContainerPage extends WizardPage - implements IClasspathContainerPage { +public class OteContainerPage extends WizardPage implements IClasspathContainerPage { - public OteContainerPage() { super("OTE Library"); } - + @Override public boolean finish() { return true; @@ -47,19 +45,17 @@ public class OteContainerPage extends WizardPage Composite comp = new Composite(parent, SWT.None); GridLayout layout = new GridLayout(1, true); comp.setLayout(layout); - + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); comp.setLayoutData(data); - + Label label = new Label(comp, SWT.NONE); label.setText("Please click finish."); - + data = new GridData(SWT.FILL, SWT.FILL, true, true); label.setLayoutData(data); setControl(comp); - - + } - } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/ProjectChangeResourceListener.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/ProjectChangeResourceListener.java index 2a8b7df6505..972c03e74d8 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/ProjectChangeResourceListener.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/ProjectChangeResourceListener.java @@ -14,9 +14,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; -/** +/** * @author Robert A. Fisher - * */ public class ProjectChangeResourceListener implements IResourceChangeListener { diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java index c889d29e275..24686a36319 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java @@ -27,14 +27,14 @@ public class RuntimeBundleServer { /** * Creates a new ClassServer which will serve all projects currently in the workspace - * @param safeWorkspaceTracker * + * @param safeWorkspaceTracker * @param testManager */ public RuntimeBundleServer(SafeWorkspaceTracker safeWorkspaceTracker) { try { InetAddress useHostAddress = CorePreferences.getDefaultInetAddress(); - classServer = new ClassServer(0, useHostAddress){ + classServer = new ClassServer(0, useHostAddress) { @Override protected void fileDownloaded(String fp, InetAddress addr) { System.out.println("RuntimeBundleServer: File " + fp + " downloaded to " + addr); @@ -48,10 +48,10 @@ public class RuntimeBundleServer { } catch (BindException ex) { OseeLog.log( - RuntimeManager.class, - Level.SEVERE, - "Class Server not started. Likely the IP address used is not local. Set your IP address in the advanced page.", - ex); + RuntimeManager.class, + Level.SEVERE, + "Class Server not started. Likely the IP address used is not local. Set your IP address in the advanced page.", + ex); } catch (Exception ex) { OseeLog.log(RuntimeManager.class, Level.SEVERE, "Class Server not started.", ex); } diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeLibResourceFinder.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeLibResourceFinder.java index 80ca324014b..0b659b82505 100644 --- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeLibResourceFinder.java +++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeLibResourceFinder.java @@ -13,22 +13,20 @@ package org.eclipse.osee.ote.runtimemanager.internal; import java.io.FileInputStream; import java.io.IOException; import java.util.Collection; - import org.eclipse.core.runtime.CoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.plugin.core.server.ResourceFinder; import org.eclipse.osee.ote.core.BundleInfo; import org.eclipse.osee.ote.runtimemanager.SafeWorkspaceTracker; -/** +/** * @author Robert A. Fisher - * */ public class RuntimeLibResourceFinder extends ResourceFinder { - private SafeWorkspaceTracker safeWorkspaceTracker; + private final SafeWorkspaceTracker safeWorkspaceTracker; /** - * @param safeWorkspaceTracker + * @param safeWorkspaceTracker * @param runtimeManager */ public RuntimeLibResourceFinder(SafeWorkspaceTracker safeWorkspaceTracker) { @@ -42,7 +40,7 @@ public class RuntimeLibResourceFinder extends ResourceFinder { Collection<BundleInfo> runtimeLibs = safeWorkspaceTracker.getRuntimeLibs(); for (BundleInfo info : runtimeLibs) { if (info.getSymbolicName().equals(path)) { - return Lib.inputStreamToBytes(new FileInputStream(info.getFile())); + return Lib.inputStreamToBytes(new FileInputStream(info.getFile())); } } } catch (CoreException ex) { @@ -51,7 +49,7 @@ public class RuntimeLibResourceFinder extends ResourceFinder { } return null; } - + @Override public void dispose() { } |