@@TITLE: WireHose Database Setup@@
[Something should be here, but it's missing.][Something should be here, but it's missing.] | ||||||||||||||||||||||||||||||||||||||||||||||||||
WireHose Database SetupContents
IntroductionThe WireHose frameworks are designed to work with any database supported by WebObjects, and offer several features to make cross-database development and deployment easier. WireHose comes with support for building and running applications with FrontBase, OpenBase and Oracle, and it's easy to add support for other databases. WireHose can replace the database adaptor and connection dictionary on the fly when each EOModel is loaded. This allows you to switch between multiple databases by specifying a different adaptor dictionary on the command line when launching your application, as, for example, during development versus deployment. For improved performance, WireHose fetchers use custom SQL which may be incompatible with some databases. Use of this SQL can be controlled by several defaults. In general, any database which supports subselects should work properly with WireHose, though databases that support SQL set operators such as INTERSECT and EXCEPT (or MINUS) will perform better. All WireHose-specific entity attributes are defined by a handful of attribute prototypes. Using prototypes allows you to change the definition of every WireHose attribute in a single place. Versions of WebObjects prior to 5.0 provided a method for automatically generating primary keys which were 12-byte NSData objects. This was convenient because it did not require a round-trip to the database to allocate new primary keys. WHEnterpriseObject provides this capability for WebObjects 5.2, and will encode entity information into the primary key generated. Changing the adaptor dictionaryEach EOModel in a WebObjects application contains information in its index.eomodeld file called the "connection dictionary", which tells WebObjects which database on which host to connect to, which JDBC driver to use, etc. WireHose can replace the database adaptor and connection dictionary on the fly when each EOModel is loaded. This allows you to switch between multiple databases by specifying a different adaptor dictionary on the command line when launching your application, as, for example, during development versus deployment. An adaptor dictionary file is a property list
with two keys, "adaptorName" and "connectionDictionary".
There are adaptor dictionaries for FrontBase, OpenBase and Oracle
located in the Here's a sample adaptor dictionary: { adaptorName = JDBC; connectionDictionary = { URL = "jdbc:FrontBase://localhost/wirehose/user=wirehose"; driver = "jdbc.FrontBase.FBJDriver"; plugin = ""; username = ""; password = ""; }; } If you name your adaptor dictionary "adaptorDict.plist" and add it to your application's Bundle Resources in the Application Server target, the WireHose frameworks will find it and use it automatically. Otherwise, you can use the WHAdaptorDict property to specify the name of the adaptor dictionary to use at runtime. You can specify either the name of an adaptor dictionary in your application's Bundle Resources, or the full pathname to the desired file. SQL propertiesFor improved performance, WireHose fetchers use custom SQL which may be incompatible with some databases. In general, any database which supports subselects should work properly with WireHose, though databases that support SQL set operators such as INTERSECT and EXCEPT (or MINUS) will perform better. The custom SQL generated is controlled by several defaults (see Properties for more information about setting defaults):
Setting attribute prototypesAll WireHose-specific entity attributes are defined by a handful of attribute prototypes. Using prototypes allows you to change the definition of every WireHose entity in a single place, no matter which EOModel or framework they reside in (including the WireHoseBase EOModel in the WireHoseBase framework). See Apple's Using EOModeler documentation for details about creating prototype definitions. Default prototype definitions for FrontBase, OpenBase and Oracle
are provided in frameworks which were installed in your
To define your own prototypes, create a new WebObjects Framework project, and add a new EOModel to the Application Server target. Create one entity named "EOJDBCPrototypes", and define prototypes as shown in the table below. Then build and install your prototypes framework. Adding this framework to any WireHose application will cause WebObjects to use your prototype definitions instead of the ones defined in the WireHoseBase framework. To use a prototypes framework in a command-line tool, make sure there is entry in your classpath which points to the prototypes framework directory as there won't be a jar file to point to, e.g., "...:/Library/MyPrototypes.framework:..."
Working with boolean attributesSome WireHose attributes are boolean, e.g., Your eomodel should define boolean columns as an attribute of type BOOLEAN, INTEGER or CHAR(1), depending on what's appropriate for your database. The WireHoseBase eomodel defines a "whBoolean" prototype which you can use to modify the definition for all boolean attributes in a single place. WHEnterpriseObject's See the WHEnterpriseObject documentation for more information about working with boolean attributes. Using other databasesThe WireHose frameworks are designed to be as database independent as possible. For improved performance, WireHose fetchers use custom SQL which may be incompatible with some databases. In general, any database which supports subselects should work properly with WireHose, though databases that support SQL set operators such as INTERSECT and EXCEPT (or MINUS) will perform better. Create the databaseHere's one way to accomplish this task:
Create an adaptor dictionarySee Changing the adaptor dictionary for instructions. Create a prototypes frameworkSee Setting attribute prototypes for more information. Create a new WebObjects Framework project and add the EOModel containing your prototype definitions to the Application Server target. Before you build and launch your application, be sure that you have added the correct prototypes framework for your database to the Application Server target. Launching the sample applicationsWhen launching WireHose applications you'll also need to tell the WireHose frameworks to use your adaptor dictionary by using this extra command-line default:
In addition, you may need to use one or more properties to control the custom SQL WireHose generates. See SQL properties for more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright ©2000-2016 Gary Teter. All rights reserved. WireHose and the eyeball-and-arrows logo are trademarks of Gary Teter. |