Thanks JR and David. I will use the lazy approach of overriding run() in 
Application.
I will also pass -WOLifebeatEnabled false as I don't want this application to 
talk to wotaskd
If anyone can tell me if this flag would achieve that, I would be interested 
and without it would the app in fact be pinging wotaskd and would wotaskd take 
any notice if it wasn't "in charge" of this application?
Thanks
John

On 25 Apr 2014, at 22:58, Ruggentaler, JR <jr.ruggenta...@experian.com> wrote:

> Awhile back I had a plain Java app that included EOF. In eclipse it's just a 
> Java project with the following jars and a WO framework in the class path:
> 
> JavaJDBCAdaptor.framework
> javaeoaccess.jar
> javaeocontrol.jar
> javafoundation.jar
> JavaJDBCAdaptor.jar
> javaxml.jar
> 
> Here is the EOF initialization code:
> 
> public class EOFSetup
> {
> private static EOFSetup setupHandler;
> 
> protected NSArray modelNames;
> protected Properties props;
> 
> public static void initSharedHandler(Properties props, NSArray modelNames)
> {
> setupHandler = new EOFSetup(props, modelNames);
> }
> 
> public static EOFSetup getSetupHandler()
> {
> return setupHandler;
> }
> 
> public EOFSetup(Properties props, NSArray modelNames)
> {
> this.modelNames = modelNames;
> this.props = props;
> 
> createDbContextStacks();
> }
> 
> /**
> * Overrides connection dictionary of this database context's adaptor
> * to the one specified in defaults if applicable.
> */
> protected void createDbContextStacks()
> {
> EOEditingContext ec = EOSharedEditingContext.defaultSharedEditingContext();
> 
> EOObjectStoreCoordinator storeCoord =
> EOObjectStoreCoordinator.defaultCoordinator();
> EOModelGroup mg = 
> EOModelGroup.defaultGroup();
> 
> // see if we have custom connection dictionary
> //NSDictionary altConnectInfo = props.eofAltConnection();
> NSMutableDictionary altConnectInfo = new NSMutableDictionary();
>         
>         String[] connectionPorops = new String[] 
>         {
>         
> "URL", "password", "username"
>         };
>         
>         for (int i = 0; i < connectionPorops.length; i++)
>         {
>         
> // Allow command line override of connection properties
>         if (null != System.getProperty(connectionPorops[i]))
>         {
>         
> altConnectInfo.setObjectForKey(System.getProperty(connectionPorops[i]),
>                 
> connectionPorops[i]);
>             
> Log.logI("Connection property '" + connectionPorops[i] +
>                 
> "' changed to '" + System.getProperty(connectionPorops[i]) + "'");
>         }
>         }
> 
> if (altConnectInfo != null)
> {
> Log.logI("Using alt. connection info.");
> }
> 
> for (int i = 0, iMax = modelNames.count(); i < iMax; i++)
> {
> try {
> mg.addModelWithPathURL(new File(modelNames.objectAtIndex(i) + 
> ".eomodeld").toURI().toURL());
> }
> catch (MalformedURLException x) {
> Log.logX(x);
> System.exit(-1);
> }
> 
> EOModel aModel = mg.modelNamed((String)modelNames.objectAtIndex(i));
> 
> if (null == aModel) {
> Log.logE("Model '" + modelNames.objectAtIndex(i) + "' not found!");
> System.exit(-1);
> }
> 
> Log.logI("Initializing model: " + modelNames.objectAtIndex(i));
> 
> // merge model connection dictionary with alt dictionary
> // this way, only certain keys can be overriden in alt.
> NSMutableDictionary dict = null;
> 
> if (null != altConnectInfo && null != aModel)
> {
> dict = new NSMutableDictionary(aModel.connectionDictionary());
> dict.addEntriesFromDictionary(altConnectInfo);
> }
> 
> // create EOF stack with new connection dict...
> EODatabaseContext dbContext =
> EODatabaseContext.forceConnectionWithModel(
>                      aModel,
>                      dict,
>                      new EOEditingContext(storeCoord));
> 
> 
> storeCoord.addCooperatingObjectStore(dbContext);
> 
> // this line is important !!!
> // this will force shared editing contexts to be fetched...
> EODatabaseContext.registeredDatabaseContextForModel(aModel, ec);
> }
> }
> }
> 
> JR
> On 4/25/14 10:03 AM, "David Avendasora" <webobje...@avendasora.com> wrote:
> 
>> Sounds like what would have been a “Command Line App” in the old Project 
>> Builder days…
>> 
>> I’d start with a Wonder app and strip out all the frameworks that you don’t 
>> want - maybe even start with the JavaClient project template and just delete 
>> all the client-side stuff, or the ERRest application and yank out the ERRest 
>> framework.
>> 
>> If you have the original install disks for WO 5.2 then you could probably 
>> find the project builder setup script and look at what it used for a 
>> command-line project… but I’ve dug around and I don’t seem to have it 
>> anymore.
>> 
>> Dave
>> 
>> 
>> 
>> On Apr 25, 2014, at 10:43 AM, John Pollard <j...@pollardweb.com> wrote:
>> 
>>> Hi List,
>>> What is the sensible way to create a new application in Eclipse that uses 
>>> EOF and a model, plus draws on Wonder bits and bobs, but isn't a web app 
>>> i.e. has no web front end? I think Eclipse once had an EOF Application 
>>> type, or I may have mis-remembered that.
>>> I can create a new Wonder app in eclipse and just not have any request / 
>>> responses and launch my code from Application(), but that feels a bit 
>>> wrong. I don't want it to talk to wotaskd or be started from JavaMonitor.
>>> Thanks in advance.
>>> John
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
>>> This email sent to webobje...@avendasora.com
>> 
>> 
>> —————————————————————————————
>> WebObjects - so easy that even Dave Avendasora can do it!™
>> —————————————————————————————
>> David Avendasora
>> Senior Software Abuser
>> Nekesto, Inc.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jr.ruggentaler%40experian.com
>> 
>> This email sent to jr.ruggenta...@experian.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to