xjimmyshcn

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
firefox的插件sdbtool是aws simple db免费管理工具中比较好用的,但是只支持US East 1 (Northern Virgina),US West 1 (Northern California),EU West 1 (Ireland)和Asia Pacific Southeast 1 (Singapore) 4个region,而当前aws实际已经有7个region。
为了让sdbtool支持其他的region,需要对sdbtool进行扩展。
 
sdbtool是开源的,可以从 https://github.com/floodfx/sdbtool 获取源码,解压后,进行如下修改:
 
原始源码文件为floodfx-sdbtool-2008.12.15.1011-28-g87482d3.zip
 
unzip floodfx-sdbtool-2008.12.15.1011-28-g87482d3.zip
cd floodfx-sdbtool-87482d3
 
1.修改 /root/floodfx-sdbtool-87482d3/src/chrome/content/sdbizo/js/sdbizo_control.js

var sdbizo_region_to_url = function(region) {
if(region == 'us-west-1') return 'sdb.us-west-1.amazonaws.com';
if(region == 'eu-west-1') return 'sdb.eu-west-1.amazonaws.com';
if(region == 'ap-southeast-1') return 'sdb.ap-southeast-1.amazonaws.com';
//added by xjimmy
if(region == 'us-west-2') return 'sdb.us-west-2.amazonaws.com';
if(region == 'ap-northeast-1') return 'sdb.ap-northeast-1.amazonaws.com';
if(region == 'sa-east-1') return 'sdb.sa-east-1.amazonaws.com';


// else default to east
return 'sdb.amazonaws.com';
}

var sdbizo_region_to_index = function(region) {
if(region == 'us-west-1') return 1;
if(region == 'eu-west-1') return 2;
if(region == 'ap-southeast-1') return 3;
//added by xjimmy
if(region == 'us-west-2') return 4;
if(region == 'ap-northeast-1') return 5;
if(region == 'sa-east-1') return 6;


// else default to east
return 0;
}
 
 
2.修改 /root/floodfx-sdbtool-87482d3/src/chrome/content/sdbizo/sdbizo_window.xul
 
<menulist class="regionList" id="sdb_region_list" label="[Select Region]" oncommand="SdbizoController.execute('changeSelectedRegion');">
<menupopup>
<menuitem label="US East 1 (Northern Virgina)" value="us-east-1"/>
<menuitem label="US West 1 (Northern California)" value="us-west-1"/>
<menuitem label="EU West 1 (Ireland)" value="eu-west-1"/>
<menuitem label="Asia Pacific Southeast 1 (Singapore)" value="ap-southeast-1"/>
<!-- add by xjimmy -->
<menuitem label="US West 2 (Oregon)" value="us-west-2"/>
<menuitem label="Asia Pacific Northeast 1 (Tokyo)" value="ap-northeast-1"/>
<menuitem label="South America 1 (Sao Paulo)" value="sa-east-1"/>
</menupopup>
</menulist>
 
 
3.重新编译插件
[root@localhost floodfx-sdbtool-87482d3]# ./make.sh
Fri Oct 12 00:28:32 CST 2012
+ Bulding sdbizo version 2011.07.17-0000
+ Creating dist/sdbizo-2011.07.17.0000.xpi
adding: install.rdf (deflated 54%)
adding: chrome.manifest (deflated 50%)
adding: chrome/sdbizo.jar (deflated 5%)
adding: README (deflated 36%)
adding: LICENSE (deflated 65%)
+ Creating dist/sdbizo-2011.07.17.0000.zip
adding: sdbizo-2011.07.17.0000.xpi (deflated 0%)
adding: README (deflated 36%)
adding: LICENSE (deflated 65%)
+ Creating dist/sdbizo-2011.07.17.0000-src.tgz
[root@localhost floodfx-sdbtool-87482d3]# cd /root/floodfx-sdbtool-87482d3/dist
[root@localhost dist]# ll
total 184

-rw-r--r--. 1 root root 11345 Oct 12 00:28 LICENSE
-rw-r--r--. 1 root root 555 Oct 12 00:28 README
-rw-r--r--. 1 root root 46494 Oct 12 00:28 sdbizo-2011.07.17.0000-src.tgz
-rw-r--r--. 1 root root 53715 Oct 12 00:28 sdbizo-2011.07.17.0000.xpi
-rw-r--r--. 1 root root 58286 Oct 12 00:28 sdbizo-2011.07.17.0000.zip
-rw-r--r--. 1 root root 787 Oct 12 00:28 sdbizo.rdf

 sdbizo-2011.07.17.0000.xpi 即编译后的插件,拖到firefox中即可安装。
 
最后效果:

 
posted on 2012-10-12 00:50  xjimmyshcn  阅读(281)  评论(0编辑  收藏  举报