Skip to content

Commit

Permalink
Finished renaming of RegisteredAddons
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Dec 20, 2012
1 parent b5cd13d commit 0729bac
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jboss.forge.container;

public class RegisteredAddonFilters
public class AddonFilters
{
public static AddonFilter allStarted()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.forge.container.event.Perform;
import org.jboss.forge.container.events.InitializeServices;
import org.jboss.forge.container.impl.AddonRepositoryProducer;
import org.jboss.forge.container.impl.RegisteredAddonImpl;
import org.jboss.forge.container.impl.AddonImpl;
import org.jboss.forge.container.modules.ModularWeld;
import org.jboss.forge.container.services.ServiceRegistry;
import org.jboss.forge.container.util.Assert;
Expand All @@ -20,13 +20,13 @@
public final class AddonRunnable implements Runnable
{
private Forge forge;
private RegisteredAddonImpl addon;
private AddonImpl addon;
private boolean shutdown = false;
private static final Logger LOGGER = Logger.getLogger(AddonRunnable.class.getName());

private CDIContainer container;

public AddonRunnable(Forge forge, RegisteredAddonImpl addon)
public AddonRunnable(Forge forge, AddonImpl addon)
{
this.forge = forge;
this.addon = addon;
Expand All @@ -46,7 +46,7 @@ public void run()
ClassLoaders.executeIn(addon.getClassLoader(), container);
}

public RegisteredAddonImpl getAddon()
public AddonImpl getAddon()
{
return addon;
}
Expand Down
16 changes: 8 additions & 8 deletions container/src/main/java/org/jboss/forge/container/Forge.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.jboss.forge.container.exception.ContainerException;
import org.jboss.forge.container.impl.AddonRegistryImpl;
import org.jboss.forge.container.impl.AddonRepositoryImpl;
import org.jboss.forge.container.impl.RegisteredAddonImpl;
import org.jboss.forge.container.impl.AddonImpl;
import org.jboss.forge.container.modules.AddonModuleLoader;
import org.jboss.forge.container.util.Sets;
import org.jboss.modules.Module;
Expand Down Expand Up @@ -123,7 +123,7 @@ private void updateAddons(Set<AddonThread> threads, ModuleLoader addonLoader)
for (Addon addon : toStop)
{
// TODO This needs to handle dependencies and ordering.
((RegisteredAddonImpl) addon).setStatus(Status.STOPPING);
((AddonImpl) addon).setStatus(Status.STOPPING);
logger.info("Stopping addon (" + addon.getId() + ")");
for (AddonThread thread : threads)
{
Expand Down Expand Up @@ -154,7 +154,7 @@ private Set<AddonThread> startAddons(Set<Addon> toStart)
int batchSize = Math.min(BATCH_SIZE, toStart.size());
for (Addon addon : toStart)
{
((RegisteredAddonImpl) addon).setStatus(Status.STARTING);
((AddonImpl) addon).setStatus(Status.STARTING);
logger.info("Starting addon (" + addon.getId() + ")");
while (registry.getServiceRegistries().size() + batchSize <= startedThreads)
{
Expand All @@ -168,7 +168,7 @@ private Set<AddonThread> startAddons(Set<Addon> toStart)
}
}

AddonRunnable runnable = new AddonRunnable(this, (RegisteredAddonImpl) addon);
AddonRunnable runnable = new AddonRunnable(this, (AddonImpl) addon);
Thread thread = new Thread(runnable, addon.getId().toCoordinates());
started.add(new AddonThread(thread, runnable));
thread.start();
Expand Down Expand Up @@ -218,10 +218,10 @@ private Addon loadAddon(ModuleLoader addonLoader, AddonId addonId)
{
AddonRegistryImpl registry = AddonRegistryImpl.INSTANCE;

RegisteredAddonImpl addonToLoad = (RegisteredAddonImpl) registry.getRegisteredAddon(addonId);
AddonImpl addonToLoad = (AddonImpl) registry.getRegisteredAddon(addonId);
if (addonToLoad == null)
{
addonToLoad = new RegisteredAddonImpl(addonId, Status.STARTING);
addonToLoad = new AddonImpl(addonId, Status.STARTING);
registry.register(addonToLoad);
}

Expand All @@ -237,7 +237,7 @@ else if (!waitlist.containsKey(addonToLoad) && (addonToLoad.getModule() == null)
AddonId dependencyId = dependency.getId();
if (!registry.isRegistered(dependencyId) && !dependency.isOptional())
{
RegisteredAddonImpl missingDependency = new RegisteredAddonImpl(dependencyId, null);
AddonImpl missingDependency = new AddonImpl(dependencyId, null);
missingDependencies.add(missingDependency);
}
}
Expand All @@ -264,7 +264,7 @@ else if (!waitlist.containsKey(addonToLoad) && (addonToLoad.getModule() == null)
waitlist.get(waiting).remove(addonToLoad);
if (waitlist.get(waiting).isEmpty())
{
((RegisteredAddonImpl) registry.getRegisteredAddon(waiting.getId())).setStatus(Status.STARTING);
((AddonImpl) registry.getRegisteredAddon(waiting.getId())).setStatus(Status.STARTING);
waitlist.remove(waiting);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import org.jboss.forge.container.Addon;
import org.jboss.forge.container.AddonRegistry;
import org.jboss.forge.container.RegisteredAddonFilters;
import org.jboss.forge.container.AddonFilters;
import org.jboss.forge.container.exception.ContainerException;
import org.jboss.forge.container.services.ServiceRegistry;

Expand Down Expand Up @@ -77,7 +77,7 @@ public void notify(final Object event, final Set<Annotation> qualifiers)
if (contextClassLoader.equals(eventClassLoader))
{
AddonRegistry addonRegistry = CDI.current().select(AddonRegistry.class).get();
for (Addon addon : addonRegistry.getRegisteredAddons(RegisteredAddonFilters.allStarted()))
for (Addon addon : addonRegistry.getRegisteredAddons(AddonFilters.allStarted()))
{
// Events should not be fired back into the container from which they originated
ClassLoader addonClassLoader = addon.getClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import org.jboss.forge.container.services.ServiceRegistry;
import org.jboss.modules.Module;

public class RegisteredAddonImpl implements Addon
public class AddonImpl implements Addon
{
private Module module;
private ServiceRegistry registry;
private Status status;
private AddonId entry;

public RegisteredAddonImpl(AddonId entry, Status status)
public AddonImpl(AddonId entry, Status status)
{
this.entry = entry;
this.status = status;
Expand Down Expand Up @@ -90,7 +90,7 @@ public boolean equals(Object obj)
return false;
if (getClass() != obj.getClass())
return false;
RegisteredAddonImpl other = (RegisteredAddonImpl) obj;
AddonImpl other = (AddonImpl) obj;
if (entry == null)
{
if (other.entry != null)
Expand Down

0 comments on commit 0729bac

Please sign in to comment.