Effective use of JsonRestStore: Referencing, Lazy Loading, and more November 21st, 2008 at 2:27 pm by Kris Zyp

The JsonRestStore is a Dojo Data store that provides a JSON-based RESTful interface to servers and implements the Dojo Data read, write, notification, and identity APIs.

One of the core concepts of a REST architecture is hyperlinking, and this is available in the JsonRestStore through it’s referencing support. This concept enables powerful features like lazy loading and cross-store referencing that greatly improve the effectiveness and usability of the JsonRestStore. All of the features described in this article are available with Dojo Toolkit version 1.2 and later.

(more…)

When to Use Persevere: a Comparison with CouchDB and Others November 18th, 2008 at 10:24 am by Kris Zyp

Persevere and CouchDB are both new JSON-based storage systems, and have been receiving increasing focus. It may be informative to those interested in these new technologies to discuss the differences between these new database systems and what types of applications each is best suited for. While Persevere and CouchDB share an extremely similar JSON HTTP/REST interface and object structured data storage, there are important distinctions. Each of these different tools has a different target audience, and despite my obvious bias being the developer of Persevere, I hope to give at least some semi-objective differentiations between these tools.

(more…)

Evolving Schemas with Persevere November 17th, 2008 at 7:27 am by Kris Zyp

Traditional relational databases have strict data schemas; all records in a table must be of the same type. With new non-relational database technologies, some databases feature schema-free tables, each record is free to have any structure desired. This fundamentally different approach to the structure of persisted data is one of the core differences between relational and non-relational databases. However, is strict-schema or schema-free always the best approach for all the components in an application, throughout the entire life cycle of the application? Persevere provides a more flexible approach, allowing tables to start schema-free, and type constraints can be gradually added as desired or needed, with the freedom to partially constrain, defining types for some properties and not for others.

(more…)

Using the Persistent Object Model in Persevere November 2nd, 2008 at 9:09 pm by Kris Zyp

Persevere uses a storage structure that closely follows the semantics of JavaScript’s class system. Persevere stores objects in tables that each have a corresponding class/constructor and schema of properties. Every object in a Persevere table is an instance of the table’s class. This provides a very natural clean integration between Persevere’s persisted data and JavaScript environment, and an intuitive class-based object model for building applications. We can see this relationship by creating some classes and interacting with it at in the Persevere Server-Side JavaScript (SSJS) environment.

(more…)

JSON Schema in Dojo October 31st, 2008 at 7:36 am by Kris Zyp

JSON Schema is a specification for defining the structure of JSON data. JSON Schema provides the definition of contractual type constraints for describing a valid set of values for object style data structures. JSON Schema development is based on the concepts from XML Schema, RelaxNG, and Kwalify, but is a JSON-based format, so it is well suited for JSON-based applications. It is intended to provide validation, documentation, and interaction control. Defining type constraints provides a standardized form of data documentation that can be used for data persistence, form generation, and creating contracts on data used in web services.

(more…)

Jaxer + Persevere via Dojo’s JsonRestStore September 29th, 2008 at 9:43 am by Kris Zyp

perseverejaxerdojo.png With the increasing popularity of JavaScript, and rising usage of JavaScript in the browser, it is becoming very effective to use JavaScript on the server to have a single end-to-end language for both client and server-side development. Options for server-side JavaScript are also increasing.

Jaxer is a new server that uses server-side JavaScript for HTML generation, using the standard browser DOM model (it is actually running Mozilla’s engine on the server) as the API. Persevere is a JavaScript based database system, that integrates a JavaScript based object model with object persistence. Dojo’s new PersevereStore, which is built on the JsonRestStore, allows code running in Jaxer to easily query, manipulate, and interact with data in Persevere by running Dojo on Jaxer’s server-side JavaScript environment. These two JavaScript servers can complement each other, with Jaxer providing HTML presentation/generation and Persevere providing the data object model and persistence, with JsonRestStore as the bridge.

(more…)

CouchDBRestStore September 26th, 2008 at 6:54 am by Kris Zyp

One of the stores built on JsonRestStore and included in Dojo 1.2 is the new CouchDBRestStore. CouchDB server is a JSON-based schema-free database with clustering and fault-tolerance. This new module utilizes the JsonRestStore RESTful capabilities to interact with a CouchDB server. CouchDB has a standards-based REST interface that integrates well with JsonRestStore via a few adaptions from the CouchDBRestStore modules.

(more…)

Security in Ajax September 25th, 2008 at 12:38 am by Kris Zyp

Security in Ajax web applications is of growing importance. While the client-server model is very useful for architecting web applications, the web security is model is not client-server, but rather a client-deputy-server model. Understanding this security model is important for building secure web applications, and it is becoming even more important as we build mashups and web applications that utilize cross-site resources.

In a client-server model, the client acts on behalf of the user, and the server trusts the client to the degree that a user is authorized. In the client-deputy-server model, the deputy (the browser) acts on behalf of the user, with suspicion of the client (web page/JavaScript), taking responsibility for some aspects of security, limiting client to client interaction. By understanding the mechanisms for the deputy boundaries, servers can appropriately participate in the security model with proper trust for the browser to act on behalf of the user. We will look at how to secure resources from being accessed from the wrong clients and protect clients from malicious server code.

(more…)

Effortless Offline with OfflineRest September 23rd, 2008 at 12:01 am by Kris Zyp

offlinerest.png There is growing support in browsers for offline capabilities with the HTML 5 specification for local storage, offline notifications, and offline application cache, but adapting an application to store changes locally and do synchronization when connectivity is restored remains a major challenge for developers. Dojo 1.2’s new dojox.rpc.OfflineRest module automates the local storage of data and synchronization by leveraging the Dojo Data and REST abstractions. The OfflineRest module augments the JsonRest service in Dojo such that requests are cached in local storage for offline access, and modification requests (put, post, and delete) modify the cache and are recorded for delivery to the server; immediately if online, otherwise when connectivity is restored. Furthermore, JsonRest is the core engine used by JsonRestStore. Consequently, you can simply use the standard Dojo Data API with the JsonRestStore and effortlessly add offline capability with no modifications to your data interaction code. The underlying Rest service automates the handling of caching, storing data locally, and syncing changes. In addition the new OfflineRest module has no dependency on plugins, but rather progressively utilizes offline features that are available, while still operating properly on legacy browsers without offline support.

(more…)

Protected Cross-Domain Access with Dojo’s windowName August 18th, 2008 at 3:25 pm by Kris Zyp

The new windowName module (dojox.io.windowName) now includes support for resource authorization as Neil Roberts described in his article on xauth. Now the windowName module can be used with a window.name enabled resources for simple (direct) access as well resources that require an authorization step.

(more…)