protected void checkIntegrity ( WorkspaceEntry wsConfig , RepositoryEntry repConfig ) throws RepositoryConfigurationException { DatabaseStructureType dbType = DBInitializerHelper . getDatabaseType ( wsConfig ) ; for ( WorkspaceEntry wsEntry : repConfig . getWorkspaceEntries ( ) ) { if ( wsEntry . getName ( ) . equals ( wsConfig . getName ( ) ) || ! wsEntry . getContainer ( ) . getType ( ) . equals ( wsConfig . getContainer ( ) . getType ( ) ) || ! wsEntry . getContainer ( ) . getType ( ) . equals ( this . getClass ( ) . getName ( ) ) ) { continue ; } if ( ! DBInitializerHelper . getDatabaseType ( wsEntry ) . equals ( dbType ) ) { throw new RepositoryConfigurationException ( "All workspaces must be of same DB type. But " + wsEntry . getName ( ) + "=" + DBInitializerHelper . getDatabaseType ( wsEntry ) + " and " + wsConfig . getName ( ) + "=" + dbType ) ; } // source name String wsSourceName = null ; String newWsSourceName = null ; try { wsSourceName = wsEntry . getContainer ( ) . getParameterValue ( "sourceName" ) ; newWsSourceName = wsConfig . getContainer ( ) . getParameterValue ( "sourceName" ) ; } catch ( RepositoryConfigurationException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } if ( wsSourceName != null && newWsSourceName != null ) { if ( dbType . isShareSameDatasource ( ) ) { if ( ! wsSourceName . equals ( newWsSourceName ) ) { throw new RepositoryConfigurationException ( "SourceName must be equals in " + dbType + "-database repository." + " Check " + wsEntry . getName ( ) + " and " + wsConfig . getName ( ) ) ; } } else { if ( wsSourceName . equals ( newWsSourceName ) ) { throw new RepositoryConfigurationException ( "SourceName " + wsSourceName + " already in use in " + wsEntry . getName ( ) + ". SourceName must be different in " + dbType + "-database structure type. Check configuration for " + wsConfig . getName ( ) ) ; } } continue ; } } }
Checks if DataSources used in right manner .