├── .gitignore ├── .idea ├── .name ├── couchapp-takeout.iml ├── encodings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── LICENSE.txt ├── couchapp ├── .idea │ ├── .name │ ├── couchapp.iml │ ├── encodings.xml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── _design-app.json ├── docs │ └── _design │ │ ├── takeout-settings.jnlp.json │ │ └── takeout-settings.jnlp │ │ ├── icon.png │ │ └── splash.png ├── html │ ├── commons-codec-1.4.jar │ ├── commons-io-2.0.1.jar │ ├── commons-lang-2.6.jar │ ├── commons-logging-1.1.1.jar │ ├── couchapp-takeout-1.0-SNAPSHOT.jar │ ├── eventbus-1.4.jar │ ├── httpclient-4.1.1.jar │ ├── httpcore-4.1.jar │ ├── index.html │ ├── ini4j-0.5.2.jar │ ├── install.html │ ├── jackson-core-asl-1.7.3.jar │ ├── jackson-mapper-asl-1.7.3.jar │ ├── jquery-1.6.2.min.js │ ├── log4j-1.2.16.jar │ ├── org.ektorp-1.1.0.jar │ ├── slf4j-api-1.6.1.jar │ ├── slf4j-log4j12-1.6.1.jar │ ├── styles.css │ ├── swing-layout-1.0.3.jar │ ├── takeout.js │ └── text.txt ├── pom.xml ├── reupholster.json └── show_takeout.js ├── embedded-couchapp ├── .idea │ ├── .name │ ├── embedded-couchapp.iml │ ├── encodings.xml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── _design-app.json ├── html │ └── lib │ │ ├── MozillaGlue.jar │ │ ├── MozillaInterfaces.jar │ │ ├── engine-gecko.jar │ │ ├── engine-ie.jar │ │ ├── engine-webkit.jar │ │ ├── jxbrowser-2.8.jar │ │ ├── log4j-1.2.15.jar │ │ ├── slf4j-api-1.5.8.jar │ │ ├── slf4j-log4j12-1.5.8.jar │ │ ├── tuxpack-0.2.jar │ │ ├── winpack-3.8.2.jar │ │ ├── xulrunner-linux.jar │ │ ├── xulrunner-linux64.jar │ │ ├── xulrunner-mac.jar │ │ └── xulrunner-windows.jar ├── reupholster.json └── show_JxBrowser.js ├── java ├── keystore ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── couchapptakeout │ │ │ ├── App.java │ │ │ ├── BasicCouchDownloader.java │ │ │ ├── CouchDBEmbeddedInstaller.java │ │ │ ├── CouchDBNotFoundException.java │ │ │ ├── CouchDbInstallException.java │ │ │ ├── CouchDownloader.java │ │ │ ├── CouchRunner.java │ │ │ ├── DefaultCouchManager.java │ │ │ ├── DefaultUninstaller.java │ │ │ ├── LocalCouch.java │ │ │ ├── LocalCouchMock.java │ │ │ ├── OSUtils.java │ │ │ ├── ShowApplicationUrlMessage.java │ │ │ ├── ShutDownMessage.java │ │ │ ├── Tray.java │ │ │ ├── Uninstaller.java │ │ │ └── ui │ │ │ ├── AuthenticationDialog.form │ │ │ ├── AuthenticationDialog.java │ │ │ ├── EmbeddedBrowser.form │ │ │ ├── EmbeddedBrowser.java │ │ │ ├── LoadingDialog.form │ │ │ ├── LoadingDialog.java │ │ │ ├── Splash.form │ │ │ ├── Splash.java │ │ │ └── Tray.java │ ├── jnlp │ │ ├── README │ │ └── resources │ │ │ └── README │ └── resources │ │ ├── META-INF │ │ └── teamdev.licenses │ │ ├── README │ │ ├── log4j.properties │ │ └── plate.png │ └── test │ ├── java │ └── com │ │ └── github │ │ └── couchapptakeout │ │ ├── AppTest.java │ │ ├── BasicCouchDownloaderTest.java │ │ └── DefaultCouchManagerTest.java │ └── resources │ ├── local.ini │ └── log4j.properties └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Generic Maven ignores 2 | target/ 3 | java/velocity.log 4 | java/logs/* 5 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | couchapp-takeout -------------------------------------------------------------------------------- /.idea/couchapp-takeout.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 73 | 74 | 77 | 78 | 79 | 80 | 83 | 84 | 87 | 88 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 120 | 121 | 122 | 1314318846957 123 | 1314318846957 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [2011] [Ryan Ramage] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /couchapp/.idea/.name: -------------------------------------------------------------------------------- 1 | couchapp -------------------------------------------------------------------------------- /couchapp/.idea/couchapp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /couchapp/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /couchapp/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | http://www.w3.org/1999/xhtml 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /couchapp/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /couchapp/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /couchapp/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 121 | 122 | 123 | 124 | 127 | 128 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 160 | 161 | 162 | 163 | 1310607601676 164 | 1310607601676 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | -------------------------------------------------------------------------------- /couchapp/_design-app.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | 4 | "rewrites" : [ 5 | {from:"/", to:'install.html'} 6 | , {from:"/api", to:'../../'} 7 | , {from:"/api/*", to:'../../*'} 8 | , {from:"/*", to:'*'} 9 | ], 10 | "language": "javascript", 11 | "shows": { 12 | "takeout.jnlp": "function(doc, req) { if (!this._attachments) return''; if (!doc) return ''; var ddoc = req.path[2]; var codebase = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/'+ddoc+'/'; var defaults = { codebase : codebase, href : '_show/takeout.jnlp/_design/takeout-settings.jnlp' }; var result = ''; result += ''; var cur = doc; var advanced = cur.advanced; result += ''+cur.appName+''+cur.vendor+''+cur.homepage+''+cur.description+''; var icon = 'icon.png'; var splash = 'splash.png'; if (doc._attachments) { if (doc._attachments['splash.png']) { splash = '../takeout-settings.jnlp/splash.png'; } if (doc._attachments['icon.png']) { icon = '../takeout-settings.jnlp/icon.png' } } result += ''; result += ''; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ''; result += ' '; result += ' '; String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; for (var a in this._attachments) { if (a.endsWith('.jar')) { var main = ''; if (a == advanced['main-jar']) main = 'main=\"true\"'; result += ' '; } } if (advanced.embedded) { var extended = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/takeout-extended/_show/JxBrowser.jnlp'; result += ' '; } if (ddoc != 'takeout') { result += ' '; } result += ''; result += ' '; result += ' ' + cur.appName + ''; result += ' ' + req.headers.Host + ''; result += ' ' + req.userCtx.db + ''; if (req.userCtx && req.userCtx.name && req.userCtx.name != null) { result += ' ' + req.userCtx.name + ''; } result += ' '; result += ''; return { 'headers' : {'Content-Type' : 'application/x-java-jnlp-file'}, 'body' : result } }", 13 | "test" : "function(doc, req) { if(!doc) {return 'empty'} return doc._id}" 14 | }, 15 | "filters": { 16 | "not_design": "function (doc, req) { if (doc._id[0] == \"_\" ) { return false; } return true; } " 17 | } 18 | } -------------------------------------------------------------------------------- /couchapp/docs/_design/takeout-settings.jnlp.json: -------------------------------------------------------------------------------- 1 | { 2 | "appName" : "Takeout", 3 | "vendor" : "Ecko-it", 4 | "homepage" : "http://eckoit.com", 5 | "description" : "A couch app installer.", 6 | "localStartUrl" : "_design/takeout/index.html", 7 | "advanced" : { 8 | "syncType" : "bi-directional", 9 | "embedded" : false, 10 | "main-jar" : "couchapp-takeout-1.0-SNAPSHOT.jar", 11 | "main-class" : "com.github.couchapptakeout.App" 12 | } 13 | } -------------------------------------------------------------------------------- /couchapp/docs/_design/takeout-settings.jnlp/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/docs/_design/takeout-settings.jnlp/icon.png -------------------------------------------------------------------------------- /couchapp/docs/_design/takeout-settings.jnlp/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/docs/_design/takeout-settings.jnlp/splash.png -------------------------------------------------------------------------------- /couchapp/html/commons-codec-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/commons-codec-1.4.jar -------------------------------------------------------------------------------- /couchapp/html/commons-io-2.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/commons-io-2.0.1.jar -------------------------------------------------------------------------------- /couchapp/html/commons-lang-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/commons-lang-2.6.jar -------------------------------------------------------------------------------- /couchapp/html/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /couchapp/html/couchapp-takeout-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/couchapp-takeout-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /couchapp/html/eventbus-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/eventbus-1.4.jar -------------------------------------------------------------------------------- /couchapp/html/httpclient-4.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/httpclient-4.1.1.jar -------------------------------------------------------------------------------- /couchapp/html/httpcore-4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/httpcore-4.1.jar -------------------------------------------------------------------------------- /couchapp/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Takeout! 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 |

Install Couch Tasks

19 | 20 |

Example 1 - As a link

21 | Take out! 22 | 23 |

Example 2 - Changes based on running remote or local.

24 |

25 | On the remote app (where you are installing from) this will be a button. 26 | On the local app this will just be text. It would confuse the user if they see the button again on the local app!. 27 |

28 | 29 |
30 | 31 |
32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /couchapp/html/ini4j-0.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/ini4j-0.5.2.jar -------------------------------------------------------------------------------- /couchapp/html/install.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Install 4 | 5 | 6 | 77 | 78 | 79 |
80 | 84 | 85 |
86 | This will install on your computer.
87 |
88 | 89 |
90 |
91 | For OSX, Windows XP, Vista and 7.
92 | Java required. 93 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /couchapp/html/jackson-core-asl-1.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/jackson-core-asl-1.7.3.jar -------------------------------------------------------------------------------- /couchapp/html/jackson-mapper-asl-1.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/jackson-mapper-asl-1.7.3.jar -------------------------------------------------------------------------------- /couchapp/html/log4j-1.2.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/log4j-1.2.16.jar -------------------------------------------------------------------------------- /couchapp/html/org.ektorp-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/org.ektorp-1.1.0.jar -------------------------------------------------------------------------------- /couchapp/html/slf4j-api-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/slf4j-api-1.6.1.jar -------------------------------------------------------------------------------- /couchapp/html/slf4j-log4j12-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/slf4j-log4j12-1.6.1.jar -------------------------------------------------------------------------------- /couchapp/html/styles.css: -------------------------------------------------------------------------------- 1 | .main { 2 | width: 500px; 3 | margin-left: auto; 4 | margin-right: auto; 5 | } 6 | 7 | .takeoutLink { 8 | text-align: center; 9 | } 10 | 11 | .description { 12 | margin-top: 25px; 13 | } 14 | 15 | .requirements { 16 | margin-top: 10px; 17 | font-size: 10px; 18 | } -------------------------------------------------------------------------------- /couchapp/html/swing-layout-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/couchapp/html/swing-layout-1.0.3.jar -------------------------------------------------------------------------------- /couchapp/html/takeout.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by . 3 | * User: ryan 4 | * Date: 11-07-16 5 | * Time: 9:30 AM 6 | * To change this template use File | Settings | File Templates. 7 | */ 8 | (function( $ ){ 9 | $.fn.takeout = function(options) { 10 | 11 | var match = /\/([a-zA-Z0-9_-]+)\//.exec(window.location); 12 | var db = match[1]; 13 | var linkText = "Install"; 14 | var localText = "Running Local." 15 | 16 | 17 | if (options && options.db) { 18 | db = options.db; 19 | } 20 | if (options && options.linkText) { 21 | linkText = options.linkText; 22 | } 23 | if (options && options.localText) { 24 | localText = options.localText; 25 | } 26 | 27 | var takeoutLocalDoc = "/" + db + "/_local/takeout" ; 28 | var div = this; 29 | $.ajax({ 30 | url: takeoutLocalDoc, 31 | success: function(data) { 32 | div.each(function() { 33 | var $this = $(this); 34 | $this.text(localText); 35 | 36 | }) 37 | }, 38 | error: function() { 39 | div.each(function() { 40 | var $this = $(this); 41 | var jnlpLink = "/" + db + "/_design/takeout/_show/takeout.jnlp/_design/takeout-settings.jnlp" ; 42 | $this.append(''+ linkText + ''); 43 | 44 | }) 45 | }, 46 | dataType: 'json' 47 | }); 48 | 49 | 50 | 51 | return this; 52 | }; 53 | })( jQuery ); -------------------------------------------------------------------------------- /couchapp/html/text.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /couchapp/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.eckoit.couchapp 5 | eckoit-couchapp 6 | jar 7 | 1.0-SNAPSHOT 8 | Ecko-It Couchapp 9 | http://eckoit.com 10 | 11 | 12 | com.googlecode.reupholster 13 | reupholster 14 | [0.4.1,) 15 | 16 | 17 | 18 | 19 | 20 | com.googlecode.reupholster 21 | maven-reupholster-plugin 22 | 1.0-SNAPSHOT 23 | 24 | 25 | deploy 26 | compile 27 | 28 | reupholster 29 | 30 | 31 | 32 | test 33 | test 34 | 35 | reupholster-test 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | reupholster 45 | reupholster Repository 46 | http://reupholster.googlecode.com/svn/maven 47 | 48 | true 49 | never 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | reupholster-plugin-snapshots 59 | http://reupholster.googlecode.com/svn/maven 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /couchapp/reupholster.json: -------------------------------------------------------------------------------- 1 | { 2 | designDocName : "_design/takeout", 3 | couch : { 4 | host : "localhost", 5 | port : 5984, 6 | db : "takeout" 7 | }, 8 | stages : { 9 | production : { 10 | host : "ecko-it.iriscouch.com", 11 | port : 5984, 12 | db : "takeout", 13 | username : "test" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /couchapp/show_takeout.js: -------------------------------------------------------------------------------- 1 | function(doc, req) { 2 | if (!this._attachments) return''; 3 | if (!doc) return ''; 4 | var ddoc = req.path[2]; 5 | var codebase = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/'+ddoc+'/'; 6 | var defaults = { codebase : codebase, href : '_show/takeout.jnlp/_design/takeout-settings.jnlp' }; 7 | var result = ''; 8 | result += ''; 9 | var cur = doc; 10 | var advanced = cur.advanced; 11 | result += ''+cur.appName+''+cur.vendor+''+cur.homepage+''+cur.description+''; 12 | var icon = 'icon.png'; 13 | var splash = 'splash.png'; 14 | if (doc._attachments) { 15 | if (doc._attachments['splash.png']) { 16 | splash = '../takeout-settings.jnlp/splash.png'; 17 | } 18 | if (doc._attachments['icon.png']) { 19 | icon = '../takeout-settings.jnlp/icon.png' 20 | } 21 | } 22 | result += ''; 23 | result += ''; 24 | result += ' '; 25 | result += ' '; 26 | result += ' '; 27 | result += ' '; 28 | result += ' '; 29 | result += ''; 30 | result += ' '; 31 | result += ' '; 32 | String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; 33 | for (var a in this._attachments) { if (a.endsWith('.jar')) { var main = ''; if (a == advanced['main-jar']) main = 'main=\"true\"'; result += ' '; } } 34 | if (advanced.embedded) { 35 | var extended = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/takeout-extended/_show/JxBrowser.jnlp'; 36 | result += ' '; 37 | } 38 | if (ddoc != 'takeout') { 39 | result += ' '; 40 | } 41 | result += ''; 42 | result += ' '; 43 | result += ' ' + cur.appName + ''; 44 | result += ' ' + req.headers.Host + ''; 45 | result += ' ' + req.userCtx.db + ''; 46 | if (req.userCtx && req.userCtx.name && req.userCtx.name != null) { result += ' ' + req.userCtx.name + ''; } 47 | result += ' '; 48 | result += ''; 49 | return { 'headers' : {'Content-Type' : 'application/x-java-jnlp-file'}, 'body' : result } 50 | } -------------------------------------------------------------------------------- /embedded-couchapp/.idea/.name: -------------------------------------------------------------------------------- 1 | embedded-couchapp -------------------------------------------------------------------------------- /embedded-couchapp/.idea/embedded-couchapp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /embedded-couchapp/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /embedded-couchapp/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | http://www.w3.org/1999/xhtml 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /embedded-couchapp/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /embedded-couchapp/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /embedded-couchapp/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 85 | 86 | 87 | 88 | 91 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 125 | 126 | 127 | 128 | 1311217169550 129 | 1311217169550 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /embedded-couchapp/_design-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites" : [ 3 | { 4 | "from" : "", 5 | "to" : "index.html" 6 | }, 7 | { 8 | "from" : "images/*", 9 | "to" : "images/*" 10 | }, 11 | { 12 | "from" : "scripts/*", 13 | "to" : "scripts/*" 14 | }, 15 | { 16 | "from" : "skin/*", 17 | "to" : "skin/*" 18 | }, 19 | { 20 | "from" : "styles/*", 21 | "to" : "styles/*" 22 | }, 23 | { 24 | "from" : "*", 25 | "to" : "../../*" 26 | } 27 | ], 28 | "language": "javascript", 29 | "shows": { 30 | "JxBrowser.jnlp": "function(doc, req) { var codebase = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/'+req.path[2]+'/'; var defaults = { codebase : codebase, href : '_show/JxBrowser.jnlp' }; var result = ''; result += ''; result += ''; result += ' JxBrowser resources'; result += ' TeamDev Ltd.'; result += ' '; result += ' '; result += ''; result += ''; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ''; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ' '; result += ''; return { 'headers' : {'Content-Type' : 'application/x-java-jnlp-file'}, 'body' : result } }" 31 | } 32 | } -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/MozillaGlue.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/MozillaGlue.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/MozillaInterfaces.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/MozillaInterfaces.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/engine-gecko.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/engine-gecko.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/engine-ie.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/engine-ie.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/engine-webkit.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/engine-webkit.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/jxbrowser-2.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/jxbrowser-2.8.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/log4j-1.2.15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/log4j-1.2.15.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/slf4j-api-1.5.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/slf4j-api-1.5.8.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/slf4j-log4j12-1.5.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/slf4j-log4j12-1.5.8.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/tuxpack-0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/tuxpack-0.2.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/winpack-3.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/winpack-3.8.2.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/xulrunner-linux.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/xulrunner-linux.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/xulrunner-linux64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/xulrunner-linux64.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/xulrunner-mac.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/xulrunner-mac.jar -------------------------------------------------------------------------------- /embedded-couchapp/html/lib/xulrunner-windows.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/embedded-couchapp/html/lib/xulrunner-windows.jar -------------------------------------------------------------------------------- /embedded-couchapp/reupholster.json: -------------------------------------------------------------------------------- 1 | {"couch":{"host":"localhost","port":6984,"db":"takeout-embedded", "username" : "admin", "password" : "admin"}, "designDocName" : "_design/takeout-extended"} 2 | -------------------------------------------------------------------------------- /embedded-couchapp/show_JxBrowser.js: -------------------------------------------------------------------------------- 1 | function(doc, req) { 2 | var codebase = 'http://' + req.headers.Host + '/' + req.path[0] + '/_design/'+req.path[2]+'/'; 3 | var defaults = { codebase : codebase, href : '_show/JxBrowser.jnlp' }; 4 | var result = ''; 5 | result += ''; 6 | result += ''; 7 | result += ' JxBrowser resources'; 8 | result += ' TeamDev Ltd.'; 9 | result += ' '; 10 | result += ' '; 11 | result += ''; 12 | result += ''; 13 | result += ' '; 14 | result += ' '; 15 | result += ' '; 16 | result += ' '; 17 | result += ' '; 18 | result += ' '; 19 | result += ' '; 20 | result += ''; 21 | result += ' '; 22 | result += ' '; 23 | result += ' '; 24 | result += ' '; 25 | result += ' '; 26 | result += ' '; 27 | result += ' '; 28 | result += ' '; 29 | result += ' '; 30 | result += ' '; 31 | result += ' '; 32 | result += ' '; 33 | result += ' '; 34 | result += ' '; 35 | result += ' '; 36 | result += ' '; 37 | result += ' '; 38 | result += ' '; 39 | result += ' '; 40 | result += ' '; 41 | result += ' '; 42 | result += ''; 43 | return { 'headers' : {'Content-Type' : 'application/x-java-jnlp-file'}, 'body' : result } 44 | } -------------------------------------------------------------------------------- /java/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/java/keystore -------------------------------------------------------------------------------- /java/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-jnlp 5 | jnlp 6 | 7 | webstart:jnlp 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.github.couchapp-takeout 6 | couchapp-takeout 7 | jar 8 | 1.0 9 | couchapp-takeout 10 | https://github.com/ryanramage/couchapp-takeout 11 | 12 | 13 | 14 | 15 | maven-assembly-plugin 16 | 17 | 18 | jar-with-dependencies 19 | 20 | 21 | 22 | com.github.couchapptakeout.App 23 | 24 | 25 | 26 | 27 | 28 | make-assembly 29 | package 30 | 31 | single 32 | 33 | 34 | 35 | 36 | 37 | org.apache.maven.plugins 38 | maven-compiler-plugin 39 | 40 | 1.6 41 | 1.6 42 | 43 | 44 | 45 | org.codehaus.mojo.webstart 46 | webstart-maven-plugin 47 | 1.0-beta-1 48 | 49 | 50 | 51 | jnlp 52 | 53 | 54 | 55 | 56 | 57 | 58 | 60 | test.jnlp 61 | com.github.couchapptakeout.App 62 | 63 | 64 | 65 | 66 | 67 | ../../keystore 68 | m2m2m2 69 | m2m2m2 70 | 71 | alias 72 | 180 73 | 74 | www.example.com 75 | None 76 | ExampleOrg 77 | Seattle 78 | Washington 79 | US 80 | 81 | true 82 | 83 | 84 | false 85 | false 86 | 87 | 88 | 89 | 90 | false 91 | 92 | 93 | 94 | 95 | 96 | org.apache.maven.wagon 97 | wagon-webdav 98 | 1.0-alpha-6 99 | 100 | 101 | org.jvnet.wagon-svn 102 | wagon-svn 103 | 1.8 104 | 105 | 106 | 107 | 108 | 109 | maven-deploy-plugin 110 | 111 | 112 | org.codehaus.mojo.webstart 113 | webstart-maven-plugin 114 | 1.0-beta-1 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | com.github.couchapp-takeout 123 | plugins 124 | 1.0 125 | 126 | 127 | org.apache.httpcomponents 128 | httpclient 129 | 4.1.1 130 | 131 | 132 | org.ini4j 133 | ini4j 134 | 0.5.2 135 | 136 | 137 | commons-lang 138 | commons-lang 139 | 2.6 140 | 141 | 142 | org.slf4j 143 | slf4j-log4j12 144 | 1.6.1 145 | 146 | 147 | junit 148 | junit 149 | 4.7 150 | test 151 | 152 | 153 | org.easymock 154 | easymock 155 | 3.0 156 | test 157 | 158 | 159 | org.swinglabs 160 | swing-layout 161 | 1.0.3 162 | 163 | 164 | 165 | 166 | 167 | eckoit 168 | https://eckoit.googlecode.com/svn/maven 169 | 170 | 171 | 172 | 173 | eckoit 174 | svn:https://eckoit.googlecode.com/svn/maven 175 | 176 | 177 | eckoit-snapshot 178 | svn:https://eckoit.googlecode.com/svn/maven 179 | false 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/BasicCouchDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import com.github.couchapptakeout.events.LoadingMessage; 9 | import com.github.couchapptakeout.events.utils.FileDownloader; 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.net.URL; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import org.apache.commons.io.IOUtils; 17 | import org.bushe.swing.event.EventBus; 18 | 19 | /** 20 | * 21 | * @author ryan.ramage 22 | */ 23 | public class BasicCouchDownloader implements CouchDownloader{ 24 | 25 | 26 | private String rootUrl; 27 | private boolean cancel = false; 28 | 29 | 30 | 31 | public BasicCouchDownloader(String rootUrl) { 32 | this.rootUrl = rootUrl; 33 | if (!rootUrl.endsWith("/")) { 34 | this.rootUrl = rootUrl + "/"; 35 | } 36 | 37 | } 38 | 39 | @Override 40 | public void cancelDownload() { 41 | cancel = true; 42 | } 43 | 44 | @Override 45 | public File downloadLatestCouch(File destDir) { 46 | try { 47 | String os = OSUtils.getGenericOSName(); 48 | String version = getLatestVersion(); 49 | URL source = new URL(rootUrl + "couchdb-" + os + "-" + version + ".zip"); 50 | return download(destDir, source); 51 | } catch (Exception ex) { 52 | Logger.getLogger(BasicCouchDownloader.class.getName()).log(Level.SEVERE, null, ex); 53 | return null; 54 | } 55 | } 56 | 57 | public File download(File destDir, URL source) throws InterruptedException { 58 | File dest = new File(destDir, "couchdb.zip"); 59 | 60 | FileDownloader downloader = new FileDownloader(source, dest); 61 | new Thread(downloader).start(); 62 | 63 | while(downloader.getStatus() == FileDownloader.DOWNLOADING ) { 64 | if (cancel) downloader.cancel(); 65 | EventBus.publish(new LoadingMessage(-1, -1, null, (int)downloader.getProgress(), 100, "Downloading..." )); 66 | Thread.sleep(1000); 67 | } 68 | return dest; 69 | } 70 | 71 | 72 | public String getLatestVersion() { 73 | InputStream stream = null; 74 | try { 75 | URL latestVersionURL = new URL(rootUrl + "latest.txt"); 76 | stream = latestVersionURL.openStream(); 77 | return IOUtils.toString(stream); 78 | } catch (IOException ex) { 79 | Logger.getLogger(BasicCouchDownloader.class.getName()).log(Level.SEVERE, null, ex); 80 | return null; 81 | } finally { 82 | try { 83 | stream.close(); 84 | } catch (IOException ex) { 85 | Logger.getLogger(BasicCouchDownloader.class.getName()).log(Level.SEVERE, null, ex); 86 | } 87 | } 88 | } 89 | 90 | 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/CouchDBEmbeddedInstaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan.ramage 11 | */ 12 | public interface CouchDBEmbeddedInstaller { 13 | boolean isCouchEmbeddedInstalled(); 14 | void installCouchEmbedded(); 15 | boolean isCouchEmbeddedLatestRelease(); 16 | void updateCouchEmbedded(); 17 | } 18 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/CouchDBNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan.ramage 11 | */ 12 | public class CouchDBNotFoundException extends Exception { 13 | 14 | /** 15 | * Creates a new instance of CouchDBNotFoundException without detail message. 16 | */ 17 | public CouchDBNotFoundException() { 18 | } 19 | 20 | 21 | /** 22 | * Constructs an instance of CouchDBNotFoundException with the specified detail message. 23 | * @param msg the detail message. 24 | */ 25 | public CouchDBNotFoundException(String msg) { 26 | super(msg); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/CouchDbInstallException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan.ramage 11 | */ 12 | public class CouchDbInstallException extends Exception { 13 | 14 | /** 15 | * Creates a new instance of CouchDbInstallException without detail message. 16 | */ 17 | public CouchDbInstallException() { 18 | } 19 | 20 | 21 | /** 22 | * Constructs an instance of CouchDbInstallException with the specified detail message. 23 | * @param msg the detail message. 24 | */ 25 | public CouchDbInstallException(String msg) { 26 | super(msg); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/CouchDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import java.io.File; 9 | 10 | /** 11 | * 12 | * @author ryan.ramage 13 | */ 14 | public interface CouchDownloader { 15 | 16 | File downloadLatestCouch(File destDir); 17 | void cancelDownload(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/CouchRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import com.github.couchapptakeout.events.ExitApplicationMessage; 9 | import com.github.couchapptakeout.events.LoadingMessage; 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import org.bushe.swing.event.EventBus; 16 | import org.bushe.swing.event.EventSubscriber; 17 | 18 | /** 19 | * 20 | * @author ryan.ramage 21 | */ 22 | public class CouchRunner implements Runnable,EventSubscriber { 23 | 24 | protected Process couchProcess; 25 | private InputStream couchStream; 26 | private boolean running; 27 | private String couchExe; 28 | 29 | private File workingDir = null; 30 | 31 | public CouchRunner(String couchExe) { 32 | this.couchExe = couchExe; 33 | 34 | } 35 | 36 | public void setWorkingDir(File workingDir) { 37 | this.workingDir = workingDir; 38 | } 39 | 40 | 41 | @Override 42 | public void onEvent(ExitApplicationMessage t) { 43 | running = false; 44 | Logger.getLogger(CouchRunner.class.getName()).log(Level.INFO, "Killing couch."); 45 | if (couchProcess != null) { 46 | couchProcess.destroy(); 47 | couchProcess = null; 48 | } 49 | System.out.println("Exit Received in Couch"); 50 | } 51 | 52 | @Override 53 | public void run() { 54 | try { 55 | EventBus.subscribeStrongly(ExitApplicationMessage.class, this); 56 | Logger.getLogger(CouchRunner.class.getName()).log(Level.INFO, "Starting couch."); 57 | EventBus.publish(new LoadingMessage(-1, -1, null, 0, 0, "Starting Database" )); 58 | 59 | if (couchProcess != null) { 60 | couchProcess.destroy(); 61 | } 62 | 63 | ProcessBuilder pb = new ProcessBuilder(new String[]{couchExe}); 64 | pb.redirectErrorStream(true); 65 | if (workingDir != null) pb.directory(workingDir); 66 | couchProcess = pb.start(); 67 | running = true; 68 | couchStream = couchProcess.getInputStream(); 69 | int chr = couchStream.read(); 70 | while (chr != -1 && running) { 71 | chr = couchStream.read(); 72 | } 73 | Logger.getLogger(CouchRunner.class.getName()).log(Level.INFO, "Couch Process Disconnected."); 74 | if (couchProcess != null) couchProcess.destroy(); 75 | couchProcess = null; 76 | 77 | System.out.println("Publish sd from run"); 78 | EventBus.publish(new ShutDownMessage()); 79 | 80 | 81 | } catch (IOException ex) { 82 | Logger.getLogger(CouchRunner.class.getName()).log(Level.SEVERE, null, ex); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/DefaultCouchManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import com.github.couchapptakeout.events.ExitApplicationMessage; 9 | import com.github.couchapptakeout.events.utils.Unzipper; 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.net.MalformedURLException; 13 | import java.net.ServerSocket; 14 | import java.net.URL; 15 | import java.util.List; 16 | import java.util.logging.Level; 17 | import java.util.logging.Logger; 18 | import org.apache.commons.lang.SystemUtils; 19 | import org.bushe.swing.event.EventBus; 20 | import org.bushe.swing.event.EventSubscriber; 21 | import org.ektorp.CouchDbConnector; 22 | import org.ektorp.CouchDbInstance; 23 | import org.ektorp.http.HttpClient; 24 | import org.ektorp.http.StdHttpClient; 25 | import org.ektorp.impl.StdCouchDbConnector; 26 | import org.ektorp.impl.StdCouchDbInstance; 27 | import org.ini4j.Wini; 28 | 29 | /** 30 | * 31 | * @author ryan.ramage 32 | */ 33 | public class DefaultCouchManager implements LocalCouch{ 34 | 35 | 36 | private static String COUCH_DIR = "couch"; 37 | private int localCouchPort = 5984; 38 | private CouchDownloader couchDownloader; 39 | private Unzipper unzipper; 40 | private int cachedCouchPort = 5984; 41 | private String username = null; 42 | private String password = null; 43 | private boolean couchStarted = false; 44 | 45 | 46 | public void setCouchDownloader(CouchDownloader couchDownloader) { 47 | this.couchDownloader = couchDownloader; 48 | } 49 | 50 | public void setUnzipper(Unzipper unzipper) { 51 | this.unzipper = unzipper; 52 | } 53 | 54 | public void setLocalCouchPort(int localCouchPort) { 55 | this.localCouchPort = localCouchPort; 56 | } 57 | 58 | @Override 59 | public int getCouchPort() { 60 | return cachedCouchPort; 61 | } 62 | 63 | 64 | @Override 65 | public synchronized CouchDbInstance getCouchInstance() throws CouchDBNotFoundException { 66 | // check if we already have a embedded couch setup, if yes startEmbeded 67 | if (haveEmbeddedCouch()) { 68 | 69 | if (isLocalCouchRunning()) { 70 | setupShutdownHook(); 71 | return getLocalCouchInstance(); 72 | } 73 | 74 | if (!couchStarted) { 75 | String exe = getCouchExe(); 76 | CouchRunner runner = new CouchRunner(exe); 77 | if (!SystemUtils.IS_OS_WINDOWS) { 78 | runner.setWorkingDir(new File(getWorkingDir(), COUCH_DIR)); 79 | } 80 | new Thread(runner).start(); 81 | couchStarted = true; 82 | setupShutdownHookForLocal(); 83 | } 84 | // wait for couch 85 | return waitForEmbeddedCouch(); 86 | } 87 | // check for local couch on 5984, use that 88 | if (isLocalCouchRunning()) { 89 | setupShutdownHook(); 90 | return getLocalCouchInstance(); 91 | } 92 | // no luck 93 | throw new CouchDBNotFoundException(); 94 | 95 | } 96 | 97 | protected void setupShutdownHookForLocal() { 98 | // create a annon listener 99 | EventBus.subscribeStrongly(ExitApplicationMessage.class, new EventSubscriber() { 100 | @Override 101 | public void onEvent(ExitApplicationMessage t) { 102 | System.out.println("Exiting Local DB"); 103 | // wait for the local db to shutdown 104 | for (int i=0; i < 4; i++) { 105 | try { 106 | Thread.sleep(1000); 107 | if (!isLocalCouchRunning()) { 108 | System.out.println("Local couch shutdown successfully"); 109 | break; 110 | } else { 111 | System.out.println("Waiting for local couch to shutdown"); 112 | } 113 | } catch (Exception e) {} 114 | 115 | } 116 | EventBus.publish(new ShutDownMessage()); 117 | } 118 | }); 119 | } 120 | 121 | 122 | protected void setupShutdownHook() { 123 | // create a annon listener 124 | EventBus.subscribeStrongly(ExitApplicationMessage.class, new EventSubscriber() { 125 | @Override 126 | public void onEvent(ExitApplicationMessage t) { 127 | System.out.println("Exiting Local DB"); 128 | EventBus.publish(new ShutDownMessage()); 129 | } 130 | }); 131 | } 132 | 133 | 134 | @Override 135 | public void installCouchDbEmbedded() throws CouchDbInstallException { 136 | try { 137 | // download couchdb for os 138 | File couchZip = couchDownloader.downloadLatestCouch(getWorkingDir()); 139 | 140 | File couchDir = new File(getWorkingDir(), COUCH_DIR); 141 | 142 | unzipper.doUnzip(couchZip, couchDir); 143 | 144 | // find a random port 145 | int port = findFreePort(); 146 | // set random port in ini 147 | String iniFile = getCouchIniLocation(); 148 | setEmbeddedCouchPort(iniFile, port); 149 | } catch (IOException ex) { 150 | Logger.getLogger(DefaultCouchManager.class.getName()).log(Level.SEVERE, null, ex); 151 | throw new CouchDbInstallException(ex.getMessage()); 152 | } 153 | } 154 | 155 | @Override 156 | public CouchDbConnector getCouchConnector(String name, CouchDbInstance instance) { 157 | return new StdCouchDbConnector(name, instance); 158 | } 159 | 160 | public static File getWorkingDir() { 161 | String userHome = System.getProperty("user.home"); 162 | File homeDir = new File(userHome, ".couchapptakeout"); 163 | if (!homeDir.exists()) { 164 | homeDir.mkdirs(); 165 | } 166 | return homeDir; 167 | } 168 | 169 | 170 | public boolean haveEmbeddedCouch() { 171 | File workDir = getWorkingDir(); 172 | File couchdir = new File(workDir, COUCH_DIR); 173 | if (couchdir.exists()) return true; 174 | return false; 175 | } 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | public static int findFreePort() throws IOException { 185 | ServerSocket server = new ServerSocket(0); 186 | int port = server.getLocalPort(); 187 | server.close(); 188 | return port; 189 | } 190 | 191 | public CouchDbInstance getLocalCouchInstance() { 192 | this.cachedCouchPort = localCouchPort; 193 | StdHttpClient.Builder builder = new StdHttpClient.Builder() 194 | .host("localhost") 195 | .port(localCouchPort); 196 | if (username != null) { 197 | builder.username(username); 198 | builder.password(password); 199 | } 200 | 201 | 202 | HttpClient httpClient = builder.build(); 203 | return new StdCouchDbInstance(httpClient); 204 | } 205 | 206 | private String getCouchExe() { 207 | File workDir = getWorkingDir(); 208 | File couchdir = new File(workDir, COUCH_DIR); 209 | if (SystemUtils.IS_OS_WINDOWS) { 210 | File couchdbBinDir = new File(couchdir, OSUtils.getCouchBinLocation()); 211 | return couchdbBinDir.getAbsolutePath(); 212 | } else { 213 | return OSUtils.getCouchBinLocation(); 214 | } 215 | } 216 | 217 | private String getCouchIniLocation() { 218 | File workDir = getWorkingDir(); 219 | File couchdir = new File(workDir, COUCH_DIR); 220 | File localIni = new File(couchdir, OSUtils.getCouchIniLocation()); 221 | return localIni.getAbsolutePath(); 222 | } 223 | 224 | public CouchDbInstance getEmbeddedCouchInstance() throws IOException { 225 | String ini = getCouchIniLocation(); 226 | int port = getEmbeddedCouchPort(ini); 227 | this.cachedCouchPort = port; 228 | StdHttpClient.Builder builder = new StdHttpClient.Builder() 229 | .host("localhost") 230 | .port(port); 231 | if (username != null) { 232 | builder.username(username); 233 | builder.password(password); 234 | } 235 | HttpClient httpClient = builder.build(); 236 | return new StdCouchDbInstance(httpClient); 237 | } 238 | 239 | 240 | protected int getEmbeddedCouchPort(String localIniFile) throws IOException { 241 | Wini ini = new Wini(new File(localIniFile)); 242 | int port = ini.get("httpd", "port", int.class); 243 | return port; 244 | } 245 | 246 | protected void setEmbeddedCouchPort(String localIniFile, int port) throws IOException { 247 | Wini ini = new Wini(new File(localIniFile)); 248 | ini.put("httpd", "port", port); 249 | // side effects!!! need to ensure bind address is 127.0.0.1, add lucene 250 | ini.put("httpd", "bind_address", "127.0.0.1"); 251 | ini.put("httpd_global_handlers", "_fti", "{couch_httpd_proxy, handle_proxy_req, <<\"http://127.0.0.1:5985\">>}"); 252 | 253 | 254 | 255 | ini.store(); 256 | } 257 | 258 | 259 | private CouchDbInstance waitForEmbeddedCouch() { 260 | for (int i =0; i < 4; i++) { 261 | try { 262 | if (isEmbeddedCouchRunning()) { 263 | return getEmbeddedCouchInstance(); 264 | } 265 | Thread.sleep(2100); 266 | } catch (Exception ex) { 267 | Logger.getLogger(DefaultCouchManager.class.getName()).log(Level.SEVERE, null, ex); 268 | } 269 | } 270 | return null; 271 | } 272 | 273 | public boolean isLocalCouchRunning() { 274 | CouchDbInstance instance = getLocalCouchInstance(); 275 | return isCouchInstanceUp(instance); 276 | 277 | } 278 | 279 | private boolean isEmbeddedCouchRunning() throws IOException { 280 | CouchDbInstance instance = getEmbeddedCouchInstance(); 281 | return isCouchInstanceUp(instance); 282 | } 283 | 284 | private boolean isCouchInstanceUp(CouchDbInstance dbInstance) { 285 | try { 286 | List names = dbInstance.getAllDatabases(); 287 | if (names != null && names.size() > 0) { 288 | return true; 289 | } 290 | } catch (Exception e) {} 291 | return false; 292 | } 293 | 294 | @Override 295 | public void setCredentials(String username, String password) { 296 | this.username = username; 297 | this.password = password; 298 | } 299 | 300 | 301 | } 302 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/DefaultUninstaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | 9 | 10 | 11 | /** 12 | * 13 | * @author ryan 14 | */ 15 | public class DefaultUninstaller implements Uninstaller { 16 | 17 | 18 | public void uninstall() { 19 | 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/LocalCouch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import org.ektorp.CouchDbConnector; 9 | import org.ektorp.CouchDbInstance; 10 | 11 | /** 12 | * 13 | * @author ryan.ramage 14 | */ 15 | public interface LocalCouch { 16 | 17 | void setCredentials(String username, String password); 18 | 19 | CouchDbInstance getCouchInstance() throws CouchDBNotFoundException; 20 | CouchDbConnector getCouchConnector(String name, CouchDbInstance instance); 21 | void installCouchDbEmbedded() throws CouchDbInstallException; 22 | int getCouchPort(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/LocalCouchMock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import org.ektorp.CouchDbConnector; 9 | import org.ektorp.CouchDbInstance; 10 | import org.ektorp.impl.StdCouchDbConnector; 11 | 12 | /** 13 | * 14 | * @author ryan.ramage 15 | */ 16 | public class LocalCouchMock implements LocalCouch { 17 | 18 | private CouchDbInstance instance = null; 19 | 20 | public LocalCouchMock() { 21 | 22 | } 23 | 24 | public LocalCouchMock(CouchDbInstance instance) { 25 | this.instance = instance; 26 | } 27 | 28 | @Override 29 | public CouchDbInstance getCouchInstance() throws CouchDBNotFoundException { 30 | if (instance != null) return instance; 31 | else throw new CouchDBNotFoundException(); 32 | } 33 | 34 | @Override 35 | public void installCouchDbEmbedded() throws CouchDbInstallException { 36 | // noop 37 | } 38 | 39 | @Override 40 | public CouchDbConnector getCouchConnector(String name, CouchDbInstance instance) { 41 | return new StdCouchDbConnector(name, instance); 42 | } 43 | 44 | @Override 45 | public int getCouchPort() { 46 | return 5984; 47 | } 48 | 49 | @Override 50 | public void setCredentials(String username, String password) { 51 | throw new UnsupportedOperationException("Not supported yet."); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/OSUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import org.apache.commons.lang.SystemUtils; 9 | 10 | /** 11 | * 12 | * @author ryan 13 | */ 14 | public class OSUtils { 15 | 16 | public static String getGenericOSName() { 17 | if (SystemUtils.IS_OS_WINDOWS) { 18 | return "win"; 19 | } 20 | else if (SystemUtils.IS_OS_MAC_OSX) { 21 | return "osx"; 22 | 23 | } else if (SystemUtils.IS_OS_LINUX) { 24 | return "linux"; 25 | } 26 | return null; 27 | } 28 | 29 | public static String getCouchIniLocation() { 30 | if (SystemUtils.IS_OS_WINDOWS) { 31 | return "etc/couchdb/local.ini"; 32 | } 33 | else if (SystemUtils.IS_OS_MAC_OSX) { 34 | return "couchdb_trunk/etc/couchdb/local.ini"; 35 | 36 | } else if (SystemUtils.IS_OS_LINUX) { 37 | return "couchdb_trunk/etc/couchdb/local.ini"; 38 | } 39 | return null; 40 | } 41 | 42 | public static String getCouchBinLocation() { 43 | if (SystemUtils.IS_OS_WINDOWS) { 44 | return "bin/couchdb.bat"; 45 | } 46 | else if (SystemUtils.IS_OS_MAC_OSX) { 47 | return "couchdb_trunk/bin/couchdb"; 48 | 49 | } else if (SystemUtils.IS_OS_LINUX) { 50 | return "couchdb_trunk/bin/couchdb"; 51 | } 52 | return null; 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ShowApplicationUrlMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan 11 | */ 12 | public class ShowApplicationUrlMessage { 13 | 14 | private String relativeUrl; 15 | 16 | public ShowApplicationUrlMessage(String relativeUrl){ 17 | this.relativeUrl = relativeUrl; 18 | } 19 | 20 | public String getRelativeUrl() { 21 | return relativeUrl; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ShutDownMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan 11 | */ 12 | public class ShutDownMessage { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/Tray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | 9 | import com.github.couchapptakeout.events.AddMenuItemEvent; 10 | import com.github.couchapptakeout.events.ExitApplicationMessage; 11 | import com.github.couchapptakeout.events.TrayMessage; 12 | import java.awt.AWTException; 13 | import java.awt.Image; 14 | import java.awt.MenuItem; 15 | import java.awt.PopupMenu; 16 | import java.awt.Robot; 17 | import java.awt.SystemTray; 18 | import java.awt.TrayIcon; 19 | import java.awt.event.InputEvent; 20 | import java.awt.event.MouseEvent; 21 | import java.awt.event.MouseListener; 22 | import java.net.URL; 23 | import java.util.List; 24 | import javax.swing.ImageIcon; 25 | import org.bushe.swing.event.EventBus; 26 | import org.bushe.swing.event.EventSubscriber; 27 | 28 | /** 29 | * This class represents the tray. 30 | * 31 | * @author ryan 32 | */ 33 | public class Tray { 34 | 35 | 36 | public static final String MENU_SEPERATOR = "SEPERATOR"; 37 | 38 | 39 | private String appName; 40 | private TrayIcon trayIcon; 41 | 42 | private Image baseImage; 43 | 44 | 45 | protected Tray() { 46 | // for unit tests 47 | } 48 | 49 | public Tray(ImageIcon icon, String appName, List popupItems) { 50 | if (icon == null) { 51 | baseImage = createImage("/plate.png"); 52 | } else { 53 | this.baseImage = icon.getImage(); 54 | } 55 | this.appName = appName; 56 | SystemTray tray = SystemTray.getSystemTray(); 57 | if (!SystemTray.isSupported()) { 58 | throw new RuntimeException("Tray is not supported"); 59 | } 60 | trayIcon = new TrayIcon(baseImage, appName); 61 | final PopupMenu popup = createMenu(popupItems); 62 | trayIcon.setPopupMenu(popup); 63 | trayIcon.addMouseListener(new MouseListener() { 64 | 65 | @Override 66 | public void mouseClicked(MouseEvent e) { 67 | if (MouseEvent.BUTTON3 == e.getButton()) return; 68 | try { 69 | Robot robot = new Robot(); 70 | // RIGHT CLICK 71 | robot.mousePress(InputEvent.BUTTON3_MASK); 72 | robot.mouseRelease(InputEvent.BUTTON3_MASK); 73 | } catch (Exception exe) { 74 | System.out.println("error=" + exe); 75 | } 76 | } 77 | 78 | @Override 79 | public void mousePressed(MouseEvent e) { 80 | 81 | } 82 | 83 | @Override 84 | public void mouseReleased(MouseEvent e) { 85 | 86 | } 87 | 88 | @Override 89 | public void mouseEntered(MouseEvent e) { 90 | 91 | } 92 | 93 | @Override 94 | public void mouseExited(MouseEvent e) { 95 | 96 | } 97 | }); 98 | 99 | try { 100 | tray.add(trayIcon); 101 | registerEvents(); 102 | } catch (AWTException e) { 103 | throw new RuntimeException("Cant start tray"); 104 | } 105 | 106 | } 107 | 108 | 109 | protected void registerEvents() { 110 | 111 | EventBus.subscribeStrongly(TrayMessage.class, new EventSubscriber() { 112 | @Override 113 | public void onEvent(TrayMessage t) { 114 | System.out.println("Tray Message: " + t.getMessage()); 115 | trayIcon.displayMessage(appName, t.getMessage(), t.getType()); 116 | } 117 | }); 118 | 119 | EventBus.subscribeStrongly(ExitApplicationMessage.class, new EventSubscriber() { 120 | @Override 121 | public void onEvent(ExitApplicationMessage t) { 122 | SystemTray tray = SystemTray.getSystemTray(); 123 | tray.remove(trayIcon); 124 | } 125 | }); 126 | EventBus.subscribeStrongly(AddMenuItemEvent.class, new EventSubscriber() { 127 | @Override 128 | public void onEvent(AddMenuItemEvent t) { 129 | trayIcon.getPopupMenu().add(t.getMenuItem()); 130 | } 131 | }); 132 | 133 | } 134 | 135 | 136 | 137 | protected final PopupMenu createMenu(List popupItems) { 138 | final PopupMenu popup = new PopupMenu("Menu"); 139 | for (Object object : popupItems) { 140 | if (object instanceof MenuItem) { 141 | popup.add((MenuItem)object); 142 | } 143 | if (MENU_SEPERATOR.equals(object)) { 144 | popup.addSeparator(); 145 | } 146 | } 147 | return popup; 148 | } 149 | 150 | 151 | 152 | 153 | //Obtain the image URL 154 | protected static Image createImage(String path) { 155 | URL imageURL = Tray.class.getResource(path); 156 | 157 | if (imageURL == null) { 158 | System.err.println("Resource not found: " + path); 159 | return null; 160 | } else { 161 | return (new ImageIcon(imageURL)).getImage(); 162 | } 163 | 164 | } 165 | 166 | 167 | 168 | } 169 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/Uninstaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | /** 9 | * 10 | * @author ryan 11 | */ 12 | public interface Uninstaller { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/AuthenticationDialog.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/AuthenticationDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * AuthenticationDialog.java 8 | * 9 | * Created on Jul 12, 2011, 8:07:05 PM 10 | */ 11 | 12 | package com.github.couchapptakeout.ui; 13 | 14 | import com.github.couchapptakeout.events.ExitApplicationMessage; 15 | import org.bushe.swing.event.EventBus; 16 | 17 | /** 18 | * 19 | * @author ryan 20 | */ 21 | public class AuthenticationDialog extends javax.swing.JDialog { 22 | 23 | private boolean ok = false; 24 | 25 | /** Creates new form AuthenticationDialog */ 26 | public AuthenticationDialog(java.awt.Frame parent, boolean modal) { 27 | super(parent, modal); 28 | initComponents(); 29 | } 30 | 31 | public void isLocalAuth(boolean isLocal) { 32 | if (isLocal) { 33 | headerLabel.setText("Local Authenticate"); 34 | messageLabel.setText("The local data source is password protected. Please enter your password."); 35 | } 36 | } 37 | 38 | 39 | public boolean isOk() { 40 | return ok; 41 | } 42 | 43 | public void setSrcUrl(String url) { 44 | dataSourceTextField.setText(url); 45 | } 46 | 47 | public void setUsername(String username) { 48 | usernameTextField.setText(username); 49 | } 50 | 51 | 52 | 53 | public String getUsername() { 54 | return usernameTextField.getText(); 55 | } 56 | 57 | public char[] getPassword() { 58 | return passwordField.getPassword(); 59 | } 60 | 61 | 62 | /** This method is called from within the constructor to 63 | * initialize the form. 64 | * WARNING: Do NOT modify this code. The content of this method is 65 | * always regenerated by the Form Editor. 66 | */ 67 | @SuppressWarnings("unchecked") 68 | // //GEN-BEGIN:initComponents 69 | private void initComponents() { 70 | 71 | jPanel1 = new javax.swing.JPanel(); 72 | headerLabel = new javax.swing.JLabel(); 73 | jPanel2 = new javax.swing.JPanel(); 74 | messageLabel = new javax.swing.JLabel(); 75 | jLabel2 = new javax.swing.JLabel(); 76 | usernameTextField = new javax.swing.JTextField(); 77 | jLabel5 = new javax.swing.JLabel(); 78 | dataSourceTextField = new javax.swing.JTextField(); 79 | jLabel4 = new javax.swing.JLabel(); 80 | cancelButton = new javax.swing.JButton(); 81 | passwordField = new javax.swing.JPasswordField(); 82 | okButton = new javax.swing.JButton(); 83 | 84 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 85 | 86 | jPanel1.setBackground(new java.awt.Color(255, 255, 255)); 87 | jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 20, 1, 20)); 88 | 89 | headerLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N 90 | headerLabel.setText("Remote Authenticate "); 91 | 92 | org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); 93 | jPanel1.setLayout(jPanel1Layout); 94 | jPanel1Layout.setHorizontalGroup( 95 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 96 | .add(jPanel1Layout.createSequentialGroup() 97 | .addContainerGap() 98 | .add(headerLabel) 99 | .addContainerGap(419, Short.MAX_VALUE)) 100 | ); 101 | jPanel1Layout.setVerticalGroup( 102 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 103 | .add(jPanel1Layout.createSequentialGroup() 104 | .addContainerGap() 105 | .add(headerLabel) 106 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 107 | ); 108 | 109 | jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 20, 20, 20)); 110 | 111 | messageLabel.setText("The remote data source is password protected. Please enter your password."); 112 | 113 | jLabel2.setText("Data Source"); 114 | 115 | usernameTextField.setText("superhero"); 116 | usernameTextField.addActionListener(new java.awt.event.ActionListener() { 117 | public void actionPerformed(java.awt.event.ActionEvent evt) { 118 | usernameTextFieldActionPerformed(evt); 119 | } 120 | }); 121 | 122 | jLabel5.setText("Password"); 123 | 124 | dataSourceTextField.setEditable(false); 125 | dataSourceTextField.setText("http://someplace.iriscouch.com/yourdatabase"); 126 | dataSourceTextField.setEnabled(false); 127 | 128 | jLabel4.setText("Username"); 129 | 130 | cancelButton.setText("Cancel"); 131 | cancelButton.addActionListener(new java.awt.event.ActionListener() { 132 | public void actionPerformed(java.awt.event.ActionEvent evt) { 133 | cancelButtonActionPerformed(evt); 134 | } 135 | }); 136 | 137 | passwordField.addActionListener(new java.awt.event.ActionListener() { 138 | public void actionPerformed(java.awt.event.ActionEvent evt) { 139 | passwordFieldActionPerformed(evt); 140 | } 141 | }); 142 | 143 | okButton.setText("Ok"); 144 | okButton.addActionListener(new java.awt.event.ActionListener() { 145 | public void actionPerformed(java.awt.event.ActionEvent evt) { 146 | okButtonActionPerformed(evt); 147 | } 148 | }); 149 | 150 | org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); 151 | jPanel2.setLayout(jPanel2Layout); 152 | jPanel2Layout.setHorizontalGroup( 153 | jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 154 | .add(jPanel2Layout.createSequentialGroup() 155 | .addContainerGap() 156 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 157 | .add(messageLabel) 158 | .add(jPanel2Layout.createSequentialGroup() 159 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 160 | .add(jLabel5) 161 | .add(jLabel4) 162 | .add(jLabel2)) 163 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 164 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 165 | .add(jPanel2Layout.createSequentialGroup() 166 | .add(okButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 167 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 341, Short.MAX_VALUE) 168 | .add(cancelButton)) 169 | .add(usernameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 502, Short.MAX_VALUE) 170 | .add(dataSourceTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 502, Short.MAX_VALUE) 171 | .add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 502, Short.MAX_VALUE)))) 172 | .addContainerGap()) 173 | ); 174 | jPanel2Layout.setVerticalGroup( 175 | jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 176 | .add(jPanel2Layout.createSequentialGroup() 177 | .add(20, 20, 20) 178 | .add(messageLabel) 179 | .add(37, 37, 37) 180 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 181 | .add(jLabel2) 182 | .add(dataSourceTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 183 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 184 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 185 | .add(jLabel4) 186 | .add(usernameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 187 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 188 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 189 | .add(jLabel5) 190 | .add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 191 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 192 | .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 193 | .add(okButton) 194 | .add(cancelButton)) 195 | .addContainerGap()) 196 | ); 197 | 198 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 199 | getContentPane().setLayout(layout); 200 | layout.setHorizontalGroup( 201 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 202 | .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 203 | .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 204 | ); 205 | layout.setVerticalGroup( 206 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 207 | .add(layout.createSequentialGroup() 208 | .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 209 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 210 | .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 211 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 212 | ); 213 | 214 | pack(); 215 | }// //GEN-END:initComponents 216 | 217 | private void usernameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameTextFieldActionPerformed 218 | // TODO add your handling code here: 219 | }//GEN-LAST:event_usernameTextFieldActionPerformed 220 | 221 | private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed 222 | ok = true; 223 | this.dispose(); 224 | }//GEN-LAST:event_okButtonActionPerformed 225 | 226 | private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed 227 | EventBus.publish(new ExitApplicationMessage()); 228 | }//GEN-LAST:event_cancelButtonActionPerformed 229 | 230 | private void passwordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordFieldActionPerformed 231 | // TODO add your handling code here: 232 | }//GEN-LAST:event_passwordFieldActionPerformed 233 | 234 | /** 235 | * @param args the command line arguments 236 | */ 237 | public static void main(String args[]) { 238 | java.awt.EventQueue.invokeLater(new Runnable() { 239 | public void run() { 240 | AuthenticationDialog dialog = new AuthenticationDialog(new javax.swing.JFrame(), true); 241 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { 242 | public void windowClosing(java.awt.event.WindowEvent e) { 243 | System.exit(0); 244 | } 245 | }); 246 | dialog.setVisible(true); 247 | } 248 | }); 249 | } 250 | 251 | // Variables declaration - do not modify//GEN-BEGIN:variables 252 | private javax.swing.JButton cancelButton; 253 | private javax.swing.JTextField dataSourceTextField; 254 | private javax.swing.JLabel headerLabel; 255 | private javax.swing.JLabel jLabel2; 256 | private javax.swing.JLabel jLabel4; 257 | private javax.swing.JLabel jLabel5; 258 | private javax.swing.JPanel jPanel1; 259 | private javax.swing.JPanel jPanel2; 260 | private javax.swing.JLabel messageLabel; 261 | private javax.swing.JButton okButton; 262 | private javax.swing.JPasswordField passwordField; 263 | private javax.swing.JTextField usernameTextField; 264 | // End of variables declaration//GEN-END:variables 265 | 266 | } 267 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/EmbeddedBrowser.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/EmbeddedBrowser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * EmbeddedBrowser.java 8 | * 9 | * Created on Jul 21, 2011, 12:07:29 PM 10 | */ 11 | 12 | package com.github.couchapptakeout.ui; 13 | 14 | import java.awt.BorderLayout; 15 | import java.awt.Component; 16 | import java.lang.reflect.InvocationTargetException; 17 | import java.util.logging.Level; 18 | import java.util.logging.Logger; 19 | import org.apache.commons.lang.ClassUtils; 20 | import org.apache.commons.lang.SystemUtils; 21 | import org.apache.commons.lang.reflect.MethodUtils; 22 | 23 | /** 24 | * 25 | * @author ryan 26 | */ 27 | public class EmbeddedBrowser extends javax.swing.JFrame { 28 | 29 | Object browser; 30 | 31 | /** Creates new form EmbeddedBrowser */ 32 | public EmbeddedBrowser() { 33 | initComponents(); 34 | try { 35 | 36 | Object browserType = null; 37 | // we do this via reflection! Saves having to include the maven stuff 38 | Class factory = ClassUtils.getClass("com.teamdev.jxbrowser.BrowserFactory"); 39 | System.out.println("Factory: " + factory); 40 | if (!SystemUtils.IS_OS_MAC_OSX) { 41 | // always use FF 42 | Class browserTypeClazz = ClassUtils.getClass("com.teamdev.jxbrowser.BrowserType"); 43 | browserType = MethodUtils.invokeStaticMethod(browserTypeClazz, "valueOf", "Mozilla"); 44 | browser = MethodUtils.invokeStaticMethod(factory, "createBrowser", browserType); 45 | 46 | } else { 47 | browser = MethodUtils.invokeStaticMethod(factory, "createBrowser", null); 48 | } 49 | System.out.println("Browser Type: " + browserType); 50 | Component c = (Component) MethodUtils.invokeMethod(browser, "getComponent", null); 51 | System.out.println("Browser : " + MethodUtils.invokeMethod(browser, "getType", null)); 52 | 53 | 54 | jPanel1.add(c, BorderLayout.CENTER); 55 | 56 | } catch (Exception ex) { 57 | Logger.getLogger(EmbeddedBrowser.class.getName()).log(Level.SEVERE, null, ex); 58 | } 59 | 60 | 61 | } 62 | 63 | 64 | public void setUrl(String url) { 65 | try { 66 | MethodUtils.invokeMethod(browser, "navigate", url); 67 | MethodUtils.invokeMethod(browser, "waitReady", null); 68 | System.out.println("Document is loaded completely"); 69 | } catch (Exception ex) { 70 | Logger.getLogger(EmbeddedBrowser.class.getName()).log(Level.SEVERE, null, ex); 71 | } 72 | } 73 | 74 | 75 | 76 | /** This method is called from within the constructor to 77 | * initialize the form. 78 | * WARNING: Do NOT modify this code. The content of this method is 79 | * always regenerated by the Form Editor. 80 | */ 81 | @SuppressWarnings("unchecked") 82 | // //GEN-BEGIN:initComponents 83 | private void initComponents() { 84 | 85 | jPanel1 = new javax.swing.JPanel(); 86 | 87 | setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 88 | 89 | jPanel1.setBackground(new java.awt.Color(255, 255, 255)); 90 | jPanel1.setLayout(new java.awt.BorderLayout()); 91 | getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); 92 | 93 | pack(); 94 | }// //GEN-END:initComponents 95 | 96 | /** 97 | * @param args the command line arguments 98 | */ 99 | public static void main(String args[]) { 100 | java.awt.EventQueue.invokeLater(new Runnable() { 101 | public void run() { 102 | new EmbeddedBrowser().setVisible(true); 103 | } 104 | }); 105 | } 106 | 107 | // Variables declaration - do not modify//GEN-BEGIN:variables 108 | private javax.swing.JPanel jPanel1; 109 | // End of variables declaration//GEN-END:variables 110 | 111 | } 112 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/LoadingDialog.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/LoadingDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * LoadingDialog.java 8 | * 9 | * Created on Jul 12, 2011, 7:57:56 PM 10 | */ 11 | 12 | package com.github.couchapptakeout.ui; 13 | 14 | import com.github.couchapptakeout.events.ExitApplicationMessage; 15 | import com.github.couchapptakeout.events.LoadingMessage; 16 | import org.bushe.swing.event.EventBus; 17 | import org.bushe.swing.event.EventSubscriber; 18 | 19 | /** 20 | * 21 | * @author ryan 22 | */ 23 | public class LoadingDialog extends javax.swing.JDialog { 24 | 25 | /** Creates new form LoadingDialog */ 26 | public LoadingDialog(java.awt.Frame parent, boolean modal) { 27 | super(parent, modal); 28 | initComponents(); 29 | 30 | EventBus.subscribeStrongly(LoadingMessage.class, new EventSubscriber() { 31 | @Override 32 | public void onEvent(LoadingMessage t) { 33 | 34 | 35 | // only update if stepnum > 0 36 | if (t.getStepNum() > 0) { 37 | 38 | stepProgressBar.setMinimum(1); 39 | stepProgressBar.setMaximum(t.getTotalSteps()); 40 | stepProgressBar.setValue(t.getStepNum()); 41 | stepProgressBar.setString(t.getStepName()); 42 | } 43 | 44 | 45 | if (t.getStatusTotal() == 0) { 46 | statusProgressBar.setIndeterminate(true); 47 | } else { 48 | statusProgressBar.setIndeterminate(false); 49 | statusProgressBar.setMinimum(1); 50 | statusProgressBar.setMaximum(t.getStatusTotal()); 51 | statusProgressBar.setValue(t.getStatusProgress()); 52 | } 53 | statusLabel.setText(t.getStepDesc()); 54 | 55 | 56 | } 57 | 58 | }); 59 | 60 | 61 | 62 | } 63 | 64 | 65 | public void setAppName(String appName) { 66 | this.appNameLabel.setText(appName); 67 | } 68 | 69 | 70 | /** This method is called from within the constructor to 71 | * initialize the form. 72 | * WARNING: Do NOT modify this code. The content of this method is 73 | * always regenerated by the Form Editor. 74 | */ 75 | @SuppressWarnings("unchecked") 76 | // //GEN-BEGIN:initComponents 77 | private void initComponents() { 78 | 79 | statusProgressBar = new javax.swing.JProgressBar(); 80 | statusLabel = new javax.swing.JLabel(); 81 | cancelButton = new javax.swing.JButton(); 82 | stepProgressBar = new javax.swing.JProgressBar(); 83 | jPanel1 = new javax.swing.JPanel(); 84 | jLabel1 = new javax.swing.JLabel(); 85 | appNameLabel = new javax.swing.JLabel(); 86 | 87 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 88 | 89 | statusProgressBar.setIndeterminate(true); 90 | 91 | statusLabel.setText("Starting..."); 92 | 93 | cancelButton.setText("Cancel"); 94 | cancelButton.addActionListener(new java.awt.event.ActionListener() { 95 | public void actionPerformed(java.awt.event.ActionEvent evt) { 96 | cancelButtonActionPerformed(evt); 97 | } 98 | }); 99 | 100 | stepProgressBar.setString(""); 101 | stepProgressBar.setStringPainted(true); 102 | 103 | jPanel1.setBackground(new java.awt.Color(255, 255, 255)); 104 | 105 | jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N 106 | jLabel1.setText("Installing"); 107 | 108 | appNameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N 109 | appNameLabel.setText("App Name"); 110 | 111 | org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); 112 | jPanel1.setLayout(jPanel1Layout); 113 | jPanel1Layout.setHorizontalGroup( 114 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 115 | .add(jPanel1Layout.createSequentialGroup() 116 | .add(33, 33, 33) 117 | .add(jLabel1) 118 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 119 | .add(appNameLabel) 120 | .addContainerGap(368, Short.MAX_VALUE)) 121 | ); 122 | jPanel1Layout.setVerticalGroup( 123 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 124 | .add(jPanel1Layout.createSequentialGroup() 125 | .addContainerGap() 126 | .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 127 | .add(jLabel1) 128 | .add(appNameLabel)) 129 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 130 | ); 131 | 132 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 133 | getContentPane().setLayout(layout); 134 | layout.setHorizontalGroup( 135 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 136 | .add(layout.createSequentialGroup() 137 | .addContainerGap(475, Short.MAX_VALUE) 138 | .add(cancelButton) 139 | .addContainerGap()) 140 | .add(layout.createSequentialGroup() 141 | .addContainerGap(49, Short.MAX_VALUE) 142 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) 143 | .add(org.jdesktop.layout.GroupLayout.LEADING, statusProgressBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 144 | .add(org.jdesktop.layout.GroupLayout.LEADING, stepProgressBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 502, Short.MAX_VALUE) 145 | .add(statusLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 469, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 146 | .add(27, 27, 27)) 147 | .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 148 | ); 149 | layout.setVerticalGroup( 150 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 151 | .add(layout.createSequentialGroup() 152 | .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 153 | .add(41, 41, 41) 154 | .add(stepProgressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 155 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 156 | .add(statusProgressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 157 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 158 | .add(statusLabel) 159 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 25, Short.MAX_VALUE) 160 | .add(cancelButton) 161 | .addContainerGap()) 162 | ); 163 | 164 | pack(); 165 | }// //GEN-END:initComponents 166 | 167 | private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed 168 | // TODO add your handling code here: 169 | EventBus.publish(new ExitApplicationMessage()); 170 | }//GEN-LAST:event_cancelButtonActionPerformed 171 | 172 | /** 173 | * @param args the command line arguments 174 | */ 175 | public static void main(String args[]) { 176 | java.awt.EventQueue.invokeLater(new Runnable() { 177 | public void run() { 178 | LoadingDialog dialog = new LoadingDialog(new javax.swing.JFrame(), true); 179 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { 180 | public void windowClosing(java.awt.event.WindowEvent e) { 181 | System.exit(0); 182 | } 183 | }); 184 | dialog.setVisible(true); 185 | } 186 | }); 187 | } 188 | 189 | // Variables declaration - do not modify//GEN-BEGIN:variables 190 | private javax.swing.JLabel appNameLabel; 191 | private javax.swing.JButton cancelButton; 192 | private javax.swing.JLabel jLabel1; 193 | private javax.swing.JPanel jPanel1; 194 | private javax.swing.JLabel statusLabel; 195 | private javax.swing.JProgressBar statusProgressBar; 196 | private javax.swing.JProgressBar stepProgressBar; 197 | // End of variables declaration//GEN-END:variables 198 | 199 | } 200 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/Splash.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/Splash.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * Splash.java 8 | * 9 | * Created on Jan 11, 2011, 4:00:12 PM 10 | */ 11 | 12 | package com.github.couchapptakeout.ui; 13 | 14 | 15 | import com.github.couchapptakeout.events.LoadingMessage; 16 | import java.awt.Dimension; 17 | import java.awt.Toolkit; 18 | import org.bushe.swing.event.EventBus; 19 | import org.bushe.swing.event.EventSubscriber; 20 | 21 | /** 22 | * 23 | * @author ryan 24 | */ 25 | public class Splash extends javax.swing.JWindow { 26 | 27 | /** Creates new form Splash */ 28 | public Splash(String appName) { 29 | initComponents(); 30 | appNameLabel.setText(appName); 31 | Toolkit tk = Toolkit.getDefaultToolkit(); 32 | Dimension screenSize = tk.getScreenSize(); 33 | int screenHeight = screenSize.height; 34 | int screenWidth = screenSize.width; 35 | int width = 278; 36 | int height = 200; 37 | setSize(width, height); 38 | 39 | 40 | setLocation((screenWidth/2) - (width/2), (screenHeight /2) - (height /2)); 41 | 42 | EventBus.subscribeStrongly(LoadingMessage.class, new EventSubscriber() { 43 | @Override 44 | public void onEvent(LoadingMessage t) { 45 | 46 | if (t.getStatusTotal() == 0) { 47 | progressBar.setIndeterminate(true); 48 | } else { 49 | progressBar.setIndeterminate(false); 50 | progressBar.setMinimum(1); 51 | progressBar.setMaximum(t.getStatusTotal()); 52 | progressBar.setValue(t.getStatusProgress()); 53 | } 54 | statusLabel.setText(t.getStepDesc()); 55 | } 56 | }); 57 | } 58 | 59 | 60 | 61 | /** This method is called from within the constructor to 62 | * initialize the form. 63 | * WARNING: Do NOT modify this code. The content of this method is 64 | * always regenerated by the Form Editor. 65 | */ 66 | @SuppressWarnings("unchecked") 67 | // //GEN-BEGIN:initComponents 68 | private void initComponents() { 69 | 70 | jPanel1 = new javax.swing.JPanel(); 71 | statusLabel = new javax.swing.JLabel(); 72 | progressBar = new javax.swing.JProgressBar(); 73 | appNameLabel = new javax.swing.JLabel(); 74 | 75 | setBackground(new java.awt.Color(255, 255, 255)); 76 | 77 | jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true)); 78 | jPanel1.setLayout(new java.awt.BorderLayout()); 79 | 80 | statusLabel.setBackground(new java.awt.Color(255, 255, 255)); 81 | statusLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 82 | statusLabel.setText("Please Wait..."); 83 | statusLabel.setMaximumSize(new java.awt.Dimension(278, 200)); 84 | statusLabel.setOpaque(true); 85 | jPanel1.add(statusLabel, java.awt.BorderLayout.CENTER); 86 | 87 | progressBar.setIndeterminate(true); 88 | progressBar.setMaximumSize(new java.awt.Dimension(200, 14)); 89 | jPanel1.add(progressBar, java.awt.BorderLayout.SOUTH); 90 | 91 | appNameLabel.setBackground(new java.awt.Color(255, 255, 255)); 92 | appNameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N 93 | appNameLabel.setText("App Name"); 94 | appNameLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(3, 10, 3, 1)); 95 | appNameLabel.setOpaque(true); 96 | jPanel1.add(appNameLabel, java.awt.BorderLayout.PAGE_START); 97 | 98 | getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); 99 | 100 | pack(); 101 | }// //GEN-END:initComponents 102 | 103 | /** 104 | * @param args the command line arguments 105 | */ 106 | public static void main(String args[]) { 107 | java.awt.EventQueue.invokeLater(new Runnable() { 108 | public void run() { 109 | new Splash("App Name").setVisible(true); 110 | } 111 | }); 112 | } 113 | 114 | // Variables declaration - do not modify//GEN-BEGIN:variables 115 | private javax.swing.JLabel appNameLabel; 116 | private javax.swing.JPanel jPanel1; 117 | private javax.swing.JProgressBar progressBar; 118 | private javax.swing.JLabel statusLabel; 119 | // End of variables declaration//GEN-END:variables 120 | 121 | } 122 | -------------------------------------------------------------------------------- /java/src/main/java/com/github/couchapptakeout/ui/Tray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout.ui; 7 | 8 | /** 9 | * 10 | * @author ryan 11 | */ 12 | public class Tray { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java/src/main/jnlp/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/java/src/main/jnlp/README -------------------------------------------------------------------------------- /java/src/main/jnlp/resources/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/java/src/main/jnlp/resources/README -------------------------------------------------------------------------------- /java/src/main/resources/META-INF/teamdev.licenses: -------------------------------------------------------------------------------- 1 | Tue Jul 19 09:35:06 CDT 2011 2 | 3 | couchapp-takeout 4 | NEVER 5 | Runtime 6 | Not for development 7 | win32/x64;win32/x86 8 | dd4qvucleuc72tby6okpqnpbdfqjs7qtu66r0u8b9h1minc9e8j5731qq92pw4ivudc16g7yrcugyt5x 9 | bc1zkgcyn9apyf7g092u8yv6i0w3uqyhbnr7t6no1q7wsbmulei8qbrknh15lyhk52ga3k7dmnezwliy 10 | Version: 2.x 11 | Product: ComfyJ 12 | 13 | Product: JxBrowser 14 | Version: 2.x 15 | Licensed to: 16 | License type: Runtime 17 | License info: Not for development 18 | Expiration date: NEVER 19 | Generation date: 19-07-2011 20 | Platforms: linux/x86;mac/x64;mac/ppc;linux/x64;win32/x64;mac/x86;win32/x86 21 | Company: couchapp-takeout 22 | SigB: gzd61fccm1ak6sk5uitfp1m0hq18hgaqjq92n8x91dzvt9dot4ctgzc50xl3eiuxuetlz5h9p1al9fwr 23 | SigA: ylasi1kctrvrrk6bel6pdvk21v637o9ccb8fzp67q5vxoffzsi51d1clpo5o5ef2uv92sngqtvgy9jl1 24 | 25 | Tue Jul 19 09:35:06 CDT 2011 26 | 27 | couchapp-takeout 28 | NEVER 29 | Runtime 30 | Not for development 31 | win32/x64;win32/x86 32 | 9imb94w011i9yd6oddsgvu93tn7mw03ysjhx98dluu5r3j3ev66hef3bwoc4tyck2y4oxzkb66i40liw 33 | dy1i4p85qlf33rvu0s1wr8k2stouzpwkipv2daasriq7u4t4dxlpeypachqmgn0c90qa6q3kdk2ke6pa 34 | Version: 2.x 35 | Product: JExplorer 36 | 37 | Tue Jul 19 09:35:06 CDT 2011 38 | 39 | couchapp-takeout 40 | NEVER 41 | Runtime 42 | Not for development 43 | linux/x86;mac/x64;mac/ppc;linux/ppc64;linux/x64;win32/x64;mac/x86;win32/x86;linux/ppc 44 | cy2uk321e0o62wsespx05lz96bo2wmo7i13bsbwct3v933mt7lycyh4jv5nplonry51kre3a3fe2z7ws 45 | f3vhe0dero95xdzt7w7ipmzy7u7h10h4eyzemctsltr9kkz67etzaurl0tty4whwdnzi65pmowqx13q2 46 | Version: 3.x 47 | Product: JNIWrapper 48 | 49 | 50 | -------------------------------------------------------------------------------- /java/src/main/resources/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/java/src/main/resources/README -------------------------------------------------------------------------------- /java/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | log4j.rootLogger=INFO, A1 4 | 5 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 6 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.A1.layout.ConversionPattern=%-5p %c %x - %m%n 8 | 9 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 10 | 11 | log4j.logger.org.apache=ERROR 12 | log4j.logger.net.sf=ERROR 13 | log4j.logger.org.bushe=ERROR 14 | log4j.logger.freemarker=ERROR 15 | log4j.logger.com.teamdev=INFO 16 | log4j.logger.com.ettrema=TRACE 17 | log4j.logger.com.bradmcevoy=TRACE -------------------------------------------------------------------------------- /java/src/main/resources/plate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanramage/couchapp-takeout/a67275b301a1201b041d8c4425858073d27eb951/java/src/main/resources/plate.png -------------------------------------------------------------------------------- /java/src/test/java/com/github/couchapptakeout/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | import java.io.IOException; 11 | import org.codehaus.jackson.JsonNode; 12 | import org.codehaus.jackson.map.ObjectMapper; 13 | import org.ektorp.impl.StdCouchDbInstance; 14 | import org.ektorp.http.StdHttpClient; 15 | import org.ektorp.http.HttpClient; 16 | import org.junit.Before; 17 | import org.ektorp.CouchDbConnector; 18 | import org.ektorp.CouchDbInstance; 19 | import org.junit.Test; 20 | import static org.junit.Assert.*; 21 | import static org.easymock.EasyMock.*; 22 | 23 | /** 24 | * 25 | * @author ryan.ramage 26 | */ 27 | public class AppTest { 28 | 29 | App app; 30 | LocalCouch mock ; 31 | CouchDbInstance couchMock ; 32 | CouchDbConnector connectorMock; 33 | 34 | 35 | public AppTest() { 36 | } 37 | 38 | 39 | 40 | @Test 41 | public void createLocalDatabaseNameTest() { 42 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 80, null); 43 | String localDbName = app2.createLocalDbName(); 44 | assertEquals("choose-choose_iriscouch_com", localDbName); 45 | } 46 | 47 | @Test 48 | public void createLocalDatabaseNameTestPort() { 49 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 5984, null); 50 | String localDbName = app2.createLocalDbName(); 51 | assertEquals("choose-choose_iriscouch_com-5984", localDbName); 52 | } 53 | 54 | @Test 55 | public void createLocalDatabaseNameLowerCase() { 56 | App app2 = new App("App Name", "choose.irisCouch.com", "choose", 5984, null); 57 | String localDbName = app2.createLocalDbName(); 58 | assertEquals("choose-choose_iriscouch_com-5984", localDbName); 59 | } 60 | 61 | @Test 62 | public void testGetSrcReplicationUrl() { 63 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 64 | String result = app2.getSrcReplicationUrl(false); 65 | assertEquals("http://choose.iriscouch.com:81/choose", result); 66 | } 67 | 68 | 69 | @Test 70 | public void testFindPluginNames() throws IOException { 71 | ObjectMapper mapper = new ObjectMapper(); 72 | JsonNode design = mapper.readTree("{ \"advanced\" : { \"plugins\" : [ \"com.test.Alpha\" ] } }"); 73 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 74 | 75 | List results = app2.findPluginNamess(design); 76 | assertEquals(1, results.size()); 77 | assertEquals("com.test.Alpha", results.get(0)); 78 | } 79 | 80 | @Test 81 | public void testFindPluginNamesEmpty() throws IOException { 82 | ObjectMapper mapper = new ObjectMapper(); 83 | JsonNode design = mapper.readTree("{ \"advanced\" : { \"plugins\" : [ ] } }"); 84 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 85 | 86 | List results = app2.findPluginNamess(design); 87 | assertEquals(0, results.size()); 88 | 89 | } 90 | @Test 91 | public void testFindPluginNamesNothing() throws IOException { 92 | ObjectMapper mapper = new ObjectMapper(); 93 | JsonNode design = mapper.readTree("{ \"advanced\" : { } }"); 94 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 95 | 96 | List results = app2.findPluginNamess(design); 97 | assertEquals(0, results.size()); 98 | 99 | } 100 | @Test 101 | public void testFindPluginNamesNoAdvanced() throws IOException { 102 | ObjectMapper mapper = new ObjectMapper(); 103 | JsonNode design = mapper.readTree("{ \"pizza\" : { } }"); 104 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 105 | 106 | List results = app2.findPluginNamess(design); 107 | assertEquals(0, results.size()); 108 | } 109 | 110 | 111 | @Test 112 | public void testConvertNamesToClasses() throws IOException { 113 | App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); 114 | 115 | List plugins = Arrays.asList("com.github.couchapptakeout.App"); 116 | 117 | List results = app2.convertPluginNamesToClasses(plugins); 118 | 119 | assertEquals(1, results.size()); 120 | assertEquals(App.class, results.get(0)); 121 | 122 | 123 | 124 | } 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | // Needs to be an integration test 133 | public void testStartSync() { 134 | App app2 = new App("App Name", "localhost", "choose", 5984, null); 135 | 136 | HttpClient httpClient = new StdHttpClient.Builder() 137 | .host("localhost") 138 | .port(5984) 139 | .build(); 140 | CouchDbInstance couch = new StdCouchDbInstance(httpClient); 141 | CouchDbConnector connector = couch.createConnector("test-choose", true); 142 | app2.setupReplication(couch, connector); 143 | 144 | 145 | 146 | 147 | 148 | } 149 | 150 | 151 | 152 | public void testCopyDesignDocs() { 153 | App app2 = new App("App Name", "localhost", "ecko-it", 5984, null); 154 | 155 | HttpClient httpClient1 = new StdHttpClient.Builder() 156 | .host("localhost") 157 | .port(5984) 158 | .build(); 159 | CouchDbInstance couch1 = new StdCouchDbInstance(httpClient1); 160 | CouchDbConnector connector1 = couch1.createConnector("ecko-it", false); 161 | 162 | 163 | 164 | HttpClient httpClient2 = new StdHttpClient.Builder() 165 | .host("localhost") 166 | .port(5984) 167 | .build(); 168 | CouchDbInstance couch2 = new StdCouchDbInstance(httpClient2); 169 | try { 170 | couch2.deleteDatabase("eckoit-clone"); 171 | } catch(Exception ignore) {} 172 | 173 | CouchDbConnector connector2 = couch2.createConnector("eckoit-clone", true); 174 | app2.copyDesignDocs(connector1, connector2); 175 | 176 | app2.setupReplication(couch2, connector2); 177 | 178 | } 179 | 180 | 181 | 182 | /** 183 | * Test of loadNeeded method, of class App. 184 | */ 185 | 186 | public void testLoadNeededNoPassword() throws Exception { 187 | App app = new App("App Name", "choose.irisCouch.com", "choose", 5984, null); 188 | setupMocksFor(app); 189 | replay(mock); 190 | replay(couchMock); 191 | replay(connectorMock); 192 | 193 | app.loadNeeded(false); 194 | 195 | } 196 | 197 | 198 | protected void setupMocksFor(App app) throws CouchDBNotFoundException { 199 | mock = createMock(LocalCouch.class); 200 | couchMock = createMock(CouchDbInstance.class); 201 | connectorMock = createNiceMock(CouchDbConnector.class); 202 | 203 | expect(mock.getCouchInstance()).andReturn(couchMock); 204 | expect(mock.getCouchConnector(app.createLocalDbName(), couchMock)).andReturn(connectorMock); 205 | app.setLocalCouchManager(mock); 206 | } 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | // Some scenarios to consider 216 | 217 | // one app, one user 218 | // many apps, one user 219 | // many users, many apps 220 | 221 | 222 | 223 | } -------------------------------------------------------------------------------- /java/src/test/java/com/github/couchapptakeout/BasicCouchDownloaderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import java.io.File; 9 | import org.junit.Test; 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * 14 | * @author ryan.ramage 15 | */ 16 | public class BasicCouchDownloaderTest { 17 | 18 | String rootUrl = "http://couchdb-binary-releases.googlecode.com/svn/trunk"; 19 | 20 | public BasicCouchDownloaderTest() { 21 | } 22 | 23 | 24 | /** 25 | * Test of download method, of class BasicCouchDownloader. 26 | */ 27 | 28 | // move to an integration type test 29 | 30 | public void testDownload() throws Exception { 31 | BasicCouchDownloader dl = new BasicCouchDownloader(rootUrl); 32 | File dest = new File("target"); 33 | 34 | dl.downloadLatestCouch(dest); 35 | } 36 | 37 | /** 38 | * Test of getLatestVersion method, of class BasicCouchDownloader. 39 | */ 40 | // move to an integration type test 41 | public void testGetLatestVersion() { 42 | BasicCouchDownloader dl = new BasicCouchDownloader(rootUrl); 43 | String latestVersion = dl.getLatestVersion(); 44 | assertEquals("1.1.0", latestVersion); 45 | } 46 | 47 | @Test 48 | public void test() { 49 | // we need at least one 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /java/src/test/java/com/github/couchapptakeout/DefaultCouchManagerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.github.couchapptakeout; 7 | 8 | import com.github.couchapptakeout.events.utils.DefaultUnzipper; 9 | import org.junit.Test; 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * 14 | * @author ryan.ramage 15 | */ 16 | public class DefaultCouchManagerTest { 17 | 18 | public DefaultCouchManagerTest() { 19 | } 20 | 21 | Boolean complete = false; 22 | 23 | 24 | 25 | 26 | @Test 27 | public void testFindFreePort() throws Exception{ 28 | int port = DefaultCouchManager.findFreePort(); 29 | System.out.println("Port: " + port); 30 | assertTrue(port > 0); 31 | } 32 | 33 | 34 | public void testInstallCouchDbEmbedded() throws CouchDbInstallException { 35 | DefaultCouchManager manager = new DefaultCouchManager(); 36 | BasicCouchDownloader bcd = new BasicCouchDownloader("http://couchdb-binary-releases.googlecode.com/svn/trunk"); 37 | DefaultUnzipper unzipper = new DefaultUnzipper(); 38 | manager.setCouchDownloader(bcd); 39 | manager.setUnzipper(unzipper); 40 | 41 | manager.installCouchDbEmbedded(); 42 | } 43 | 44 | 45 | } -------------------------------------------------------------------------------- /java/src/test/resources/local.ini: -------------------------------------------------------------------------------- 1 | # CouchDB Configuration Settings 2 | # Custom settings should be made in this file. They will override settings 3 | # in default.ini, but unlike changes made to default.ini, this file won't be 4 | # overwritten on server upgrade. 5 | 6 | # max_document_size = 4294967296 ; bytes 7 | [httpd] 8 | bind_address = 0.0.0.0 9 | port = 81 10 | 11 | # Uncomment next line to trigger basic-auth popup on unauthorized requests. 12 | # WWW-Authenticate = Basic realm="administrator" 13 | # Uncomment next line to set the configuration modification whitelist. Only 14 | # whitelisted values may be changed via the /_config URLs. To allow the admin 15 | # to change this value over HTTP, remember to include {httpd,config_whitelist} 16 | # itself. Excluding it from the list would require editing this file to update 17 | # the whitelist. 18 | # config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}] 19 | [couch_httpd_auth] 20 | # If you set this to true, you should also uncomment the WWW-Authenticate line 21 | # above. If you don't configure a WWW-Authenticate header, CouchDB will send 22 | # Basic realm="server" in order to prevent you getting logged out. 23 | # require_valid_user = false 24 | authentication_redirect = /_utils/session2.html 25 | 26 | # cert_file = /full/path/to/server_cert.pem 27 | # key_file = /full/path/to/server_key.pem 28 | # To enable Virtual Hosts in CouchDB, add a vhost = path directive. All requests to 29 | # the Virual Host will be redirected to the path. In the example below all requests 30 | # to http://example.com/ are redirected to /database. 31 | # If you run CouchDB on a specific port, include the port number in the vhost: 32 | # example.com:5984 = /database 33 | [vhosts] 34 | # example.com = /database/ 35 | dev.choose-your-adventure.com = 81 = 36 | dev.hostname.com = 81 = 37 | http = //172.17.1.95:81 = /editor3_/_design/app/_rewrite 38 | 39 | # admin = mysecretpassword 40 | [httpd_global_handlers] 41 | _hris = {couch_httpd_misc_handlers, handle_utils_dir_req, "../share/couchdb/wikid"} 42 | _hris2 = {couch_httpd_misc_handlers, handle_utils_dir_req, "../share/couchdb/hris"} 43 | _bi = {couch_httpd_misc_handlers, handle_utils_dir_req, "../share/couchdb/wikid"} 44 | _http = 45 | _google = 46 | 47 | -------------------------------------------------------------------------------- /java/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | log4j.rootLogger=INFO, A1 4 | 5 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 6 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.A1.layout.ConversionPattern=%-5p %c %x - %m%n 8 | 9 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 10 | 11 | log4j.logger.org.apache=ERROR 12 | log4j.logger.net.sf=ERROR 13 | log4j.logger.org.bushe=ERROR 14 | log4j.logger.freemarker=ERROR 15 | log4j.logger.com.teamdev=INFO 16 | log4j.logger.com.ettrema=TRACE 17 | log4j.logger.com.bradmcevoy=TRACE -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Couchapp Takeout provides couchapps with an installer and desktop experience. 2 | 3 | From one link in your couchapp, it will install all the pieces on an end users computer, to run it locally. It solves these problems: 4 | 5 | * Do you have a couchapp that you want to distribute to end users? 6 | * Do you want updates be pushed to them automatically? 7 | * [Optional] Do you want to have their local data sync with an online couch? 8 | 9 | Here are some projects using couchapp-takeout: 10 | 11 | * The Little Library [http://library.ic.tl/library/_design/takeout/install.html] 12 | * Ecko-It [http://eckoit.com/download.html] 13 | * CouchTasks [http://ecko-it.couchone.com:5984/couchtasks/_design/takeout/install.html] 14 | 15 | 16 | 17 | # How to use 18 | 19 | You can add an installer to your couchapp in about two minutes. 20 | 21 | ### Replicate Couchapp-Takeout into your application 22 | 23 | replicate this database into your couchapp: 24 | http://ecko-it.iriscouch.com/takeout 25 | 26 | It has two design docs: 27 | 28 | * _design/takeout 29 | * _design/takeout-settings.jnlp 30 | 31 | so make sure these do not conflict with any of your existing design docs. 32 | 33 | ### Configure Couchapp-Takeout 34 | 35 | Edit the design document _design/takeout-settings.jnlp in your database. Here are the settings to change: 36 | 37 | ```json 38 | { 39 | "appName": "Takeout", 40 | "vendor": "Ecko-it", 41 | "homepage": "http://eckoit.com", 42 | "description": "A great couchapp that does amazing stuff", 43 | "localStartUrl": "_design/takeout/index.html", 44 | "advanced": { 45 | "syncType": "bi-directional", 46 | "main-jar": "couchapp-takeout-1.0-SNAPSHOT.jar", 47 | "main-class": "com.github.couchapptakeout.App" 48 | } 49 | } 50 | ``` 51 | 52 | change the *appName*, *vendor*, *homepage* and *description* to match your application. 53 | 54 | *localStartUrl* is the page that is shown on the users computer after the install, and everytime they launch from their desktop. 55 | You probably want something like _design/app/index.html But maybe you want a different interface when the couchapp is running locally? 56 | You could have a sepereate design doc like _design/installed/index.html 57 | 58 | *syncType* is the type of continuous replication that is started on the users machine to the couchdb it was launched from. Valid values are: 59 | 60 | * 'bi-directional' useful for online/offline style applications. Users local changes will be synced with the database takeout is installed from. 61 | * 'pull' useful want to just distrubte your couchapp to end users. Allows them to receive updates to their local couchapp automatically, when the online couchapp is updated. 62 | * 'push' not sure when this would be usefull, but for completeness. 63 | * 'none' no continuous replication is started. 64 | 65 | ### Brand Couchapp-Takeout 66 | 67 | On the design doc '_design/takeout-settings.jnlp', replace the two attachements called logo.png and splash.png with your own logo and splash image. 68 | Keep the names exactly the same. 69 | 70 | 71 | ### Link to your install page. 72 | 73 | You will now have a install page ready to give to users. 74 | 75 | _design/takeout/install.html 76 | 77 | 78 | 79 | 80 | 81 | # Some notes: 82 | 83 | * End users will need to have up to date java on their machine. All mac osx meet this requirement, and most windows users will have it installed. 84 | * Currently we only have couch binaries for windows and mac. Other operating systems to come. 85 | * If you have a couch installed locally on port 5984 couchapp-desktop will just install into that db. If you experience the full install, turn off couch on that port. A new couch will be installed on a random port. 86 | * CouchDB is installed in .couchapptakeout in the users home directory. 87 | 88 | 89 | # System Processes 90 | 91 | While Couchapp-Takeout is running, the following processes will be seen: 92 | 93 | 1. The initial java process. 94 | 2. Couchdb and it's associated erlang processes. 95 | 96 | # Uninstalling 97 | 98 | ## Under Windows 99 | 100 | 1. Click on the program icon in the taskbar (or on the desktop), and click on "Quit" . 101 | 2. Go to Start>Control Panel>Uninstall Programs, and find the app's name in the list of installed programs, and click on it to uninstall. 102 | 3. Delete the .couchapptakeout folder in your home directory. 103 | 104 | 105 | 106 | # The Distant Future 107 | 108 | At this point we have ironed out most of the workflow, but Couchapp Takeout still feels a bit heavy from the launch. I really need to spend some time reducing dependancies, making smaller couch binaries, and making it feel more snappy. 109 | 110 | For mobile users, on the install page, if a mobile os is detected we can generate a link, or intent, that takes them to a mobile couch in the app store, and somehow passes the replication params. 111 | 112 | Create plugins that can run code on the users desktop. For those tasks where a couchapp does not have enough horse power. I have started this here: 113 | https://github.com/ryanramage/couchapp-takeout-plugins 114 | 115 | And some upcoming plugins: 116 | 117 | * https://github.com/ryanramage/couch-audio-recorder 118 | * a couchdb-lucene or elasticsearch plugin 119 | 120 | Maybe try and integrate with other less 'heavyweight' replicators, like 121 | 122 | * https://github.com/drsm79/ReplicateMe 123 | * https://chrome.google.com/webstore/detail/clbdmcdmjlpgedncppkbkepbilnhgddh 124 | * https://github.com/mikeal/pouchdb 125 | 126 | 127 | 128 | 129 | ## License 130 | 131 | This project is under an [Apache 2.0 license](https://github.com/ryanramage/couchapp-takeout/blob/master/LICENSE.txt) . 132 | 133 | 134 | ## Jenkins Build 135 | CloudBees graciously offers free Jenkins builds to open source projects. See the build for Couchapp-Takeout here: 136 | 137 | https://reupholster.ci.cloudbees.com/job/Takeout%20Java%20Build/ 138 | 139 | 140 | 141 | 142 | --------------------------------------------------------------------------------