Enterprise JavaScript is a set of API modules that aims at standardising the usage of HTTP client and server, database access, files operations, websockets, soap and even threads and streams manipulations for JavaScript language.
2. 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
3. What the Enterprise JavaScript is?
• A JavaScript for Enterprises?
• A script for Java-focused Enterprises?
• Enterprise ready JavaScript?
5. 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
9. The shortest development turn-
around time
• Leveraging the In-System Programming
paradigm
• Avoid the side-effects of the sandbox systems
10. 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
• …
11. 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 …
12. You have to code – yeah!
What do you want to code today?
21. More about HTTP
• Session
• Cookies
• Headers
• Attributes
• Roles
Is it all about HTTP only?
22. What about WebSockets?
var websocket = require("net/websocket");
…
var websocketSession = websocket.getSession();
…
websocketSession.sendText("Welcome!”);
23. ‘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());
24. 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();
}
25. 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);
26. 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);
…
27. … and Threads?!
var threads = require('core/threads');
var response = require('net/http/response');
// Define a JavaScript function
function runnable() {
response.println("Hello World from a Thread!");
};
// Pass the JavaScript function to a thread
var worker = threads.create(runnable, "I am a thread");
response.println(worker.getName());
worker.start();
worker.join(); // to be able to print to the response
…
28. Services like Mail, Messaging,
Indexing?
var mail = require('service/mail');
var response = require('net/http/response');
var from = "dirigible@eclipse.org";
var to = "example@gmail.com";
var subject = "Subject";
var content = "Content";
mail.send(from, to, subject, content);
30. 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();
…
32. 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.
33. Benefits - Completeness
• Rich, but still standardized APIs;
• Expose legacy components and frameworks
to the new environment;
34. 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;
35. Benefits - Lifecycle
• The API itself is a standard Eclipse Dirigible
project, hence can have the same lifecycle
as the rest of the projects;
36. 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