@Override public void run() { for (UpgradeInfo upgradeInfo : _upgradeInfos) { UpgradeStep upgradeStep = upgradeInfo.getUpgradeStep(); try { upgradeStep.upgrade( new DBProcessContext() { @Override public DBContext getDBContext() { return new DBContext(); } @Override public OutputStream getOutputStream() { return _outputStream; } }); _releaseLocalService.updateRelease( _bundleSymbolicName, upgradeInfo.getToSchemaVersionString(), upgradeInfo.getFromSchemaVersionString()); } catch (Exception e) { throw new RuntimeException(e); } } CacheRegistryUtil.clear(); }
public void check() { Set<String> bundleSymbolicNames = _serviceTrackerMap.keySet(); for (String bundleSymbolicName : bundleSymbolicNames) { String schemaVersionString = getSchemaVersionString(bundleSymbolicName); ReleaseGraphManager releaseGraphManager = new ReleaseGraphManager(_serviceTrackerMap.getService(bundleSymbolicName)); List<List<UpgradeInfo>> upgradeInfosList = releaseGraphManager.getUpgradeInfosList(schemaVersionString); int size = upgradeInfosList.size(); if (size > 1) { System.out.println("There are " + size + " possible end nodes for " + schemaVersionString); } if (size == 0) { continue; } StringBundler sb = new StringBundler(6); sb.append("There is an upgrade process available for "); sb.append(bundleSymbolicName); sb.append(" from "); sb.append(schemaVersionString); sb.append(" to "); List<UpgradeInfo> upgradeInfos = upgradeInfosList.get(0); UpgradeInfo lastUpgradeInfo = upgradeInfos.get(upgradeInfos.size() - 1); sb.append(lastUpgradeInfo.getToSchemaVersionString()); System.out.println(sb.toString()); } }