Table of Contents - documentation.darwino.com · Database server: These instructions document the...

Post on 04-Jun-2020

4 views 0 download

Transcript of Table of Contents - documentation.darwino.com · Database server: These instructions document the...

1.1

1.2

1.3

1.3.1

1.3.1.1

1.3.1.2

1.3.1.3

1.3.1.4

1.3.2

1.3.2.1

1.4

1.4.1

1.4.2

1.4.3

1.4.4

1.5

1.5.1

TableofContentsIntroduction

Home

Installation

SettingUp

ConfiguringTOMCAT

ConfiguringIBMWebsphereLiberty

ConfiguringPostgreSQL

ConfiguringNPM

InstallingEclipse

MavenSettings

GettingStarted

RunningtheContactsSamples

RunningtheNewsSamples

RunningtheDominoDiscussionSamples

CreatinganewDarwinoProject

PackagingMobileApplications

iOSApplications

2

DarwinoInstallationGuide

Introduction

3

WelcometoDarwino!ThisguidewillshowyouhowtoinstalladevelopmentenvironmenttocreateDarwinobasedapplications.

Togetstarted,gotoSettingUppage.

Home

4

Installation

Installation

5

SettingUpYourenvironmentDarwinoisaflexibledevelopmentplatformthatsupportsIDEorcommandlinebaseddevelopment.TheplatformitselfisbuiltusingApacheMaven.MavenisalsotherecommendedbuildtoolforDarwinoapplications,butothersystemscanalsobeused,includingGradle,EclipsePDE,etc.Thefollowinginstructionsassumethatyouareusing:

EclipseJ2EEasyourIDE

Mavenasyourbuildtool.

NodeJSandNPMforJavaScriptclientdevelopment

Unlessspecifiedotherwise,alltheinstallationinstructionsassumeaMicrosoftWindowsenvironment,withthesoftwarebeinginstalledonc:\Darwino.However,mostoftheinstructionsworkidenticallyonotherplatformssuchasApplemacOSorLinux.

Darwinocurrentlysupportsthefollowingtargetplatforms:

WebapplicationsthroughaJavaEEserver

Androidapplications

AppleiOSapplications

OSGienvironments,likeEclipserichclientorIBMDomino

Notes:BasedonApplerequirements,anAppleMaccomputerrunningmacOSisrequiredfordevelopingAppleiOSapplications.Currently,onlyAndroidapplicationscanbedevelopedandtestedusingMicrosoftWindowsorLinux.

DarwinoInstallationInordertodevelopwiththeDarwinoStudio,thefollowingcomponentsshouldbeinstalled:

JavaJDK:TheminimumversionisJava7,butitisadvisedtousethelatestone(Java8asoftoday)EclipseforJ2EEorotherIDEWebapplicationserverisrequiredtorunthewebapplications.Althoughanyservlet

SettingUp

6

