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

50

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

Page 1: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo
Page 2: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 3: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

DarwinoInstallationGuide

Introduction

3

Page 4: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

WelcometoDarwino!ThisguidewillshowyouhowtoinstalladevelopmentenvironmenttocreateDarwinobasedapplications.

Togetstarted,gotoSettingUppage.

Home

4

Page 5: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Installation

Installation

5

Page 6: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 7: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 8: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 9: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 10: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 11: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 12: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 13: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

SelectyourTomcatenvironmentandeventuallychangetheservername,andhit'Finish'

Downloadthedarwino-beans.xmlanddarwino.propertiesfilestotheTomcatinstalldirectory.

ConfiguringTOMCAT

13

Page 14: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

NowyouhaveyourserverreadyfortheDarwinoapplications

ConfiguringTOMCAT

14

Page 15: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 16: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

NowyouhaveyourserverreadyfortheDarwinoapplications

ConfiguringIBMWebsphereLiberty

16

Page 17: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 18: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

3. Rightclickonthedatabaseandselect'NewDatabase...'

4. Nameitdwodemoandhitok.Alltheotherdefaultsettings

Oncedone,youshouldseethedatabasecreatedafterdoubleclickingitinthelist:

ConfiguringPostgreSQL

18

Page 19: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 20: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 21: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 22: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

TheDarwinostudio,onceinstalled,featuresaninstallationvalidationmoduleavailableunderWindow->Preferences/Darwino:

Thismodulechecksyourenvironmentandgivesyouguidanceonthenextactions:

HavingMavensettings.xmlproperlyconfiguredHavingtheDarwinoconfigurationfilesattherightplaceMakingsurethattheEclipsedependenciesareinstalled

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

InstallingEclipse

22

Page 23: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

InstallingEclipse

23

Page 24: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

ManuallyConfiguringEclipseTheconfigurationvalidatorexposedaboveshouldgiveyouallthenecessaryinformationbutsomedetailsareexposedbellow.

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

IfAndroidisadesiredtargetplatform:

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

InstallingEclipse

24

Page 25: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 26: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 27: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 28: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

TheimportantinformationtoaddtoyourMavensettingsisthelocationoftheDarwinorepository,whichcontainsthecoreDarwinocomponentsaswellasneededthird-partydependencies.

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

MavenSettings

28

Page 29: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

<?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

Page 30: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

GettingStarted

GettingStarted

30

Page 31: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 32: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Theapplicationrendering,withnodata,shouldlooklikethis:

RunningtheapplicationthroughMaven

YoufirsthavetobuildtheprojectusingMaven.Forthis,rightclickonthecontactsrootprojectandselectMaveninstall:

RunningtheContactsSamples

32

Page 33: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

IfthisisthefirsttimeTOMCATisrunthisway,thenallthedependencieswillbedownloadedbyMaven,whichwilltakeafewminutes.

RunningtheapplicationusingEclipseWTP

ThiswilllaunchtheappinTomcatandopenupthedefaultlandingpagefortheapplication.

RunningtheContactsSamples

33

Page 34: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

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

AddingdatafromIBMNotes/Domino

RunningtheContactsSamples

34

Page 35: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 36: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Oncedone,createascheduleserviceforthisadapterandtheproperDarwinoconnectionbean:

Youcanschedulethereplication,orexecuteitoncefromthemainreplicationserviceview.Afterthereplicationisrun,thentheDarwinoapplicationshouldshowthedata:

RunningtheContactsSamples

36

Page 37: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

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

Theresultshouldbeasetofprojectinyourworkspace:

RunningtheNewsSamples

37

Page 38: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

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

Thisapplicationcanserveasacentralserverforreplicationwiththemobiledemoapps.

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

RunningtheNewsSamples

38

Page 39: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 40: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 41: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

RunningtheNewsSamples

41

Page 42: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 43: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

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

RunningtheDominoDiscussionSamples

43

Page 44: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

AlthoughDarwinodoesnotrequiretheuseofanyIDEtowork,theDarwinostudioisthefastestwaytogetstartedwithanewproject.

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

Select'NewDarwinoApplication'hitNext.

Foryourfirstproject,youcanlivethedefaultvaluesasis

CreatinganewDarwinoProject

44

Page 45: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Note:thefirstgenerationmighttakeseveralminutes,asEclipseisdownloadingallthenecessarydependenciesfromthemavenrepositories.Subsequentrunsofthewizardwillbealotfaster:-)

ThiswillcreateaDarwinoApplicationthatcanrunonaJ2EEserver,anAndroidmobiledeviceandaniOSmobiledevice.Tosupportalltheseplatformswhilesharingcode,thewizardgeneratedseveralprojectsintheEclipseworkspace:

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

CreatinganewDarwinoProject

45

Page 46: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

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

Page 47: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Therearedifferentplaceswheretheapplicationcanbeextended

DevelopingtheUIAsimpleAngularJSbasedUIislocatedinthewebuiproject:

AddingbusinesslogicBusinesslogiccanbeaddedtothesharedproject

Andofcourse,everythingcanbecustomized!

CreatinganewDarwinoProject

47

Page 48: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

Installation

PackagingMobileApplications

48

Page 49: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

BuildingtheiOSdemoapplicationrequiresaMacwithavalidiOSdeveloperprofileregisteredviaXcode'sAccountspreferencepanel.Toseeifyourcomputerhasanyactiveprofiles,run:

securityfind-identity-v-pcodesigning

Thatshouldlistanyavailablesigningprofiles,andvalidoneswillcontain"iPhoneDeveloper"or"iOSDevelopment".

RunningintheSimulatorToruniOSapplicationsinthesimulator,right-clicktheiOSprojectinEclipseandchooseRunAs→Multi-OSEngineiOSApplication:

TochangethedeviceorOSversionusedinthesimulator,choose"RunConfigurations"andselectadifferenttargetdevicefromthelist:

iOSApplications

49

Page 50: Table of Contents - documentation.darwino.com · Database server: These instructions document the use of Postgres 9.4+ database server. Although other databases may be used, the demo

RunningonaniOSDeviceRunninganapplicationonaphysicaliOSdevicecanbedonebyadjustingtheRunConfigurationasabove,butinsteadchoosingaphysicaldevicefromthelist.

iOSApplications

50