Package org.eclipse.osgi.service.datalocation

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


    PlatformURLPluginConnection.startup();
    PlatformURLFragmentConnection.startup();
    PlatformURLMetaConnection.startup();
    PlatformURLConfigConnection.startup();

    Location service = getInstallLocation();
    if (service != null)
      PlatformURLBaseConnection.startup(service.getURL());

    Hashtable properties = new Hashtable(1);
    properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {PlatformURLHandler.PROTOCOL});
    getContext().registerService(URLStreamHandlerService.class.getName(), new PlatformURLHandler(), properties);
  }
View Full Code Here


    Shell shell = new Shell(display, SWT.ON_TOP);

    try {

      Location instanceLocaction = Platform.getInstanceLocation();

      if (instanceLocaction == null) {

        // show an error to the user

        Platform.endSplash();
        return EXIT_OK;
      }

      if (instanceLocaction.isSet()) {
        // everything is fine
      } else {
        ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLocaction.getDefault());

        new ChooseWorkspaceDialog(null, launchData, false, true).prompt(true);

        String instancePath = launchData.getSelection();

        File workspace = new File(instancePath);
        if (!workspace.exists()) {
          workspace.mkdir();
        }

        String path = workspace.getAbsolutePath().replace(File.separatorChar, '/');

        URL candidateWorkspaceURL = new URL("file", null, path);

        instanceLocaction.setURL(candidateWorkspaceURL, true);
        launchData.writePersistedData();
      }
    } finally {
      if (shell != null) {
        shell.dispose();
View Full Code Here

     * @return folder used for the EPSG database
     */
    public static File epsgDatabaseFile(){
        // unpack into the shared configuration location
        try {
            Location configLocation = Platform.getInstallLocation();
            return doEpsg(configLocation);
        } catch (MalformedURLException e) {
            // unable to use the config directory - perhaps the user does not have permission
        }
        // if that did not work unpack into the user's data directory
        try {
            Location dataLocation = Platform.getInstanceLocation();
            return doEpsg(dataLocation);
        } catch (MalformedURLException e) {
            // unable to use instance location - ie the data directory
        }
        return null; // database location not known - temporary directory will be used
View Full Code Here

            // go through and check a couple of locations
            // for an "epsg.properties" file full of
            // suplementary codes
            //
            URL epsg = null;
            Location configLocaiton = Platform.getInstallLocation();
            Location dataLocation = Platform.getInstanceLocation();
           
            if (dataLocation != null) {
                try {
                    URL url = dataLocation.getURL();
                    URL proposed = new URL(url, "epsg.properties"); //$NON-NLS-1$
                    monitor.subTask(Messages.CHECK + proposed);
                    String externalForm = proposed.toExternalForm();
                    if ("file".equals(proposed.getProtocol())) { //$NON-NLS-1$
                        String path = externalForm.replaceFirst("file:", "")//$NON-NLS-1$//$NON-NLS-2$
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

    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

    if (Boolean.valueOf(FrameworkProperties.getProperty(BaseStorage.PROP_CLEAN)).booleanValue())
      cleanOSGiCache();

    // 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

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.