enterprise javascript ... what the heck?
TRANSCRIPT
![Page 1: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/1.jpg)
Enterprise JavaScript…what the heck?
Nedelcho Delchev [SAP]2016-10-25
![Page 2: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/2.jpg)
Who am I?
I am Development Architect in HANA Cloud Platform Core team in the area of extensions for large enterprises in the cloud.
Project lead of Eclipse Dirigible – a Cloud Development Platform project that provides full-fledged capabilities for developing, running and operating cloud applications – http://www.dirigible.io
![Page 3: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/3.jpg)
What the Enterprise JavaScript is?
• A JavaScript for Enterprises?• A script for Java-focused Enterprises?• Enterprise ready JavaScript?
![Page 4: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/4.jpg)
The Problem
We wanted The Perfect
Development Platform
![Page 5: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/5.jpg)
We wanted it …
• … to be instantly accessible• … to give the shortest development turn-around
time• … to provide all the needed features• … to fully cover the DevOps cycles• … to be highly adaptable and flexible• … to be turbo- mega- super- scalable• … must be Open Source• … to be beloved by the developers
![Page 6: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/6.jpg)
![Page 7: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/7.jpg)
The Solution
![Page 8: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/8.jpg)
Instantly accessible
• http://trial.dirigible.io• You can deploy on any Cloud • Complex landscapes can be easily organized
![Page 9: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/9.jpg)
The shortest development turn-around time
• Leveraging the In-System Programming paradigm
• Avoid the side-effects of the sandbox systems
![Page 10: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/10.jpg)
Providing all the features you may need
• Database modeling• Scripting Services• User Interfaces• Flows and Jobs• Mobile Apps• Debugging• Git Integration• Project & Artifacts Templates• Shell Access via Terminal• Log Console & Raw Logs
• Content Transport• Security Management• Access Management• Browse the Content• Discover Endpoints• Monitoring Basic Metrics• …
![Page 11: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/11.jpg)
Beloved by the Developers
• RAD technics – wizards, modeling tools• Multiple templates producing ready to use
RESTful services, CRUD User Interfaces, Mobile Apps, etc.
• Configurable and customizable• Extension Points and Extensions• Injected Services – Built-in and Platform services• Powerful source code editing by Orion …
![Page 12: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/12.jpg)
You have to code – yeah!
What do you want to code today?
![Page 13: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/13.jpg)
We Chose the Default
JavaScript
![Page 14: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/14.jpg)
Hello World!
var response = require('net/http/response');
response.println("Hello World!");
response.flush();response.close();
![Page 15: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/15.jpg)
Hello World!
var response = require('net/http/response');
response.println("Hello World!");
response.flush();response.close();
![Page 16: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/16.jpg)
Hello World!
var response = require('net/http/response');
response.println("Hello World!");
response.flush();response.close();
![Page 17: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/17.jpg)
Hello World!
var response = require('net/http/response');
response.println("Hello World!");
response.flush();response.close();
![Page 18: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/18.jpg)
HTTP Request & Response
var request = require('net/http/request');var response = require('net/http/response');
var parameter = request.getParameter("name");
response.println("[Parameter]: " + parameter);
response.flush();response.close();
![Page 19: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/19.jpg)
HTTP Upload
if (request.getMethod() === "POST") {if (upload.isMultipartContent()) {var files = upload.parseRequest();files.forEach(function(file) {response.println("[File Name] " + file.name);});} else {response.println("The request must be 'multipart'");}}
![Page 20: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/20.jpg)
HTTP Client
var options = { method: 'GET', // default host: 'http://services.odata.org', port: 80, path: '/V4/Northwind/Northwind.svc/', binary: false };var httpResponse = http.request(options);response.println(httpResponse.statusMessage);response.println(httpResponse.data);
![Page 21: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/21.jpg)
More about HTTP
• Session• Cookies• Headers• Attributes• Roles
Is it all about HTTP only?
![Page 22: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/22.jpg)
What about WebSockets?
var websocket = require("net/websocket");…var websocketSession = websocket.getSession();…websocketSession.sendText("Welcome!”);
![Page 23: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/23.jpg)
‘Enterprise’ without SOAP?var soap = require("net/soap");...var requestMessage = soap.createMessage();var part = requestMessage.getPart();var envelope = part.getEnvelope();envelope.addNamespaceDeclaration("ws", "http://ws.cdyne.com/");var body = envelope.getBody();var resolveIPElement = body.addChildElement("ResolveIP", "ws");...var mimeHeaders = requestMessage.getMimeHeaders();mimeHeaders.addHeader("SOAPAction", "http://ws.cdyne.com/ResolveIP");...var responseMessage = soap.call(requestMessage, "http://ws.cdyne.com/ip2geo/ip2geo.asmx");response.println("Response: " + responseMessage.getText());
![Page 24: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/24.jpg)
Relational Databases?var datasource = database.getDatasource();var connection = datasource.getConnection();try { var statement = connection.prepareStatement("select * from ..."); ... var resultSet = statement.executeQuery(); while (resultSet.next()) { response.println("[path]: " + resultSet.getString("...")); } resultSet.close(); statement.close();} catch(e) { …} finally { connection.close();}
![Page 25: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/25.jpg)
Files?var files = require('io/files');var response = require('net/http/response');
files.createFile(”sample.txt");
var file = files.get(”sample.txt");response.println("[File Exists?]: " + file.exists());response.println("[File Is File?]: " + file.isFile());
files.writeText("sample.txt", "Some content");
var content = files.readText(”sample.txt");response.println("[File Content]: " + content);
![Page 26: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/26.jpg)
Even Streams?!…var outputStream = streams.createByteArrayOutputStream();
streams.writeText(outputStream, "Some text content");
var bytes = outputStream.getBytes();response.println("[Stream Content as Bytes]: " + bytes);
var inputStream = streams.createByteArrayInputStream(bytes);var outputStreamCopy = streams.createByteArrayOutputStream();streams.copy(inputStream, outputStreamCopy);…
![Page 27: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/27.jpg)
… and Threads?!var threads = require('core/threads');var response = require('net/http/response');// Define a JavaScript functionfunction runnable() {response.println("Hello World from a Thread!");};// Pass the JavaScript function to a threadvar worker = threads.create(runnable, "I am a thread");response.println(worker.getName());worker.start();worker.join(); // to be able to print to the response…
![Page 28: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/28.jpg)
Services like Mail, Messaging, Indexing?
var mail = require('service/mail');var response = require('net/http/response');
var from = "[email protected]";var to = "[email protected]";var subject = "Subject";var content = "Content";
mail.send(from, to, subject, content);
![Page 29: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/29.jpg)
Internal Services
• Exec• Generator• Lifecycle• Repository• Workspaces
![Page 30: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/30.jpg)
Does it look familiar?
…var workspace = workspaces.getWorkspace();var workspaceRoot = workspace.getRoot();var project = workspaceRoot.getProject(“project1");project.create();project.open();var folder = project.getFolder(”folder1");folder.create();…
![Page 31: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/31.jpg)
Plenty of Utilities
• Assert• Config• Context• Console• Env• Globals• Extensions• Base64
• Digest• Error• Hex• Uuid• Xml• Xss
![Page 32: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/32.jpg)
Finally – the mission statement?
The ultimate goal of the “Enterprise JavaScript” is to provide a set of a standard APIs, which can be used by the business applications developers.
![Page 33: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/33.jpg)
Benefits - Completeness
• Rich, but still standardized APIs;• Expose legacy components and frameworks
to the new environment;
![Page 34: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/34.jpg)
Benefits - Portability
• No tight vendor lock-in to the currently chosen underlying JavaScript platform;• OS, platform and database agnostic;• Developers can stick to native JavaScript
objects and primitives only in their source code;
![Page 35: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/35.jpg)
Benefits - Lifecycle
• The API itself is a standard Eclipse Dirigible project, hence can have the same lifecycle as the rest of the projects;
![Page 36: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/36.jpg)
You already know…
• … what the Enterprise JavaScript really is.• … how to continue to rely on your knowledge &
experience in Java frameworks and APIs.• … that this effort is just the beginning and you
can join in the definition and implementation work
• … the reference implementation in the Cloud Development Platform project called Eclipse Dirigible: http://www.dirigible.io
![Page 37: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/37.jpg)
Thank You!
![Page 38: Enterprise JavaScript ... what the heck?](https://reader034.vdocuments.net/reader034/viewer/2022051404/5874844f1a28abc62f8b4983/html5/thumbnails/38.jpg)
References
• http://api.dirigible.io• http://samples.dirigible.io• http://www.dirigible.io/blogs/2016/08/01/
blogs_why_enterprise_js.html