Package org.eclipse.osgi.service.datalocation

Examples of org.eclipse.osgi.service.datalocation.Location


  public void checkLogErrors() throws Throwable {
    checkLogErrors_();
  }
 
  private static void initializeWorkingDirToEclipseInstanceLocation() {
    Location instanceLocation = Platform.getInstanceLocation();
    try {
      URI uri = instanceLocation.getURL().toURI();
      String workingDirPath = new File(uri).getAbsolutePath();
      TestsWorkingDir.initWorkingDir(workingDirPath);
    } catch (URISyntaxException e) {
      throw assertFail();
    }
View Full Code Here


  private BaseAdaptor adaptor;
  private boolean noXML = false;

  public void frameworkStart(BundleContext context) throws BundleException {
    registerEndorsedXMLParser(context);
    Location location = LocationManager.getUserLocation();
    Hashtable locationProperties = new Hashtable(1);
    if (location != null) {
      locationProperties.put("type", LocationManager.PROP_USER_AREA); //$NON-NLS-1$
      context.registerService(Location.class.getName(), location, locationProperties);
    }
View Full Code Here

    ClassLoader fwloader = BaseStorage.class.getClassLoader();
    if (fwloader != null)
      addURLMethod = findaddURLMethod(fwloader.getClass());
    // we need to set the install path as soon as possible so we can determine
    // the absolute location of install relative URLs
    Location installLoc = LocationManager.getInstallLocation();
    if (installLoc != null) {
      URL installURL = installLoc.getURL();
      // assume install URL is file: based
      installPath = installURL.getPath();
    }
    boolean readOnlyConfiguration = LocationManager.getConfigurationLocation().isReadOnly();
    storageManager = initFileManager(LocationManager.getOSGiConfigurationDir(), readOnlyConfiguration ? "none" : null, readOnlyConfiguration); //$NON-NLS-1$
View Full Code Here

        break;
      }
    if (success)
      return storageFiles;
    //if it does not exist, try to read it from the parent
    Location parentConfiguration = null;
    Location currentConfiguration = LocationManager.getConfigurationLocation();
    if (currentConfiguration != null && (parentConfiguration = currentConfiguration.getParentLocation()) != null) {
      try {
        File stateLocationDir = new File(parentConfiguration.getURL().getFile(), FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME);
        StorageManager newFileManager = initFileManager(stateLocationDir, "none", true); //$NON-NLS-1$);
        for (int i = 0; i < storageFiles.length; i++)
          storageFiles[i] = newFileManager.lookup(fileNames[i], false);
View Full Code Here

        Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$
        Debug.printStackTrace(ex);
      }
    }
    if (storageStream == null) {
      Location currentConfiguration = LocationManager.getConfigurationLocation();
      Location parentConfiguration = null;
      if (currentConfiguration != null && (parentConfiguration = currentConfiguration.getParentLocation()) != null) {
        try {
          File bundledataLocationDir = new File(parentConfiguration.getURL().getFile(), FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME);
          StorageManager newStorageManager = initFileManager(bundledataLocationDir, "none", true); //$NON-NLS-1$
          storageStream = newStorageManager.getInputStream(fileName);
          newStorageManager.close();
        } catch (MalformedURLException e1) {
          // This will not happen since all the URLs are derived by us
View Full Code Here

    FrameworkLog frameworkLog;
    String logFileProp = FrameworkProperties.getProperty(EclipseStarter.PROP_LOGFILE);
    if (logFileProp != null) {
      frameworkLog = new EclipseLog(new File(logFileProp));
    } else {
      Location location = LocationManager.getConfigurationLocation();
      File configAreaDirectory = null;
      if (location != null)
        // TODO assumes the URL is a file: url
        configAreaDirectory = new File(location.getURL().getFile());

      if (configAreaDirectory != null) {
        String logFileName = Long.toString(System.currentTimeMillis()) + ".log"; //$NON-NLS-1$
        File logFile = new File(configAreaDirectory, logFileName);
        FrameworkProperties.setProperty(EclipseStarter.PROP_LOGFILE, logFile.getAbsolutePath());
View Full Code Here

      }
    }
  }

  private static void loadConfigurationInfo() {
    Location configArea = LocationManager.getConfigurationLocation();
    if (configArea == null)
      return;

    URL location = null;
    try {
      location = new URL(configArea.getURL().toExternalForm() + LocationManager.CONFIG_FILE);
    } catch (MalformedURLException e) {
      // its ok.  This should never happen
    }
    mergeProperties(FrameworkProperties.getProperties(), loadProperties(location));
  }
View Full Code Here

  File getGenerationDir() {
    return new File(getBundleStore(), String.valueOf(getGeneration()));
  }

  File getParentGenerationDir() {
    Location parentConfiguration = null;
    Location currentConfiguration = LocationManager.getConfigurationLocation();
    if (currentConfiguration != null && (parentConfiguration = currentConfiguration.getParentLocation()) != null)
      return new File(parentConfiguration.getURL().getFile(), FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME + '/' + LocationManager.BUNDLES_DIR + '/' + bundleData.getBundleID() + '/' + getGeneration());
    return null;
  }
View Full Code Here

  public static void initializeLocations() {
    // do install location initialization first since others may depend on it
    // assumes that the property is already set
    installLocation = buildLocation(PROP_INSTALL_AREA, null, "", true); //$NON-NLS-1$
   
    Location temp = buildLocation(PROP_USER_AREA_DEFAULT, null, "", false); //$NON-NLS-1$
    URL defaultLocation = temp == null ? null : temp.getURL();
    if (defaultLocation == null)
      defaultLocation = buildURL(new File(FrameworkProperties.getProperty(PROP_USER_HOME), "user").getAbsolutePath(), true); //$NON-NLS-1$
    userLocation = buildLocation(PROP_USER_AREA, defaultLocation, "", false); //$NON-NLS-1$

    temp = buildLocation(PROP_INSTANCE_AREA_DEFAULT, null, "", false); //$NON-NLS-1$
    defaultLocation = temp == null ? null : temp.getURL();
    if (defaultLocation == null)
      defaultLocation = buildURL(new File(FrameworkProperties.getProperty(PROP_USER_DIR), "workspace").getAbsolutePath(), true); //$NON-NLS-1$
    instanceLocation = buildLocation(PROP_INSTANCE_AREA, defaultLocation, "", false); //$NON-NLS-1$

    mungeConfigurationLocation();
    // compute a default but it is very unlikely to be used since main will have computed everything
    temp = buildLocation(PROP_CONFIG_AREA_DEFAULT, null, "", false); //$NON-NLS-1$
    defaultLocation = temp == null ? null : temp.getURL();
    if (defaultLocation == null)
      defaultLocation = buildURL(computeDefaultConfigurationLocation(), true);
    configurationLocation = buildLocation(PROP_CONFIG_AREA, defaultLocation, "", false); //$NON-NLS-1$
    // get the parent location based on the system property. This will have been set on the
    // way in either by the caller/user or by main.  There will be no parent location if we are not
    // cascaded.
    URL parentLocation = computeSharedConfigurationLocation();
    if (parentLocation != null && !parentLocation.equals(configurationLocation.getURL())) {
      Location parent = new BasicLocation(null, parentLocation, true);
      ((BasicLocation) configurationLocation).setParent(parent);
    }
    initializeDerivedConfigurationLocations();
  }
View Full Code Here

    FrameworkLog frameworkLog;
    String logFileProp = FrameworkProperties.getProperty(EclipseStarter.PROP_LOGFILE);
    if (logFileProp != null) {
      frameworkLog = new EclipseLog(new File(logFileProp));
    } else {
      Location location = LocationManager.getConfigurationLocation();
      File configAreaDirectory = null;
      if (location != null)
        // TODO assumes the URL is a file: url
        configAreaDirectory = new File(location.getURL().getFile());

      if (configAreaDirectory != null) {
        String logFileName = Long.toString(System.currentTimeMillis()) + EclipseLogHook.LOG_EXT;
        File logFile = new File(configAreaDirectory, logFileName);
        FrameworkProperties.setProperty(EclipseStarter.PROP_LOGFILE, logFile.getAbsolutePath());
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.service.datalocation.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.