Skip to content

Commit

Permalink
queue definition and deployment errors and throw after observers have…
Browse files Browse the repository at this point in the history
… been notified

git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2855 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
mojavelinux committed Jun 19, 2009
1 parent 12c8254 commit 19a5baa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
@@ -1,16 +1,22 @@
package org.jboss.webbeans.bootstrap;

import javax.enterprise.inject.spi.AfterBeanDiscovery;
import java.util.ArrayList;
import java.util.List;

import org.jboss.webbeans.DefinitionException;
import javax.enterprise.inject.spi.AfterBeanDiscovery;

public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery
{
private List<Throwable> definitionErrors = new ArrayList<Throwable>();

public void addDefinitionError(Throwable t)
{
//XXX spec says need to delay abort until all observers
//have been notified
throw new DefinitionException(t);
definitionErrors.add(t);
}

public List<Throwable> getDefinitionErrors()
{
return definitionErrors;
}

}
@@ -1,16 +1,21 @@
package org.jboss.webbeans.bootstrap;

import javax.enterprise.inject.spi.AfterDeploymentValidation;
import java.util.ArrayList;
import java.util.List;

import org.jboss.webbeans.DeploymentException;
import javax.enterprise.inject.spi.AfterDeploymentValidation;

public class AfterDeploymentValidationImpl implements AfterDeploymentValidation
{
private List<Throwable> deploymentProblems = new ArrayList<Throwable>();

public void addDeploymentProblem(Throwable t)
{
//XXX spec says need to delay abort until all observers
//have been notified
throw new DeploymentException(t);
deploymentProblems.add(t);
}

public List<Throwable> getDeploymentProblems()
{
return deploymentProblems;
}
}
Expand Up @@ -240,7 +240,11 @@ protected void fireAfterBeanDiscoveryEvent()
throw new DefinitionException(e);
}

// TODO handle registered definition errors
if (event.getDefinitionErrors().size() > 0)
{
// FIXME communicate all the captured definition errors in this exception
throw new DefinitionException(event.getDefinitionErrors().get(0));
}
}

protected void fireAfterDeploymentValidationEvent()
Expand All @@ -256,7 +260,11 @@ protected void fireAfterDeploymentValidationEvent()
throw new DeploymentException(e);
}

// TODO handle registered deployment errors
if (event.getDeploymentProblems().size() > 0)
{
// FIXME communicate all the captured deployment problems in this exception
throw new DeploymentException(event.getDeploymentProblems().get(0));
}
}

/**
Expand Down

0 comments on commit 19a5baa

Please sign in to comment.