SlideShare una empresa de Scribd logo
1 de 15
Darwino Script and Command Line
Add customization capabilities to your Darwino applications
Darwino Script Introduction
• Darwino Script is a scripting language, very similar to JavaScript
– Follows ECMA-Script 262-3 for a lot of behaviors
– Designed as a “formula language” rather than a language for writing programs
– Extended for ease of use: new operators like ?. or ?[, @functions…
– Uses the Java primitives as core language primitives, include BigDecimal
– Objects are Java objects and don’t have prototypes
• Although a custom library can easily provide this feature
• Ex: JsonArray & JsonObject
– Tailored to script Java classes/objects
• Can directly call any Java classes/objects, if security permits
• Can easily be extended through java extension points
Darwino Script Introduction
• Low resource consumption, even on mobile devices
– Fast compiler with caching capability
• Dynamic execution: interprets an AST tree in memory
– No class file is generated, so it does not require a JVM (AOT compiler works)
• Can be transpiled to other languages (Java, JavaScript, AngularJS
expressions…)
Darwino Script Usage
• Script language for citizen developers
– Can be interpreted dynamically or transpiled (see: UI generation)
• End user customization
– Workflow engine conditions, …
– Other customizations done by a user
• Database events, …
Darwino Script Main Objects
• DSEnvironment
– Maintains the global scripting options, libraries and variables
– Shared across script executions
• DSContext
– The execution context for a script execution
– Contains the local variables, and execution options
• DSScript
– An in-memory compiled script, ready to be executed
• DSLibrary
– Define a set of functions, classes or value members (including constants)
Executing a Piece of Script
// Create the execution environment
// This environment holds the libraries to use
// - standard (print, println..)
// - JavaJre (access to Java Object using reflection)
DSEnvironment env = new DSEnvironment();
env.registerLibrary(new StandardLibrary());
env.registerLibrary(new JavaJreLibrary(env));
// The context can also take extra parameters:
// this
// library to use for this context
// Note that the context contains the global variables being created by the script
// and can also be reused, with these values, while executing another script
DSProgramRuntimeContext ctx = new DSProgramRuntimeContext(env);
// Compile the script or get it from the cache
DSScript expr = ctx.getEnvironment().createScript("1+4");
// Execute and get the result
Object result = expr.execute(ctx);
assertEquals(5, result);
Creating a Reusable Library
• A library can export
– Member access (global values, object members…)
– Function calls (global function, object method…)
– Object/Array constructors
public interface DSLibrary {
public Object getMember(DSRuntimeContext context, Object instance, String member) throws DSRuntimeException;
public Object getMember(DSRuntimeContext context, Object instance, int index) throws DSRuntimeException;
public boolean putMember(DSRuntimeContext context, Object instance, String member, Object value) throws DSRuntimeException;
public boolean putMember(DSRuntimeContext context, Object instance, int index, Object value) throws DSRuntimeException;
public Object call(DSRuntimeContext context, Object instance, Object[] parameters) throws DSRuntimeException;
public Object constructObject(DSRuntimeContext context, String type, Object[] parameters) throws DSRuntimeException;
public Object constructArray(DSRuntimeContext context, String type, int dimensions, int size) throws DSRuntimeException;
}
Existing Libraries
• Java bridge
• @function
– Similar to Notes/Domino @functions
– Targets citizen developers
• Java Objects cab implement
– DSObject, DSArray, DSCallable for easy library creationb
A Word About Security
• If the script is going to be exposed to end users
– You should control what library is exposed
• Use reflection to access Java object?
– You should fine control what object can be exposed/called from the script
• Can also depend on the user profile
• All the features are exposed through libraries, so it is easy to control
– But Darwino will make it even easier with a new security interface
Darwino Command Framework
• The Darwino command framework allows the execution of text based
commands
• The lists of commands is contributed via extensions
• Generally used to exposed administration/debugging capabilities
Some Available Commands
• Built-in commands libraries are provided by the runtime
– Default: echo, set, call, profiler, classpath…
– JSON Store: manage databases, access data…
– Runtime: access to user
• And more to come over time
– Access to log files
– Java logging API settings
Darwino Command CLI
• Commands can be executed from a simple console shell
– Provided as a Java class in the dwo-apps-jstore-cli project
• Configuration file is executed when the console is launched
~/.darwino/console-init.dsh
• Example:
# Initialize with TOMCAT environment
classpath c:phildevapache-tomcat-8.0.20libsqljdbc42.jar
classpath c:phildevapache-tomcat-8.0.20libpostgresql-9.4-1203-jdbc4.jar
load-config c:phildevapache-tomcat-8.0.20
Darwino Debug Web UI
• A simple WebUI can be added to any Darwino Web application
– Access to Commands, Profiler, Script…
– Just add the maven dependency to the web project
• For security reasons, it requires a property to be explicitly set
– Commands can execute code that inspect, create or delete sensitive data
# Enabled the debug module
dwo-runtime-debug-enable=true
# only admins - this is the default
#dwo-runtime-debug-users=admin
Darwino Debug Web UI - Demo
Thank you for your attention!

Más contenido relacionado

La actualidad más candente

Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration TestingSam Brannen
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machineNikhil Sharma
 
Infrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraInfrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraTomislav Plavcic
 
Best Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBest Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBlueData, Inc.
 
1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ振东 刘
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepguest9efd1a1
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central DispatchRobert Brown
 
Distributed Applications with Apache Zookeeper
Distributed Applications with Apache ZookeeperDistributed Applications with Apache Zookeeper
Distributed Applications with Apache ZookeeperAlex Ehrnschwender
 
Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache ZookeeperAnshul Patel
 
Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Shahriman .
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvmhome
 
Tech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM WorkflowsTech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM Workflows51 lecture
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010Arun Gupta
 
Java ain't scary - introducing Java to PL/SQL Developers
Java ain't scary - introducing Java to PL/SQL DevelopersJava ain't scary - introducing Java to PL/SQL Developers
Java ain't scary - introducing Java to PL/SQL DevelopersLucas Jellema
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in ScalaKnoldus Inc.
 

La actualidad más candente (20)

Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 
Inside the jvm
Inside the jvmInside the jvm
Inside the jvm
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Infrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraInfrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfra
 
Best Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBest Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker Containers
 
1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstep
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
 
Distributed Applications with Apache Zookeeper
Distributed Applications with Apache ZookeeperDistributed Applications with Apache Zookeeper
Distributed Applications with Apache Zookeeper
 
3. jvm
3. jvm3. jvm
3. jvm
 
Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache Zookeeper
 
Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
Tech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM WorkflowsTech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM Workflows
 
What is-java
What is-javaWhat is-java
What is-java
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Java ain't scary - introducing Java to PL/SQL Developers
Java ain't scary - introducing Java to PL/SQL DevelopersJava ain't scary - introducing Java to PL/SQL Developers
Java ain't scary - introducing Java to PL/SQL Developers
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in Scala
 
JavaOne 2011 Recap
JavaOne 2011 RecapJavaOne 2011 Recap
JavaOne 2011 Recap
 

Destacado

05 darwino db
05   darwino db05   darwino db
05 darwino dbdarwinodb
 
SFD 2014: Multiplatform App Development with Migeran
SFD 2014: Multiplatform App Development with MigeranSFD 2014: Multiplatform App Development with Migeran
SFD 2014: Multiplatform App Development with MigeranGergely Kis
 
Migeran Tech Talk at Prezi HQ
Migeran Tech Talk at Prezi HQMigeran Tech Talk at Prezi HQ
Migeran Tech Talk at Prezi HQGergely Kis
 
09 business apis
09   business apis09   business apis
09 business apisdarwinodb
 
Migeran: iOS Apps in Java at Budapest New Tech Meetup
Migeran: iOS Apps in Java at Budapest New Tech MeetupMigeran: iOS Apps in Java at Budapest New Tech Meetup
Migeran: iOS Apps in Java at Budapest New Tech MeetupGergely Kis
 
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...darwinodb
 
06 web applications
06   web applications06   web applications
06 web applicationsdarwinodb
 
02 configuration
02   configuration02   configuration
02 configurationdarwinodb
 
07 darwino rest services
07   darwino rest services07   darwino rest services
07 darwino rest servicesdarwinodb
 
10 domino integration
10   domino integration10   domino integration
10 domino integrationdarwinodb
 
01 introduction to darwino
01   introduction to darwino01   introduction to darwino
01 introduction to darwinodarwinodb
 
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and TychoCooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and TychoGergely Kis
 
MOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaMOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaGergely Kis
 
Cross-Platform Native Apps in Java (budapest.mobile)
Cross-Platform Native Apps in Java (budapest.mobile)Cross-Platform Native Apps in Java (budapest.mobile)
Cross-Platform Native Apps in Java (budapest.mobile)Gergely Kis
 
04 darwino concepts and utility classes
04   darwino concepts and utility classes04   darwino concepts and utility classes
04 darwino concepts and utility classesdarwinodb
 
Space mouse sameer kumar telikicherla
Space mouse   sameer kumar telikicherlaSpace mouse   sameer kumar telikicherla
Space mouse sameer kumar telikicherlaSameer Telikicherla
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 

Destacado (20)

05 darwino db
05   darwino db05   darwino db
05 darwino db
 
SFD 2014: Multiplatform App Development with Migeran
SFD 2014: Multiplatform App Development with MigeranSFD 2014: Multiplatform App Development with Migeran
SFD 2014: Multiplatform App Development with Migeran
 
Migeran Tech Talk at Prezi HQ
Migeran Tech Talk at Prezi HQMigeran Tech Talk at Prezi HQ
Migeran Tech Talk at Prezi HQ
 
09 business apis
09   business apis09   business apis
09 business apis
 
Migeran: iOS Apps in Java at Budapest New Tech Meetup
Migeran: iOS Apps in Java at Budapest New Tech MeetupMigeran: iOS Apps in Java at Budapest New Tech Meetup
Migeran: iOS Apps in Java at Budapest New Tech Meetup
 
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
 
06 web applications
06   web applications06   web applications
06 web applications
 
02 configuration
02   configuration02   configuration
02 configuration
 
07 darwino rest services
07   darwino rest services07   darwino rest services
07 darwino rest services
 
10 domino integration
10   domino integration10   domino integration
10 domino integration
 
01 introduction to darwino
01   introduction to darwino01   introduction to darwino
01 introduction to darwino
 
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and TychoCooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho
Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho
 
Multi-OS Engine Technology Overview
Multi-OS Engine Technology OverviewMulti-OS Engine Technology Overview
Multi-OS Engine Technology Overview
 
MOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaMOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in Java
 
Cross-Platform Native Apps in Java (budapest.mobile)
Cross-Platform Native Apps in Java (budapest.mobile)Cross-Platform Native Apps in Java (budapest.mobile)
Cross-Platform Native Apps in Java (budapest.mobile)
 
04 darwino concepts and utility classes
04   darwino concepts and utility classes04   darwino concepts and utility classes
04 darwino concepts and utility classes
 
MWLUG 2016 - AD106
MWLUG 2016 - AD106MWLUG 2016 - AD106
MWLUG 2016 - AD106
 
Space mouse sameer kumar telikicherla
Space mouse   sameer kumar telikicherlaSpace mouse   sameer kumar telikicherla
Space mouse sameer kumar telikicherla
 
Space mouse
Space mouseSpace mouse
Space mouse
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar a 15 darwino script & command line

Building Server Applications Using Objective C And Gn Ustep
Building Server Applications Using Objective C And Gn UstepBuilding Server Applications Using Objective C And Gn Ustep
Building Server Applications Using Objective C And Gn Ustepwangii
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUlrich Krause
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languageselliando dias
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel Fomitescu
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
OOP with Java
OOP with JavaOOP with Java
OOP with JavaOmegaHub
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceTrisha Gee
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Trisha Gee
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the BasicsUlrich Krause
 
Containerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationContainerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationC4Media
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsGianluca Varisco
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Codemotion
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptAayush Chimaniya
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicGourav Varma
 

Similar a 15 darwino script & command line (20)

CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Building Server Applications Using Objective C And Gn Ustep
Building Server Applications Using Objective C And Gn UstepBuilding Server Applications Using Objective C And Gn Ustep
Building Server Applications Using Objective C And Gn Ustep
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languages
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
Java and the JVM
Java and the JVMJava and the JVM
Java and the JVM
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics
 
Containerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationContainerization Is More than the New Virtualization
Containerization Is More than the New Virtualization
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoops
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
 
Java >= 9
Java >= 9Java >= 9
Java >= 9
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 

Más de darwinodb

17 open ntf-v30-darwinoorg
17   open ntf-v30-darwinoorg17   open ntf-v30-darwinoorg
17 open ntf-v30-darwinoorgdarwinodb
 
16 endeavour reporter
16   endeavour reporter16   endeavour reporter
16 endeavour reporterdarwinodb
 
14 integrating watson services
14   integrating watson services14   integrating watson services
14 integrating watson servicesdarwinodb
 
13 deploying cloud applications
13   deploying cloud applications13   deploying cloud applications
13 deploying cloud applicationsdarwinodb
 
12 ibm connections integration
12   ibm connections integration12   ibm connections integration
12 ibm connections integrationdarwinodb
 
11 advanced replication
11   advanced replication11   advanced replication
11 advanced replicationdarwinodb
 
08 mobile development
08   mobile development08   mobile development
08 mobile developmentdarwinodb
 

Más de darwinodb (7)

17 open ntf-v30-darwinoorg
17   open ntf-v30-darwinoorg17   open ntf-v30-darwinoorg
17 open ntf-v30-darwinoorg
 
16 endeavour reporter
16   endeavour reporter16   endeavour reporter
16 endeavour reporter
 
14 integrating watson services
14   integrating watson services14   integrating watson services
14 integrating watson services
 
13 deploying cloud applications
13   deploying cloud applications13   deploying cloud applications
13 deploying cloud applications
 
12 ibm connections integration
12   ibm connections integration12   ibm connections integration
12 ibm connections integration
 
11 advanced replication
11   advanced replication11   advanced replication
11 advanced replication
 
08 mobile development
08   mobile development08   mobile development
08 mobile development
 

Último

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 

Último (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 

15 darwino script & command line

  • 1. Darwino Script and Command Line Add customization capabilities to your Darwino applications
  • 2. Darwino Script Introduction • Darwino Script is a scripting language, very similar to JavaScript – Follows ECMA-Script 262-3 for a lot of behaviors – Designed as a “formula language” rather than a language for writing programs – Extended for ease of use: new operators like ?. or ?[, @functions… – Uses the Java primitives as core language primitives, include BigDecimal – Objects are Java objects and don’t have prototypes • Although a custom library can easily provide this feature • Ex: JsonArray & JsonObject – Tailored to script Java classes/objects • Can directly call any Java classes/objects, if security permits • Can easily be extended through java extension points
  • 3. Darwino Script Introduction • Low resource consumption, even on mobile devices – Fast compiler with caching capability • Dynamic execution: interprets an AST tree in memory – No class file is generated, so it does not require a JVM (AOT compiler works) • Can be transpiled to other languages (Java, JavaScript, AngularJS expressions…)
  • 4. Darwino Script Usage • Script language for citizen developers – Can be interpreted dynamically or transpiled (see: UI generation) • End user customization – Workflow engine conditions, … – Other customizations done by a user • Database events, …
  • 5. Darwino Script Main Objects • DSEnvironment – Maintains the global scripting options, libraries and variables – Shared across script executions • DSContext – The execution context for a script execution – Contains the local variables, and execution options • DSScript – An in-memory compiled script, ready to be executed • DSLibrary – Define a set of functions, classes or value members (including constants)
  • 6. Executing a Piece of Script // Create the execution environment // This environment holds the libraries to use // - standard (print, println..) // - JavaJre (access to Java Object using reflection) DSEnvironment env = new DSEnvironment(); env.registerLibrary(new StandardLibrary()); env.registerLibrary(new JavaJreLibrary(env)); // The context can also take extra parameters: // this // library to use for this context // Note that the context contains the global variables being created by the script // and can also be reused, with these values, while executing another script DSProgramRuntimeContext ctx = new DSProgramRuntimeContext(env); // Compile the script or get it from the cache DSScript expr = ctx.getEnvironment().createScript("1+4"); // Execute and get the result Object result = expr.execute(ctx); assertEquals(5, result);
  • 7. Creating a Reusable Library • A library can export – Member access (global values, object members…) – Function calls (global function, object method…) – Object/Array constructors public interface DSLibrary { public Object getMember(DSRuntimeContext context, Object instance, String member) throws DSRuntimeException; public Object getMember(DSRuntimeContext context, Object instance, int index) throws DSRuntimeException; public boolean putMember(DSRuntimeContext context, Object instance, String member, Object value) throws DSRuntimeException; public boolean putMember(DSRuntimeContext context, Object instance, int index, Object value) throws DSRuntimeException; public Object call(DSRuntimeContext context, Object instance, Object[] parameters) throws DSRuntimeException; public Object constructObject(DSRuntimeContext context, String type, Object[] parameters) throws DSRuntimeException; public Object constructArray(DSRuntimeContext context, String type, int dimensions, int size) throws DSRuntimeException; }
  • 8. Existing Libraries • Java bridge • @function – Similar to Notes/Domino @functions – Targets citizen developers • Java Objects cab implement – DSObject, DSArray, DSCallable for easy library creationb
  • 9. A Word About Security • If the script is going to be exposed to end users – You should control what library is exposed • Use reflection to access Java object? – You should fine control what object can be exposed/called from the script • Can also depend on the user profile • All the features are exposed through libraries, so it is easy to control – But Darwino will make it even easier with a new security interface
  • 10. Darwino Command Framework • The Darwino command framework allows the execution of text based commands • The lists of commands is contributed via extensions • Generally used to exposed administration/debugging capabilities
  • 11. Some Available Commands • Built-in commands libraries are provided by the runtime – Default: echo, set, call, profiler, classpath… – JSON Store: manage databases, access data… – Runtime: access to user • And more to come over time – Access to log files – Java logging API settings
  • 12. Darwino Command CLI • Commands can be executed from a simple console shell – Provided as a Java class in the dwo-apps-jstore-cli project • Configuration file is executed when the console is launched ~/.darwino/console-init.dsh • Example: # Initialize with TOMCAT environment classpath c:phildevapache-tomcat-8.0.20libsqljdbc42.jar classpath c:phildevapache-tomcat-8.0.20libpostgresql-9.4-1203-jdbc4.jar load-config c:phildevapache-tomcat-8.0.20
  • 13. Darwino Debug Web UI • A simple WebUI can be added to any Darwino Web application – Access to Commands, Profiler, Script… – Just add the maven dependency to the web project • For security reasons, it requires a property to be explicitly set – Commands can execute code that inspect, create or delete sensitive data # Enabled the debug module dwo-runtime-debug-enable=true # only admins - this is the default #dwo-runtime-debug-users=admin
  • 14. Darwino Debug Web UI - Demo
  • 15. Thank you for your attention!