Package webobjectsexamples.businesslogic

Source Code of webobjectsexamples.businesslogic.ERMoviesLogic

package webobjectsexamples.businesslogic;

import com.webobjects.foundation.NSBundle;
import com.webobjects.foundation.NSLog;

import er.extensions.ERXFrameworkPrincipal;
import er.extensions.foundation.ERXProperties;

/**
*
* @property webobjectsexamples.ERMoviesLogic.useEmbeddedH2Database
*/
public class ERMoviesLogic extends ERXFrameworkPrincipal {
   
    static {
        setUpFrameworkPrincipalClass(ERMoviesLogic.class);
    }

    @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);
        System.setProperty("ERTaggable.URL", h2URL);
      }
   
    }

}
TOP

Related Classes of webobjectsexamples.businesslogic.ERMoviesLogic

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.