项目作者: kaven276

项目描述 :
NodeJS和ORACLE PL / SQL集成平台(node + plsql)oracle oracle oracle
高级语言: JavaScript
项目地址: git://github.com/kaven276/noradle.git
创建时间: 2012-05-22T01:03:53Z
项目社区:https://github.com/kaven276/noradle

开源协议:

下载


Want to build solid information system solely on PL/SQL and javascript easily,
no rely on any other programming language or technical stack? develop with NORADLE.

NORADLE

What’s NORADLE?

The word NORADLE is combination of node.js and oracle,
It aims at

  1. write http servlet in PL/SQL with extremely concise code
  2. with node.js as http gateway, give full http protocol support for oracle environment
  3. node.js accessibility to oracle, give node.js ecosystem a real thustworthy db backend

take a first glance at pl/sql servlet code

bind data into html

  1. procedure bind_data is
  2. cursor c_packages is
  3. select *
  4. from user_objects a
  5. where a.object_type = 'PACKAGE'
  6. and rownum <= 5
  7. order by a.object_name asc;
  8. begin
  9. b.l('<!DOCTYPE html>');
  10. o.t('<html>');
  11. o.t('<body>');
  12. o.t('<table rules=all cellspacing=0 cellpadding=5 style="border:1px solid silver;">');
  13. o.t(' <caption>', 'bind sql data to table example');
  14. o.t(' <thead>', o.t('<tr>', m.w('<th>@</th>', 'package name,created')));
  15. o.t(' <tbody>');
  16. for i in c_packages loop
  17. o.t('<tr>');
  18. o.t(' <td>', i.object_name);
  19. o.t(' <td>', t.d2s(i.created));
  20. o.t('</tr>');
  21. end loop;
  22. o.t(' </tbody>');
  23. o.t('</table>');
  24. o.t('</body>');
  25. o.t('</html>');
  26. end;

use json data service to populate chart

  1. create or replace package body chart_b is
  2. procedure common_preface(default_type varchar2) is
  3. v_chart_type varchar2(30) := r.getc('chart_type', default_type);
  4. begin
  5. src_b.header;
  6. o.u('<link rel=stylesheet/>', '[animate.css]');
  7. o.u('<script>', '[chart.js]', '');
  8. o.u('<script>', '[zepto.js]', '');
  9. o.u('<script>', '[underscore.js]', '');
  10. o.t('<canvas#cc width=600 height=400>', '');
  11. o.t('<script>',
  12. t.ps('
  13. var ctx = document.getElementById("cc").getContext("2d")
  14. , demoChart = new Chart(ctx)
  15. , chartType=":1"
  16. ;',
  17. st(v_chart_type)));
  18. end;
  19. procedure salary_min_max_by_job_id is
  20. cur sys_refcursor;
  21. begin
  22. if r.is_xhr then
  23. open cur for
  24. select a.job_id, count(*) cnt, avg(a.salary) avg, min(a.salary) min, max(a.salary) max
  25. from employees a
  26. group by a.job_id
  27. order by avg asc;
  28. rs.print(cur);
  29. return;
  30. end if;
  31. common_preface('Bar');
  32. o.t('<div#links>');
  33. o.u(' <a>', r.prog || '?chart_type=Line', 'Line');
  34. o.u(' <a>', r.prog || '?chart_type=Bar', 'Bar');
  35. o.u(' <a>', r.prog || '?chart_type=Radar', 'Rader');
  36. o.t('</div>');
  37. b.l('<script>
  38. $.getJSON(location.pathname+"?data", function(data){
  39. var salaries = data.$DATA.rows;
  40. var chartData = {
  41. labels : _.pluck(salaries, "job_id"),
  42. datasets : [
  43. {
  44. fillColor : "rgba(220,220,220,0.5)",
  45. strokeColor : "rgba(220,220,220,1)",
  46. pointColor : "rgba(220,220,220,1)",
  47. pointStrokeColor : "#fff",
  48. data : _.pluck(salaries, "min")
  49. },
  50. {
  51. fillColor : "rgba(151,187,205,0.5)",
  52. strokeColor : "rgba(151,187,205,1)",
  53. pointColor : "rgba(151,187,205,1)",
  54. pointStrokeColor : "#fff",
  55. data : _.pluck(salaries, "max")
  56. }
  57. ]
  58. };
  59. demoChart[chartType](chartData);
  60. });</script>');
  61. end;
  62. end chart_b;

What NORADLE provide?

  • NORADLE support full dynamic(data driving) web development(whether for html page service or json data service),
    but more concise than PHP, J2EE, …
  • NORADLE NDBC make node ecosystem embracing oracle, expand node’s realm to serious enterprise information systems
  • NORADLE call out feature extend oracle PL/SQL to access external service/resource, break restrictions

Core thinking

  • use pl/sql stored procedure to implement application/business logic
    • servlet code that access data should be as close as the data, avoid complexity and develop-time and runtime overhead
    • all SQL should be in PL/SQL stored procedure, no string concat, no network transfer
    • no triditional templating, print html/json with concise API, just use pl/sql, introduce no excessive templating language
    • give all function that a triditional servlet tech can provide, but be more concise and easier to master
    • be aware of that middle layer JAVA/PHP/.NET/PYTHON/RUBY… is superfluous, except adding comlexity
    • enjoy the good of oracle, advanced SQL, availility, stability, performance, scalability, tunable…
  • node.js can access oracle, and vice versa, they can aid each other
    • node.js give oracle a http servlet container environment
    • pl/sql can call out by node.js, extending oracle
    • by node.js, oracle became a full servlet container, integrate code and data seamlessly
    • by connectivity to oracle, node.js ecosysetm will extend to the area of enterprise information system

the resource for NORADLE

document site http://docs.noradle.com

demo site http://demo.noradle.com

about submodules

note: from v0.14.0, noradle is split into several sub projects under https://github.com/noradle.

it’s for those considerations:

  • deploy only the sub-module you require, for example, in one server, you deploy noradle-dispatcher only
  • each submodule is focused on one goal, easy to manage
  • each submodule will evolve itself, allow contributors to improve just the submodule they are interest in
  • each submodule represent a special aspect of noradle, doc/wiki will distributed among them, no longer a mess all in the main project
  1. {{browser}} -----------(http)--------------> {{1.noradle-http}} --- / {{noradle-console}}
  2. http client / \ /
  3. \--------(http)-> {{proxy(nginx)}} -----/ {{noradle-dispatcher}} <------ {{oracle}}
  4. \----(SCGI)----> {{2.noradle-scgi}} ----/ /
  5. \---(FCGI)----> {{3.noradle-fcgi}} -----/
  6. (note: 123 require {{noradle-nodejs-client}} )

the submodule list, all under github noradle