Changes for page Your First Framework
Last modified by Steve Peery on 2012/08/09 05:08
From version 3.1
edited by Pascal Robert
on 2012/01/07 21:35
on 2012/01/07 21:35
Change comment:
There is no comment for this version
To version 2.1
edited by Pascal Robert
on 2012/01/07 19:53
on 2012/01/07 19:53
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -7,45 +7,45 @@ 7 7 When a framework is built (with Ant or Maven), the structure is like this: 8 8 9 9 MyStuff.framework 10 --> Resources 11 -~-~--> Info.plist 12 -~-~--> Java 13 -~-~-~-~--> mystuff.jar 14 -~-~-~-~--> some-third-party.jar 15 -~-~--> MyEOModel.eomodeld 16 -~-~--> Properties 17 --> WebServerResources 18 -~-~--> someimage.png 19 -~-~--> somestyling.css 10 +~-~-> Resources 20 20 21 - 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.12 +---- 22 22 23 - =Creating theframework =14 +~> Info.plist 24 24 25 - 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**.16 +---- 26 26 27 - Nowyou haveanother project in your Eclipse workspace. Open it and you will see that the folder structure is the same as for an Wonder application. A framework and an application in Eclipse is almost the same, the difference is the nature of the project and when the project is built, the product will be a bit different.18 +~> Java 28 28 29 - The next step is to copy the EOModel and its related Java code to the framework. Open the **BlogRest** project, open its **Resources** folder, and select **BlogModel.eogen** and **BlogModel.eomodel**. Right-click on one of the two files and select **Refactor**-> **Move**.20 +---- 30 30 31 - Youwill see the list of all opened projects inyour Eclipse workspace, and we wantto copy the two files into the **BlogCommon** project. Select the **Resources**folder ofthe **BlogCommon** projectand click **OK**.22 +~> mystuff.jar 32 32 33 - We need to do similar steps for the Java code. Open the **Sources** folder of the **BlogRest** project. Select the **your.app.model** and **your.app.model.migrations** packages, right-click on one of the packages, and select **Refactor**-> **Move**. For the destination, select the **Sources** folder, and click **OK**.24 +---- 34 34 35 - =Linkingthe application with the framework =26 +~> some-third-party.jar 36 36 37 - If you go back to the **BlogRest** project, you will see compilation errors. We need to link the application project with the framework project. To do so, right-click on the **BlogRest** project, and select **Build Path**-> **Configure Build Path**.28 +---- 38 38 39 - Clickthe **Libraries** tab, andyou will see thelist of Java archives (.jar) and Project Wonder frameworks.30 +~> MyEOModel.eomodeld 40 40 41 - To add **BlogCommon** to the build path (aka the class path), click on **Add Library**.32 +---- 42 42 43 -Select **WebObjects Frameworks** and click **Next**. 34 +~> Properties 35 +~-~-> WebServerResources 44 44 45 - You will see a list of all frameworks that you can add to your project. Check **BlogCommon** in the list and click **Finish**. Click **OK** in the **Properties** window to go back to the main Eclipse window.37 +---- 46 46 47 - Youcansee that all compilationerrors are now gone. The next thing we need to do is to link the H2PlugIn with the **BlogCommon** framework. Why? Because since we moved the database model to the framework, the framework needs the JDBC plugin included in the H2PlugIn in its build path.To do so, right-click on the **BlogCommon**project, and select **Build Path** -> **Configure Build Path**.39 +~> someimage.png 48 48 49 - Click the **Libraries** tab, and you will see the list of Java archives (.jar) and Project Wonder frameworks. Click on **Add Library**, select **WebObjects Frameworks** and click **Next**. Select **H2PlugIn**, click on **Add Library**. Close the **Properties** window to go back to the main Eclipse window.41 +---- 50 50 51 -You can run the **BlogRest** application and everything will work. By moving the EOModel to the framework, you will be able to use the model in the next tutorial: building a DirectToWeb application to manage the blog. 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.