Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handlers are now being called (at least in the simple case, need more tests).
- Loading branch information
1 parent
19347b6
commit 7ede72d
Showing
14 changed files
with
506 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
impl/src/main/java/org/jboss/seam/exception/control/CatchInjectionPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.seam.exception.control; | ||
|
||
import org.jboss.weld.extensions.bean.ForwardingInjectionPoint; | ||
|
||
import javax.enterprise.inject.spi.InjectionPoint; | ||
import java.lang.annotation.Annotation; | ||
import java.util.Collection; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class CatchInjectionPoint extends ForwardingInjectionPoint | ||
{ | ||
private InjectionPoint delegate; | ||
private Set<Annotation> qualifiers; | ||
|
||
public CatchInjectionPoint(InjectionPoint delegate) | ||
{ | ||
this.delegate = delegate; | ||
this.qualifiers = new HashSet<Annotation>(delegate.getQualifiers()); | ||
} | ||
|
||
public void addQualifier(Annotation qualifier) | ||
{ | ||
this.qualifiers.add(qualifier); | ||
} | ||
|
||
public void addAllQualifiers(Collection<Annotation> qualifiers) | ||
{ | ||
this.qualifiers.addAll(qualifiers); | ||
} | ||
|
||
@Override | ||
protected InjectionPoint delegate() | ||
{ | ||
return this.delegate; | ||
} | ||
|
||
@Override public Set<Annotation> getQualifiers() | ||
{ | ||
return this.qualifiers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
impl/src/main/java/org/jboss/seam/exception/control/HandlesExceptionsLiteral.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.seam.exception.control; | ||
|
||
import javax.enterprise.util.AnnotationLiteral; | ||
|
||
public class HandlesExceptionsLiteral extends AnnotationLiteral<HandlesExceptions> implements HandlesExceptions | ||
{ | ||
private static final long serialVersionUID = -6775381615228078023L; | ||
|
||
public static final HandlesExceptions INSTANCE = new HandlesExceptionsLiteral(); | ||
} |
33 changes: 33 additions & 0 deletions
33
impl/src/main/java/org/jboss/seam/exception/control/OutboundLiteral.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.seam.exception.control; | ||
|
||
import javax.enterprise.util.AnnotationLiteral; | ||
|
||
@SuppressWarnings({"ClassExplicitlyAnnotation"}) | ||
public class OutboundLiteral extends AnnotationLiteral<Outbound> implements Outbound | ||
{ | ||
private static final long serialVersionUID = 411584330706373947L; | ||
|
||
public static final Outbound INSTANCE = new OutboundLiteral(); | ||
} |
67 changes: 67 additions & 0 deletions
67
impl/src/main/java/org/jboss/seam/exception/control/OutboundParameterValueRedefiner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.seam.exception.control; | ||
|
||
import org.jboss.weld.extensions.reflection.annotated.ParameterValueRedefiner; | ||
|
||
import javax.enterprise.context.spi.CreationalContext; | ||
import javax.enterprise.inject.spi.Bean; | ||
import javax.enterprise.inject.spi.BeanManager; | ||
|
||
public class OutboundParameterValueRedefiner implements ParameterValueRedefiner | ||
{ | ||
final CatchEvent event; | ||
final BeanManager bm; | ||
final Bean<?> declaringBean; | ||
|
||
public OutboundParameterValueRedefiner(CatchEvent event, final BeanManager manager, Bean<?> declaringBean) | ||
{ | ||
this.event = event; | ||
this.bm = manager; | ||
this.declaringBean = declaringBean; | ||
} | ||
|
||
public Object redefineParameterValue(ParameterValue value) | ||
{ | ||
CreationalContext<?> ctx = this.bm.createCreationalContext(this.declaringBean); | ||
|
||
try | ||
{ | ||
switch (value.getPosition()) | ||
{ | ||
case 0: | ||
{ | ||
return event; | ||
} | ||
} | ||
return value.getDefaultValue(ctx); | ||
} | ||
finally | ||
{ | ||
if (ctx != null) | ||
{ | ||
ctx.release(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.