Wiki source code of Your First Framework
Version 2.1 by Pascal Robert on 2012/01/07 19:53
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{toc}}{{/toc}} | ||
| 2 | |||
| 3 | = Introduction = | ||
| 4 | |||
| 5 | Now that we have a working REST project, let's create a framework. A framework in a Project Wonder context is a special folder that contains Java libraries (.jar), other resources (EOModels, images, CSS, etc.) and a Info.plist file. If you are a Cocoa developer, a Project Wonder framework structure have a similar structure as a Cocoa framework. | ||
| 6 | |||
| 7 | When a framework is built (with Ant or Maven), the structure is like this: | ||
| 8 | |||
| 9 | MyStuff.framework | ||
| 10 | ~-~-> Resources | ||
| 11 | |||
| 12 | ---- | ||
| 13 | |||
| 14 | ~> Info.plist | ||
| 15 | |||
| 16 | ---- | ||
| 17 | |||
| 18 | ~> Java | ||
| 19 | |||
| 20 | ---- | ||
| 21 | |||
| 22 | ~> mystuff.jar | ||
| 23 | |||
| 24 | ---- | ||
| 25 | |||
| 26 | ~> some-third-party.jar | ||
| 27 | |||
| 28 | ---- | ||
| 29 | |||
| 30 | ~> MyEOModel.eomodeld | ||
| 31 | |||
| 32 | ---- | ||
| 33 | |||
| 34 | ~> Properties | ||
| 35 | ~-~-> WebServerResources | ||
| 36 | |||
| 37 | ---- | ||
| 38 | |||
| 39 | ~> someimage.png | ||
| 40 | |||
| 41 | ---- | ||
| 42 | |||
| 43 | ~> somestyling.css | ||
| 44 | |||
| 45 | So why using frameworks? Simple: to be able to use them in more than one project. Putting your EOModel into a framework is a good idea since you can built many different projects for the same business logic. | ||
| 46 | |||
| 47 | = Creating a framework = | ||
| 48 | |||
| 49 | So let's make a new framework. In Eclipse, open the **File** menu, select **New** and select **Wonder Framework**. Name it **BlogCommon** and click **Finish**. | ||
| 50 | |||
| 51 | Now you have another project in your Eclipse workspace. Open it and you will see that the folder structure is the same as for an Wonder application. |