Discover the location of the apiman.properties (for example) file by checking
in various likely locations.
976772
private static URL discoverConfigFileUrl(String configFileName, String customConfigPropertyName) {
        URL rval;

        // User Defined
        ///////////////////////////////////
        String userConfig = System.getProperty(customConfigPropertyName);
        if (userConfig != null) {
            // Treat it as a URL
            try {
                rval = new URL(userConfig);
                return rval;
            } catch (Exception t) {
            }
            // Treat it as a file
            try {
                File f = new File(userConfig);
                if (f.isFile()) {
                    rval = f.toURI().toURL();
                    return rval;
                }
            } catch (Exception t) {
            }
            throw new RuntimeException("Apiman configuration provided at [" + userConfig + "] but could not be loaded."); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        // Wildfly/EAP
        ///////////////////////////////////
        String jbossConfigDir = System.getProperty("jboss.server.config.dir"); //$NON-NLS-1$
        String jbossConfigUrl = System.getProperty("jboss.server.config.url"); //$NON-NLS-1$
        if (jbossConfigDir != null) {
            File dirFile = new File(jbossConfigDir);
            rval = findConfigUrlInDirectory(dirFile, configFileName);
            if (rval != null) {
                return rval;
            }
        }
        if (jbossConfigUrl != null) {
            File dirFile = new File(jbossConfigUrl);
            rval = findConfigUrlInDirectory(dirFile, configFileName);
            if (rval != null) {
                return rval;
            }
        }

        // Apache Tomcat
        ///////////////////////
        String tomcatHomeDir = System.getProperty("catalina.home"); //$NON-NLS-1$
        if (tomcatHomeDir != null) {
            File dirFile = new File(tomcatHomeDir, "conf"); //$NON-NLS-1$
            rval = findConfigUrlInDirectory(dirFile, configFileName);
            if (rval != null) {
                return rval;
            }
        }

        // If not found, use an empty file.
        ////////////////////////////////////////
        return ConfigFileConfiguration.class.getResource("empty.properties"); //$NON-NLS-1$
    }
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;
    }
441908
@Nonnull
	private static Properties findDefaultProperties() {
		final InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);
		final Properties p = new Properties();
		try {
			p.load(in);
		} catch (final IOException e) {
			throw new RuntimeException(String.format("Can not load resource %s", DEFAULT_PROPERTIES_PATH));
		}
		return p;
	}
762302
function findProxyObject(uri, proxyName, callback) {
    var proxyObject = {},
        folderUri = path.join(uri, proxyName)

    iterateFiles(folderUri, function (fileName) {
        var relativePropertyName = path.relative(folderUri, fileName),
            relativeValue = path.relative(uri, fileName)

        relativePropertyName = relativePropertyName.replace(isFile, "")
        var props = relativePropertyName.split("/")

        props.reduce(function (memo, value, index) {
            if (index === props.length - 1) {
                memo[value] = relativeValue
            } else {
                return (memo[value] = memo[value] || {})
            }
        }, proxyObject)

    }, function (err) {
        callback(err, proxyObject)
    })

    //fs.readdir(folderUri, mapIntoProxyObject)

    function mapIntoProxyObject(err, files) {
        if (err) {
            return callback(err)
        }
        files.filter(isFileFunction).forEach(addToProxyObject)
        callback(null, proxyObject)
    }

    function addToProxyObject(fileName) {
        var propertyName = fileName.replace(isFile, "")

        proxyObject[propertyName] = 
            path.join(proxyName, fileName)
    }
}
1246100
private void readPropertiesFiles() {

        if (this.messageFileWildcard.isEmpty() || !CoreParameters.LOG_RESOLUTION.get()) {
            // Skip configuration loading
            LOGGER.info(JRebirthMarkers.MESSAGE, "Messages Loading is skipped");

        } else {
            // Assemble the regex pattern
            final Pattern filePattern = Pattern.compile(this.messageFileWildcard + "\\.properties");

            // Retrieve all resources from default classpath
            final Collection<String> list = ClasspathUtility.getClasspathResources(filePattern);

            LOGGER.info(JRebirthMarkers.MESSAGE, "{} Messages file{} found.", list.size(), list.size() > 1 ? "s" : "");

            for (final String rbFilename : list) {
                readPropertiesFile(rbFilename);
            }
        }
    }
