@@ -0,0 +1,154 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js">/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/*!
* Ext Server
* Copyright (c)2012 Xenophy.CO.,LTD All rights Reserved.
* MIT Licensed
*/

// {{{ Ext.server.proxy.Reverse

<span id='Ext-server-proxy-Reverse'>/**
</span> * @class Ext.server.proxy.Reverse
*
* {Ext_server_proxy_Reverse:doc-contents}
*/
Ext.define('Ext.server.proxy.Reverse', {

// {{{ statics

statics: {

// {{{ createInstance

createInstance: function(config) {
return new Ext.server.proxy.Reverse(config || {});
}

// }}}

},

// }}}
// {{{ constructor

constructor: function(config) {

config = config || {};

var me = this, rotate = 0;

Ext.apply(this, config);
Ext.applyIf(this, {
servers: []
});


var rotation = function() {

if(me.servers.length &gt; 0) {
rotate = ++rotate % me.servers.length;
}

};

if(!config.ssl) {

return require('http').createServer(
function(req, res) {
me.$listener.call(me, req, res, {
ssl: true,
rotate: rotate
});
rotation();
}
);

} else {

return require('https').createServer(
config.ssl,
function(req, res) {
me.$listener.call(me, req, res, {
ssl: true,
rotate: rotate
});
rotation();
}
);

}

process.on('uncaughtException', function(err) {
console.log(&quot;%s ERROR: %s&quot;, new Date().toFormat('YYYY-MM-DD HH24:MI:SS'), err);
});

},

// }}}
// {{{ $listener

$listener: function(req, res, opts) {

var httpProxy, url, proxy, server, o;

httpProxy = Ext.$dependencies['http-proxy'];
url = require('url');
proxy = new httpProxy.RoutingProxy();
server = this.servers[opts.rotate];
o = Ext.applyIf(url.parse('http://' + server), {
port: 80
});

proxy.proxyRequest(req, res, {
host : o.hostname,
port : o.port
});

}

// }}}

}, function() {

Ext.apply(Ext, {

// {{{ createProxy

createProxy: Ext.server.proxy.Reverse.createInstance

// }}}

});

});

// }}}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
</pre>
</body>
</html>
@@ -246,10 +246,8 @@

