Get ivy settings file from classpath
8035
public static File getIvySettingsFile() throws IOException {
    URL settingsUrl = Thread.currentThread().getContextClassLoader().getResource(IVY_SETTINGS_FILE_NAME);
    if (settingsUrl == null) {
      throw new IOException("Failed to find " + IVY_SETTINGS_FILE_NAME + " from class path");
    }

    // Check if settingsUrl is file on classpath
    File ivySettingsFile = new File(settingsUrl.getFile());
    if (ivySettingsFile.exists()) {
      // can access settingsUrl as a file
      return ivySettingsFile;
    }

    // Create temporary Ivy settings file.
    ivySettingsFile = File.createTempFile("ivy.settings", ".xml");
    ivySettingsFile.deleteOnExit();

    try (OutputStream os = new BufferedOutputStream(new FileOutputStream(ivySettingsFile))) {
      Resources.copy(settingsUrl, os);
    }

    return ivySettingsFile;
  }
776041
def _get_config_file_in_folder(cls, path):
        
        if os.path.isfile(path):
            path = os.path.dirname(path)

        for fn in cls.PROJECT_CONFIG_FILES:
            config = RawConfigParser()
            full_path = os.path.join(path, fn)
            if config.read(full_path) and cls._get_section_name(config):
                return full_path
925011
public static Properties getPropertiesFromClasspath(String fileName)
      throws PropertiesFileNotFoundException {

    Properties props = new Properties();
    try {
      InputStream is = ClassLoader.getSystemResourceAsStream(fileName);
      if (is == null) { // try this instead
        is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
        logger.debug("loaded properties file with Thread.currentThread()");
      }
      props.load(is);
    } catch (Exception e) {
      throw new PropertiesFileNotFoundException(
          "ERROR LOADING PROPERTIES FROM CLASSPATH >" + fileName + "< !!!", e);
    }
    return props;
  }
335340
function getConfig(fpath, defaults) {
  var path = require('path');
  var dpath = path.dirname(path.resolve(fpath));

  function parentpath(fromdir, pattern) {
    var pp = require('parentpath'),
        cwd = process.cwd();
    try {
      process.chdir(fromdir);
      return pp.sync(pattern);
    } catch (e) {
      return null;
    } finally {
      process.chdir(cwd);
    }
  }

  function fromNpm() {
    var config;
    var dir = parentpath(dpath, 'package.json');
    if (dir) {
      try {
        config = require(dir + '/package.json')[MJS_NPM];
        config.__origin__ = dir + '/package.json';
      } catch (e) {
      }
    }
    return config;
  }

  function fromResourceFile() {
    var candidates = [
      parentpath(path, MJS_RC),
      process.env.HOME, process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOMEDRIVE + process.env.HOMEPATH
    ];

    var config;
    for (var i = 0; i < candidates.length; i++) {
      var candidate = candidates[i] + '/' + MJS_RC;
      if (fs.existsSync(candidate)) {
        try {
          config = JSON.parse(fs.readFileSync(candidate));
          config.__origin__ = candidate;
          break;
        } catch (e) {
          showHelpAndExit('Unable to read config from "' + candidate + '": ' + e.message, 1);
        }
      }
    }
    return config;
  }

  var config = fromNpm() || fromResourceFile() || {};
  // Make sure we apply defaults to missing values
  Object.keys(defaults).filter(function (k) {
    return config[k] == null
  }).forEach(function (k) {
    config[k] = defaults[k];
  });
  return config;
}
932366
def _get_classpath(self, workunit_factory):
    
    if not self._classpath:
      self._classpath = self._bootstrap_ivy_classpath(workunit_factory)
    return self._classpath
199303
public static Properties getProperties(String classpath) {
        Properties properties = new Properties();
        try (InputStream is = getResourceInputStream(classpath)) {
            properties.load(is);
            return properties;
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "getProperties", classpath);
        }
    }
22954
private File[] getFilesFromProperty(final String name, final Properties props) {
        String sep = WildFlySecurityManager.getPropertyPrivileged("path.separator", null);
        String value = props.getProperty(name, null);
        if (value != null) {
            final String[] paths = value.split(Pattern.quote(sep));
            final int len = paths.length;
            final File[] files = new File[len];
            for (int i = 0; i < len; i++) {
                files[i] = new File(paths[i]);
            }
            return files;
        }
        return NO_FILES;
    }
663342
def getSettingsPath() :
	""""""
	parser = SafeConfigParser()
	try :
		parser.read(os.path.normpath(pyGeno_SETTINGS_DIR+'/config.ini'))
		return parser.get('pyGeno_config', 'settings_dir')
	except :
		createDefaultConfigFile()
		return getSettingsPath()
