oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Applying "Digital Hub" Concepts to Enterprise Software Design, Part 2
Pages: 1, 2, 3

Create and Use an Administration Tool (Direct to Web)

If you have completed all of the steps above, you've created a simple, but flexible database for holding weather measurements. Of course, it is not very exciting in its current state. Our database does not even have any data yet! Fortunately there is a cool technology in WebObjects that can automatically build a web application, based on our EOModel, that we can use to populate the database. We will build much better data entry tools in future articles, but this will give us some data to play with as we design the rest of the system.

Create the Administration Tool

  1. Launch Xcode (you can find it in /Developer/Applications/).
  2. Choose New Project from the File menu.
  3. You will be presented with many types of projects that you can build. Select Direct to Web Application from the WebObjects group. Then, click Next.
  4. Name the project WeatherHub and click Next.
  5. Leave the J2EE options set to their defaults and click Next.
  6. Leave the Web Service Support options set to their defaults and click Next.
  7. On the EOAdaptor screen, make sure that the JDBC framework is selected, and then click Next.
  8. Leave the Choose Frameworks options set to their defaults, click Next.
  9. This is the important step, so pay attention! Click the Add button and select the EOModel that you created earlier (called Weather.eomodeld). Then click Next.
  10. Choose the WebObjects Look so that your project will look like my screenshots. Click Next.
  11. The last page lets us choose to build and run the project right away. Make sure the box is checked and click Finish! After a minute or two of compiling, your application will automatically launch and open in your web browser. Congratulations on creating an Administration tool!

Add Sample Data to the Database

Add Data Types:
  1. Make sure that you followed the previous steps and that the web application is visible in your browser. You should see a login screen.
  2. Leave the text fields blank and click the Login button.
  3. On the left side of the window, make sure that the DataType entity is selected, and then click the New button.
  4. Type number in the text box and press Save.
  1. Repeat steps 3 and 4 and create a data type with the name string.
  2. Click the search button on the left side of the screen, followed by the SearchDB button in the middle of the screen. A list of your newly created data types should appear.
Add Measurement Types:
  1. Select the entity MeasurementType in the pop-up menu on the left side of the browser window. Click the New button.
  2. Assign the name Temperature to the new measurement type.
  3. Click the hand icon next to Data Type, and then click SearchDB at the bottom of the window.
  4. Click the Add button that is next to the data type "number." Click Return to finish editing the new measurement type.
  5. Click the Save button.
  6. Repeat steps 1 to 5 to add a measurement type of Wind Speed (just like Temperature, its data type is also "number").
Add Measured Data:
  1. Adding some measurement data should be almost the same as adding the type data, so I'm going to leave the steps up to you. Remember to select MeasuredData as an entity before trying to add new data.
  2. Add a temperature of 70 for May 1, 2004.
  3. Add a wind speed of 5 for May 1, 2004.
  4. When you are done adding data, view the data by performing a search in the Administration Tool. You may also want to view the data using the Browse database feature in OpenBase.

Final Thoughts

Congratulations on designing and building a flexible database. We also built an administration tool using WebObjects and entered some data into our new database. Not bad for our first tutorial together! Give yourself a pat on the back if you made it all of the way through. For each article in this series, I will assign some extra credit for those who want to go beyond the tutorial. For this article, it would be nice to have a location associated with each measurement. For extra credit, add another table that stores location data (such as latitude, longitude, and altitude) and create a relationship so that it is connected to the measured data table.

In the next article we'll design an XML format that can be used to transfer all of the data in database. After we do that, we will have our hub and spokes well-defined and we can get into the really fun stuff. Until then, happy programming.


Adam Behringer works as the CEO of Bee Documents, which strives to help legal and medical firms efficiently manage their documents.

Return to the Mac DevCenter