blob: 94ce68d89e46545283c13f5b519ae33c4e9c707d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<cheatsheet title="Create a Hello World composite application">
<intro>
<description>This cheat sheet shows you how to create a simple hello world composite application using Sigil.</description>
</intro>
<item title="Create an empty Newton project" href="/org.cauldron.sigil.help/html/tasks/new_project.html" dialog="true" skip="true">
<description>
First, you must create a new &quot;org.example.helloworld&quot; empty Newton project to house the java classes and SCA composites.
</description>
<subitem label="Select &quot;File &gt;New &gt;Project...&quot;. Expand &quot;Sigil&quot;, select &quot;Newton Project&quot; and click &quot;Next&quot;." skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.OpenEmptyNewtonProjectWizardAction"
param1="org.example.helloworld"
translate="" />
</subitem>
<subitem label="Enter &quot;org.example.helloworld&quot; as the &quot;Project name&quot;, then click &quot;Finish&quot;." skip="false" />
</item>
<item title="Create The Java Interfaces and Classes" skip="true">
<description>
Create a new &quot;org.example.helloworld.api&quot; package and add a HelloWorld interface to this package.
Then create a new &quot;org.example.helloworld.impl&quot; package and add a HelloWorldImpl class which implements HelloWorld to the impl package.
Finally create a new &quot;org.example.helloworld.cli&quot; package and add a HelloWorldCli class which references the HelloWorld api to the cli package.
</description>
<subitem label="Create the HelloWorld API" skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin"
param1="org.example.helloworld"
param2="src/org/example/helloworld/api"
param3="org.cauldron.sigil.help"
param4="archive/java/HelloWorld.java"
param5="org.eclipse.jdt.ui.CompilationUnitEditor"
translate="" />
</subitem>
<subitem label="Create the HelloWorld Impl" skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin"
param1="org.example.helloworld"
param2="src/org/example/helloworld/impl"
param3="org.cauldron.sigil.help"
param4="archive/java/HelloWorldImpl.java"
param5="org.eclipse.jdt.ui.CompilationUnitEditor"
translate="" />
</subitem>
<subitem label="Create the HelloWorld CLI" skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin"
param1="org.example.helloworld"
param2="src/org/example/helloworld/cli"
param3="org.cauldron.sigil.help"
param4="archive/java/HelloWorldCli.java"
param5="org.eclipse.jdt.ui.CompilationUnitEditor"
translate="" />
</subitem>
</item>
<item
title="Add OSGi Package Imports To The HelloWorld Project">
<description>
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.
</description>
<subitem
label="Open the &quot;org.example.helloworld&quot; project editor by double-clicking on the &quot;sigil.properties&quot; file in the project directory."
skip="false">
</subitem>
<subitem
label="Select the &quot;Overview&quot; tab.">
</subitem>
<subitem
label="Click on the &quot;Resolve missing dependencies&quot; link in the &quot;Tools&quot; section.">
</subitem>
<subitem
label="Wait for the background task to complete. When the &quot;Review New Imports&quot; dialog appears, click &quot;OK&quot;.">
</subitem>
</item>
<item title="Create The SCA Composites That Describe The Java Resources" skip="true">
<description>
Create a new HelloWorld service composite that exports the HelloWorldImpl class using the HelloWorld interface.
Then create a new HelloWorld cli composite that imports the HelloWorld interface and exports a ConsoleCommandHandler
service to allow user interaction via the command handler.
</description>
<subitem label="Create the HelloWorld Service" skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin"
param1="org.example.helloworld"
param2="sca"
param3="org.cauldron.sigil.help"
param4="archive/sca/org.example.helloworld.service.composite"
param5="org.cauldron.sigil.editors.SCACompositeEditor"
translate="" />
</subitem>
<subitem label="Create the HelloWorld Command Line" skip="true">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.CopyResourceFromPlugin"
param1="org.example.helloworld"
param2="sca"
param3="org.cauldron.sigil.help"
param4="archive/sca/org.example.helloworld.cli.composite"
param5="org.cauldron.sigil.editors.SCACompositeEditor"
translate="" />
</subitem>
</item>
<item
title="Add The SCA Composites To The HelloWorld Bundle">
<description>
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.
</description>
<subitem
label="Open the &quot;org.example.helloworld&quot; project editor by double-clicking on the &quot;sigil.properties&quot; file in the project directory.">
</subitem>
<subitem
label="Select the &quot;Exports&quot; tab.">
</subitem>
<subitem
label="Click on the &quot;Add&quot; button in the Composites section.">
</subitem>
<subitem
label="Add the &quot;org.example.helloworld.service&quot; and &quot;org.example.helloworld.cli&quot; composites to the OSGi bundle.">
</subitem>
<subitem
label="Save the &quot;org.example.helloworld&quot; project editor.">
</subitem>
</item>
<item
title="Launch A Newton Container">
<description>
Launch a Newton enabled JVM in which to host the SCA composites you have just created.
</description>
<subitem
label="Make sure that the the &quot;org.example.helloworld&quot; project editor is open.">
</subitem>
<subitem
label="Select the &quot;Overview&quot; tab.">
</subitem>
<subitem
label="Click on the &quot;Launch a newton container&quot; link in the &quot;Testing&quot; section.">
</subitem>
<subitem
label="Wait for the newton container to finish launching. This is signified by the console message: &quot;Boot complete&quot;">
</subitem>
</item>
<item
title="Install The HelloWorld Composites In The Newton Container">
<description>
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.
</description>
<subitem
label="Open the &quot;org.example.helloworld.service.composite&quot; document using the Sigil &quot;SCA Composite Editor&quot;.">
</subitem>
<subitem
label="Click on the &quot;Install Composite&quot; short-cut menu item in the navigation bar.">
</subitem>
<subitem
label="Select the &quot;org.example.helloworld&quot; instance and click ok">
</subitem>
<subitem
label="Open the &quot;org.example.helloworld.cli.composite&quot; document using the Sigil &quot;SCA Composite Editor&quot;.">
</subitem>
<subitem
label="Again, click on the &quot;Install Composite&quot; short-cut menu item in the navigation bar and install into the &quot;org.example.helloworld&quot; Newton instance.">
</subitem>
</item>
<item title="Type &quot;sayhello&quot; on the Newton console" skip="false">
<description>
</description>
<subitem
label="Select the Newton console.">
<action
pluginId="org.cauldron.sigil.help"
class="org.cauldron.sigil.cheatsheets.actions.ShowViewAction"
param1="org.eclipse.ui.console.ConsoleView"
translate="" />
</subitem>
<subitem
label="Type &quot;sayhello&quot;. You should see the response:&lt;br/&gt;Hello World">
</subitem>
</item>
<onCompletion>Congratulations you have created your first composite application using Sigil.</onCompletion>
</cheatsheet>