container2.5+wouldwork,theseinstructionsshowhowtoinstall/runthedemoprojectsusingApacheTOMCATDatabaseserver:TheseinstructionsdocumenttheuseofPostgres9.4+databaseserver.Althoughotherdatabasesmaybeused,thedemoapplicationsarepre-configuredtoworkwithPostgreSQL.(NotethatafutureversionofDarwinomightuseaembeddeddatabaseandthusthisstepwon'tbenecessary.)

Also,afewconfigurationactionshastobetaken:

ConfiguretheMavensettingstopointtoDarwinorepositoryConfiguretheNPMsettingstopointtoDarwinorepositoryConfiguretheDarwinobeansandproperties

NotethatsinceDarwino1.5.1,theDarwinoEclipsestudiofeaturesaconfigurationmodulethatmakestheinstallationprocesseasier.Itishighlyrecommendedtousethishelper.

Thefollowinginstructionsdescribetheinstallationofeachcomponent.

InstallingtheJavaJDKIfyoualreadyhaveJavaJDK7orhigherinstalled(Java8ishighlyrecommended),youcanskipthisstep.

AfullJavaJDKisrequiredbythemaventoolstocompiletheJava.AJavaJREisnotsufficient.

TheJavaSDKcanbedownloadedfromtheOraclewebsite:http://www.oracle.com/technetwork/java/javase/downloads/index.html.AnIBMJDKwillalsowork.Onceinstalled,makesurethatthedevelopmentenvironmentvariableJAVA_HOMEispointingtoyouJavaenvironment.MakealsosurethattheJVMisavailablefromthecommandline(TerminalonmacOSorLinux)byusingthecommandjava-version.

SettingUp

7

InstallingtheAndroidapplicationdevelopmenttoolsDevelopingfortheAndroidplatformrequirestheAndroidSoftwareDevelopmentKittobeinstalled.Itisavailablefrom:http://developer.android.com/sdk/index.html#Other.The'SDKToolsonly'packageissufficientifyouplantouseEclipseorMavenfromthecommandline.

UsingtheSDKmanagerAndroidSDKmanager,selectandinstallatleasttheentire"Android4.2.2(API17)"&"Android4.4.2(API19)"folders.

Additionally,setthepathtotheAndroidSDKroot(e.g.c:\Android\SDK)inanenvironmentvariablenamedANDROID_HOME.Alsodonotforget,wheninstallingmaven,toaddtheandroidlibrariestoyourlocalrepository,asdescribedinthedocumentationoninstallingMaven.TheStudioconfigurationmodulewillalsoreportanerrorifthisisnotproperlydefined.

Note:usingthestockAndroidemulator,itislikelythattheapplicationswillbetooslowtoprovideagreatdeveloperexperience.Thisisparticularlytrueifyoulaunchtheemulatorfromavirtualmachine.Itisthenbettertorunthedemoapplicationsonrealhardwareorinafasteremulator/virtualmachine.See:http://blog.riand.com/2014/08/running-android-apps-for-development.html

InstallingtheiOSapplicationdevelopmenttools

SettingUp

8

Asstatedearlier,developingforiOSrequiresanAppleMaccomputerrunningOSX.Tocompile,runinasimulatorordeploytheapplication,theAppleXcodedevelopmentenvironmentisrequired.ItisavailablefreelyfromtheMacAppStore(https://itunes.apple.com/us/app/xcode/id497799835?mt=12).

PostgreSQLPostgresqlisafreeandpopularrelationaldatabasefeaturingwellsuitedJSONextensionsforDarwino.TheinstructionsbellowshowhowtoinstallPostgreqlfordevelopmentandtestpurposes.Otherdatabases,likeIBMDB210.5FP8orMSSqlServer2016,arealsosupported.

See:ConfiguringPostgreSQL

InstallingEclipseforJ2EEWeadvisedeveloperstouseEclipseasthedevelopmentIDE.Moreover,startingwithDarwino1.5.1,theDarwinoEclipsepluginsfeatureaninstallationvalidationmodulethatchecksforthepre-requisites,andhelpsfixingthepotentialissues.

IfyouplantouseEclipse,oralreadydo,pleaseensurethatyoufirstensurethatyoufollowthe[instructions](InstallingEclipse)fordownloadingandconfiguringEclipse,andtheDarwinoStudioEclipseadd-oncomponent.TheseinstructionsassumethatyouwillusetheEclipseforJ2EEversion(NotEclipseforJava).

NPMInstallationNPMshouldbeconfiguredtopointtotheDarwinorepositoryforDarwinolibraries,identifiedby@darwino.

YoushouldfirstinstallNodeJSandNPMfollowingtheinstructionshere:https://www.npmjs.com/get-npm

ThenyoushouldconfigureNPMtoconnecttotheDarwinoprivaterepository.See:ConfiguringNPM

Manualconfiguration

SettingUp

9

ThesestepsareonlyrequirediftheywerenotachievedthroughtheStudioconfigurationmodule.

MavenConfiguration

MavenshouldbeconfiguredtopointtotheDarwinorepositoryforDarwinolibraries.IfyouareusingEclipse,pleaseseethefollowinginstructionsafterinstallingEclipse:SettingUpMaven.

(Ifyouareusingthecommandlinetools,thenyoushouldfirstinstallmaven(latestrecommended)andconfigureitasdescribedintheinstructions.)

ApacheTOMCAT

ApacheTomcatisafree,easytouse,Javaservletcontainer.Theinstructionsbellowexplainhowtoconfigureitfordevelopmentandtestpurposes.Anyservlet3.0compliantwebservercanalsobeused.

See:ConfiguringTOMCAT

NotethatTOMCATcanalsobelaunchfromMaven.Mostofthedemoprojects,aswellasthenewapplicationwizard,nowintegratetheTOMCATMavenplugin.Asaresult,TOMCATcanbelaunchedusingamavencommendwithoutgoingthoughafullinstallation:mvntomcat7:run

IBMWebsphereLiberty

Alternatively,youcanuseIBMWebsphereLibertyastheapplicationserver,onpremisesandonthecloudthroughIBMBluemix.

See:ConfiguringIBMWebsphereLiberty

SettingUp

10

IfyouplantouseTomcatasthedevelopmentwebapplicationserver,thenyouhavetobothinstallitinthefilesystemandeventuallyconfigureEclipsetouseit.

InstallingApacheTomcatDownloadthelatestTomcatserver(8.xor8.5x)fromtheApacheWebSite:https://tomcat.apache.org/download-80.cgi.Justunziptheserverunderyourinstallation

directory:

Ifyouplantousethedemoapplications,thenyouneedtoaddsomedemouserswithrolesinyourtomcatenvironment.Addthefollowingcontentto{tomcatinstalldir}\conf\tomcat-users.xml:

<rolename="user"/>

<userpassword="darwino"roles="user"username="atinov"/>

<userpassword="darwino"roles="user"username="amass"/>

<userpassword="darwino"roles="user"username="aboucher"/>

<userpassword="darwino"roles="user"username="acalder"/>

<userpassword="darwino"roles="user"username="agardner"/>

<userpassword="darwino"roles="user"username="bchapot"/>

<userpassword="darwino"roles="user"username="blemercier"/>

<userpassword="darwino"roles="user"username="bchris"/>

<userpassword="darwino"roles="user"username="bbright"/>

<userpassword="darwino"roles="user"username="larmatti"/>

<userpassword="darwino"roles="user"username="lbros"/>

<userpassword="darwino"roles="user"username="mdavis"/>

<userpassword="darwino"roles="user"username="pcollins"/>

<userpassword="darwino"roles="user"username="rjordan"/>

ConfiguringEclipsewithTomcat

ConfiguringTOMCAT

11

EclipseJ2EEcomeswithasetoftoolscalledWTP,whichallowstheconfigurationanduseofapplicationservers.ToconfigureApacheTOMCAT,youhavetocreateanew'RuntimeEnvironment'fromtheEclipse'Window->Preferences...':

Oncetheruntimeenvironmentisconfigured,youshouldcreateanewserver.Forthis,youshouldeithermakevisibletheEclipse'Servers'view(Window->ShowView...Servers)orswitchtotheJ2EEperspective(Window->OpenPerspective...JavaEE).Intheserverview,createanewserverbyhittingthelinkbellow.Iftheviewdisplays

ConfiguringTOMCAT

12

alistinstead,rightclickandselect'New->Server...'

SelectyourTomcatenvironmentandeventuallychangetheservername,andhit'Finish'

Downloadthedarwino-beans.xmlanddarwino.propertiesfilestotheTomcatinstalldirectory.

ConfiguringTOMCAT

13

NowyouhaveyourserverreadyfortheDarwinoapplications

ConfiguringTOMCAT

14

IfyouplantouseIBMWebsphereLibertyasthedevelopmentwebapplicationserver,thenyouhavetoinstallitandconfiguretheEclipseaccordingly.TheeasiestistodroptheinstallsitetotheEclipsetoolbar,asexplainedhere:https://developer.ibm.com/wasdev/getstarted/

ConfiguringEclipsewithIBMWebsphereLibertyEclipseJ2EEcomeswithasetoftoolscalledWTP,whichallowstheconfigurationanduseofapplicationservers.ToconfigureWASLiberty,youhavetocreateanew'RuntimeEnvironment'fromtheEclipse'Window->Preferences...':

Downloadthedarwino-beans.xmlanddarwino.propertiesfilestotheWebphereLibertyinstalldirectory,under/etc(iftheoptionaldirectorydoesnotexist,justcreateit).

ConfiguringIBMWebsphereLiberty

15

NowyouhaveyourserverreadyfortheDarwinoapplications

ConfiguringIBMWebsphereLiberty

16

PostgreSQLisafree,opensourcedatabasewithgreatcapability.ItisparticularlysuitedtoDarwinobecause,since9.4,itfeaturesanativeJSONdatatypewithquerycapabilities.Moreover,itcomeswithanintegratedfulltextsearchengine.

InstallingPostgreSQLIfyoujuststartedwithPostgreSQL,thewestronglyadviseyoutorunoneofthepredefinedinstallers.See:http://www.postgresql.org/download/.Please,choosethelatestversion,oratleastversion9.4.

Bydefault,thepre-packagedDarwinoconfigurationfiles(see:TOMCATinstallation)lookforaPostgreSQLdatabaseonthelocalhostusingtheuser/passwordandportbelow:

Port:5432(default)Username:postgresPassword:postgres

ConfiguringPostgreSQLfortheDemoApplicationThedemoprojectsuseaspecificdatabasecalleddwodemo,whichshouldbecreatedbyeitherusingthePostgreSQLcommandlinetools,ortheeasiestUIadmin'pgAdminIII',installedbythePostgreSQLinstaller.

Herearethesteps:

1. LaunchpgAdminIII2. Rightclickontheserverandselect'Connect'.Ifasked,enterthepassword

'postgres'

ConfiguringPostgreSQL

17

3. Rightclickonthedatabaseandselect'NewDatabase...'

4. Nameitdwodemoandhitok.Alltheotherdefaultsettings

Oncedone,youshouldseethedatabasecreatedafterdoubleclickingitinthelist:

ConfiguringPostgreSQL

18

BasicNPMSettingsDarwinorequiresNodeJSandNPMtocompilethenewgenerationofJavaScriptapplications.

ReleaseversionsoftheDarwinoJavaScriptassetsaredistributedthroughthecentralNPMregistryanddon'trequireanyspecialconfiguration.

DevelopmentBuilds

IncrementaldevelopmentbuildsaredistributedthroughaprivateNPMserverservingallthepackagesscopedby@darwino.Fornormaluse,thisisnotnecessary,butitmaybeusefulifyouhaveanexistingprojectusing"snapshot"buildsorareworkingwiththeDarwinodevelopmentteamonupcomingfeatures.

Tobeabletoconsumethem,youshouldinstructyoulocalNPMtousethatserverfor@darwino.Thisisdonebyrunningthefollowingcommandfromthecommandline(itassumesthatNodeJSandNPMareinstalled):npmadduser--registryhttps://npm.darwino.com--scope@darwino

Itwillaskyouforyourdarwinouser/passwordandyouremail.Oncedone,you'llbeabletoconsumeallthedarwinopackagesasdescribedat:https://npm.darwino.com

ConfiguringNPM

19

InstallingtheEclipseIDEAlthoughtheuseofanIDE,andinparticularEclipse,isnotarequirement,itcertainlyeasesthedevelopmentofDarwinoapplications.Inparticular,italsohelpsvalidatethatalltherequirementsaremet(installedsoftware,configurationfiles...)

Inordertoconfigurewebserversandgetthebestwebdevelopmentexperience,pleasedownloadandinstallthelatestversionof'EclipseIDEforJavaEEDevelopers‘(NOTEclipseIDEforJavaDevelopers).http://www.eclipse.org/downloads/

DarwinorunbestwiththelatestEclipseversion,currentlyNeon-1.AlthoughithasbeentestedwithearlierversionslikeMars-1,themavenintegrationdefinitivelyworksbestwithNeon.

InstallingEclipseisachievedbyunzippingthearchiveinitstargetdirectory.Thefollowingdirectorystructureshowseclipseunzippedintothec:\Darwinodirectory:

LaunchingEclipseforthefirsttimeWhenEclipseislaunchedforthefirsttime,itpromptsforaworkspacedirectory.Thedefaultvalueisfine,butwell,youcouldalsomakethisdirectoryapeeroftheeclipseone,togetthewholeenvironmentcontainedwithinc:\Darwino:

InstallingEclipse

20

InstallingtheDarwinoStudioadd-onThefirstmoduletoinstallistheDarwinoStudio.Bellowaretheinstructions:

1. SelectHelp>InstallNewSoftware.

2. Inthe"WorkWith:"field,enterthefollowingURL,dependingontheeditionyouselected:

EnterpriseEdition:https://eclipse.darwino.com/darwino/studio/enterprise/Communityedition:https://eclipse.darwino.com/darwino/studio/community/

NotethatyoucanalsoinstallthenightlybuildsbyusingtheURLsbellow.Thenightlybuildsprovideaccesstothelatestversion,underdevelopment

EnterpriseEdition:https://eclipse.darwino.com/darwino/studio/enterprise-nightly/Communityedition:https://eclipse.darwino.com/darwino/studio/community-nightly/

3. Whenprompted,enteryourDarwinouserandpassword,asprovidedduringtheregistrationprocess.

4. IntheAvailableSoftwaredialog,selecttheDarwinoStudiocheckbox.

5. Inthenextwindow,you'llseealistofthetoolstobedownloaded.ClickNext.

6. Readandacceptthelicenseagreements,thenclickFinish.

7. Ifyougetasecuritywarningsayingthattheauthenticityorvalidityofthesoftwarecan'tbeestablished,clickOK.

8. Whentheinstallationcompletes,restartEclipse.

Validatingtheconfiguration

InstallingEclipse

21

TheDarwinostudio,onceinstalled,featuresaninstallationvalidationmoduleavailableunderWindow->Preferences/Darwino:

Thismodulechecksyourenvironmentandgivesyouguidanceonthenextactions:

HavingMavensettings.xmlproperlyconfiguredHavingtheDarwinoconfigurationfilesattherightplaceMakingsurethattheEclipsedependenciesareinstalled

WindowsEclipseJRE/JDKOnWindows,EclipsewillsometimespickuponaninstalledJREinsteadofthefullJDK,whichwillmanifestduringaMavenbuildwithaerroraboutnotfindingaJavacompiler.Torectifythis,gotoEclipse'spreferences,thenJava→InstalledJREs:

InstallingEclipse

22

Selectthecurrently-activeone,click"Edit…"andpointitata"jdk"directory,usuallywithin"C:\ProgramFiles\Java":

InstallingEclipse

23

ManuallyConfiguringEclipseTheconfigurationvalidatorexposedaboveshouldgiveyouallthenecessaryinformationbutsomedetailsareexposedbellow.

Darwinorequiressomeextraplug-insbellowtobeinstalledontopoftheversionofEclipse.Theseplug-inscangenerallybeinstalledfromtheEclipseMarketplaceorbyselectingHelp→InstallNewSoftware...,thenusetheprovidedupdatesiteURL

IfAndroidisadesiredtargetplatform:

Andmore(successortoGoogle'sADT),SelectHelp→Eclipse→Marketplace...andsearchforandmore.Itwillbecalledsomethinglike"Andmore:DevelopmentToolsforAndroid"Note:duringtheprocessforinstallingm2eadapters(aswithTychobelow),them2eadapterforAndroidmaypromptyoutoinstalltheearlierAndroid

InstallingEclipse

24

DevelopmentToolkit.Ifso,andyoualreadyhaveAndmoreinstalled,deselectthosepluginsduringthem2esetup.

IfiOSisadesiredtargetplatform:

Multi-OSEngine.Thecurrentupdatesiteishttp://dl.bintray.com/multi-os-engine/eclipse

IfIBMDominoisadesiredtargetplatform

TheDarwinoprojectwizardaswellasthesampleapplicationsuseTychototargetOSGiplatforms(Eclipse,IBMDomino...).Asaresult,itrequirestheTychom2econnectortobeinstalled.TheeasiestwaytogetitinstalledistowaitfromEclipsetodisplayabuildproblem(seebellow),rightclickontheissueandchoosequickfix.Eclipsewillautomaticallyproposetodownloadandinstalltheconnector.

EclipseAdd-onsInformationDarwinoStudio

UpdatesiteURL:https://eclipse.darwino.com/darwino/studio/enterprise/https://eclipse.darwino.com/darwino/studio/community/https://eclipse.darwino.com/darwino/studio/enterprise-nightly/https://eclipse.darwino.com/darwino/studio/community-nightly/

Andmore(AndroidTools)

InstallfromtheEclipseMarketplaceMulti-OSEngine

Instructions:https://multi-os-engine.org/start/

UpdatesiteURL:http://dl.bintray.com/multi-os-engine/eclipse

InstallingEclipse

25

BasicMavenSettingsDarwinoprojectsrequireMaventobeproperlyconfiguredtopointtotheDarwinorepository.ThisisbestdonebymodifyingMaven'ssettingsfile,whichisafilecalledsettings.xmllocatedinthe.m2directoryinyourhomefolder.

Ifyou'reusingEclipseandthisfilealreadyexists,youcanopenitforeditingbygoingtotheMaven→UserSettingspaneinEclipse'sPreferencesandclicking"OpenFile":

Ifthefiledoesnotyetexist,thislinkwillbeabsent.Inthatcase,createanewfileinatexteditorand,whensaving,browsetoyourhomedirectory(e.g.C:\Users\yournameonWindows,~/onamac),createafoldernamed".m2"(withtheleadingdot),andsavethefileas"settings.xml".Ifitisanewfile,usethefollowingcontentormergeitwiththeexistingfile.Thisfilecanbedownloadedhere.

Ofcourse,youhavetosetyourownuserandpasswordand,dependingontheeditionyouarewillingtouse,settherepositoryURLto:

EnterpriseEditionhttps://maven.darwino.com/darwino-enterprise-editionCommunityEditionhttps://maven.darwino.com/darwino-community-editionThesemavenrepositoriescontainboththeproductionbuildsandthenightlyones(akaxxxx-SNAPSHOTS)

Tovalidatethatyourmavensettingsarecorrect,displaytheMavenRepositoriesviewineclipse(Window->ShowView->Other...).HittherefreshbuttontomaketheDarwinorepositoryappear.Finally,rightclickonthisrepositoryandselectRebuildIndex,.Asaresult,youshouldseetheDarwinoassetslikein:

MavenSettings

26

IBMDominoSpecificSettingsIfyouwillbeworkingonDomino-relatedprojects,itisnecessarytodownloadandinstallandreferencetheIBMDominoUpdateSiteforBuildManagementfromopenntf.org.ItcontainstheOSGipluginsrequiredbyDomino.

TheUpdateSitecanbedownloadedhere.ExpandthedownloadzipfileandplacethecontentsintheJavainstalldirectory.

InEclipsePreferences,addtheUpdateSitetothetargetplatform.Todothis,under'Plug-inDevelopment\TargetPlatform'selecttheRunningPlatformandchoose'Edit...'.Intheresultingdialog,choose'Add...',then'Directory',thenpointtotheUpdateSitedirectoryandclick'Finish'.

MavenSettings

27

TheimportantinformationtoaddtoyourMavensettingsisthelocationoftheDarwinorepository,whichcontainsthecoreDarwinocomponentsaswellasneededthird-partydependencies.

Hereisanexampleofacompletesettings.xmlcontainingtheremoterepositoryusingthegenericrepoaccessorusername.Ifyoursettings.xmlfiledidn'texistpreviously,youcanusethisasthefile'scontents.IfyouwillbeworkingonDomino-relatedprojects,changethefilepathspecifiedinthenotes-platformpropertytoyourJavadirectory.IfyouwillNOTbeworkingonDomino-relatedprojects,youcandeletethenotes-platformpropertyaltogether.

MavenSettings

28

<?xmlversion="1.0"?>

<settingsxmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.

org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/

1.0.0http://maven.apache.org/xsd/settings-1.0.0.xsd">

<profiles>

<profile>

<id>darwino-repository-profile</id>

<properties>

<notes-platform>

file:///*pathtoJavainstallation*/DominoBuildManagementUpdat

eSite/UpdateSite

</notes-platform>

</properties>

<repositories>

<repository>

<id>darwino-repository</id>

<name>DarwinoPlatform</name>

<url>https://maven.darwino.com/darwino-enterprise-edition</url

>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>darwino-repository</id>

<name>DarwinoPlatform</name>

<url>https://maven.darwino.com/darwino-enterprise-edition</url

>

</pluginRepository>

</pluginRepositories>

</profile>

</profiles>

<activeProfiles>

<activeProfile>darwino-repository-profile</activeProfile>

</activeProfiles>

<servers>

<server>

<id>darwino-repository</id>

<username>[username]</username>

<password>[password]</password>

</server>

</servers>

</settings>

Tomergethisintoanexistingsettings.xml,thepertinentcomponentsarethe<profile>...</profile>block,includingthenamedprofileintheactiveProfiles,specifyingthecredentialsusedwhenaccessingtherepository,andaddingthenotes-platformproperty(ifyouwillbeworkingonDomino-relatedprojects).

MavenSettings

29

GettingStarted

GettingStarted

30

TheContactssampleisasimpleprojectshowingthecapabilitiesoftheDarwinoplatform:

Sampleview/formbasedapplicationRunsasawebappaswellasmobilehybridonmobiledevicesLeveragestheUIcodegeneratorfortheUI

InstallingtheContactsapplicationinEclipseTheContactsapplicationisprovidedbythedarwino-demoGithubrepositoryasasetofmavenenabledprojects.ToimporttheminEclipseoncetheGitrepositoryhasbeencloned,selectImport...->ExistingMavenProjectsandchoosedarwino-demo/contacts.

Theresultshouldbeasetofprojectsinyourworkspace:

Note:ifthisisthefirstprojectyouimport,youmightbepromptedbyEclipsetoinstallsomeM2Econnectors.Ifthishappens,justinstalltheconnectorsandrebootEclipse.

RunningtheWebApplicationTherearetwowaystorunthecontactapplication:

BystartingTOMCATusingtheMavenplugin.Thisisthesimplestsolutiontostartwith.ByinstallingtheapplicationwithinafullTOMCAT

TheURLtotheapplicationis:http://localhost:8080/contacts/mobile/index.html

RunningtheContactsSamples

31

Theapplicationrendering,withnodata,shouldlooklikethis:

RunningtheapplicationthroughMaven

YoufirsthavetobuildtheprojectusingMaven.Forthis,rightclickonthecontactsrootprojectandselectMaveninstall:

RunningtheContactsSamples

32

Oncedone,rightclickonthecontacts-j2eeprojectandselectMavenbuild....Inthegoalfield,entertomcat7:run:

IfthisisthefirsttimeTOMCATisrunthisway,thenallthedependencieswillbedownloadedbyMaven,whichwilltakeafewminutes.

RunningtheapplicationusingEclipseWTP

ThiswilllaunchtheappinTomcatandopenupthedefaultlandingpagefortheapplication.

RunningtheContactsSamples

33

AndroidApplicationsTheAndroidapplicationiscontacts-android-hybrid.Torunit,right-clicktheprojectandchooseRunAs→AndroidApplication:

iOSApplicationsIfyouarerunningonaMac,youcanruntheiOSapplication,whichiscontacts-moe-native.Todoso,right-clickontheprojectandchooseoneoftheRunAs→iOSSimulatorAppoptions:

AddingdatafromIBMNotes/Domino

RunningtheContactsSamples

34

Ifyou'reanIBMDominodeveloper,thentheContactsapplicationisagreatexampleforsettingupthereplicationwithanexistingNSFdatabase

ThisassumesthatyouhavesomeIBMNotes/DominoknowledgeandboththeDarwinoruntime,aswellastheSyncAdmindatabaseareproperlyinstalledonanIBMDominoserver.ItalsoassumesthattheDarwinoconfigurationfiles(beans,properties)aresetup,andfinallythedatabaseJDBCdriverinaddedtotheDominoJVM.Becareful,astheDominoservercanbeexecutedasasystemuserandthustheuser.homedirectorycanbeC:\Windows\System32\config\systemprofile.

Asafirst,createanewNSFbasedonthetemplate'DarwinoContacts.ntf.ThistemplatehasanXPagesUIthatyoucanreachusingaURLlike:http://localhost/DarwinoContacts.nsf

Then,fromtheheaderbaroftheXPagesapplication,clickthe'Admin'optionandgeneratecontactsdocumentsbyhitting'Create500fakecontacts'.

Oncedone,youcansetupthesynchronizationbetweentheDominodatabaseandtheDarwinoone.Forthis,launchthesynchronizationadminUI,runningonyourDominoserver:http://localhost/DarwinoSync.nsf

First,createanadapter:nameitcontactstomatchtheDarwinodatabasename.Generatethedefinitionbyclicking'GenerateFromDatabase'andselectingDarwinoContacts.nsf.

RunningtheContactsSamples

35

Oncedone,createascheduleserviceforthisadapterandtheproperDarwinoconnectionbean:

Youcanschedulethereplication,orexecuteitoncefromthemainreplicationserviceview.Afterthereplicationisrun,thentheDarwinoapplicationshouldshowthedata:

RunningtheContactsSamples

36

TheNewsapplicationsareanexampleofasyncingnews-readerappwithrandomly-generatedarticlecontent.ItcontainsaJ2EEapplicationwithtwoUIexamplesandwhichcanactasaremoteserverforitsmobileapplications.ItalsoincludespairsofexamplesforbothAndroidandiOS:nativeUIsandhybrid(HTML-based)UIs.

InstallingthenewsapplicationinEclipseThenewapplicationisprovidedbythedarwino-demoGithubrepositoryasasetofmavenenabledprojects.ToimporttheminEclipseoncetheGitrepositoryhasbeencloned,selectImport...->ExistingMavenProjectsandchooseparent-dwo-demo-news.

Theresultshouldbeasetofprojectinyourworkspace:

RunningtheNewsSamples

37

J2EEApplicationTheJ2EEapplicationisnameddwo-demo-news-j2ee.TorunitusingaconfiguredTomcatserverinsideEclipse,right-clickontheprojectandchooseRunAs→RunOnServer:

ThiswilllaunchtheappinTomcatandopenupthedefaultlandingpagefortheapplication.InadditiontothedefaultJSF-basedUI,thereisalsoanAngular-basedUI,whichissharedwiththehybridmobileapplications.

Thisapplicationcanserveasacentralserverforreplicationwiththemobiledemoapps.

ItconnectstoPostgreSQLforitsdatastorage.Bydefault,itusestheportandcredentialsspecifiedonthe[[PreparingtheDevelopmentEnvironment]]page.Ifneeded,thiscanbemodifiedbychangingeitherthe

RunningtheNewsSamples

38

src/main/resources/darwino_default.propertiesfileinthedwo-demo-commonsproject(whichaffectstheotherdemosaswell)orbycreatingacopyofthisfilenamedsrc/main/resources/darwino.propertiesinthedwo-demo-news-j2eeprojectitself.

AndroidApplicationsThetwoAndroidapplicationsaredwo-demo-news-android-hybridanddwo-demo-news-android-native.Toruneitheroftheseapps,right-clicktheprojectandchooseRunAs→AndroidApplication:

iOSApplicationsIfyouarerunningonaMac,youcanruntheiOSapplications,whicharedwo-demo-news-moe-nativeanddwo-demo-news-moe-hybrid.Todoso,right-clickontheprojectandchooseoneoftheRunAs→iOSSimulatorAppoptions:

RunningtheNewsSamples

39

ConnectingtotheJ2EEAppfromMobileToconnecttoarunninginstanceoftheJ2EEapplicationfromeithertheAndroidoriOSapplications,modifytheconnectionsettingsinthesrc/main/resources/predefined_connections_default.jsonfileinthedwo-demo-commons-mobileproject,replacing{0}withthebaseURLofyourTomcatserverinthefirstsettingsblock.Forexample,wheretheTomcatserveris"10.0.1.8"andrunningonport8081:

{

"enabled":true,

"local":false,

"name":"LocalServer-http://10.0.1.8:8081",

"url":"http://10.0.1.8:8081",

"userId":"amass",

"password":"floflo",

"dn":"cn=almass,o=triloggroup",

"cn":"AlMass"

}

Thesesettingscanalsobemodifiedfromwithinthemobileapplicationswhenrunningbygoingtothesettingsfortheapp,whichisavailablebytapping"Settings"inthebottom-rightcorneroftheiOSnativeappandinthetop-rightdrop-downmenuotherwise:

RunningtheNewsSamples

40

RunningtheNewsSamples

41

TheDominoDiscussionapplicationsareanexampleofreplicatingwithastandardDominoNSF-baseddiscussiondatabase.

J2EEApplicationTheJ2EEapplicationisnameddwo-demo-dominodisc-j2ee.TorunitusingaconfiguredTomcatserverinsideEclipse,right-clickontheprojectandchooseRunAs→RunOnServer:

ThiswilllaunchtheappinTomcatandopenupthedefaultlandingpagefortheapplication.

Thisapplicationcanserveasacentralserverforreplicationwiththemobiledemoapps.

ToconfigureitsconnectiontoaDominoserverrunningtheDarwinosyncservice,whichisrequiredforproperusage,modifythesrc/main/webapp/WEB-INF/web.xmlfileinthedwo-demo-dominodisc-j2eeproject.

ItconnectstoPostgreSQLforitslocaldatastorage.Bydefault,itusestheportandcredentialsspecifiedonthe[[PreparingtheDevelopmentEnvironment]]page.Ifneeded,thiscanbemodifiedbychangingeitherthesrc/main/resources/darwino_default.propertiesfileinthedwo-demo-commonsproject(whichaffectstheotherdemosaswell)orbycreatingacopyofthisfilenamedsrc/main/resources/darwino.propertiesinthedwo-demo-dominodisc-j2eeprojectitself.

AndroidApplication

RunningtheDominoDiscussionSamples

42

TheAndroidapplicationisdwo-demo-dominodisc-android-hybrid.Torunthisapp,right-clicktheprojectandchooseRunAs→AndroidApplication:

iOSApplicationIfyouarerunningonaMac,youcanruntheiOSapplication,whichisdwo-demo-dominodisc-moe-hybrid.Todoso,right-clickontheprojectandchooseoneoftheRunAs→iOSSimulatorAppoptions:

RunningtheDominoDiscussionSamples

43

AlthoughDarwinodoesnotrequiretheuseofanyIDEtowork,theDarwinostudioisthefastestwaytogetstartedwithanewproject.

UsingtheDarwinoApplicationWizardFromtheEclipsemainmenu.selectFile...New...Project...andthesearchforDarwino:

Select'NewDarwinoApplication'hitNext.

Foryourfirstproject,youcanlivethedefaultvaluesasis

CreatinganewDarwinoProject

44

Note:thefirstgenerationmighttakeseveralminutes,asEclipseisdownloadingallthenecessarydependenciesfromthemavenrepositories.Subsequentrunsofthewizardwillbealotfaster:-)

ThiswillcreateaDarwinoApplicationthatcanrunonaJ2EEserver,anAndroidmobiledeviceandaniOSmobiledevice.Tosupportalltheseplatformswhilesharingcode,thewizardgeneratedseveralprojectsintheEclipseworkspace:

RunningtheWebApplicationIfyou'reusingaTOMCATserver,thenyoushouldadditinEclipsefromthe'Servers'view.Rightclickontheserver,select'AddandRemove...'.Selectthenewapplication,addittothelistofconfiguredapplicationsandhit'Finish'.

CreatinganewDarwinoProject

45

Then,rightclickontheserver,select'Publish'.Finallyrightclickanothertimeontheserverandhit'Start'.

YoushouldbeabletohittheapplicationfromyourbrowserbyusingaURLlike:http://localhost:8080/demoapp/main.html

RunningtheMobileApplicationsBeforerunningthemobileapplications,youhavetoconfiguretheserverURLthattheapplicationsareusing.Thisisnotrequired,butheavilyrecommendedtoavoideverysingleusertohavetoconfigurethemobileapplication.Todothis,openthepredefined_connections.jsonfileandensurethattheserveraddressisavailablefromthedeviceoremulatorrunningtheapplication:

Thenruntheappbyrightclickingtheapplicationandselect'RunAs...AndroidApplication'or'RunAs...iOSxxx'dependingonyourplatform.

ExtendingtheGeneratedApplication

CreatinganewDarwinoProject

46

Therearedifferentplaceswheretheapplicationcanbeextended

DevelopingtheUIAsimpleAngularJSbasedUIislocatedinthewebuiproject:

AddingbusinesslogicBusinesslogiccanbeaddedtothesharedproject

Andofcourse,everythingcanbecustomized!

CreatinganewDarwinoProject

47

Installation

PackagingMobileApplications

48

BuildingtheiOSdemoapplicationrequiresaMacwithavalidiOSdeveloperprofileregisteredviaXcode'sAccountspreferencepanel.Toseeifyourcomputerhasanyactiveprofiles,run:

securityfind-identity-v-pcodesigning

Thatshouldlistanyavailablesigningprofiles,andvalidoneswillcontain"iPhoneDeveloper"or"iOSDevelopment".

RunningintheSimulatorToruniOSapplicationsinthesimulator,right-clicktheiOSprojectinEclipseandchooseRunAs→Multi-OSEngineiOSApplication:

TochangethedeviceorOSversionusedinthesimulator,choose"RunConfigurations"andselectadifferenttargetdevicefromthelist:

iOSApplications

49

RunningonaniOSDeviceRunninganapplicationonaphysicaliOSdevicecanbedonebyadjustingtheRunConfigurationasabove,butinsteadchoosingaphysicaldevicefromthelist.

iOSApplications

50