Skip to content

Commit

Permalink
The registry used by addons should be the registry they were created for
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Jul 11, 2013
1 parent 4f29196 commit b320d3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*/
public class WeightedComparator implements Comparator<Weighted>
public enum WeightedComparator implements Comparator<Weighted>
{
public static final Comparator<Weighted> INSTANCE = new WeightedComparator();

private WeightedComparator()
{
}
INSTANCE;

@Override
public int compare(final Weighted left, final Weighted right)
Expand All @@ -29,7 +25,9 @@ public int compare(final Weighted left, final Weighted right)
{
return 0;
}
return ((Integer) left.priority()).compareTo(right.priority());
int thisVal = left.priority();
int anotherVal = right.priority();
return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package org.jboss.forge.furnace.addons;

import java.util.Set;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -27,6 +28,7 @@
import org.jboss.forge.furnace.modules.ModularURLScanner;
import org.jboss.forge.furnace.modules.ModularWeld;
import org.jboss.forge.furnace.modules.ModuleScanResult;
import org.jboss.forge.furnace.repositories.AddonRepository;
import org.jboss.forge.furnace.services.ServiceRegistry;
import org.jboss.forge.furnace.util.Addons;
import org.jboss.forge.furnace.util.Assert;
Expand Down Expand Up @@ -185,7 +187,7 @@ public Object call() throws Exception

AddonRegistryProducer addonRegistryProducer = BeanManagerUtils.getContextualInstance(manager,
AddonRegistryProducer.class);
addonRegistryProducer.setRegistry(furnace.getAddonRegistry());
addonRegistryProducer.setRegistry(furnace.getAddonRegistry(getRepositories()));

ContainerServiceExtension extension = BeanManagerUtils.getContextualInstance(manager,
ContainerServiceExtension.class);
Expand Down Expand Up @@ -264,6 +266,12 @@ public int hashCode()
return result;
}

public AddonRepository[] getRepositories()
{
Set<AddonRepository> repositories = stateManager.getViewsOf(addon).iterator().next().getRepositories();
return repositories.toArray(new AddonRepository[] {});
}

@Override
public boolean equals(Object obj)
{
Expand Down

0 comments on commit b320d3d

Please sign in to comment.