1 11 package org.eclipse.core.boot; 12 13 import java.io.IOException ; 14 import java.net.URL ; 15 import org.eclipse.core.internal.boot.PlatformConfiguration; 16 import org.eclipse.core.internal.runtime.InternalPlatform; 17 import org.eclipse.core.runtime.Platform; 18 import org.eclipse.update.configurator.IPlatformConfiguration; 19 import org.eclipse.update.configurator.IPlatformConfigurationFactory; 20 import org.osgi.framework.BundleContext; 21 import org.osgi.framework.ServiceReference; 22 23 47 public final class BootLoader { 48 49 52 public static boolean CONFIGURATION_DEBUG = false; 53 54 58 public static final String PI_BOOT = "org.eclipse.core.boot"; 60 65 public static final String OS_WIN32 = "win32"; 67 72 public static final String OS_LINUX = "linux"; 74 79 public static final String OS_AIX = "aix"; 81 86 public static final String OS_SOLARIS = "solaris"; 88 93 public static final String OS_HPUX = "hpux"; 95 100 public static final String OS_QNX = "qnx"; 102 108 public static final String OS_MACOSX = "macosx"; 110 115 public static final String OS_UNKNOWN = "unknown"; 117 122 public static final String ARCH_X86 = "x86"; 124 129 public static final String ARCH_PA_RISC = "PA_RISC"; 131 137 public static final String ARCH_PPC = "ppc"; 139 145 public static final String ARCH_SPARC = "sparc"; 147 152 public static final String WS_WIN32 = "win32"; 154 159 public static final String WS_MOTIF = "motif"; 161 166 public static final String WS_GTK = "gtk"; 168 173 public static final String WS_PHOTON = "photon"; 175 181 public static final String WS_CARBON = "carbon"; 183 188 public static final String WS_UNKNOWN = "unknown"; 190 193 private BootLoader() { 194 } 196 197 205 public static String [] getCommandLineArgs() { 206 return InternalPlatform.getDefault().getApplicationArgs(); 207 } 208 209 216 public static org.eclipse.core.boot.IPlatformConfiguration getCurrentPlatformConfiguration() { 217 BundleContext context = InternalPlatform.getDefault().getBundleContext(); 218 ServiceReference configFactorySR = context.getServiceReference(IPlatformConfigurationFactory.class.getName()); 220 if (configFactorySR == null) 221 throw new IllegalStateException (); 222 IPlatformConfigurationFactory configFactory = (IPlatformConfigurationFactory) context.getService(configFactorySR); 223 if (configFactory == null) 224 throw new IllegalStateException (); 225 IPlatformConfiguration currentConfig = configFactory.getCurrentPlatformConfiguration(); 227 context.ungetService(configFactorySR); 228 return new PlatformConfiguration(currentConfig); 229 } 230 231 238 public static URL getInstallURL() { 239 return InternalPlatform.getDefault().getInstallURL(); 240 } 241 242 249 public static String getNL() { 250 return InternalPlatform.getDefault().getNL(); 251 } 252 253 265 public static String getOS() { 266 return InternalPlatform.getDefault().getOS(); 267 } 268 269 279 public static String getOSArch() { 280 return InternalPlatform.getDefault().getOSArch(); 281 } 282 283 294 public static org.eclipse.core.boot.IPlatformConfiguration getPlatformConfiguration(URL url) throws IOException { 295 BundleContext context = InternalPlatform.getDefault().getBundleContext(); 296 ServiceReference configFactorySR = context.getServiceReference(IPlatformConfigurationFactory.class.getName()); 298 if (configFactorySR == null) 299 throw new IllegalStateException (); 300 IPlatformConfigurationFactory configFactory = (IPlatformConfigurationFactory) context.getService(configFactorySR); 301 if (configFactory == null) 302 throw new IllegalStateException (); 303 IPlatformConfiguration config = configFactory.getPlatformConfiguration(url); 305 context.ungetService(configFactorySR); 306 return new PlatformConfiguration(config); 307 } 308 309 317 public static String getWS() { 318 return InternalPlatform.getDefault().getWS(); 319 } 320 321 335 public static String [] knownOSArchValues() { 336 return Platform.knownOSArchValues(); 337 } 338 339 353 public static String [] knownOSValues() { 354 return Platform.knownOSValues(); 355 } 356 357 371 public static String [] knownWSValues() { 372 return Platform.knownWSValues(); 373 } 374 375 383 public static boolean inDebugMode() { 384 return Platform.inDebugMode(); 385 } 386 387 396 public static boolean inDevelopmentMode() { 397 return Platform.inDevelopmentMode(); 398 } 399 400 407 public static boolean isRunning() { 408 return InternalPlatform.getDefault().isRunning(); 409 } 410 411 420 public static URL [] getPluginPath(URL pluginPathLocation) { 421 return InternalPlatform.getDefault().getPluginPath(pluginPathLocation); 422 } 423 424 437 public static boolean containsSavedPlatform(String location) { 438 return true; 439 } 440 441 456 public static IPlatformRunnable getRunnable(String applicationName) throws Exception { 457 return null; 458 } 459 477 public static IPlatformRunnable getRunnable(String pluginId, String className, Object args) throws Exception { 478 return null; 479 } 480 481 508 public static Object run(String applicationName, URL pluginPathLocation, String location, String [] args) throws Exception { 509 return null; 510 } 511 542 public static Object run(String applicationName, URL pluginPathLocation, String location, String [] args, Runnable handler) throws Exception { 543 return null; 544 } 545 566 public static void shutdown() throws Exception { 567 } 568 604 public static String [] startup(URL pluginPathLocation, String location, String [] args) throws Exception { 605 return null; 606 } 607 647 public static String [] startup(URL pluginPathLocation, String location, String [] args, Runnable handler) throws Exception { 648 return null; 649 } 650 651 } 652 | Popular Tags |