Richard S. Hall | 85bafab | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!-- |
| 3 | Licensed to the Apache Software Foundation (ASF) under one |
| 4 | or more contributor license agreements. See the NOTICE file |
| 5 | distributed with this work for additional information |
| 6 | regarding copyright ownership. The ASF licenses this file |
| 7 | to you under the Apache License, Version 2.0 (the |
| 8 | "License"); you may not use this file except in compliance |
| 9 | with the License. You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, |
| 14 | software distributed under the License is distributed on an |
| 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | KIND, either express or implied. See the License for the |
| 17 | specific language governing permissions and limitations |
| 18 | under the License. |
| 19 | --> |
| 20 | <cheatsheet title="Create a Hello World composite application"> |
| 21 | <intro> |
| 22 | <description>This cheat sheet shows you how to create a simple hello world composite application using Sigil.</description> |
| 23 | </intro> |
| 24 | |
| 25 | <item title="Create an empty Newton project" href="/org.cauldron.sigil.help/html/tasks/new_project.html" dialog="true" skip="true"> |
| 26 | <description> |
| 27 | First, you must create a new "org.example.helloworld" empty Newton project to house the java classes and SCA composites. |
| 28 | </description> |
| 29 | |
| 30 | <subitem label="Select "File >New >Project...". Expand "Sigil", select "Newton Project" and click "Next"." skip="true"> |
| 31 | <action |
| 32 | pluginId="org.cauldron.sigil.help" |
| 33 | class="org.cauldron.sigil.cheatsheets.actions.OpenEmptyNewtonProjectWizardAction" |
| 34 | param1="org.example.helloworld" |
| 35 | translate="" /> |
| 36 | </subitem> |
| 37 | |
| 38 | <subitem label="Enter "org.example.helloworld" as the "Project name", then click "Finish"." skip="false" /> |
| 39 | </item> |
| 40 | |
| 41 | <item title="Create The Java Interfaces and Classes" skip="true"> |
| 42 | <description> |
| 43 | Create a new "org.example.helloworld.api" package and add a HelloWorld interface to this package. |
| 44 | Then create a new "org.example.helloworld.impl" package and add a HelloWorldImpl class which implements HelloWorld to the impl package. |
| 45 | Finally create a new "org.example.helloworld.cli" package and add a HelloWorldCli class which references the HelloWorld api to the cli package. |
| 46 | </description> |
| 47 | |
| 48 | <subitem label="Create the HelloWorld API" skip="true"> |
| 49 | <action |
| 50 | pluginId="org.cauldron.sigil.help" |
| 51 | class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin" |
| 52 | param1="org.example.helloworld" |
| 53 | param2="src/org/example/helloworld/api" |
| 54 | param3="org.cauldron.sigil.help" |
| 55 | param4="archive/java/HelloWorld.java" |
| 56 | param5="org.eclipse.jdt.ui.CompilationUnitEditor" |
| 57 | translate="" /> |
| 58 | </subitem> |
| 59 | <subitem label="Create the HelloWorld Impl" skip="true"> |
| 60 | <action |
| 61 | pluginId="org.cauldron.sigil.help" |
| 62 | class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin" |
| 63 | param1="org.example.helloworld" |
| 64 | param2="src/org/example/helloworld/impl" |
| 65 | param3="org.cauldron.sigil.help" |
| 66 | param4="archive/java/HelloWorldImpl.java" |
| 67 | param5="org.eclipse.jdt.ui.CompilationUnitEditor" |
| 68 | translate="" /> |
| 69 | </subitem> |
| 70 | <subitem label="Create the HelloWorld CLI" skip="true"> |
| 71 | <action |
| 72 | pluginId="org.cauldron.sigil.help" |
| 73 | class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin" |
| 74 | param1="org.example.helloworld" |
| 75 | param2="src/org/example/helloworld/cli" |
| 76 | param3="org.cauldron.sigil.help" |
| 77 | param4="archive/java/HelloWorldCli.java" |
| 78 | param5="org.eclipse.jdt.ui.CompilationUnitEditor" |
| 79 | translate="" /> |
| 80 | </subitem> |
| 81 | </item> |
| 82 | <item |
| 83 | title="Add OSGi Package Imports To The HelloWorld Project"> |
| 84 | <description> |
| 85 | The HelloWorldCli class references classes which are exported from other OSGi bundles. In order to satisfy the OSGi classloading rules the HelloWorld project must import the required packages. |
| 86 | </description> |
| 87 | <subitem |
| 88 | label="Open the "org.example.helloworld" project editor by double-clicking on the "sigil.properties" file in the project directory." |
| 89 | skip="false"> |
| 90 | </subitem> |
| 91 | <subitem |
| 92 | label="Select the "Overview" tab."> |
| 93 | </subitem> |
| 94 | <subitem |
| 95 | label="Click on the "Resolve missing dependencies" link in the "Tools" section."> |
| 96 | </subitem> |
| 97 | <subitem |
| 98 | label="Wait for the background task to complete. When the "Review New Imports" dialog appears, click "OK"."> |
| 99 | </subitem> |
| 100 | </item> |
| 101 | |
| 102 | |
| 103 | <item title="Create The SCA Composites That Describe The Java Resources" skip="true"> |
| 104 | <description> |
| 105 | Create a new HelloWorld service composite that exports the HelloWorldImpl class using the HelloWorld interface. |
| 106 | Then create a new HelloWorld cli composite that imports the HelloWorld interface and exports a ConsoleCommandHandler |
| 107 | service to allow user interaction via the command handler. |
| 108 | </description> |
| 109 | |
| 110 | <subitem label="Create the HelloWorld Service" skip="true"> |
| 111 | <action |
| 112 | pluginId="org.cauldron.sigil.help" |
| 113 | class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin" |
| 114 | param1="org.example.helloworld" |
| 115 | param2="sca" |
| 116 | param3="org.cauldron.sigil.help" |
| 117 | param4="archive/sca/org.example.helloworld.service.composite" |
| 118 | param5="org.cauldron.sigil.editors.SCACompositeEditor" |
| 119 | translate="" /> |
| 120 | </subitem> |
| 121 | <subitem label="Create the HelloWorld Command Line" skip="true"> |
| 122 | <action |
| 123 | pluginId="org.cauldron.sigil.help" |
| 124 | class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin" |
| 125 | param1="org.example.helloworld" |
| 126 | param2="sca" |
| 127 | param3="org.cauldron.sigil.help" |
| 128 | param4="archive/sca/org.example.helloworld.cli.composite" |
| 129 | param5="org.cauldron.sigil.editors.SCACompositeEditor" |
| 130 | translate="" /> |
| 131 | </subitem> |
| 132 | </item> |
| 133 | |
| 134 | <item |
| 135 | title="Add The SCA Composites To The HelloWorld Bundle"> |
| 136 | <description> |
| 137 | In order to load a composite in a Newton container it needs to be associated with an OSGi bundle that will act as the classpath for that bundle. |
| 138 | </description> |
| 139 | <subitem |
| 140 | label="Open the "org.example.helloworld" project editor by double-clicking on the "sigil.properties" file in the project directory."> |
| 141 | </subitem> |
| 142 | <subitem |
| 143 | label="Select the "Exports" tab."> |
| 144 | </subitem> |
| 145 | <subitem |
| 146 | label="Click on the "Add" button in the Composites section."> |
| 147 | </subitem> |
| 148 | <subitem |
| 149 | label="Add the "org.example.helloworld.service" and "org.example.helloworld.cli" composites to the OSGi bundle."> |
| 150 | </subitem> |
| 151 | <subitem |
| 152 | label="Save the "org.example.helloworld" project editor."> |
| 153 | </subitem> |
| 154 | </item> |
| 155 | |
| 156 | <item |
| 157 | title="Launch A Newton Container"> |
| 158 | <description> |
| 159 | Launch a Newton enabled JVM in which to host the SCA composites you have just created. |
| 160 | </description> |
| 161 | <subitem |
| 162 | label="Make sure that the the "org.example.helloworld" project editor is open."> |
| 163 | </subitem> |
| 164 | <subitem |
| 165 | label="Select the "Overview" tab."> |
| 166 | </subitem> |
| 167 | <subitem |
| 168 | label="Click on the "Launch a newton container" link in the "Testing" section."> |
| 169 | </subitem> |
| 170 | <subitem |
| 171 | label="Wait for the newton container to finish launching. This is signified by the console message: "Boot complete""> |
| 172 | </subitem> |
| 173 | </item> |
| 174 | |
| 175 | <item |
| 176 | title="Install The HelloWorld Composites In The Newton Container"> |
| 177 | <description> |
| 178 | We will now install the two composites in the Newton container we just launched using the short-cut menu items in the eclipse navigation bar. |
| 179 | </description> |
| 180 | <subitem |
| 181 | label="Open the "org.example.helloworld.service.composite" document using the Sigil "SCA Composite Editor"."> |
| 182 | </subitem> |
| 183 | <subitem |
| 184 | label="Click on the "Install Composite" short-cut menu item in the navigation bar."> |
| 185 | </subitem> |
| 186 | <subitem |
| 187 | label="Select the "org.example.helloworld" instance and click ok"> |
| 188 | </subitem> |
| 189 | <subitem |
| 190 | label="Open the "org.example.helloworld.cli.composite" document using the Sigil "SCA Composite Editor"."> |
| 191 | </subitem> |
| 192 | <subitem |
| 193 | label="Again, click on the "Install Composite" short-cut menu item in the navigation bar and install into the "org.example.helloworld" Newton instance."> |
| 194 | </subitem> |
| 195 | </item> |
| 196 | |
| 197 | <item title="Type "sayhello" on the Newton console" skip="false"> |
| 198 | <description> |
| 199 | |
| 200 | </description> |
| 201 | <subitem |
| 202 | label="Select the Newton console."> |
| 203 | <action |
| 204 | pluginId="org.cauldron.sigil.help" |
| 205 | class="org.cauldron.sigil.cheatsheets.actions.ShowViewAction" |
| 206 | param1="org.eclipse.ui.console.ConsoleView" |
| 207 | translate="" /> |
| 208 | |
| 209 | </subitem> |
| 210 | <subitem |
| 211 | label="Type "sayhello". You should see the response:<br/>Hello World"> |
| 212 | </subitem> |
| 213 | </item> |
| 214 | |
| 215 | <onCompletion>Congratulations you have created your first composite application using Sigil.</onCompletion> |
| 216 | |
| 217 | |
| 218 | </cheatsheet> |