r3-legacy/src/r3-server.js

84 lines
1.7 KiB
JavaScript

/**
* R3.Server
* @param apiComponent
* @constructor
*/
R3.Server = function(
apiComponent
) {
__RUNTIME_COMPONENT__;
this.connected = false;
__UPGRADE_TO_RUNTIME__;
};
R3.Server.prototype = Object.create(R3.Component.prototype);
R3.Server.prototype.constructor = R3.Server;
R3.Server.prototype.createInstance = function() {
this.instance = true;
__CREATE_INSTANCE__;
};
/**
* Updates the instance with the current state
*/
R3.Server.prototype.updateInstance = function(property) {
if (property === 'protocol') {
console.log('todo: server protocol update');
return;
}
if (property === 'context') {
console.log('todo: server context update');
return;
}
if (property === 'application') {
console.log('todo: server application update');
return;
}
if (property === 'domain') {
console.log('todo: server domain update');
return;
}
if (property === 'ip') {
console.log('todo: server ip update');
return;
}
if (property === 'preferIp') {
console.log('todo: server preferIp update');
return;
}
if (property === 'port') {
console.log('todo: server port update');
return;
}
if (property === 'protocols') {
console.log('todo: server protocols update');
return;
}
__UPDATE_INSTANCE__;
};
R3.Server.prototype.getURL = function() {
if (this.preferIp) {
return this.protocol + '://' + this.ip + ':' + this.port;
} else {
return this.protocol + '://' + this.context + '-' + this.application + '.' + this.domain + ':' + this.port
}
};