Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113875 Details for
Bug 240724
[plan] Update Execution Environment profile format to include custom jdt settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.osgi patch
240724.txt (text/plain), 17.56 KB, created by
Thomas Watson
on 2008-09-30 10:54:17 EDT
(
hide
)
Description:
org.eclipse.osgi patch
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2008-09-30 10:54:17 EDT
Size:
17.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.osgi.tests >Index: src/org/eclipse/osgi/tests/eclipseadaptor/AllTests.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/eclipseadaptor/AllTests.java,v >retrieving revision 1.1 >diff -u -r1.1 AllTests.java >--- src/org/eclipse/osgi/tests/eclipseadaptor/AllTests.java 3 Jun 2005 19:18:04 -0000 1.1 >+++ src/org/eclipse/osgi/tests/eclipseadaptor/AllTests.java 30 Sep 2008 14:37:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Chris Aniszczyk <zx@code9.com> - bug 240724 > *******************************************************************************/ > package org.eclipse.osgi.tests.eclipseadaptor; > >@@ -18,6 +19,7 @@ > TestSuite suite = new TestSuite(AllTests.class.getName()); > suite.addTest(EnvironmentInfoTest.suite()); > suite.addTest(FilePathTest.suite()); >+ suite.addTest(ExecutionEnvironmentTest.suite()); > return suite; > } > } >Index: src/org/eclipse/osgi/tests/eclipseadaptor/ExecutionEnvironmentTest.java >=================================================================== >RCS file: src/org/eclipse/osgi/tests/eclipseadaptor/ExecutionEnvironmentTest.java >diff -N src/org/eclipse/osgi/tests/eclipseadaptor/ExecutionEnvironmentTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/osgi/tests/eclipseadaptor/ExecutionEnvironmentTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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: >+ * Code 9 Corporation - initial API and implementation >+ * Chris Aniszczyk <zx@code9.com> - bug 240724 >+ *******************************************************************************/ >+package org.eclipse.osgi.tests.eclipseadaptor; >+ >+import junit.framework.*; >+import org.eclipse.osgi.service.environment.ExecutionEnvironment; >+import org.eclipse.osgi.service.environment.ExecutionEnvironmentService; >+import org.eclipse.osgi.tests.OSGiTestsActivator; >+import org.osgi.framework.ServiceReference; >+ >+public class ExecutionEnvironmentTest extends TestCase { >+ >+ public static Test suite() { >+ return new TestSuite(ExecutionEnvironmentTest.class); >+ } >+ >+ public ExecutionEnvironmentTest(String name) { >+ super(name); >+ } >+ >+ public void testExecutionEnvironments() { >+ ServiceReference reference = null; >+ reference = OSGiTestsActivator.getContext().getServiceReference(ExecutionEnvironmentService.class.getName()); >+ assertNotNull(reference); >+ >+ ExecutionEnvironmentService eeService = (ExecutionEnvironmentService) OSGiTestsActivator.getContext().getService(reference); >+ assertNotNull(eeService); >+ >+ ExecutionEnvironment[] environments = eeService.getExecutionEnvironments(); >+ assertNotNull(environments); >+ >+ ExecutionEnvironment env1 = eeService.getExecutionEnvironment("CDC-1.1/Foundation-1.1"); //$NON-NLS-1$ >+ assertNotNull(env1); >+ >+ // TODO add more tests >+ } >+} >#P org.eclipse.osgi >Index: core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java,v >retrieving revision 1.18 >diff -u -r1.18 SystemBundleActivator.java >--- core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java 30 Sep 2008 13:59:16 -0000 1.18 >+++ core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java 30 Sep 2008 14:37:38 -0000 >@@ -14,6 +14,7 @@ > import java.util.Dictionary; > import java.util.Hashtable; > import org.eclipse.osgi.framework.debug.FrameworkDebugOptions; >+import org.eclipse.osgi.service.environment.ExecutionEnvironmentService; > import org.osgi.framework.*; > import org.osgi.service.condpermadmin.ConditionalPermissionAdmin; > >@@ -22,20 +23,20 @@ > */ > > public class SystemBundleActivator implements BundleActivator { >- protected BundleContext context; >- protected SystemBundle bundle; >- protected Framework framework; >- protected ServiceRegistration packageAdmin; >- protected ServiceRegistration securityAdmin; >- protected ServiceRegistration startLevel; >- protected ServiceRegistration debugOptions; >+ private BundleContext context; >+ private Framework framework; >+ private ServiceRegistration packageAdmin; >+ private ServiceRegistration securityAdmin; >+ private ServiceRegistration startLevel; >+ private ServiceRegistration debugOptions; >+ private ServiceRegistration eeService; > > public SystemBundleActivator() { > } > > public void start(BundleContext context) throws Exception { > this.context = context; >- bundle = (SystemBundle) context.getBundle(); >+ SystemBundle bundle = (SystemBundle) context.getBundle(); > framework = bundle.framework; > > if (framework.packageAdmin != null) >@@ -48,6 +49,7 @@ > if ((dbgOptions = FrameworkDebugOptions.getDefault()) != null) > debugOptions = register(new String[] {org.eclipse.osgi.service.debug.DebugOptions.class.getName()}, dbgOptions); > >+ eeService = register(new String[] {ExecutionEnvironmentService.class.getName()}, new ExecutionEnvironmentServiceImpl(bundle)); > // Always call the adaptor.frameworkStart() at the end of this method. > framework.adaptor.frameworkStart(context); > // attempt to resolve all bundles >@@ -70,9 +72,9 @@ > startLevel.unregister(); > if (debugOptions != null) > debugOptions.unregister(); >- >+ if (eeService != null) >+ eeService.unregister(); > framework = null; >- bundle = null; > this.context = null; > } > >@@ -82,10 +84,10 @@ > */ > protected ServiceRegistration register(String[] names, Object service) { > Hashtable properties = new Hashtable(7); >- Dictionary headers = bundle.getHeaders(); >+ Dictionary headers = context.getBundle().getHeaders(); > properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); > properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE)); >- properties.put(Constants.SERVICE_PID, bundle.getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ >+ properties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ > return context.registerService(names, service, properties); > } > >Index: supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironment.java >=================================================================== >RCS file: supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironment.java >diff -N supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironment.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironment.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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: >+ * Chris Aniszczyk <zx@code9.com> - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.service.environment; >+ >+/** >+ * An execution environment describes the VM which the >+ * framework can run in. Execution environments describe >+ * the packages available from the VM and the other >+ * execution environments which are supported by the >+ * execution environment (subsets of the execution environment). >+ * >+ * @since 3.5 >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+// TODO Consider making this a concrete class instead of an interface. >+public interface ExecutionEnvironment { >+ >+ /** >+ * The unique and primary name of the execution environment profile >+ * >+ * @since 3.5 >+ */ >+ public String getName(); >+ >+ /** >+ * A comma separated list of export package descriptions that specify >+ * the packages available from this execution environment. >+ * >+ * @see {@link org.osgi.framework.Constants#FRAMEWORK_SYSTEMPACKAGES} >+ */ >+ public String getSystemPackages(); >+ >+ /** >+ * A comma separated list of environment names supported by this >+ * execution environment. >+ * @see {@link org.osgi.framework.Constants#FRAMEWORK_EXECUTIONENVIRONMENT} >+ */ >+ public String getSupportedEnvironments(); >+ >+} >Index: supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironmentService.java >=================================================================== >RCS file: supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironmentService.java >diff -N supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironmentService.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ supplement/src/org/eclipse/osgi/service/environment/ExecutionEnvironmentService.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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: >+ * Chris Aniszczyk <zx@code9.com> - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.service.environment; >+ >+/** >+ * The profile service is used to register, unregister and acquire profiles. >+ * >+ * <p> >+ * Profiles available by default: >+ * <ul> >+ * <li>OSGi/Minimum-1.0</li> >+ * <li>OSGi/Minimum-1.1</li> >+ * <li>CDC-1.0/Foundation-1.0</li> >+ * <li>CDC-1.1/Foundation-1.1</li> >+ * <li>JRE-1.1</li> >+ * <li>J2SE-1.2</li> >+ * <li>J2SE-1.3</li> >+ * <li>J2SE-1.4</li> >+ * <li>J2SE-1.5</li> >+ * <li>JavaSE-1.6</li> >+ * </p> >+ * >+ * <p> >+ * This interface is not intended to be implemented by clients. >+ * </p> >+ * >+ * @since 3.5 >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface ExecutionEnvironmentService { >+ /** >+ * Get an execution environment profile. >+ * >+ * @param name the unique name of the execution environment >+ * >+ * @return A <code>ExecutionEnvironment</code> for the given unique name. >+ * A value of <code>null</code> is returned if the execution environment >+ * does not exist. >+ */ >+ public ExecutionEnvironment getExecutionEnvironment(String name); >+ >+ /** >+ * Acquire the list of all available execution environment profiles >+ * >+ * @param name the unique name of the profile >+ * >+ * @return A list of <code>ExecutionEnvironment</code> available. An >+ * empty array is returned if no execution environments are available. >+ */ >+ public ExecutionEnvironment[] getExecutionEnvironments(); >+ >+} >Index: core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentServiceImpl.java >=================================================================== >RCS file: core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentServiceImpl.java >diff -N core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentServiceImpl.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentServiceImpl.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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: >+ * Chris Aniszczyk <zx@code9.com> - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.framework.internal.core; >+ >+import java.io.*; >+import java.net.URL; >+import java.util.*; >+import org.eclipse.osgi.service.environment.ExecutionEnvironment; >+import org.eclipse.osgi.service.environment.ExecutionEnvironmentService; >+import org.osgi.framework.Bundle; >+ >+public class ExecutionEnvironmentServiceImpl implements ExecutionEnvironmentService { >+ >+ private final static String PROFILE_EXT = ".profile"; >+ private final Bundle systemBundle; >+ private Map profileMap; >+ >+ /** This constructor is called by the Framework */ >+ protected ExecutionEnvironmentServiceImpl(Bundle systemBundle) { >+ this.systemBundle = systemBundle; >+ } >+ >+ public synchronized ExecutionEnvironment getExecutionEnvironment(String name) { >+ return (ExecutionEnvironment) getProfiles().get(name); >+ } >+ >+ public synchronized ExecutionEnvironment[] getExecutionEnvironments() { >+ return (ExecutionEnvironment[]) getProfiles().values().toArray(new ExecutionEnvironment[profileMap.size()]); >+ } >+ >+ // @GuardedBy(this) >+ private Map getProfiles() { >+ if (profileMap == null) >+ profileMap = new HashMap(7); >+ discoverProfiles(profileMap); >+ return profileMap; >+ } >+ >+ private void discoverProfiles(Map profiles) { >+ Enumeration frameworkEntries = systemBundle.getEntryPaths("/"); //$NON-NLS-1$ >+ if (frameworkEntries != null) >+ while (frameworkEntries.hasMoreElements()) { >+ String path = (String) frameworkEntries.nextElement(); >+ if (path.endsWith(PROFILE_EXT)) { >+ URL profile = systemBundle.getEntry(path); >+ ExecutionEnvironment ee = loadEE(profile); >+ if (ee != null) >+ profiles.put(ee.getName(), ee); >+ } >+ } >+ Enumeration fragmentEntries = systemBundle.findEntries("profiles", "*.profile", false); //$NON-NLS-1$ //$NON-NLS-2$ >+ if (fragmentEntries != null) >+ while (fragmentEntries.hasMoreElements()) { >+ URL profile = (URL) fragmentEntries.nextElement(); >+ ExecutionEnvironment ee = loadEE(profile); >+ if (ee != null) >+ profiles.put(ee.getName(), ee); >+ } >+ } >+ >+ private ExecutionEnvironment loadEE(URL profile) { >+ InputStream in = null; >+ try { >+ Properties properties = new Properties(); >+ in = profile.openStream(); >+ properties.load(new BufferedInputStream(in)); >+ // time to create profiles! >+ return new ExecutionEnvironmentImpl(properties); >+ } catch (IOException ex) { >+ // TODO consider logging or throwing... >+ return null; >+ } finally { >+ if (in != null) >+ try { >+ in.close(); >+ } catch (IOException ee) { >+ // do nothing >+ } >+ } >+ } >+ >+} >Index: core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentImpl.java >=================================================================== >RCS file: core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentImpl.java >diff -N core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentImpl.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/framework/org/eclipse/osgi/framework/internal/core/ExecutionEnvironmentImpl.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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: >+ * Chris Aniszczyk <zx@code9.com> - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.framework.internal.core; >+ >+import java.util.Properties; >+import org.eclipse.osgi.service.environment.ExecutionEnvironment; >+ >+public class ExecutionEnvironmentImpl implements ExecutionEnvironment { >+ >+ private final String name; >+ private final String environments; >+ private final String packages; >+ >+ public ExecutionEnvironmentImpl(Properties properties) { >+ this.name = properties.getProperty(Constants.OSGI_JAVA_PROFILE_NAME); >+ this.environments = properties.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT); >+ this.packages = properties.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public String getSupportedEnvironments() { >+ return environments; >+ } >+ >+ public String getSystemPackages() { >+ return packages; >+ } >+ >+ public String toString() { >+ return name; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240724
:
113375
|
113820
|
113821
| 113875 |
114032
|
114352
|
114810