@Override public void run() throws OseeCoreException { Conditions.checkNotNull(configuration, "DbInitConfiguration Info"); OseeClientProperties.setInDbInit(true); createOseeDatastore(); Bundle bundle = Platform.getBundle("org.eclipse.osee.framework.skynet.core"); int state = bundle.getState(); if (state != Bundle.ACTIVE) { try { bundle.start(); } catch (BundleException ex) { throw new OseeCoreException(ex); } } IOseeCachingService service = DatabaseInitActivator.getInstance().getCachingService(); service.clearAll(); IOseeDatabaseService databaseService = DatabaseInitActivator.getInstance().getDatabaseService(); databaseService.getSequence().clear(); IdentityService identityService = DatabaseInitActivator.getInstance().getIdentityService(); identityService.clear(); Branch systemRoot = BranchManager.getSystemRootBranch(); Conditions.checkNotNull(systemRoot, "System root was not created - "); ClientSessionManager.releaseSession(); ClientSessionManager.authenticate( new BaseCredentialProvider() { @Override public OseeCredential getCredential() { OseeCredential credential = super.getCredential(); credential.setUserName(SystemUser.BootStrap.getName()); return credential; } }); List<String> oseeTypes = configuration.getOseeTypeExtensionIds(); Conditions.checkExpressionFailOnTrue(oseeTypes.isEmpty(), "osee types cannot be empty"); OseeTypesSetup oseeTypesSetup = new OseeTypesSetup(); oseeTypesSetup.execute(oseeTypes); service.clearAll(); }
@Override public void removeSupportedVersion(String version) throws OseeCoreException { Conditions.checkNotNull(version, "Osee Version"); Conditions.checkExpressionFailOnTrue( defaultVersions.contains(version), "Unable to remove default Osee version [%s]", version); OseeServerInfoMutable info = getApplicationServerInfo(); refreshData(info); Set<String> versions = info.getVersionSet(); boolean wasRemoved = versions.remove(version); if (wasRemoved) { info.setVersions(versions); dataStore.update(Collections.singleton(info)); } else { throw new OseeStateException("Not part of the supported version [%s]", version); } }