Examples of NSBundle


Examples of com.webobjects.foundation.NSBundle

     *
     * @return version string
     */
    public static String wonderVersion() {
        String wonderVersion = null;
        NSBundle bundle = NSBundle.bundleForName("ERExtensions");
        if (bundle != null) {
            String note = valueFromPlistBundleWithKey(bundle, "Info.plist", "NOTE");
            if (note != null && note.equals("autogenerated")) {
                // Info.plist was generated by WOLips incremental builder
                wonderVersion = valueFromPlistBundleWithKey(bundle, "Info.plist", "CFBundleVersion");
            } else {
                // Info.plist was generated by ant
                wonderVersion = valueFromPlistBundleWithKey(bundle, "Info.plist", "CFBundleShortVersionString");
            }
            if (wonderVersion == "" && ERXApplication.isDevelopmentModeSafe()) {
                // running within Eclipse and no Info.plist has been generated so look at maven config
                FileInputStream is = null;
                try {
                    URL path = bundle.pathURLForResourcePath("../pom.xml");
                    File pomFile = new File(path.toURI());
                    if (pomFile.exists()) {
                        is = new FileInputStream(pomFile);
                        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                        DocumentBuilder builder = factory.newDocumentBuilder();
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

          /** Properties.<userName> -- per-Framework-per-User properties */
          String userPropertiesPath = ERXProperties.variantPropertiesInBundle(ERXSystem.getProperty("user.name"), frameworkName);
          addIfPresent(frameworkName + ".framework.user", userPropertiesPath, propertiesPaths, projectsInfo);
        }

    NSBundle mainBundle = NSBundle.mainBundle();
   
    if( mainBundle != null ) {
          String mainBundleName = mainBundle.name();
 
          String appPath = ERXFileUtilities.pathForResourceNamed("Properties", "app", null);
        addIfPresent(mainBundleName + ".app", appPath, propertiesPaths, projectsInfo);
    }

View Full Code Here

Examples of com.webobjects.foundation.NSBundle

        applicationName = application.name();
      }
      else {
        applicationName = ERXSystem.getProperty("WOApplicationName");
        if (applicationName == null) {
          NSBundle mainBundle = NSBundle.mainBundle();
          if (mainBundle != null) {
            applicationName = mainBundle.name();
          }
          if (applicationName == null) {
            applicationName = "Unknown";
          }
        }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

      public Configuration() {
        NSMutableArray bundles = NSBundle.frameworkBundles().mutableClone();
        bundles.addObject(NSBundle.mainBundle());
        for(Enumeration e = bundles.objectEnumerator(); e.hasMoreElements(); ) {
          NSBundle bundle = (NSBundle)e.nextElement();
          NSDictionary dict;
          String path = bundle.resourcePathForLocalizedResourceNamed("d2wclientConfiguration.plist", null);
          if(path != null) {
            dict = ERXDictionaryUtilities.dictionaryFromPropertyList("d2wclientConfiguration", bundle);
            if(dict != null) {
              if(dict.objectForKey("components") != null) {
                components.addEntriesFromDictionary((NSDictionary)dict.objectForKey("components"));
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

   * the index definitions to the master dictionary of application indices
   */
  public void loadIndexDefinitions() {
    // Check every bundle (app and frameworks)
      for (Enumeration bundles = NSBundle._allBundlesReally().objectEnumerator(); bundles.hasMoreElements();) {
          NSBundle bundle = (NSBundle) bundles.nextElement();
         
          // Get list of all files with extension indexModel
          NSArray<String> files = bundle.resourcePathsForResources("indexModel", null);
          for (String file : files) {
              URL url = bundle.pathURLForResourcePath(file);
             
              // Get the name of the indexModel file withut the directory path and without the file extension
              String name = url.toString().replaceAll(".*?/(\\w+)\\.indexModel$", "$1");
              if(url != null) {
               
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

  @Override
  public void finishInitialization() {
    super.finishInitialization();

    NSBundle bundle = NSBundle.mainBundle();

    String file = bundle.bundlePath() + "/Resources/H2DB/Movies";

    System.setProperty("Movies.URL", "jdbc:h2:file:" + file);
  }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

    public static NSMutableDictionary<String, Object> informationForBundles() {
      NSMutableDictionary<String, Object> extraInfo = new NSMutableDictionary<String, Object>();
      NSMutableDictionary<String, Object> bundleVersions = new NSMutableDictionary<String, Object>();
      for (Enumeration bundles = NSBundle._allBundlesReally().objectEnumerator(); bundles.hasMoreElements();) {
        NSBundle bundle = (NSBundle) bundles.nextElement();
        String version = ERXProperties.versionStringForFrameworkNamed(bundle.name());
        if(version == null) {
          version = "No version provided";
        }
        bundleVersions.setObjectForKey(version, bundle.name());
      }
      extraInfo.setObjectForKey(bundleVersions, "Bundles");
      return extraInfo;
    }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

    if (frameworkSearchPath == null) {
      frameworkSearchPath = ERXProperties.arrayForKey("er.extensions.ERXLocalizer.frameworkSearchPath");
      if(frameworkSearchPath == null) {
        NSMutableArray<String> defaultValue = new NSMutableArray<String>();
        for (Enumeration<NSBundle> e = NSBundle.frameworkBundles().objectEnumerator(); e.hasMoreElements();) {
          NSBundle bundle = e.nextElement();
          String name = bundle.name();
     
          // Check the Properties and Add it Automatically
          String propertyName = "er.extensions." + name + ".hasLocalization";
          boolean hasLocalization = ERXProperties.booleanForKeyWithDefault(propertyName, true);
     
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

    NSMutableSet<NSBundle> bundles = new NSMutableSet<NSBundle>();
    bundles.addObject(NSBundle.mainBundle());
    bundles.addObjectsFromArray(frameworkBundles);

    for (Enumeration<NSBundle> e = bundles.objectEnumerator(); e.hasMoreElements(); ) {
      NSBundle nsbundle = e.nextElement();
      NSArray<String> paths = nsbundle.resourcePathsForResources("eomodeld", null);
      int pathCount = paths.count();
      for (int currentPath = 0; currentPath < pathCount; currentPath++) {
        String indexPath = paths.objectAtIndex(currentPath);
        if(indexPath.endsWith(".eomodeld~/index.eomodeld")) {
          // AK: we don't want to use temp files. This is actually an error in the
          // builds or it happens when you open and change models from installed frameworks
          // but I'm getting so annoyed by this that we just skip the models here
          log.info("Not adding model, it's only a temp file: " + indexPath);
          continue;
        }
        String modelPath = NSPathUtilities.stringByDeletingLastPathComponent(indexPath);
        String modelName = (NSPathUtilities.stringByDeletingPathExtension(NSPathUtilities.lastPathComponent(modelPath)));
        EOModel eomodel = modelNamed(modelName);
        if (eomodel == null) {
          URL url = nsbundle.pathURLForResourcePath(modelPath);
          modelNameURLDictionary.setObjectForKey(url, modelName);
          modelNames.addObject(modelName);
        }
        else if (NSLog.debugLoggingAllowedForLevelAndGroups(1, 32768L)) {
          NSLog.debug.appendln("Ignoring model at path \"" + modelPath + "\" because the model group " + this + " already contains the model from the path \"" + eomodel.pathURL() + "\"");
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

   
    @Override
    public void finishInitialization() {
      super.finishInitialization();
     
        NSBundle bundle = NSBundle.bundleForClass(ERMoviesLogic.class);
        String file = bundle.bundlePath() + "/Resources/Movies";
        System.setProperty("Movies.URL", "jdbc:h2:file:" + file);
        System.setProperty("Rentals.URL", "jdbc:h2:file:" + file);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.