private int registerCluster ( final OCluster cluster ) { final int id ; if ( cluster != null ) { // CHECK FOR DUPLICATION OF NAMES if ( clusterMap . containsKey ( cluster . getName ( ) . toLowerCase ( configuration . getLocaleInstance ( ) ) ) ) { throw new OConfigurationException ( "Cannot add cluster '" + cluster . getName ( ) + "' because it is already registered in database '" + name + "'" ) ; } // CREATE AND ADD THE NEW REF SEGMENT clusterMap . put ( cluster . getName ( ) . toLowerCase ( configuration . getLocaleInstance ( ) ) , cluster ) ; id = cluster . getId ( ) ; } else { id = clusters . size ( ) ; } setCluster ( id , cluster ) ; return id ; }
Register the cluster internally .