public static NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled) { NSMutableArray propertiesPaths = new NSMutableArray(); NSMutableArray projectsInfo = new NSMutableArray(); String projectPath, aPropertiesPath; WOApplication application = WOApplication.application(); if (application == null) { log.warn("The application is not yet initialized. Returning an empty array."); return NSArray.EmptyArray; }   NSArray frameworkNames = (NSArray)NSBundle.frameworkBundles().valueForKey("name"); Enumeration e = frameworkNames.objectEnumerator(); while (e.hasMoreElements()) { String frameworkName = (String) e.nextElement(); projectPath = aPropertiesPath = null;   WOProjectBundle bundle = WOProjectBundle.projectBundleForProject(frameworkName, true); if (bundle != null) projectPath = bundle.projectPath(); else projectPath = System.getProperty("projects." + frameworkName);  if (projectPath != null) { aPropertiesPath = pathForPropertiesUnderProjectPath(projectPath); if (aPropertiesPath != null) { projectsInfo.addObject("Framework:   " + frameworkName + " (opened, development-mode) " + aPropertiesPath); } }  if (aPropertiesPath == null) {  aPropertiesPath = ERXFileUtilities.pathForResourceNamed("Properties", frameworkName, null); if (aPropertiesPath != null) { aPropertiesPath = getActualPath(aPropertiesPath); projectsInfo.addObject("Framework:   " + frameworkName + " (not opened, installed) " + aPropertiesPath); } }  if (aPropertiesPath != null) propertiesPaths.addObject(aPropertiesPath); }     projectPath = aPropertiesPath = null; String mainBundleName = NSBundle.mainBundle().name();  WOProjectBundle mainBundle = WOProjectBundle.projectBundleForProject(mainBundleName, false); if (mainBundle == null) { projectPath = System.getProperty("projects." + mainBundleName); if (projectPath == null) projectPath = "../.."; } else { projectPath = mainBundle.projectPath(); }  if (projectPath != null) { aPropertiesPath = pathForPropertiesUnderProjectPath(projectPath); if (aPropertiesPath != null) { projectsInfo.addObject("Application: " + mainBundleName + " (opened, development-mode) " + aPropertiesPath); } }  if (aPropertiesPath == null) {  aPropertiesPath = ERXFileUtilities.pathForResourceNamed("Properties", "app", null); if (aPropertiesPath != null) { aPropertiesPath = getActualPath(aPropertiesPath); projectsInfo.addObject("Application: " + mainBundleName + " (not opened, installed) " + aPropertiesPath); } }  if (aPropertiesPath != null) propertiesPaths.addObject(aPropertiesPath);    String userHome = System.getProperty("user.home"); if (userHome != null  &&  userHome.length() > 0) { File file = new File(userHome, "WebObjects.properties"); if (file.exists()  &&  file.isFile()  &&  file.canRead()) { try { aPropertiesPath = file.getCanonicalPath(); projectsInfo.addObject("User:        WebObjects.properties " + aPropertiesPath); propertiesPaths.addObject(aPropertiesPath); } catch (java.io.IOException ex) { ; } } }   if (optionalConfigurationFiles() != null && optionalConfigurationFiles().count() > 0) { for (Enumeration configEnumerator = optionalConfigurationFiles().objectEnumerator(); configEnumerator.hasMoreElements();) { String configFile = (String)configEnumerator.nextElement(); File file = new File(configFile); if (file.exists()  &&  file.isFile()  &&  file.canRead()) { try { aPropertiesPath = file.getCanonicalPath(); projectsInfo.addObject("Optional Configuration:    " + aPropertiesPath); propertiesPaths.addObject(aPropertiesPath); } catch (java.io.IOException ex) { ; } } } }   if (reportLoggingEnabled  &&  projectsInfo.count() > 0) { StringBuffer message = new StringBuffer(); message.append("\n\n") .append("ERXProperties has found the following Properties files: \n"); message.append(projectsInfo.componentsJoinedByString("\n")); message.append("\n"); log.info(message.toString()); }  return propertiesPaths.immutableClone();
public static NSArray pathsForUserAndBundleProperties() { return pathsForUserAndBundleProperties(false);
    public static NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled) {        NSMutableArray propertiesPaths = new NSMutableArray();        NSMutableArray projectsInfo = new NSMutableArray();        String projectPath, aPropertiesPath;        WOApplication application = WOApplication.application();        if (application == null) {            log.warn("The application is not yet initialized. Returning an empty array.");            return NSArray.EmptyArray;        }                        /* *** Properties for frameworks *** */        NSArray frameworkNames = (NSArray)NSBundle.frameworkBundles().valueForKey("name");        Enumeration e = frameworkNames.objectEnumerator();        while (e.hasMoreElements()) {            String frameworkName = (String) e.nextElement();            projectPath = aPropertiesPath = null;                        // Check if the framework project is opened from PBX            WOProjectBundle bundle = WOProjectBundle.projectBundleForProject(frameworkName, true);            if (bundle != null)                 projectPath = bundle.projectPath();            else                 projectPath = System.getProperty("projects." + frameworkName);                        if (projectPath != null) {                aPropertiesPath = pathForPropertiesUnderProjectPath(projectPath);                if (aPropertiesPath != null) {                    projectsInfo.addObject("Framework:   " + frameworkName                             + " (opened, development-mode) " + aPropertiesPath);                }            }                        if (aPropertiesPath == null) {                // The framework project is not opened from PBX, use the one in the bundle.                 aPropertiesPath = ERXFileUtilities.pathForResourceNamed("Properties", frameworkName, null);                if (aPropertiesPath != null) {                    aPropertiesPath = getActualPath(aPropertiesPath);                    projectsInfo.addObject("Framework:   " + frameworkName                             + " (not opened, installed) " + aPropertiesPath);                 }            }                        if (aPropertiesPath != null)                     propertiesPaths.addObject(aPropertiesPath);        }                 /* *** Properties for the application (mainBundle) *** */                // Check if the application project is opened from PBXs        projectPath = aPropertiesPath = null;        String mainBundleName = NSBundle.mainBundle().name();        // horrendous hack to avoid having to set the NSProjectPath manually.            WOProjectBundle mainBundle = WOProjectBundle.projectBundleForProject(mainBundleName, false);            if (mainBundle == null) {                projectPath = System.getProperty("projects." + mainBundleName);                if (projectPath == null)                    projectPath = "../..";            } else {                projectPath = mainBundle.projectPath();            }                    if (projectPath != null) {            aPropertiesPath = pathForPropertiesUnderProjectPath(projectPath);            if (aPropertiesPath != null) {                projectsInfo.addObject("Application: " + mainBundleName                             + " (opened, development-mode) " + aPropertiesPath);             }        }        if (aPropertiesPath == null) {            // The application project is not opened from PBX, use the one in the bundle.             aPropertiesPath = ERXFileUtilities.pathForResourceNamed("Properties", "app", null);            if (aPropertiesPath != null) {               aPropertiesPath = getActualPath(aPropertiesPath);               projectsInfo.addObject("Application: " + mainBundleName                             + " (not opened, installed) " + aPropertiesPath);              }        }        if (aPropertiesPath != null)             propertiesPaths.addObject(aPropertiesPath);        /* *** WebObjects.properties in the user home directory *** */        String userHome = System.getProperty("user.home");        if (userHome != null  &&  userHome.length() > 0) {             File file = new File(userHome, "WebObjects.properties");            if (file.exists()  &&  file.isFile()  &&  file.canRead()) {                try {                    aPropertiesPath = file.getCanonicalPath();                    projectsInfo.addObject("User:        WebObjects.properties " + aPropertiesPath);                      propertiesPaths.addObject(aPropertiesPath);                } catch (java.io.IOException ex) {                    ;                }            }        }        /* **** Optional properties files **** */        if (optionalConfigurationFiles() != null &&            optionalConfigurationFiles().count() > 0) {            for (Enumeration configEnumerator = optionalConfigurationFiles().objectEnumerator();                 configEnumerator.hasMoreElements();) {                String configFile = (String)configEnumerator.nextElement();                File file = new File(configFile);                if (file.exists()  &&  file.isFile()  &&  file.canRead()) {                    try {                        aPropertiesPath = file.getCanonicalPath();                        projectsInfo.addObject("Optional Configuration:    " + aPropertiesPath);                        propertiesPaths.addObject(aPropertiesPath);                    } catch (java.io.IOException ex) {                        ;                    }                                    }            }        }                /* *** Report the result *** */         if (reportLoggingEnabled  &&  projectsInfo.count() > 0) {            StringBuffer message = new StringBuffer();            message.append("\n\n")                    .append("ERXProperties has found the following Properties files: \n");            message.append(projectsInfo.componentsJoinedByString("\n"));            message.append("\n");            log.info(message.toString());        }        return propertiesPaths.immutableClone();    }