641495
public static void findSourceFiles(List<SourceLocation> sourceLocations,
                                       Set<String> sourceTypes,
                                       Map<String,Source> foundFiles,
                                       Map<String, Module> foundModules,
                                       Module currentModule,
                                       boolean permitSourcesInDefaultPackage,
                                       boolean inLinksrc)
                                               throws IOException {

        for (SourceLocation source : sourceLocations) {
            source.findSourceFiles(sourceTypes,
                                   foundFiles,
                                   foundModules,
                                   currentModule,
                                   permitSourcesInDefaultPackage,
                                   inLinksrc);
        }
    }
371623
private void getFilesForFeature(File installRoot,
                                    final Set<String> absPathsForLibertyContent,
                                    final Set<String> absPathsForLibertyBundles,
                                    final Set<String> absPathsForLibertyLocalizations,
                                    final Set<String> absPathsForLibertyIcons,
                                    final ProvisioningFeatureDefinition fd,
                                    final ContentBasedLocalBundleRepository br) {
        Collection<FeatureResource> frs = fd.getConstituents(null);

        for (FeatureResource fr : frs) {
            switch (fr.getType()) {
                case FEATURE_TYPE: {
                    // No resource for this feature
                    break;
                }

                case BUNDLE_TYPE:
                case BOOT_JAR_TYPE: {
                    // Add to the list of bundle files
                    addJarResource(absPathsForLibertyBundles, fd, br, fr);
                    break;
                }

                case JAR_TYPE: {
                    // Add to the list of normal files
                    addJarResource(absPathsForLibertyContent, fd, br, fr);
                    break;
                }

                case FILE_TYPE: {
                    // file uses loc as a relative path from install root.
                    String locString = fr.getLocation();
                    if (locString != null) {
                        addFileResource(installRoot, absPathsForLibertyContent,
                                        locString);
                    } else {
                        // a file type without a loc is bad, means misuse of the
                        // type.
                        throw new BuildException("No location on file type for resource "
                                                 + fr.getSymbolicName() + " in feature "
                                                 + fd.getFeatureName());
                    }
                    break;
                }

                case UNKNOWN: {
                    // if its not jar,bundle,feature, or file.. then something
                    // is wrong.
                    log("Unknown feature resource for " + fr.getSymbolicName()
                        + " in feature " + fd.getFeatureName()
                        + ". The type is: " + fr.getRawType(),
                        Project.MSG_ERR);
                    // we assume that other types will use the location field as
                    // something useful.
                    String locString = fr.getLocation();
                    if (locString != null) {
                        addFileResource(installRoot, absPathsForLibertyContent,
                                        locString);
                    }
                }
            }
        }
        // add in (all) the NLS files for this featuredef.. if any..
        for (File nls : fd.getLocalizationFiles()) {
            if (nls.exists()) {
                absPathsForLibertyLocalizations.add(nls.getAbsolutePath());
            }
        }

        for (String icon : fd.getIcons()) {
            File iconFile = new File(fd.getFeatureDefinitionFile().getParentFile(), "icons/" + fd.getSymbolicName() + "/" + icon);
            if (iconFile.exists()) {
                absPathsForLibertyIcons.add(iconFile.getAbsolutePath());
            } else {
                throw new BuildException("Icon file " + iconFile.getAbsolutePath() + " doesn't exist");
            }
        }
    }
206802
def command_locate(options):
    """"""
    matches = find_owners(options.file.name)

    if matches:
        print(*matches, sep='\n')
41098
private void locateCodebasesRequiredForAnalysis(IClassPath classPath, IClassPathBuilderProgress progress)
            throws InterruptedException, IOException, ResourceNotFoundException {
        boolean foundJavaLangObject = false;
        boolean foundFindBugsAnnotations = false;
        boolean foundJSR305Annotations = false;

        for (DiscoveredCodeBase discoveredCodeBase : discoveredCodeBaseList) {
            if (!foundJavaLangObject) {
                foundJavaLangObject = probeCodeBaseForResource(discoveredCodeBase, "java/lang/Object.class");
            }
            if (!foundFindBugsAnnotations) {
                foundFindBugsAnnotations = probeCodeBaseForResource(discoveredCodeBase,
                        "edu/umd/cs/findbugs/annotations/Nonnull.class");
            }
            if (!foundJSR305Annotations) {
                foundJSR305Annotations = probeCodeBaseForResource(discoveredCodeBase, "javax/annotation/meta/TypeQualifier.class");
                if (DEBUG) {
                    System.out.println("foundJSR305Annotations: " + foundJSR305Annotations);
                }
            }
        }

        if (!foundJavaLangObject) {
            processWorkList(classPath, buildSystemCodebaseList(), progress);
        }

        // If we're running findbugs-full.jar, IT contains the contents
        // of jsr305.jar and annotations.jar. So, add it to the classpath.
        if (runningFindBugsFullJar()) {
            processWorkList(classPath, buildFindBugsFullJarCodebaseList(), progress);
            return;
        }

        // Not running findbugs-full.jar: try to find jsr305.jar and
        // annotations.jar.

        if (!foundFindBugsAnnotations) {
            processWorkList(classPath, buildFindBugsAnnotationCodebaseList(), progress);
        }
        if (!foundJSR305Annotations) {
            processWorkList(classPath, buildJSR305AnnotationsCodebaseList(), progress);
        }
    }
