private void checkChanges(Features newFeatures, ObjectFactory objectFactory) throws Exception, IOException, JAXBException, XMLStreamException {
if (checkDependencyChange) {
//combine all the dependencies to one feature and strip out versions
Features features = objectFactory.createFeaturesRoot();
features.setName(newFeatures.getName());
Feature feature = objectFactory.createFeature();
features.getFeature().add(feature);
for (Feature f : newFeatures.getFeature()) {
for (Bundle b : f.getBundle()) {
Bundle bundle = objectFactory.createBundle();
bundle.setLocation(b.getLocation());
feature.getBundle().add(bundle);
}
for (Dependency d : f.getFeature()) {
Dependency dependency = objectFactory.createDependency();
dependency.setName(d.getName());
feature.getFeature().add(dependency);
}
}
Collections.sort(feature.getBundle(), new Comparator<Bundle>() {
public int compare(Bundle bundle, Bundle bundle1) {
return bundle.getLocation().compareTo(bundle1.getLocation());
}
});
Collections.sort(feature.getFeature(), new Comparator<Dependency>() {
public int compare(Dependency dependency, Dependency dependency1) {
return dependency.getName().compareTo(dependency1.getName());
}
});
if (dependencyCache.exists()) {
//filter dependencies file
filter(dependencyCache, filteredDependencyCache);
//read dependency types, convert to dependencies, compare.
Features oldfeatures = readFeaturesFile(filteredDependencyCache);
Feature oldFeature = oldfeatures.getFeature().get(0);
List<Bundle> addedBundles = new ArrayList<Bundle>(feature.getBundle());
List<Bundle> removedBundles = new ArrayList<Bundle>();
for (Bundle test : oldFeature.getBundle()) {
boolean t1 = addedBundles.contains(test);
int s1 = addedBundles.size();
boolean t2 = addedBundles.remove(test);
int s2 = addedBundles.size();
if (t1 != t2) {
getLogger().warn("dependencies.contains: " + t1 + ", dependencies.remove(test): " + t2);
}
if (t1 == (s1 == s2)) {
getLogger().warn("dependencies.contains: " + t1 + ", size before: " + s1 + ", size after: " + s2);
}
if (!t2) {
removedBundles.add(test);
}
}
List<Dependency> addedDependencys = new ArrayList<Dependency>(feature.getFeature());
List<Dependency> removedDependencys = new ArrayList<Dependency>();
for (Dependency test : oldFeature.getFeature()) {
boolean t1 = addedDependencys.contains(test);
int s1 = addedDependencys.size();
boolean t2 = addedDependencys.remove(test);
int s2 = addedDependencys.size();
if (t1 != t2) {