if(config.ssl) {

var httpsServer = https.createServer({
key: config.ssl.key,
cert: config.ssl.cert
}, app);
var httpsServer = https.createServer(config.ssl, app);

httpsServer.listen(config.ssl.port || 443);

if(config.wss) {
@@ -34,7 +34,7 @@
(function() {

// Current core version
var version = '0.1.0', Version;
var version = '0.1.2', Version;

Ext.Version = Version = Ext.extend(Object, {

@@ -0,0 +1 @@
このクラスが初期化されるときに自動的に接続するかどうかを指定します。
@@ -0,0 +1 @@
このクラスが使用するコネクションの名前を指定します。
@@ -0,0 +1 @@
使用するテーブル名を指定します。
@@ -0,0 +1,3 @@
Ext Server MVC の Modelを構成するクラスです。

Ext ServeではModuleと呼びます。
@@ -0,0 +1 @@
トランザクションを開始します。
@@ -0,0 +1 @@
コールバック関数
Empty file.
@@ -0,0 +1 @@
現在のトランザクションをコミットします。
@@ -0,0 +1 @@
コールバック関数
Empty file.
@@ -0,0 +1,2 @@
新しいコレクションを作成します。
MongoDBでのみ有効です。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
コレクションの名前
Empty file.
@@ -0,0 +1,2 @@
新しいデータベースを作成します。
MongoDBでのみ有効です。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
データベースの名前
Empty file.
Empty file.
@@ -0,0 +1,2 @@
既存のコレクションを削除します。
MongoDBでのみ有効です。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
コレクションの名前
Empty file.
@@ -0,0 +1,2 @@
既存のデータベースを削除します。
MongoDBでのみ有効です。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
データベースの名前
Empty file.
@@ -0,0 +1 @@
テーブルから指定した条件のレコードを取り出します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1,2 @@
抽出条件を指定します。
指定方法については、それぞれのデータベースのfindメソッドの項を参照してください。
Empty file.
@@ -0,0 +1 @@
MongoDBでのみ有効です。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1,2 @@
抽出条件を指定します。
指定方法については、それぞれのデータベースのfindメソッドの項を参照してください。
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
@@ -0,0 +1 @@
レコードを挿入します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1,2 @@
挿入するオブジェクト。
指定方法については、それぞれのデータベースのfindメソッドの項を参照してください。
Empty file.
@@ -0,0 +1 @@
SQL文を実行します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
実行するSQL
Empty file.
@@ -0,0 +1 @@
レコードを削除します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
削除条件を指定します
Empty file.
Empty file.
@@ -0,0 +1 @@
現在のトランザクションをロールバックします。
@@ -0,0 +1 @@
コールバック関数
Empty file.
@@ -0,0 +1 @@
データを保存します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
保存するオブジェクト
Empty file.
@@ -0,0 +1,2 @@
挿入するデータが既にテーブルに存在する場合は、新しくレコードを挿入せず、既存のレコードを新しいデータで上書き(置換)します。
また、挿入するデータがテーブルに存在しない場合は、新規レコードを挿入します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
挿入・または追加するレコードのオブジェクト。
Empty file.
@@ -0,0 +1 @@
レコードを更新します。
@@ -0,0 +1 @@
コールバック関数
@@ -0,0 +1 @@
更新するレコードのオブジェクト。
Empty file.
@@ -121,9 +121,9 @@ module.exports = {
},

$removeRec: function(id, cb) {
var o = {id: id}
var o = {id: id};

this.delete(o, function(err) {
this.remove(o, function(err) {
cb(id);
});
}
@@ -19,10 +19,15 @@ Ext.define('Ext.app.module.Module', {

config: {

/**
* @cfg {String} connName
* {Ext_app_module_Module:cfg-connName:desc}
*/
connName: 'default'

},


// }}}
// {{{ constructor

@@ -32,7 +37,16 @@ Ext.define('Ext.app.module.Module', {

Ext.apply(this, config);
Ext.applyIf(this, {
/**
* @cfg {String} useTable
* {Ext_app_module_Module:cfg-useTable:desc}
*/
useTable: null,

/**
* @cfg {String} autoConnect
* {Ext_app_module_Module:cfg-autoConnect:desc}
*/
autoConnect: true
});

@@ -43,6 +57,11 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ init

/**
* @private
* @param config
* @param next
*/
init: function(config, next) {

if(this.useTable) {
@@ -80,10 +99,15 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ beginTrans

beginTrans: function(next) {
/**
* {Ext_app_module_Module:method-beginTrans:desc}
*
* @param fn {Ext_app_module_Module:method-beginTrans:param_fn}
*/
beginTrans: function(fn) {

if(this.conn.beginTrans) {
this.conn.beginTrans(next);
this.conn.beginTrans(fn);
} else {
// このドライバーでは実装されていないことを通知
throw new Error("'beginTrans' is not support driver");
@@ -94,10 +118,15 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ commit

commit: function(next) {
/**
* {Ext_app_module_Module:method-commit:desc}
*
* @param fn {Ext_app_module_Module:method-commit:param_fn}
*/
commit: function(fn) {

if(this.conn.commit) {
this.conn.commit(next);
this.conn.commit(fn);
} else {
// このドライバーでは実装されていないことを通知
throw new Error("'commit' is not support driver");
@@ -108,7 +137,13 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ createCollection

createCollection: function(name, next) {
/**
* {Ext_app_module_Module:method-createCollection:desc}
*
* @param name {Ext_app_module_Module:method-createCollection:param_name}
* @param fn {Ext_app_module_Module:method-createCollection:param_fn}
*/
createCollection: function(name, fn) {

if(this.conn.createCollection) {

@@ -126,12 +161,18 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ createDatabase

createDatabase: function(dbname, fn) {
/**
* {Ext_app_module_Module:method-createDatabase:desc}
*
* @param name {Ext_app_module_Module:method-createDatabase:param_name}
* @param fn {Ext_app_module_Module:method-createDatabase:param_fn}
*/
createDatabase: function(name, fn) {

if(this.conn.createDatabase) {

if(this.conn.adapter === 'mongodb') {
return this.conn.createDatabase.call(this, dbname, fn);
return this.conn.createDatabase.call(this, name, fn);
}

} else {
@@ -141,24 +182,16 @@ Ext.define('Ext.app.module.Module', {

},

// }}}
// {{{ delete

delete: function(o, fn) {

var me = this;

if(me.conn.delete) {
me.conn.delete(me.useTable, o, fn);
} else {
// このドライバーでは実装されていないことを通知
throw new error("'delete' is not support driver");
}
},

// }}}
// {{{ dropCollection

/**
* {Ext_app_module_Module:method-dropCollection:desc}
*
* @param name {Ext_app_module_Module:method-dropCollection:param_name}
* @param fn {Ext_app_module_Module:method-dropCollection:param_fn}
*/
dropCollection: function(name, fn) {

if(this.conn.dropCollection) {
@@ -176,6 +209,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ dropDatabase

/**
* {Ext_app_module_Module:method-dropDatabase:desc}
*
* @param name {Ext_app_module_Module:method-dropDatabase:param_name}
* @param fn {Ext_app_module_Module:method-dropDatabase:param_fn}
*/
dropDatabase: function(dbname, fn) {

if(this.conn.dropDatabase) {
@@ -194,14 +233,20 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ find

find: function(o, next) {
/**
* {Ext_app_module_Module:method-find:desc}
*
* @param o {Ext_app_module_Module:method-find:param_o}
* @param fn {Ext_app_module_Module:method-find:param_fn}
*/
find: function(o, fn) {

if(this.conn.find) {

if(this.conn.adapter === 'mongodb') {
return this.conn.find.call(this, this.useTable, arguments);
} else {
this.conn.find(this.useTable, o, next);
this.conn.find(this.useTable, o, fn);
}

} else {
@@ -214,6 +259,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ findAndModify

/**
* {Ext_app_module_Module:method-findAndModify:desc}
*
* @param o {Ext_app_module_Module:method-findAndModify:param_o}
* @param fn {Ext_app_module_Module:method-findAndModify:param_fn}
*/
findAndModify: function(o, fn) {

if(this.conn.findAndModify) {
@@ -232,6 +283,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ insert

/**
* {Ext_app_module_Module:method-insert:desc}
*
* @param o {Ext_app_module_Module:method-insert:param_o}
* @param fn {Ext_app_module_Module:method-insert:param_fn}
*/
insert: function(o, fn) {

if(this.conn.insert) {
@@ -252,6 +309,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ query

/**
* {Ext_app_module_Module:method-query:desc}
*
* @param sql {Ext_app_module_Module:method-query:param_sql}
* @param fn {Ext_app_module_Module:method-query:param_fn}
*/
query: function(sql, fn) {

if(this.conn.query) {
@@ -266,15 +329,24 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ remove

/**
* {Ext_app_module_Module:method-remove:desc}
*
* @param o {Ext_app_module_Module:method-remove:param_o}
* @param fn {Ext_app_module_Module:method-remove:param_fn}
*/
remove: function(o, fn) {
var me = this;

if(this.conn.remove) {

if(this.conn.adapter === 'mongodb') {
return this.conn.remove.call(this, this.useTable, arguments);
if(me.conn.remove) {
if(me.conn.adapter === 'mongodb') {
return me.conn.remove.call(me, me.useTable, arguments);
} else {
me.conn.remove(me.useTable, o, fn);
}

} else {

// このドライバーでは実装されていないことを通知
throw new Error("'remove' is not support driver");
}
@@ -284,6 +356,11 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ rollback

/**
* {Ext_app_module_Module:method-rollback:desc}
*
* @param fn {Ext_app_module_Module:method-rollback:param_fn}
*/
rollback: function(fn) {

if(this.conn.rollback) {
@@ -298,6 +375,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ save

/**
* {Ext_app_module_Module:method-save:desc}
*
* @param o {Ext_app_module_Module:method-save:param_o}
* @param fn {Ext_app_module_Module:method-save:param_fn}
*/
save: function(o, fn) {

if(this.conn.save) {
@@ -314,6 +397,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ set

/**
* {Ext_app_module_Module:method-set:desc}
*
* @param o {Ext_app_module_Module:method-set:param_o}
* @param fn {Ext_app_module_Module:method-set:param_fn}
*/
set: function(o, fn) {

if(this.conn.set) {
@@ -328,6 +417,12 @@ Ext.define('Ext.app.module.Module', {
// }}}
// {{{ update

/**
* {Ext_app_module_Module:method-update:desc}
*
* @param o {Ext_app_module_Module:method-update:param_o}
* @param fn {Ext_app_module_Module:method-update:param_fn}
*/
update: function(o, fn) {

if(this.conn.update) {
@@ -425,25 +425,20 @@ Ext.define('Ext.database.MySQL', {
},

// }}}
// {{{ delete
// {{{ remove

delete: function(table, o, fn) {
remove: function(table, o, fn) {

var me = this, where = '', sql = '';

sql += 'DELETE FROM ' + table;

where = ' ' + Ext.database.MySQL['where'](o);
sql += where;

// {{{ delete

me.driver.query(sql, function(err) {
fn(err);
});

// }}}

},

// }}}