319780
private static PropertyLookup createDirectProjectPropertyLookup(
            IFilesystemFramework filesystemFramework,
            String projectName
    )
    {
        PropertyLookup lookup;
        final Properties ownProps = new Properties();
        ownProps.setProperty("project.name", projectName);

        File projectsBaseDir = filesystemFramework.getFrameworkProjectsBaseDir();
        //generic framework properties for a project

        final File propertyFile = getProjectPropertyFile(new File(projectsBaseDir, projectName));
        final Properties projectProps = PropertyLookup.fetchProperties(propertyFile);

        lookup = PropertyLookup.create(projectProps, PropertyLookup.create(ownProps));
        lookup.expand();
        return lookup;
    }
1157698
private static InternetHeaders getManifestProperties(File manifest) {
        final InternetHeaders result = new InternetHeaders();
        if (null == manifest) {
            LOGGER.debug("Manifest file not found.");
        } else {
            try (InputStream in = new BufferedInputStream(new FileInputStream(manifest))) {
                result.load(in);
            } catch (MessagingException | FileNotFoundException e) {
                LOGGER.warn(e.getMessage(), e);
            } catch (IOException ex) {
                LOGGER.warn(ex.getMessage(), ex);
            }
        }
        return result;
    }
130200
def find_really(self, id):
        
        assert isinstance(id, basestring)

        result = None
        current_location = self.get ('location')

        __re_split_project_target = re.compile (r'(.*)//(.*)')
        split = __re_split_project_target.match (id)

        project_part = None
        target_part = None

        if split:
            project_part = split.group(1)
            target_part = split.group(2)
            if not target_part:
                get_manager().errors()(
                    'Project ID, "{}", is not a valid target reference. There should '
                    'be either a target name after the "//" or the "//" should be removed '
                    'from the target reference.'
                    .format(id)
                )


        project_registry = self.project_.manager ().projects ()

        extra_error_message = ''
        if project_part:
            # There's explicit project part in id. Looks up the
            # project and pass the request to it.
            pm = project_registry.find (project_part, current_location)

            if pm:
                project_target = project_registry.target (pm)
                result = project_target.find (target_part, no_error=1)

            else:
                extra_error_message = "error: could not find project '$(project_part)'"

        else:
            # Interpret target-name as name of main target
            # Need to do this before checking for file. Consider this:
            #
            #  exe test : test.cpp ;
            #  install s : test : <location>. ;
            #
            # After first build we'll have target 'test' in Jamfile and file
            # 'test' on the disk. We need target to override the file.

            result = None
            if self.has_main_target(id):
                result = self.main_target(id)

            if not result:
                result = FileReference (self.manager_, id, self.project_)
                if not result.exists ():
                    # File actually does not exist.
                    # Reset 'target' so that an error is issued.
                    result = None


            if not result:
                # Interpret id as project-id
                project_module = project_registry.find (id, current_location)
                if project_module:
                    result = project_registry.target (project_module)

        return result
1225418
private void readParamsFromFile()
   {
      PropertiesParam props = initParams.getPropertiesParam("artifact.workspace");

      if (props == null)
      {
         throw new IllegalArgumentException("Property parameters 'locations' expected");
      }

      repoWorkspaceName = props.getProperty("workspace");
      rootNodePath = props.getProperty("rootNode");

      LOG.info("Workspace from configuration file: " + repoWorkspaceName);
      LOG.info("RootNode from configuration file: " + rootNodePath);
   }
