Buca Bay - Always nice

Dua tiko noqu toa loaloa, na yacana ko… laga mai…

Backup and export Appjet Applications

June10

Appjet recently anounced that they are closing down. They however offer an open source download that allows you to run the appjet engine on your own server.

JGate has gone to the intiative of cloning the Appjet service. This allows you to transfer your apps from Appjet to JGate, including your storage and libraries.

Backup your Appjet Applications

For those needing to backup your applications, I’ve written a backup application that will take all your published applications and create a single compressed download in Zip or Gzip format.

http://export.appjet.net/

This app is actually cloned from two other apps. It has to contact a PHP server on the background in order to create the compressed files. I couldn’t find any JavaScript implementations of ZIP and Gzip readily available.

Using the Application is simple, just input your username and click on “backup my apps” and it will prompt a download after a few seconds.

Export your Appjet Storage

To export your storage you need to import an Appjet Library.

http://lib-export.appjet.net/
http://apps.jgate.de/lib-export

This library exists both on Appjet and JGate, and if you are hosting your own Appjet server then you need to include that library.

Here are the steps to export your appjet storage:

  • Import lib-export into both apps ie: import(’lib-export’);
  • Show the Admin Panel. On appjet.net, you can do this via the preview window. In JGate y ou need to include showExportAdminPanel(); after your import command and view the app in regular mode.
  • First set a password on both apps.
  • Then in the app you want to export from, turn off the admin panel. ie: remove the line showExportAdminPanel();
  • In the app you want to import to, click on the “import” link in the admin panel.
  • Fill in the details, make sure the URL does not include a trailing slash. eg: http://example-app.appjet.net
  • Submit the form.
You can also view the JSON representation of your root storage object (storage) by going to the URL: http://appname.appjet.net/export?password=mypass where appname and mypass are substituted for your own.

Other uses of lib-export:

If you’re interested in how it works, check out the source for lib-export.
Since appjet uses object storage instead of a traditional relational database, you can serialize the storage Objects into regular objects, and then into JSON, for export.
You can also do the opposite and unserialize JSON into native JavaScript Objects, and native JavaScript objects into Appjet storage Objects. (StorageObject and StorableCollection instances).
This can be useful if you want to storage random JavaScript Objects without knowing their type. It should even store your custom JavaScript instances, though I haven’t tried it.
eg: storing native and custom Objects
import('storage');
import('lib-export');
// native object
storage.date = storablelizeObjects(new Date());
function MyCustomObject() {
   this.name = 'my custom object';
}
// custom object
storage.customObj = storablelizeObjects(new MyCustomObject());
eg: storing Arrays
import('storage');
import('lib-export');
storage.myArray = storablelizeObjects(['hi', 'bye']);
eg: Store anything
import('storage');
import('lib-export');
storage.myArray = storablelizeObjects({
   'myarr': ['hi', 'bye', {"another object": "value"}],
   'myObj': new MyCustomObject(),
   'date': new Date(),
   'url': wget('http://example.com')
});
Convert Storage Object to native Objects
import('storage');
import('lib-export');
var myObj = objectizeStorables(storage.myObj);
Export your Storage Objects as JSON
import('storage');
import('lib-export');
var myObj_str = serializeStorables(storage.myObj);
Note that properties resolved from Object.prototype is not stored. Obviously, using StorableCollection() and StorableObject() will be faster then casting native Objects to Storables using lib-export, though the latter is more convenient for storing objects of unknown types.

Notes

The library lib-export is provided without any guarantees. Please do not use it if you do not take full responsibility for any outcome. ie: It works for me, but I cannot guarantee that it will work for your app.
Please note that the export lib is still in development, so there may be some changes to it which I will document here.

Related posts:

  1. Appjet service ends Appjet, a web based javascript application development platform, sent out an email to members today that they are closing down...
  2. RSS Feeds via cross domain JSON proxy JavaScript remoting functions are limited to the same domain. For example, XMLHttpRequest can only retrieve URLs on the same domain,...
  3. Client Side Application development for Web Developers Coming from a web development background, you would probably find using either Adobe AIR, or XUL the simplest to understand...
posted under web development

Email will not be published

Website example

Your Comment:

 
Tag Cloud