routes.js
function(req, res) {
            if (!req._body || (req.body == null) || !req.body) {
                res.send(400, "Invalid POST missing required request body.");
                return;
            }
            if ((req.body.store == null) || !req.body.store) {
                res.send(400, "Invalid POST mising 'store' property in request body.");
                return;
            }
            if ((req.body.address == null) || !req.body.address) {
                res.send(400, "Invalid POST missing 'address' property in request body.");
                return;
            }
            var store = onmStoreDictionary[req.body.store];
            if ((store == null) || !store) {
                res.send(404, "The specified onm data store '" + req.body.store + "' does not exist on this server.");
               return;
            }
            var address = undefined
            try {
                address = store.model.createAddressFromHashString(req.body.address);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            try {
                var namespace = store.createComponent(address)
                var namespaceRecord = {};
                namespaceRecord['address'] = namespace.getResolvedAddress().getHashString();
                namespaceRecord[address.getModel().jsonTag] = namespace.implementation.dataReference;
                res.send(200, namespaceRecord);
            } catch (exception) {
                res.send(412, exception);
            }
        }
function(req, res) {
            if (!req._body || (req.body == null) || !req.body) {
                res.send(400, "Invalid POST missing required request body.");
                return;
            }
            if ((req.body.store == null) || !req.body.store) {
                res.send(400, "Invalid POST mising 'store' property in request body.");
                return;
            }
            if ((req.body.address == null) || !req.body.address) {
                res.send(400, "Invalid POST missing 'address' property in request body.");
                return;
            }
            var store = onmStoreDictionary[req.body.store];
            if ((store == null) || !store) {
                res.send(404, "The specified onm data store '" + req.body.store + "' does not exist on this server.");
               return;
            }
            var address = undefined
            try {
                address = store.model.createAddressFromHashString(req.body.address);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            try {
                var namespace = store.createComponent(address)
                var namespaceRecord = {};
                namespaceRecord['address'] = namespace.getResolvedAddress().getHashString();
                namespaceRecord[address.getModel().jsonTag] = namespace.implementation.dataReference;
                res.send(200, namespaceRecord);
            } catch (exception) {
                res.send(412, exception);
            }
        }
function ( req , res ) { if ( ! req . _body || ( req . body == null ) || ! req . body ) { res . send ( 400 , "Invalid POST missing required request body." ) ; return ; } if ( ( req . body . store == null ) || ! req . body . store ) { res . send ( 400 , "Invalid POST mising 'store' property in request body." ) ; return ; } if ( ( req . body . address == null ) || ! req . body . address ) { res . send ( 400 , "Invalid POST missing 'address' property in request body." ) ; return ; } var store = onmStoreDictionary [ req . body . store ] ; if ( ( store == null ) || ! store ) { res . send ( 404 , "The specified onm data store '" + req . body . store + "' does not exist on this server." ) ; return ; } var address = undefined try { address = store . model . createAddressFromHashString ( req . body . address ) ; } catch ( exception ) { console . error ( exception ) ; res . send ( 403 , "Invalid address '" + req . body . address + "' is outside of the data model's address space." ) ; return ; } try { var namespace = store . createComponent ( address ) var namespaceRecord = { } ; namespaceRecord [ 'address' ] = namespace . getResolvedAddress ( ) . getHashString ( ) ; namespaceRecord [ address . getModel ( ) . jsonTag ] = namespace . implementation . dataReference ; res . send ( 200 , namespaceRecord ) ; } catch ( exception ) { res . send ( 412 , exception ) ; } }
Create a new component data resource in the indicated store using the specified address hash to indicate the specific component to create.
Create a new component data resource in the indicated store using the specified address hash to indicate the specific component to create .