[snip]
>> XCode used to have the ability to "merge" a jar which just
>> unjarred then included all the classes in your jar. If that's what
>> you're looking for, I believe you need to write some ant targets
>> to do that for you.
>
> No real need to merge the jar if nothing else cares - I just always
> thought it merged them because it would only have a classpath to
> that single jar.
Maybe it does. I have an app that uses a framework and I see the
following entry for it in the MacOSClassPath.txt file
LOCALROOT/Library/Frameworks/BailModel.framework/Resources/Java/
bailmodel.jar
So it's clearly going straight for the jar file in the classpath, not
loading every jar in Resources/Java. If you're including jars with
your framework, maybe they are merged in
[snip]
> Yes, I'm beginning to see the advantage to this. So you're
> advocating building regular jars and just having the apps reference
> them, getting rid of the framework concept altogether. It
> certainly is better than installing in /Library/Frameworks all the
> time. Where do you store your eomodeld?
My former boss wrote a library which I enhanced. It loads an external
plist as a configuration file. I store a public ivar to it and then I
can call valueForKeyPath on WOApplication. I set a known location (/
Library/EOModelFiles for instance) where I put my models. I wrote a
Handler which I subclass. The class stores a reference to an EOModel.
In the constructor, I load the model from the name in the
configuration file. Of course, this only works with one model but
that meets my needs. It's a simple matter to make a key ModelNames
returning an array, work through the array, and load all the models.
In my case, I'm writing a lot of apps that are nothing but web
service servers. I have also had a need for a lot of apps with a
timer that triggers an action to load data from the DB and send it
somewhere. I ended up writing a generic wrapper application that
loads the right class and the class loads the model when it's first
used. This has led to a very flexible app that can be reused with a
different configuration file so writing a new "application" really
means only writing a new class or two, putting it in the right place
in /Library/WebObjects/Extensions, and running an instance of my app
which loads a different config. It's all very flexible and much
easier to manaage than writing a new app every time with an
accompanying framework.
Here's the constructor for my class.
public Handler() {
if (model == null) {
String modelPath = RESOURCE_PATH
+ (String) WOApplication.application
().valueForKeyPath("config.ModelName");
modelPath = modelPath + ".eomodeld";
logger.debug("Attempting to load model at path " +
modelPath);
URL modelPathURL = null;
try {
modelPathURL = URLUtilities.urlForFilePath(modelPath);
model = new EOModel(modelPathURL);
EOModelGroup.defaultGroup().addModel(model);
logger.info("loaded model at path: " + modelPath);
} catch (MalformedURLException e) {
logger.fatal("Unable to load required EOModel at
url: " + modelPathURL);
System.exit(1);
}
}
}
This archive was generated by hypermail 2.0.0 : Tue Mar 21 2006 - 15:30:46 EST