1185625
static Finding createFindingWithSourceProperties(SourceName sourceName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // SourceName sourceName = SourceName.of(/*organization=*/"123234324",/*source=*/
      // "423432321");

      // Use the current time as the finding "event time".
      Instant eventTime = Instant.now();

      // Controlled by caller.
      String findingId = "samplefindingid2";

      // The resource this finding applies to.  The CSCC UI can link
      // the findings for a resource to the corresponding Asset of a resource
      // if there are matches.
      String resourceName = "//cloudresourcemanager.googleapis.com/organizations/11232";

      // Define source properties values as protobuf "Value" objects.
      Value stringValue = Value.newBuilder().setStringValue("stringExample").build();
      Value numValue = Value.newBuilder().setNumberValue(1234).build();
      ImmutableMap<String, Value> sourceProperties =
          ImmutableMap.of("stringKey", stringValue, "numKey", numValue);

      // Start setting up a request to create a finding in a source.
      Finding finding =
          Finding.newBuilder()
              .setParent(sourceName.toString())
              .setState(State.ACTIVE)
              .setResourceName(resourceName)
              .setEventTime(
                  Timestamp.newBuilder()
                      .setSeconds(eventTime.getEpochSecond())
                      .setNanos(eventTime.getNano()))
              .putAllSourceProperties(sourceProperties)
              .build();

      // Call the API.
      Finding response = client.createFinding(sourceName, findingId, finding);

      System.out.println("Created Finding with Source Properties: " + response);
      return response;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
875880
def _property_search(self, fobj):
        """"""
        # Get class object
        scontext = fobj.f_locals.get("self", None)
        class_obj = scontext.__class__ if scontext is not None else None
        if not class_obj:
            del fobj, scontext, class_obj
            return None
        # Get class properties objects
        class_props = [
            (member_name, member_obj)
            for member_name, member_obj in inspect.getmembers(class_obj)
            if isinstance(member_obj, property)
        ]
        if not class_props:
            del fobj, scontext, class_obj
            return None
        class_file = inspect.getfile(class_obj).replace(".pyc", ".py")
        class_name = self._callables_obj.get_callable_from_line(
            class_file, inspect.getsourcelines(class_obj)[1]
        )
        # Get properties actions
        prop_actions_dicts = {}
        for prop_name, prop_obj in class_props:
            prop_dict = {"fdel": None, "fget": None, "fset": None}
            for action in prop_dict:
                action_obj = getattr(prop_obj, action)
                if action_obj:
                    # Unwrap action object. Contracts match the wrapped
                    # code object while exceptions registered in the
                    # body of the function/method which has decorators
                    # match the unwrapped object
                    prev_func_obj, next_func_obj = (
                        action_obj,
                        getattr(action_obj, "__wrapped__", None),
                    )
                    while next_func_obj:
                        prev_func_obj, next_func_obj = (
                            next_func_obj,
                            getattr(next_func_obj, "__wrapped__", None),
                        )
                    prop_dict[action] = [
                        id(_get_func_code(action_obj)),
                        id(_get_func_code(prev_func_obj)),
                    ]
            prop_actions_dicts[prop_name] = prop_dict
        # Create properties directory
        func_id = id(fobj.f_code)
        desc_dict = {"fget": "getter", "fset": "setter", "fdel": "deleter"}
        for prop_name, prop_actions_dict in prop_actions_dicts.items():
            for action_name, action_id_list in prop_actions_dict.items():
                if action_id_list and (func_id in action_id_list):
                    prop_name = ".".join([class_name, prop_name])
                    del fobj, scontext, class_obj, class_props
                    return "{prop_name}({prop_action})".format(
                        prop_name=prop_name, prop_action=desc_dict[action_name]
                    )
        return None
594923
protected void findCreds() {
        if (System.getProperty(ACCESS_KEY) != null && System.getProperty(ACCESS_SECRET) != null) {
            accessKey = System.getProperty(ACCESS_KEY);
            secretKey = System.getProperty(ACCESS_SECRET);
        }

        else if (System.getenv(AWS_ACCESS_KEY) != null && System.getenv(AWS_SECRET_KEY) != null) {
            accessKey = System.getenv(AWS_ACCESS_KEY);
            secretKey = System.getenv(AWS_SECRET_KEY);
        }
    }
856071
function(location) {
  var found = false;

  while(!found) {
    if (exists(location + '/package.json')) {
      found = location;
    } else if (location !== '/') {
      location = path.dirname(location);
    } else {
      return false;
    }
  }

  return location;
}