long bundleId = newData.getBundleID(); if (stateManager != null) { State systemState = stateManager.getSystemState(); systemState.removeBundle(bundleId); BundleDescription newDescription = stateManager.getFactory().createBundleDescription(newData.getManifest(), newData.getLocation(), bundleId); systemState.addBundle(newDescription); }
updateState(newData, BundleEvent.UPDATED);
			public void commit(boolean postpone) throws BundleException {				try {					newData.setLastModified(System.currentTimeMillis());					newData.save();				} catch (IOException e) {					throw new BundleException(AdaptorMsg.formatter.getString("ADAPTOR_STORAGE_EXCEPTION"), e); //$NON-NLS-1$				}				long bundleId = newData.getBundleID();				if (stateManager != null) {					State systemState = stateManager.getSystemState();					systemState.removeBundle(bundleId);					BundleDescription newDescription = stateManager.getFactory().createBundleDescription(newData.getManifest(), newData.getLocation(), bundleId);					systemState.addBundle(newDescription);				}				File originalGenerationDir = data.createGenerationDir();				if (postpone || !rm(originalGenerationDir)) {					/* mark this bundle to be deleted to ensure it is fully cleaned up					 * on next restart.					 */					File delete = new File(originalGenerationDir, ".delete"); //$NON-NLS-1$					if (!delete.exists()) {						try {							/* create .delete */							FileOutputStream out = new FileOutputStream(delete);							out.close();						} catch (IOException e) {							if (Debug.DEBUG && Debug.DEBUG_GENERAL) {								Debug.println("Unable to write " + delete.getPath() + ": " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$							}							eventPublisher.publishFrameworkEvent(FrameworkEvent.ERROR, data.getBundle(), e);						}					}				}			}