Examples of NSBundle


Examples of com.webobjects.foundation.NSBundle

        // Grab the Scheduler instance from the Factory
        // There is no synchronized mechanism because the ivar quartzSheduler is initialized when finishInitialization is called.
        if (propFileName != null)
        {
          String propFramework = ERXProperties.stringForKey("quartz.properties.framework");
          NSBundle bundle;
          String filePath = null;
          URL propFileURL = null;
         
          if (propFramework == null)
            bundle = NSBundle.mainBundle();
          else
            bundle = NSBundle.bundleForName(propFramework);
          if (bundle != null)
            propFileURL = bundle.pathURLForResourcePath(propFileName);
          if (propFileURL == null)
            log.error("method: getScheduler: unable to get the path to the properties file: " + propFileName + " in the framework: " + propFramework + ".\nThe Quartz scheduler is not launched.");
          else
          {
            filePath = propFileURL.getFile();
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

Examples of com.webobjects.foundation.NSBundle

    @Override
    public void finishInitialization() {
     
      if (ERXProperties.booleanForKeyWithDefault("webobjectsexamples.ERMoviesLogic.useEmbeddedH2Database", false)) {
        NSBundle bundle = NSBundle.bundleForClass(ERMoviesLogic.class);

        String file = bundle.bundlePathURL().getPath() + "/Resources/Movies";
        String h2URL = "jdbc:h2:file:" + file;
        NSLog.out.appendln("ERMoviesLogic.finishInitialization, re-writing connection url to use embedded H2 db at: " + h2URL);
        System.setProperty("Movies.URL", h2URL);
        System.setProperty("Rentals.URL", h2URL);
        System.setProperty("ERAttachment.URL", h2URL);
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

    if (templateUrl == null) {
      NSArray frameworkBundles = NSBundle.frameworkBundles();
      if (frameworkBundles != null) {
        Enumeration frameworksEnum = frameworkBundles.objectEnumerator();
        while (templateUrl == null && frameworksEnum.hasMoreElements()) {
          NSBundle frameworkBundle = (NSBundle) frameworksEnum.nextElement();
          templateUrl = resourceManager.pathURLForResourceNamed(resourceName, frameworkBundle.name(), languages);
        }
      }
    }
    return templateUrl;
  }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

   *
   * @param migrationName
   * @return SQL string
   */
  protected String getSQLForMigration(String migrationName) {
    NSBundle bundle;
    String migrationBundleName = migrationBundleName();
    if (migrationBundleName == null) {
      bundle = NSBundle.bundleForClass(getClass());
    }
    else {
      bundle = NSBundle.bundleForName(migrationBundleName());
      if (bundle == null) {
        bundle = NSBundle._appBundleForName(migrationBundleName());
      }
    }
    NSArray<String> resourcePaths = bundle.resourcePathsForResources("migration", null);

    if (resourcePaths != null) {
      for (String currentPath : resourcePaths) {
        if (currentPath.endsWith(migrationName)) {
          try {
            return new String(bundle.bytesForResourcePath(currentPath), _NSStringUtilities.UTF8_ENCODING);
          }
          catch (UnsupportedEncodingException e) {
            log.error(e, e);
          }
        }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

        if(allTests == null) {
            String thisBundleName = NSBundle.bundleForClass(getClass()).name();
            NSMutableSet theClassNames = new NSMutableSet();
            Enumeration bundleEnum = bundles().objectEnumerator();
            while (bundleEnum.hasMoreElements()) {
                NSBundle bundle = (NSBundle)bundleEnum.nextElement();
                if (!bundle.name().equals(thisBundleName)) {
                    Enumeration classNameEnum = bundle.bundleClassNames().objectEnumerator();
                    while (classNameEnum.hasMoreElements()) {
                        String className = (String)classNameEnum.nextElement();
                        if (className != null
                            && ( className.endsWith( "Test" ) || className.endsWith( "TestCase" ) || className.indexOf("tests.") == 0 || className.indexOf(".tests.") > 0)
                            && !className.startsWith( "junit." )
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

    if (i > 0) {
      nsmutablearray = new NSMutableArray(i);

      for (int j = 0; j < i; j++) {
        NSBundle nsbundle = NSBundle.bundleForName((String) nsmutablearray1.objectAtIndex(j));

        if (nsbundle != null) {
          nsmutablearray.addObject(nsbundle.bundlePath());
        }
      }
    }

    if (i == 0 || nsmutablearray.count() == 0) {
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

  private String documentRoot() {
    if (_documentRoot == null) {
      _documentRoot = ERXProperties.stringForKey("WODocumentRoot");
      if(_documentRoot == null) {
        NSBundle bundle = NSBundle.bundleForName("JavaWebObjects");
        NSDictionary dict = ERXDictionaryUtilities.dictionaryFromPropertyList("WebServerConfig", bundle);
        _documentRoot = (String) dict.objectForKey("DocumentRoot");
      }
    }
    return _documentRoot;
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

           
            if (bundleFile != null && bundleFile.isDirectory()) {
              System.setProperty("webobjects.user.dir", bundleFile.getCanonicalPath());
            }
           
            NSBundle mainBundle = null;
            try {
              mainBundle = ERXRuntimeUtilities.loadBundleIfNeeded(bundleFile);
              if (mainBundle == null) {
              throw new IllegalArgumentException("The main bundle failed to load.");
            }
View Full Code Here

Examples of com.webobjects.foundation.NSBundle

  private Preferences userDefaults;
  private ERDistributedObjectStore remoteObjectStore;

  public ERClientApplication() {
    NSBundle mainBundle = NSBundle.mainBundle(); // causes the bundle to be loaded and evaluated (will load Properties)
    if (mainBundle == null) {
      throw new IllegalStateException("Main bundle not found");
    }
   
    userDefaults = Preferences.userNodeForPackage( getClass() );
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.