399629
function ConfigFromPath (superConfig, project, version) {
  ConfigFromPath.super_.call(this, superConfig, project, version);

  var strictNS = simpleWrapNS(this.ns);
  strictNS.env = simpleWrapNS(createNamespace(superConfig.getEnvConfig()));

  var files = superConfig._resolvePaths(project, version);
  var loaded = {};

  var generateLoad = function (f) {
    return function (otherVersion) {
      debug('load(%s) in %s', otherVersion, f);
      var dir = path.dirname(f);
      var otherFile = path.resolve(dir, otherVersion + '.js');
      if (loaded[otherFile]) {
        throw new Error('load(' + version + ') conflict in file ' + f);
      }
      try {
        require(otherFile)(strictNS, generateLoad(otherFile));
      } catch (err) {
        if (err.code === 'MODULE_NOT_FOUND') {
          throw new Error('load(' + version + ') fail in file ' + f);
        } else {
          throw err;
        }
      }
    };
  };
  files.forEach(function (f) {
    debug('load %s', f);
    var init = require(f);
    loaded[f] = true;
    if (typeof init !== 'function') {
      throw new Error('bad config file format, `module.exports` must be a function: ' + f);
    }
    init(strictNS, generateLoad(f));
  });

  var loadedFiles = Object.keys(loaded);
  if (loadedFiles.length < 1) {
    throw new Error('cannot find any config files for ' + project + '.' + version);
  } else {
    loadedFiles.forEach(function (f) {
      delete require.cache[f];
    });
  }

  this._loadFinish();
  debug('done');
}
301350
def _jython_set_classpath(jars):
    '''
    
    '''
    from java.net import URL, URLClassLoader
    from java.lang import ClassLoader
    from java.io import File
    m = URLClassLoader.getDeclaredMethod("addURL", [URL])
    m.accessible = 1
    urls = [File(i).toURL() for i in jars]
    m.invoke(ClassLoader.getSystemClassLoader(), urls)
1295530
static URLSpec getReleaseDownloadUrl(String path, MavenSettings settings) throws IOException {
		String url = settings.mCentralUrl;
		if (settings.mMirrorUrl != null) url = settings.mMirrorUrl;
		return new URLSpec(url + path, settings.mProxyHost, settings.mProxyPort);
	}
117074
public void resolve()
        throws InstallationException
    {
        final IvySettings ivySettings = new IvySettings();
        try  {
            ivySettings.load(this.getClass().getResource("/org/efaps/update/version/ivy.xml"));
        } catch (final IOException e)  {
            throw new InstallationException("IVY setting file could not be read", e);
        } catch (final ParseException e)  {
            throw new InstallationException("IVY setting file could not be parsed", e);
        }

        final Ivy ivy = Ivy.newInstance(ivySettings);
        ivy.getLoggerEngine().pushLogger(new IvyOverSLF4JLogger());

        final Map<String, String> attr = new HashMap<String, String>();
        attr.put("changing", "true");

        final ModuleRevisionId modRevId = ModuleRevisionId.newInstance(this.groupId,
                                                                       this.artifactId,
                                                                       this.version,
                                                                       attr);

        final ResolveOptions options = new ResolveOptions();
        options.setConfs(new String[] {"runtime"});


        final ResolvedModuleRevision resModRev = ivy.findModule(modRevId);

        Artifact dw = null;
        for (final Artifact artifact : resModRev.getDescriptor().getAllArtifacts())  {
            if ("jar".equals(artifact.getType()))  {
                dw = artifact;
                break;
            }
        }

        final DownloadOptions dwOptions = new DownloadOptions();

        final ArtifactOrigin ao = resModRev.getArtifactResolver().locate(dw);
        resModRev.getArtifactResolver().getRepositoryCacheManager().clean();

        final ArtifactDownloadReport adw = resModRev.getArtifactResolver().download(ao, dwOptions);

        this.jarFile = adw.getLocalFile();
    }
1233170
@SuppressWarnings(UNUSED)
    public FormValidation doCheckIvySettingsFile(@QueryParameter String value) {
        String v = Util.fixEmpty(value);
        if ((v == null) || (v.length() == 0)) {
            // Null values are allowed.
            return FormValidation.ok();
        }
        if (v.startsWith("/") || v.startsWith("\\") || v.matches("^\\w\\:\\\\.*")) {
            return FormValidation.error("Ivy settings file must be a relative path.");
        }
        return FormValidation.ok();
    }
817521
public static Template getClassPathTemplate(String path, String templateFileName) {
		return getTemplate(createClassPathGroupTemplate(path), templateFileName);
	}
470668
@Override
	public String getFilePath(String resourcePath) {

		String filePath = null;
		String path = getCompletePath(resourcePath);
		URL url = null;
		try {
			url = ClassLoaderResourceUtils.getResourceURL(path, this);
			String strURL = url.toString();
			if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
				filePath = new File(url.getFile()).getAbsolutePath();
			} else if (strURL.startsWith(JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX)) {
				String tmp = strURL.substring((JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX).length());
				int idxJarContentSeparator = tmp.indexOf("!");
				if (idxJarContentSeparator != -1) {
					tmp = tmp.substring(0, idxJarContentSeparator);
				}
				filePath = new File(tmp).getAbsolutePath();
			}
		} catch (ResourceNotFoundException e) {
			filePath = null;
		}

		return filePath;
	}
754000
private static InputStream getStreamFromClasspath(String fileName)
    {
        String path = fileName;
        InputStream dtdStream = PersistenceXMLLoader.class.getClassLoader().getResourceAsStream(path);
        return dtdStream;
    }
909696
def _root_path(self):
        """'"""
        if self.ROOT_PATH_FOR_DYNACONF is not None:
            return self.ROOT_PATH_FOR_DYNACONF
        elif self._loaded_files:  # called once
            root_path = os.path.dirname(self._loaded_files[0])
            self.set("ROOT_PATH_FOR_DYNACONF", root_path)
            return root_path