Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSBundle


     * @return the absolutePath method off of the
     *    file object
     */
    public static String pathForResourceNamed(String fileName, String frameworkName, NSArray<String> languages) {
        String path = null;
        NSBundle bundle = "app".equals(frameworkName) ? NSBundle.mainBundle() : NSBundle.bundleForName(frameworkName);
        if(bundle != null && bundle.isJar()) {
            log.warn("Can't get path when run as jar: " + frameworkName + " - " + fileName);
        } else {
          WOApplication application = WOApplication.application();
          if (application != null) {
              URL url = application.resourceManager().pathURLForResourceNamed(fileName, frameworkName, languages);
              if(url != null) {
                  path = url.getFile();
              }
          } else if( bundle != null ) {
            URL url = bundle.pathURLForResourcePath(fileName);
              if(url != null) {
                  path = url.getFile();
              }
          }
        }
View Full Code Here


     * @return array containing all of the framework names
     */
    public static NSArray allFrameworkNames() {
        NSMutableArray frameworkNames = new NSMutableArray();
        for (Enumeration e = NSBundle.frameworkBundles().objectEnumerator(); e.hasMoreElements();) {
            NSBundle bundle = (NSBundle)e.nextElement();
            if (bundle.name() != null)
                frameworkNames.addObject(bundle.name());
            else
                log.warn("Null framework name for bundle: " + bundle);
        }
        return frameworkNames;
    }
View Full Code Here

    public boolean didLoad() {
      return (allFrameworks != null && allFrameworks.size() == 0);
    }

    private NSBundle mainBundle() {
      NSBundle mainBundle = null;
      String mainBundleName = NSProperties._mainBundleName();
      if (mainBundleName != null) {
        mainBundle = NSBundle.bundleForName(mainBundleName);
      }
      if (mainBundle == null) {
View Full Code Here

        _typeException = _exception.getClass().getName();
        _parseException();
    }

    protected NSArray _ignoredPackages() {
        NSBundle bundle;
        String path, content;
        NSDictionary dic = null;
        NSMutableArray<NSBundle> allBundles = new NSMutableArray<NSBundle>(NSBundle.frameworkBundles());
        NSMutableArray<String> ignored = new NSMutableArray<String>();

        for (Enumeration enumerator = allBundles.objectEnumerator(); enumerator.hasMoreElements(); ) {
            bundle = (NSBundle) enumerator.nextElement();
            path = WOApplication.application().resourceManager().pathForResourceNamed("WOIgnoredPackage.plist",bundle.name(),null);
            if (path != null) {
                content = _stringFromFileSafely(path);
                if (content != null) {
                    dic = (NSDictionary) NSPropertyListSerialization.propertyListFromString(content);
                    if (dic != null && dic.containsKey("ignoredPackages")) {
View Full Code Here

     * and the WebObjects.properties and finally the command line props.
     *
     * @param n
     */
    public void bundleDidLoad(NSNotification n) {
      NSBundle bundle = (NSBundle) n.object();
      if (allFrameworks.contains(bundle.name())) {
        allFrameworks.remove(bundle.name());
        debugMsg("Loaded " + bundle.name() + ". Remaining: " + allFrameworks);
      } else if (bundle.isFramework()) {
        debugMsg("Loaded unexpected framework bundle '" + bundle.name() + "'. Ensure your build.properties settings like project.name match the bundle name (including case).");
      }
      if (allBundleProps == null) {
        allBundleProps = new Properties();
      }
     
View Full Code Here

      }   
      return result;
    }

    private void collectMainProps(String userName) {
      NSBundle mainBundle = mainBundle();
     
      if (mainBundle != null) {
        mainUserProps = readProperties(mainBundle, "Properties." + userName);
        mainProps = readProperties(mainBundle, "Properties");
      }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSBundle

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.