• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to create a non-web EOF application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a non-web EOF application


  • Subject: Re: How to create a non-web EOF application
  • From: John Pollard <email@hidden>
  • Date: Tue, 29 Apr 2014 11:19:33 +0100

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 <email@hidden> 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" <email@hidden> 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 <email@hidden> 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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


—————————————————————————————
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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to create a non-web EOF application (From: John Pollard <email@hidden>)
 >Re: How to create a non-web EOF application (From: David Avendasora <email@hidden>)
 >Re: How to create a non-web EOF application (From: "Ruggentaler, JR" <email@hidden>)

  • Prev by Date: Re: WebObjects and IPv6 Support
  • Next by Date: ERXEC RR loop locking
  • Previous by thread: Re: How to create a non-web EOF application
  • Next by thread: CentOS deployment problem
  • Index(es):
    • Date
    • Thread