lib/angoose.js
function registerClass(nameOrOpts, claz){
    var opts = typeof(nameOrOpts) == 'object'?nameOrOpts: {name: nameOrOpts};
    var className = opts.name;
    if(!className) throw "Missing module name: "+ className
    if(beans[className])
        logger.warn("Overriding existing bean: ", className);
    if(claz._angoosemeta && (claz._angoosemeta.baseClass == 'Service' || claz._angoosemeta.baseClass == 'Model') ){
        // already mixed
    }
    else{
        if(typeof(claz) === 'function' && claz.schema  && claz.modelName )
            opts.baseClass = 'Model';
        else if(claz instanceof getMongoose().Schema){
            opts.baseClass = 'Model';
            claz = getMongoose().model(className, claz);
        }
        else
            opts.baseClass = 'Service';
        angoose.Remotable.mixin(opts, claz);
    }
    _.extend(claz._angoosemeta, nameOrOpts);
    
    beans[className] = claz;
    //if(!nameOrOpts.isExtension)
        logger.debug("Registered module", claz._angoosemeta.baseClass, className);
    return claz;
    // if(claz._angoosemeta && (claz._angoosemeta.baseClass == 'Service' || claz._angoosemeta.baseClass == 'Model') ){
//         
    // }
    // else{
        // throw "Invalid class: must be a Model or Service class: " + claz;
    // }
}
function registerClass(nameOrOpts, claz){
    var opts = typeof(nameOrOpts) == 'object'?nameOrOpts: {name: nameOrOpts};
    var className = opts.name;
    if(!className) throw "Missing module name: "+ className
    if(beans[className])
        logger.warn("Overriding existing bean: ", className);
    if(claz._angoosemeta && (claz._angoosemeta.baseClass == 'Service' || claz._angoosemeta.baseClass == 'Model') ){
        // already mixed
    }
    else{
        if(typeof(claz) === 'function' && claz.schema  && claz.modelName )
            opts.baseClass = 'Model';
        else if(claz instanceof getMongoose().Schema){
            opts.baseClass = 'Model';
            claz = getMongoose().model(className, claz);
        }
        else
            opts.baseClass = 'Service';
        angoose.Remotable.mixin(opts, claz);
    }
    _.extend(claz._angoosemeta, nameOrOpts);
    
    beans[className] = claz;
    //if(!nameOrOpts.isExtension)
        logger.debug("Registered module", claz._angoosemeta.baseClass, className);
    return claz;
    // if(claz._angoosemeta && (claz._angoosemeta.baseClass == 'Service' || claz._angoosemeta.baseClass == 'Model') ){
//         
    // }
    // else{
        // throw "Invalid class: must be a Model or Service class: " + claz;
    // }
}
function registerClass ( nameOrOpts , claz ) { var opts = typeof ( nameOrOpts ) == 'object' ? nameOrOpts : { name : nameOrOpts } ; var className = opts . name ; if ( ! className ) throw "Missing module name: " + className if ( beans [ className ] ) logger . warn ( "Overriding existing bean: " , className ) ; if ( claz . _angoosemeta && ( claz . _angoosemeta . baseClass == 'Service' || claz . _angoosemeta . baseClass == 'Model' ) ) { // already mixed } else { if ( typeof ( claz ) === 'function' && claz . schema && claz . modelName ) opts . baseClass = 'Model' ; else if ( claz instanceof getMongoose ( ) . Schema ) { opts . baseClass = 'Model' ; claz = getMongoose ( ) . model ( className , claz ) ; } else opts . baseClass = 'Service' ; angoose . Remotable . mixin ( opts , claz ) ; } _ . extend ( claz . _angoosemeta , nameOrOpts ) ; beans [ className ] = claz ; //if(!nameOrOpts.isExtension) logger . debug ( "Registered module" , claz . _angoosemeta . baseClass , className ) ; return claz ; // if(claz._angoosemeta && (claz._angoosemeta.baseClass == 'Service' || claz._angoosemeta.baseClass == 'Model') ){ //          // } // else{ // throw "Invalid class: must be a Model or Service class: " + claz; // } }
register module with angoose so it knows to publish it
register module with angoose so it knows to publish it