private void createOseeDatastore() throws OseeCoreException { // OseeClientProperties.isOseeImportAllowed(); String tableDataSpace = OseeClientProperties.getOseeTableDataSpaceForDbInit(); String indexDataSpace = OseeClientProperties.getOseeIndexDataSpaceForDbInit(); boolean useSchemasSpecified = OseeClientProperties.useSchemasSpecifiedInDbConfigFiles(); DatastoreInitRequest requestData = new DatastoreInitRequest(tableDataSpace, indexDataSpace, useSchemasSpecified); String datastoreInitContext = OseeServerContext.OSEE_CONFIGURE_CONTEXT + "/datastore/initialize"; String urlString = HttpUrlBuilderClient.getInstance() .getOsgiServletServiceUrl(datastoreInitContext, new HashMap<String, String>()); IDataTranslationService service = DatabaseInitActivator.getInstance().getTranslationService(); AcquireResult updateResponse = HttpMessage.send( urlString, service, CoreTranslatorId.OSEE_DATASTORE_INIT_REQUEST, requestData, null); if (!updateResponse.wasSuccessful()) { throw new OseeStateException("Error during datastore init"); } }
@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(); }