[webbeans-commits] Webbeans SVN: r747 - in ri/trunk: webbeans-ri/src/main/java/org/jboss/webbeans/bean and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2008-12-31 18:24:08 -0500 (Wed, 31 Dec 2008)
New Revision: 747
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TeaCupPomeranian.java
Log:
Added a bean implementation for injection point metadata.
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2008-12-30 21:22:32 UTC (rev 746)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2008-12-31 23:24:08 UTC (rev 747)
@@ -1,3 +1,20 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package javax.webbeans;
import java.lang.annotation.Annotation;
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java 2008-12-31 23:24:08 UTC (rev 747)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.InjectionPoint;
+import javax.webbeans.Standard;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember;
+
+/**
+ * The container provided implementation for InjectionPoint beans
+ *
+ * @author David Allen
+ */
+@Standard
+@Dependent
+public class InjectionPointBean implements InjectionPoint
+{
+ private final AbstractAnnotatedMember<?, ? extends Member> memberInjectionPoint;
+ private final Bean<?> bean;
+ private final Object beanInstance;
+
+ /**
+ * Creates a new metadata bean for the given injection point information.
+ * @param injectedMember The member of the bean being injected
+ * @param bean The bean being injected
+ * @param beanInstance The instance of the bean being injected
+ */
+ public InjectionPointBean(AbstractAnnotatedMember<?, ? extends Member> injectedMember, Bean<?> bean, Object beanInstance)
+ {
+ this.memberInjectionPoint = injectedMember;
+ this.bean = bean;
+ this.beanInstance = beanInstance;
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ return this.memberInjectionPoint.getAnnotation(annotationType);
+ }
+
+ @Override
+ public Annotation[] getAnnotations()
+ {
+ return this.memberInjectionPoint.getAnnotations().toArray(new Annotation[0]);
+ }
+
+ @Override
+ public Bean<?> getBean()
+ {
+ return this.bean;
+ }
+
+ @Override
+ public Set<Annotation> getBindingTypes()
+ {
+ return this.memberInjectionPoint.getBindingTypes();
+ }
+
+ @Override
+ public Object getInstance()
+ {
+ return this.beanInstance;
+ }
+
+ @Override
+ public Member getMember()
+ {
+ return this.memberInjectionPoint.getDelegate();
+ }
+
+ @Override
+ public Type getType()
+ {
+ return this.memberInjectionPoint.getType();
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return this.memberInjectionPoint.isAnnotationPresent(annotationType);
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-30 21:22:32 UTC (rev 746)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-31 23:24:08 UTC (rev 747)
@@ -526,6 +526,6 @@
}
}
- protected abstract S getDelegate();
+ public abstract S getDelegate();
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-12-30 21:22:32 UTC (rev 746)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-12-31 23:24:08 UTC (rev 747)
@@ -200,7 +200,7 @@
return buffer.toString();
}
- protected Class<T> getDelegate()
+ public Class<T> getDelegate()
{
return clazz;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TeaCupPomeranian.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TeaCupPomeranian.java 2008-12-30 21:22:32 UTC (rev 746)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TeaCupPomeranian.java 2008-12-31 23:24:08 UTC (rev 747)
@@ -6,7 +6,7 @@
import org.jboss.webbeans.test.annotations.Tame;
@Tame
-@Named("Ted")
+@Named("Teddy")
public class TeaCupPomeranian
{
public static class OversizedException extends RuntimeException
15 years, 11 months
[webbeans-commits] Webbeans SVN: r746 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
by webbeans-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2008-12-30 16:22:32 -0500 (Tue, 30 Dec 2008)
New Revision: 746
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
Log:
ws
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2008-12-29 15:06:32 UTC (rev 745)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2008-12-30 21:22:32 UTC (rev 746)
@@ -8,12 +8,12 @@
import javax.webbeans.manager.Bean;
public interface InjectionPoint {
- public Type getType();
- public Set<Annotation> getBindingTypes();
- public Object getInstance();
- public Bean<?> getBean();
+ public Type getType();
+ public Set<Annotation> getBindingTypes();
+ public Object getInstance();
+ public Bean<?> getBean();
public Member getMember();
- public <T extends Annotation> T getAnnotation(Class<T> annotationType);
- public Annotation[] getAnnotations();
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType);
+ public Annotation[] getAnnotations();
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
}
15 years, 11 months
[webbeans-commits] Webbeans SVN: r745 - in ri/trunk/jboss-as: resources and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: alesj
Date: 2008-12-29 10:06:32 -0500 (Mon, 29 Dec 2008)
New Revision: 745
Modified:
ri/trunk/jboss-as/build.xml
ri/trunk/jboss-as/resources/webbeans-deployers-jboss-beans.xml
Log:
Fix int urls.
Package move fix.
Modified: ri/trunk/jboss-as/build.xml
===================================================================
--- ri/trunk/jboss-as/build.xml 2008-12-29 06:00:33 UTC (rev 744)
+++ ri/trunk/jboss-as/build.xml 2008-12-29 15:06:32 UTC (rev 745)
@@ -60,6 +60,9 @@
<copy todir="${jboss.home}/server/default/deployers/webbeans.deployer/lib-int">
<fileset dir="target/webbeans.deployer">
<include name="webbeans-ri.jar" />
+ <include name="webbeans-ri-int-jbossas.jar" />
+ <include name="webbeans-api.jar" />
+ <include name="webbeans-ri-spi.jar" />
</fileset>
</copy>
@@ -67,9 +70,6 @@
<fileset dir="target/webbeans.deployer">
<include name="**/*.xml" />
<include name="webbeans-ri-int-microcontainer.jar" />
- <include name="webbeans-ri-int-jbossas.jar" />
- <include name="webbeans-api.jar" />
- <include name="webbeans-ri-spi.jar" />
<include name="google*.jar" />
</fileset>
</copy>
Modified: ri/trunk/jboss-as/resources/webbeans-deployers-jboss-beans.xml
===================================================================
--- ri/trunk/jboss-as/resources/webbeans-deployers-jboss-beans.xml 2008-12-29 06:00:33 UTC (rev 744)
+++ ri/trunk/jboss-as/resources/webbeans-deployers-jboss-beans.xml 2008-12-29 15:06:32 UTC (rev 745)
@@ -6,7 +6,7 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- Web Beans deployer -->
- <bean name="WebBeansDiscoveryDeployer" class="org.jboss.webbeans.integration.microcontainer.WebBeanDiscoveryDeployer"/>
- <bean name="WebBeansDeployer" class="org.jboss.webbeans.integration.microcontainer.WebBeansWebUrlIntegrationDeployer"/>
+ <bean name="WebBeansDiscoveryDeployer" class="org.jboss.webbeans.integration.microcontainer.deployer.env.WebBeanDiscoveryDeployer"/>
+ <bean name="WebBeansDeployer" class="org.jboss.webbeans.integration.microcontainer.deployer.cl.WebBeansWebUrlIntegrationDeployer"/>
</deployment>
15 years, 11 months
[webbeans-commits] Webbeans SVN: r744 - doc/trunk/reference/en/modules.
by webbeans-commits@lists.jboss.org
Author: nico.ben
Date: 2008-12-29 01:00:33 -0500 (Mon, 29 Dec 2008)
New Revision: 744
Added:
doc/trunk/reference/en/modules/Author_Group.xml
Modified:
doc/trunk/reference/en/modules/Book_Info.xml
Log:
Added credits for translators
Added: doc/trunk/reference/en/modules/Author_Group.xml
===================================================================
--- doc/trunk/reference/en/modules/Author_Group.xml (rev 0)
+++ doc/trunk/reference/en/modules/Author_Group.xml 2008-12-29 06:00:33 UTC (rev 744)
@@ -0,0 +1,31 @@
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+]>
+<authorgroup>
+ <author>
+ <firstname>Gavin</firstname>
+ <surname>King</surname>
+ <affiliation>
+ <jobtitle>Web Beans (JSR-299) specification lead</jobtitle>
+ <orgname>Red Hat Middleware LLC</orgname>
+ </affiliation>
+ </author>
+ <author>
+ <firstname>Pete</firstname>
+ <surname>Muir</surname>
+ <affiliation>
+ <jobtitle>Web Beans (JSR-299) Reference Implementation lead
+ </jobtitle>
+ <orgname>Red Hat Middleware LLC</orgname>
+ </affiliation>
+ </author>
+ <othercredit>
+ <firstname>Nicola</firstname>
+ <surname>Benaglia</surname>
+ <contrib>Italian Translation</contrib>
+ </othercredit>
+ <othercredit>
+ <firstname>Francesco</firstname>
+ <surname>Milesi</surname>
+ <contrib>Italian Translation</contrib>
+ </othercredit>
+</authorgroup>
Property changes on: doc/trunk/reference/en/modules/Author_Group.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Date Author Id Revision HeadURL
Modified: doc/trunk/reference/en/modules/Book_Info.xml
===================================================================
--- doc/trunk/reference/en/modules/Book_Info.xml 2008-12-27 01:50:56 UTC (rev 743)
+++ doc/trunk/reference/en/modules/Book_Info.xml 2008-12-29 06:00:33 UTC (rev 744)
@@ -1,28 +1,8 @@
-<?xml version='1.0' encoding="iso-8859-1"?>
-
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
<bookinfo>
<title>Introduction to Web Beans</title>
- <subtitle>The new Java standard for dependency injection and
- contextual state management</subtitle>
- <authorgroup>
- <author>
- <firstname>Gavin</firstname>
- <surname>King</surname>
- <affiliation>
- <jobtitle>Web Beans (JSR-299) specification lead</jobtitle>
- <orgname>Red Hat Middleware LLC</orgname>
-
- </affiliation>
- </author>
- <author>
- <firstname>Pete</firstname>
- <surname>Muir</surname>
- <affiliation>
- <jobtitle>Web Beans (JSR-299) Reference Implementation lead</jobtitle>
- <orgname>Red Hat Middleware LLC</orgname>
- </affiliation>
- </author>
- </authorgroup>
+ <subtitle>The new Java standard for dependency injection and contextual state management</subtitle>
+
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</bookinfo>
15 years, 11 months
[webbeans-commits] Webbeans SVN: r743 - doc/trunk/reference/it-IT/modules.
by webbeans-commits@lists.jboss.org
Author: nico.ben
Date: 2008-12-26 20:50:56 -0500 (Fri, 26 Dec 2008)
New Revision: 743
Modified:
doc/trunk/reference/it-IT/modules/interceptors.po
Log:
WBRI-69: Italian translation for Web Beans
Modified: doc/trunk/reference/it-IT/modules/interceptors.po
===================================================================
--- doc/trunk/reference/it-IT/modules/interceptors.po 2008-12-27 01:37:52 UTC (rev 742)
+++ doc/trunk/reference/it-IT/modules/interceptors.po 2008-12-27 01:50:56 UTC (rev 743)
@@ -6,7 +6,7 @@
"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-12-19 20:26+0000\n"
-"PO-Revision-Date: 2008-12-26 19:27+0100\n"
+"PO-Revision-Date: 2008-12-27 02:48+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -291,19 +291,19 @@
#: interceptors.xml:114
#, no-c-format
msgid "Or we could turn them both off in our test environment!"
-msgstr ""
+msgstr "Oppure si può disattivarli entrambi dal proprio ambiente di test!"
#. Tag: title
#: interceptors.xml:119
#, no-c-format
msgid "Interceptor bindings with members"
-msgstr ""
+msgstr "Interceptor binding con membri"
#. Tag: para
#: interceptors.xml:121
#, no-c-format
msgid "Suppose we want to add some extra information to our <literal>@Transactional</literal> annotation:"
-msgstr ""
+msgstr "Si supponga di voler aggiungere qualche informazione extra all'annotazione <literal>@Transactional</literal>:"
#. Tag: programlisting
#: interceptors.xml:124
@@ -327,7 +327,7 @@
#: interceptors.xml:126
#, no-c-format
msgid "Web Beans will use the value of <literal>requiresNew</literal> to choose between two different interceptors, <literal>TransactionInterceptor</literal> and <literal>RequiresNewTransactionInterceptor</literal>."
-msgstr ""
+msgstr "Web Beans utilizzerà il valore di <literal>requiresNew</literal> per scegliere tra due diversi interceptor, <literal>TransactionInterceptor</literal> e <literal>RequiresNewTransactionInterceptor</literal>."
#. Tag: programlisting
#: interceptors.xml:130
@@ -347,7 +347,7 @@
#: interceptors.xml:132
#, no-c-format
msgid "Now we can use <literal>RequiresNewTransactionInterceptor</literal> like this:"
-msgstr ""
+msgstr "Ora è possibile usare <literal>RequiresNewTransactionInterceptor</literal> in questo modo:"
#. Tag: programlisting
#: interceptors.xml:134
@@ -363,7 +363,7 @@
#: interceptors.xml:136
#, no-c-format
msgid "But what if we only have one interceptor and we want the manager to ignore the value of <literal>requiresNew</literal> when binding interceptors? We can use the <literal>@NonBinding</literal> annotation:"
-msgstr ""
+msgstr "Ma cosa succede se si ha solo un interceptor e si vuole che il manager ignori il valore di <literal>requiresNew</literal> quando si associa l'interceptor? Si può usare l'annotazione <literal>@NonBinding</literal>:"
#. Tag: programlisting
#: interceptors.xml:140
@@ -387,13 +387,13 @@
#: interceptors.xml:145
#, no-c-format
msgid "Multiple interceptor binding annotations"
-msgstr ""
+msgstr "Annotazioni per interceptor binding multipli"
#. Tag: para
#: interceptors.xml:147
#, no-c-format
msgid "Usually we use combinations of interceptor bindings types to bind multiple interceptors to a Web Bean. For example, the following declaration would be used to bind <literal>TransactionInterceptor</literal> and <literal>SecurityInterceptor</literal> to the same Web Bean:"
-msgstr ""
+msgstr "Solitamente si usano combinazioni di tipi di interceptor binding per associare pià interceptor ad un Web Bean. Per esempio, la seguente dichiarazione verrebbe impiegata per associare <literal>TransactionInterceptor</literal> e <literal>SecurityInterceptor</literal> allo stesso Web Bean:"
#. Tag: programlisting
#: interceptors.xml:152
@@ -409,7 +409,7 @@
#: interceptors.xml:154
#, no-c-format
msgid "However, in very complex cases, an interceptor itself may specify some combination of interceptor binding types:"
-msgstr ""
+msgstr "Comunque in casi molto complessi un interceptor da solo potrebbe specificare alcune combinazioni di tipi di interceptor binding:"
#. Tag: programlisting
#: interceptors.xml:157
@@ -425,7 +425,7 @@
#: interceptors.xml:159
#, no-c-format
msgid "Then this interceptor could be bound to the <literal>checkout()</literal> method using any one of the following combinations:"
-msgstr ""
+msgstr "Allora quest'interceptor potrebbe venire associato al metodo <literal>checkout()</literal> usando una delle seguenti combinazioni:"
#. Tag: programlisting
#: interceptors.xml:162
@@ -491,7 +491,7 @@
#: interceptors.xml:175
#, no-c-format
msgid "One limitation of the Java language support for annotations is the lack of annotation inheritance. Really, annotations should have reuse built in, to allow this kind of thing to work:"
-msgstr ""
+msgstr "Una limitazione del supporto del linguaggio Java per le annotazioni è la mancanza di ereditarietà delle annotazioni. In verità le annotazioni dovrebbero avere il riutilizzo predefinito per consentire che questo avvenga:"
#. Tag: programlisting
#: interceptors.xml:179
@@ -503,7 +503,7 @@
#: interceptors.xml:181
#, no-c-format
msgid "Well, fortunately, Web Beans works around this missing feature of Java. We may annotate one interceptor binding type with other interceptor binding types. The interceptor bindings are transitive—any Web Bean with the first interceptor binding inherits the interceptor bindings declared as meta-annotations."
-msgstr ""
+msgstr "Fortunatamente Web Beans provvede a questa mancanza di Java. E' possibile annotare un tipo di interceptor binding con altri tipi di interceptor binding. Gli interceptor binding sono transitivi—qualsiasi Web Bean con il primo interceptor binding eredita gli interceptor binding dichiarati come meta-annotazioni."
#. Tag: programlisting
#: interceptors.xml:186
@@ -525,7 +525,7 @@
#: interceptors.xml:188
#, no-c-format
msgid "Any Web Bean annotated <literal>@Action</literal> will be bound to both <literal>TransactionInterceptor</literal> and <literal>SecurityInterceptor</literal>. (And even <literal>TransactionalSecureInterceptor</literal>, if it exists.)"
-msgstr ""
+msgstr "Ogni Web Bean annotato con <literal>@Action</literal> verrà legato ad entrambi <literal>TransactionInterceptor</literal> e <literal>SecurityInterceptor</literal>. (E anche <literal>TransactionalSecureInterceptor</literal>, se questo esiste.)"
#. Tag: title
#: interceptors.xml:195
@@ -537,7 +537,7 @@
#: interceptors.xml:197
#, no-c-format
msgid "The <literal>@Interceptors</literal> annotation defined by the EJB specification is supported for both enterprise and simple Web Beans, for example:"
-msgstr ""
+msgstr "L'annotazione <literal>@Interceptors</literal> definita dalla specifica EJB è supportata per entrambi i Web Bean semplici ed enterprise, per esempio:"
#. Tag: programlisting
#: interceptors.xml:200
@@ -557,29 +557,29 @@
#: interceptors.xml:202
#, no-c-format
msgid "However, this approach suffers the following drawbacks:"
-msgstr ""
+msgstr "Comunque, quest'approccio soffre dei seguenti difetti:"
#. Tag: para
#: interceptors.xml:206
#, no-c-format
msgid "the interceptor implementation is hardcoded in business code,"
-msgstr ""
+msgstr "l'implementazione degli interceptor è codificata nel codice di business,"
#. Tag: para
#: interceptors.xml:209
#, no-c-format
msgid "interceptors may not be easily disabled at deployment time, and"
-msgstr ""
+msgstr "gli interceptor possono non essere facilmente disabilitati a deployment time, e"
#. Tag: para
#: interceptors.xml:212
#, no-c-format
msgid "the interceptor ordering is non-global—it is determined by the order in which interceptors are listed at the class level."
-msgstr ""
+msgstr "l'ordinamento degli interceptor è non-globale—è determinata dall'ordine in cui gli interceptor sono elencati al livello di classe."
#. Tag: para
#: interceptors.xml:217
#, no-c-format
msgid "Therefore, we recommend the use of Web Beans-style interceptor bindings."
-msgstr ""
+msgstr "Quindi si raccomanda l'uso di interceptor binding di stile Web Beans."
15 years, 11 months
[webbeans-commits] Webbeans SVN: r742 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: context and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2008-12-26 20:37:52 -0500 (Fri, 26 Dec 2008)
New Revision: 742
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java
Log:
make it compile on java5, since that't what mvn eclipse:eclipse now generates
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2008-12-26 23:26:01 UTC (rev 741)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2008-12-27 01:37:52 UTC (rev 742)
@@ -59,7 +59,7 @@
* @param process The next method to proceed to
* @param args The method calling arguments
*/
- @Override
+ //@Override
public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
{
Method proxiedMethod = Reflections.lookupMethod(method, proxy);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java 2008-12-26 23:26:01 UTC (rev 741)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java 2008-12-27 01:37:52 UTC (rev 742)
@@ -58,7 +58,7 @@
* @param bean The bean to create
* @param create Should a new one be created
*/
- @Override
+ //@Override
public <T> T get(Contextual<T> bean, boolean create)
{
if (!isActive())
15 years, 11 months
[webbeans-commits] Webbeans SVN: r741 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: context and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-26 18:26:01 -0500 (Fri, 26 Dec 2008)
New Revision: 741
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/BasicContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/ApplicationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SessionBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
Log:
ngh n+1. some renames/removes/re-appearances and local svn won't even revert...
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.lang.annotation.Annotation;
+
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Contextual;
+
+import org.jboss.webbeans.context.beanmap.BeanMap;
+
+/**
+ * Base for the Context implementations. Delegates calls to the abstract
+ * getBeanMap and getActive to allow for different implementations (storage
+ * types and ThreadLocal vs. shared)
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ * @see org.jboss.webbeans.contexts.SharedContext
+ * @see org.jboss.webbeans.context.BasicContext
+ */
+public abstract class AbstractBeanMapContext extends AbstractContext
+{
+ /**
+ * Constructor
+ *
+ * @param scopeType The scope type
+ */
+ public AbstractBeanMapContext(Class<? extends Annotation> scopeType)
+ {
+ super(scopeType);
+ }
+
+ /**
+ * Get the bean if it exists in the contexts.
+ *
+ * @param create If true, a new instance of the bean will be created if none
+ * exists
+ * @return An instance of the bean
+ * @throws ContextNotActiveException if the context is not active
+ *
+ * @see javax.webbeans.manager.Context#get(Bean, boolean)
+ */
+ public <T> T get(Contextual<T> bean, boolean create)
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException();
+ }
+ T instance = getBeanMap().get(bean);
+ if (instance != null)
+ {
+ return instance;
+ }
+ if (!create)
+ {
+ return null;
+ }
+ instance = bean.create();
+ getBeanMap().put(bean, instance);
+ return instance;
+ }
+
+ /**
+ * Destroys a bean
+ *
+ * @param <T> The type of the bean
+ * @param bean The bean to destroy
+ */
+ private <T> void destroy(Contextual<T> bean)
+ {
+ bean.destroy(getBeanMap().get(bean));
+ }
+
+ /**
+ * Destroys the context
+ */
+ public void destroy()
+ {
+ for (Contextual<? extends Object> bean : getBeanMap().keySet())
+ {
+ destroy(bean);
+ }
+ getBeanMap().clear();
+ }
+
+ /**
+ * A method that should return the actual bean map implementation
+ *
+ * @return The actual bean map
+ */
+ protected abstract BeanMap getBeanMap();
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.lang.annotation.Annotation;
+
+import javax.webbeans.manager.Context;
+
+public abstract class AbstractContext implements Context
+{
+ // The scope type
+ private Class<? extends Annotation> scopeType;
+ // The active state of the context
+ private ThreadLocal<Boolean> active;
+
+ /**
+ * Constructor
+ *
+ * @param scopeType The scope type
+ */
+ public AbstractContext(Class<? extends Annotation> scopeType)
+ {
+ this.scopeType = scopeType;
+ this.active = new ThreadLocal<Boolean>()
+ {
+ @Override
+ protected Boolean initialValue()
+ {
+ return Boolean.TRUE;
+ }
+ };
+ }
+
+ /**
+ * Get the scope the context is for
+ *
+ * @return The scope type
+ *
+ * @see javax.webbeans.manager.Context#getScopeType()
+ */
+ public Class<? extends Annotation> getScopeType()
+ {
+ return scopeType;
+ }
+
+ /**
+ * Return true if the context is active
+ *
+ * @return The active state
+ *
+ * @see javax.webbeans.manager.Context#isActive()
+ */
+ public boolean isActive()
+ {
+ return active.get().booleanValue();
+ }
+
+ /**
+ * Set the context active, internal API for WBRI
+ *
+ * @param active The new state
+ */
+ public void setActive(boolean active)
+ {
+ this.active.set(Boolean.valueOf(active));
+ }
+
+ /**
+ * Delegates to a ThreadLocal instance
+ */
+ protected Boolean getActive()
+ {
+ return active.get();
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.webbeans.ApplicationScoped;
+
+import org.jboss.webbeans.context.beanmap.BeanMap;
+
+/**
+ * The Application context
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.ApplicationContext
+ */
+public class ApplicationContext extends AbstractBeanMapContext
+{
+
+ public static ApplicationContext INSTANCE = new ApplicationContext();
+
+ // The beans
+ private BeanMap beanMap;
+ // Is the context active?
+ private AtomicBoolean active;
+
+ /**
+ * Constructor
+ */
+ protected ApplicationContext()
+ {
+ super(ApplicationScoped.class);
+ this.active = new AtomicBoolean(true);
+ }
+
+ /**
+ * Gets the bean map
+ *
+ * @return The bean map
+ */
+ @Override
+ public BeanMap getBeanMap()
+ {
+ return this.beanMap;
+ }
+
+ /**
+ * Sets the bean map
+ *
+ * @param applicationBeanMap The bean map
+ */
+ public void setBeanMap(BeanMap applicationBeanMap)
+ {
+ this.beanMap = applicationBeanMap;
+ }
+
+ /**
+ * Indicates if the context is active
+ *
+ * @return True if active, false otherwise
+ */
+ @Override
+ public boolean isActive()
+ {
+ return active.get();
+ }
+
+ /**
+ * Sets the active state of the context
+ *
+ * @param active The new state
+ */
+ @Override
+ public void setActive(boolean active)
+ {
+ this.active.set(active);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
+ return active + "application context " + beanMapInfo;
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/BasicContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/BasicContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/BasicContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+
+/**
+ * The abstraction of a private context, on that operates on a ThreadLocal
+ * BeanMap and ThreadLocal active state
+ *
+ * A private context doesn't rely on some external context to hold it's state
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.DependentContext
+ * @see org.jboss.webbeans.context.RequestContext
+ * @see org.jboss.webbeans.context.ConversationContext
+ * @see org.jboss.webbeans.context.SessionContext
+ */
+public abstract class BasicContext extends AbstractBeanMapContext
+{
+ // The beans
+ protected ThreadLocal<BeanMap> beans;
+
+ /**
+ * Constructor
+ *
+ * @param scopeType The scope types
+ */
+ public BasicContext(Class<? extends Annotation> scopeType)
+ {
+ super(scopeType);
+ beans = new ThreadLocal<BeanMap>()
+ {
+
+ @Override
+ protected BeanMap initialValue()
+ {
+ return new SimpleBeanMap();
+ }
+
+ };
+ }
+
+ /**
+ * Delegates to a ThreadLocal instance
+ */
+ @Override
+ protected BeanMap getBeanMap()
+ {
+ return beans.get();
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Future;
+
+import javax.webbeans.ExecutionException;
+import javax.webbeans.manager.Context;
+
+import org.jboss.webbeans.util.ConcurrentCache;
+import org.jboss.webbeans.util.Strings;
+
+/**
+ * A map from a scope to a list of contexts
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ */
+public class ContextMap extends ConcurrentCache<Class<? extends Annotation>, List<Context>>
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Gets the dependent context
+ *
+ * @param scopeType The scope type to get
+ * @return The dependent context
+ */
+ public AbstractContext getBuiltInContext(Class<? extends Annotation> scopeType)
+ {
+ boolean interrupted = false;
+ try
+ {
+ while (true)
+ {
+ try
+ {
+ Future<List<Context>> future = getFuture(scopeType);
+ if (future == null)
+ return null;
+ return (AbstractContext) future.get().iterator().next();
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ catch (java.util.concurrent.ExecutionException e)
+ {
+ rethrow(e);
+ }
+ }
+ }
+ finally
+ {
+ if (interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ /**
+ * Gets the list of context with the given scope type
+ *
+ * @param scopeType The scope type to match
+ * @return A list of matching contexts. An empty list is returned if there
+ * are no matches
+ */
+ public List<Context> getContext(Class<? extends Annotation> scopeType)
+ {
+ boolean interrupted = false;
+ try
+ {
+ while (true)
+ {
+ try
+ {
+ if (getFuture(scopeType) == null)
+ {
+ throw new ExecutionException("No scope registered for " + scopeType);
+ }
+ return getFuture(scopeType).get();
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ catch (java.util.concurrent.ExecutionException e)
+ {
+ rethrow(e);
+ }
+ }
+ }
+ finally
+ {
+ if (interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ContextMap holding " + delegate().size() + " contexts: " + delegate().keySet();
+ }
+
+ public String toDetailedString()
+ {
+ return Strings.mapToString("ContextMap (scope type -> context list): ", delegate());
+ }
+
+ /**
+ * Adds a context under a scope type
+ *
+ * Creates the list of contexts if it doesn't exist
+ *
+ * @param context The new context
+ */
+ public void add(Context context)
+ {
+ List<Context> contexts = putIfAbsent(context.getScopeType(), new Callable<List<Context>>()
+ {
+
+ public List<Context> call() throws Exception
+ {
+ return new CopyOnWriteArrayList<Context>();
+ }
+
+ });
+ contexts.add(context);
+ }
+
+}
\ No newline at end of file
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import javax.webbeans.ConversationScoped;
+
+/**
+ * The conversation context
+ *
+ * @author Nicklas Karlsson
+ */
+public class ConversationContext extends BasicContext
+{
+
+ /**
+ * Constructor
+ */
+ public ConversationContext()
+ {
+ super(ConversationScoped.class);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
+ return active + "conversation context " + beanMapInfo;
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/DependentContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.Dependent;
+import javax.webbeans.manager.Contextual;
+
+/**
+ * The dependent context
+ *
+ * @author Nicklas Karlsson
+ */
+public class DependentContext extends AbstractContext
+{
+
+ public static final DependentContext INSTANCE = new DependentContext();
+
+ private ThreadLocal<AtomicInteger> reentrantActiveCount;
+
+ /**
+ * Constructor
+ */
+ public DependentContext()
+ {
+ super(Dependent.class);
+ super.setActive(false);
+ this.reentrantActiveCount = new ThreadLocal<AtomicInteger>()
+ {
+ @Override
+ protected AtomicInteger initialValue()
+ {
+ return new AtomicInteger(0);
+ }
+ };
+ }
+
+ /**
+ * Overridden method always creating a new instance
+ *
+ * @param bean The bean to create
+ * @param create Should a new one be created
+ */
+ @Override
+ public <T> T get(Contextual<T> bean, boolean create)
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException();
+ }
+ // Dependent contexts don't really use any BeanMap storage
+ return create == false ? null : bean.create();
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ return active + "dependent context";
+ }
+
+ @Override
+ public void setActive(boolean active)
+ {
+ if (active)
+ {
+ if (reentrantActiveCount.get().incrementAndGet() == 1)
+ {
+ super.setActive(true);
+ }
+ }
+ else
+ {
+ if (reentrantActiveCount.get().decrementAndGet() == 0)
+ {
+ super.setActive(false);
+ }
+ }
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import javax.webbeans.RequestScoped;
+
+/**
+ * The request context
+ *
+ * @author Nicklas Karlsson
+ */
+public class RequestContext extends BasicContext
+{
+
+ public static RequestContext INSTANCE = new RequestContext();
+
+ /**
+ * Constructor
+ */
+ protected RequestContext()
+ {
+ super(RequestScoped.class);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
+ return active + "request context " + beanMapInfo;
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context;
+
+import javax.webbeans.SessionScoped;
+
+import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * The session context
+ *
+ * @author Nicklas Karlsson
+ */
+public class SessionContext extends AbstractBeanMapContext
+{
+ private static LogProvider log = Logging.getLogProvider(SessionContext.class);
+
+ public static SessionContext INSTANCE = new SessionContext();
+
+ // The beans
+ private ThreadLocal<BeanMap> beanMap;
+
+ /**
+ * Constructor
+ */
+ protected SessionContext()
+ {
+ super(SessionScoped.class);
+ log.trace("Created session context");
+ this.beanMap = new ThreadLocal<BeanMap>();
+ }
+
+ /**
+ * Gets the bean map
+ *
+ * @returns The bean map
+ * @see org.jboss.webbeans.context.AbstractContext#getBeanMap()
+ */
+ @Override
+ public BeanMap getBeanMap()
+ {
+ return beanMap.get();
+ }
+
+ /**
+ * Sets the bean map
+ *
+ * @param beanMap The bean map
+ */
+ public void setBeanMap(BeanMap beanMap)
+ {
+ this.beanMap.set(beanMap);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
+ return active + "session context " + beanMapInfo;
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context.beanmap;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.webbeans.manager.Contextual;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.Names;
+
+public abstract class AbstractBeanMap implements BeanMap
+{
+ // The log provider
+ private static LogProvider log = Logging.getLogProvider(ApplicationBeanMap.class);
+
+ /**
+ * Gets a bean from the map
+ *
+ * @param bean The bean to get
+ * @return The instance
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T get(Contextual<? extends T> bean)
+ {
+ String key = getBeanKey(bean);
+ T instance = (T) getAttribute(key);
+ log.trace("Looked for " + key + " and got " + instance);
+ return instance;
+ }
+
+ /**
+ * Removes an instance from the map
+ *
+ * @param bean The bean of the instance to remove
+ * @return The removed instance
+ */
+ public <T> T remove(Contextual<? extends T> bean)
+ {
+ T instance = get(bean);
+ String key = getBeanKey(bean);
+ removeAttribute(key);
+ log.trace("Removed bean under key " + key);
+ return instance;
+ }
+
+ /**
+ * Clears the bean map
+ */
+ @SuppressWarnings("unchecked")
+ public void clear()
+ {
+ Enumeration names = getAttributeNames();
+ while (names.hasMoreElements())
+ {
+ String name = (String) names.nextElement();
+ removeAttribute(name);
+ log.trace("Cleared " + name);
+ }
+ log.trace("Bean Map cleared");
+ }
+
+ /**
+ * Returns the beans present in the map
+ *
+ * @return The beans
+ */
+ @SuppressWarnings("unchecked")
+ public Iterable<Contextual<? extends Object>> keySet()
+ {
+ List<Contextual<?>> beans = new ArrayList<Contextual<?>>();
+ Enumeration names = getAttributeNames();
+ while (names.hasMoreElements())
+ {
+ String name = (String) names.nextElement();
+ if (name.startsWith(getKeyPrefix()))
+ {
+ String id = name.substring(getKeyPrefix().length() + 1);
+ Contextual<?> bean = CurrentManager.rootManager().getBeans().get(Integer.parseInt(id));
+ beans.add(bean);
+ }
+ }
+ return beans;
+ }
+
+ /**
+ * Puts an instance of a bean in the map
+ *
+ * @param bean The key bean
+ * @param instance The instance
+ * @return The instance added
+ */
+ public <T> void put(Contextual<? extends T> bean, T instance)
+ {
+ String key = getBeanKey(bean);
+ setAttribute(key, instance);
+ log.trace("Added bean " + bean + " under key " + key);
+ }
+
+ /**
+ * Gets an attribute from the underlying storage
+ *
+ * @param key The key of the attribute
+ * @return The data
+ */
+ protected abstract Object getAttribute(String key);
+
+ /**
+ * Removes an attribute from the underlying storage
+ *
+ * @param key The attribute to remove
+ */
+ protected abstract void removeAttribute(String key);
+
+ /**
+ * Gets an enumeration of the beans present in the underlying storage
+ *
+ * @return The current beans
+ */
+ protected abstract Enumeration<String> getAttributeNames();
+
+ /**
+ * Sets an instance under a key in the underlying storage
+ *
+ * @param key The key
+ * @param instance The instance
+ */
+ protected abstract void setAttribute(String key, Object instance);
+
+ /**
+ * Gets a key prefix that should be prefixed to names
+ *
+ * @return The prefix
+ */
+ protected abstract String getKeyPrefix();
+
+ /**
+ * Returns a map key to a bean. Uses a known prefix and appends the index of
+ * the Bean in the Manager bean list.
+ *
+ * @param bean The bean to generate a key for.
+ * @return A unique key;
+ */
+ protected String getBeanKey(Contextual<?> bean)
+ {
+ return getKeyPrefix() + "#" + CurrentManager.rootManager().getBeans().indexOf(bean);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "holding " + Names.count(keySet()) + " instances under the key prefix " + getKeyPrefix();
+ }
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/ApplicationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/ApplicationBeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/ApplicationBeanMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context.beanmap;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.context.ApplicationContext;
+
+/**
+ * A BeanMap that uses a servlet context as backing map
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.ApplicationContext
+ */
+public class ApplicationBeanMap extends AbstractBeanMap
+{
+ // The servlet context to use as backing map
+ private ServletContext context;
+
+ /**
+ * Constructor
+ *
+ * @param context The servlet context instance
+ */
+ public ApplicationBeanMap(ServletContext context)
+ {
+ super();
+ this.context = context;
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getKeyPrefix()
+ */
+ @Override
+ protected String getKeyPrefix()
+ {
+ return ApplicationContext.class.getName();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
+ */
+ @Override
+ protected Object getAttribute(String key)
+ {
+ return context.getAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttributeNames()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ return context.getAttributeNames();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#removeAttributes()
+ */
+ @Override
+ protected void removeAttribute(String key)
+ {
+ context.removeAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#setAttribute()
+ */
+ @Override
+ protected void setAttribute(String key, Object instance)
+ {
+ context.setAttribute(key, instance);
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context.beanmap;
+
+import javax.webbeans.manager.Contextual;
+
+
+/**
+ * Interface for different implementations of Bean to Bean instance storage.
+ * Used primarily by the contexts.
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.beanmap.SimpleBeanMap
+ * @see org.jboss.webbeans.context.beanmap.SessionBeanMap
+ */
+public interface BeanMap
+{
+ /**
+ * Gets an instance of a bean from the storage.
+ *
+ * @param bean The bean whose instance to return
+ * @return The instance. Null if not found
+ */
+ public abstract <T extends Object> T get(Contextual<? extends T> bean);
+
+ /**
+ * Removes an instance of a bean from the storage
+ *
+ * @param bean The bean whose instance to remove
+ * @return The removed instance. Null if not found in storage.
+ */
+ public abstract <T extends Object> T remove(Contextual<? extends T> bean);
+
+ /**
+ * Clears the storage of any bean instances
+ */
+ public abstract void clear();
+
+ /**
+ * Returns an Iterable over the current keys in the storage
+ *
+ * @return An Iterable over the keys in the storage
+ */
+ public abstract Iterable<Contextual<? extends Object>> keySet();
+
+ /**
+ * Adds a bean instance to the storage
+ *
+ * @param bean The bean type. Used as key
+ * @param instance The instance to add
+ * @return The instance added
+ */
+ public abstract <T> void put(Contextual<? extends T> bean, T instance);
+}
\ No newline at end of file
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SessionBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SessionBeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SessionBeanMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context.beanmap;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.webbeans.context.ApplicationContext;
+
+/**
+ * A BeanMap that uses a HTTP session as backing map
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.ApplicationContext
+ */
+public class SessionBeanMap extends AbstractBeanMap
+{
+ // The HTTP session context to use as backing map
+ private HttpSession session;
+
+ /**
+ * Constructor
+ *
+ * @param session The HTTP session
+ */
+ public SessionBeanMap(HttpSession session)
+ {
+ super();
+ this.session = session;
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getKeyPrefix()
+ */
+ @Override
+ protected String getKeyPrefix()
+ {
+ return ApplicationContext.class.getName();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
+ */
+ @Override
+ protected Object getAttribute(String key)
+ {
+ return session.getAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttributeNames()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ return session.getAttributeNames();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#removeAttributes()
+ */
+ @Override
+ protected void removeAttribute(String key)
+ {
+ session.removeAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#setAttribute()
+ */
+ @Override
+ protected void setAttribute(String key, Object instance)
+ {
+ session.setAttribute(key, instance);
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2008-12-26 23:26:01 UTC (rev 741)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.context.beanmap;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Contextual;
+
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.Strings;
+
+import com.google.common.collect.ForwardingMap;
+
+/**
+ * A BeanMap that uses a simple forwarding HashMap as backing map
+ *
+ * @author Nicklas Karlsson
+ */
+public class SimpleBeanMap extends ForwardingMap<Contextual<? extends Object>, Object> implements BeanMap
+{
+ private static LogProvider log = Logging.getLogProvider(SimpleBeanMap.class);
+
+ // The backing map
+ protected Map<Contextual<? extends Object>, Object> delegate;
+
+ /**
+ * Constructor
+ */
+ public SimpleBeanMap()
+ {
+ delegate = new ConcurrentHashMap<Contextual<? extends Object>, Object>();
+ }
+
+ /**
+ * Gets an instance from the map
+ *
+ * @param The bean to look for
+ * @return An instance, if found
+ *
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#get(Bean)
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T get(Contextual<? extends T> bean)
+ {
+ T instance = (T) super.get(bean);
+ log.trace("Searched bean map for " + bean + " and got " + instance);
+ return instance;
+ }
+
+ /**
+ * Gets the delegate for the map
+ *
+ * @return The delegate
+ */
+ @Override
+ public Map<Contextual<? extends Object>, Object> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Removed a instance from the map
+ *
+ * @param bean the bean to remove
+ * @return The instance removed
+ *
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#remove(Bean)
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T remove(Contextual<? extends T> bean)
+ {
+ T instance = (T) super.remove(bean);
+ log.trace("Removed instace " + instance + " for bean " + bean + " from the bean map");
+ return instance;
+ }
+
+ /**
+ * Clears the map
+ *
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#clear()
+ */
+ public void clear()
+ {
+ delegate.clear();
+ log.trace("Bean map cleared");
+ }
+
+ /**
+ * Returns the beans contained in the map
+ *
+ * @return The beans present
+ *
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#keySet()
+ */
+ public Set<Contextual<? extends Object>> keySet()
+ {
+ return delegate.keySet();
+ }
+
+ /**
+ * Puts a bean instance under the bean key in the map
+ *
+ * @param bean The bean
+ * @param instance the instance
+ *
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#put(Bean, Object)
+ */
+ public <T> void put(Contextual<? extends T> bean, T instance)
+ {
+ delegate.put(bean, instance);
+ log.trace("Stored instance " + instance + " for bean " + bean + " in bean map");
+ }
+
+ @Override
+ public String toString()
+ {
+ return "holding " + delegate.size() + " instances";
+ }
+
+ public String toDetailedString()
+ {
+ return Strings.mapToString("SimpleBeanMap (bean -> instance): ", delegate);
+ }
+
+}
\ No newline at end of file
15 years, 11 months
[webbeans-commits] Webbeans SVN: r739 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-26 18:07:16 -0500 (Fri, 26 Dec 2008)
New Revision: 739
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java
Log:
ngh2
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java 2008-12-26 22:53:34 UTC (rev 738)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java 2008-12-26 23:07:16 UTC (rev 739)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans.contexts;
-
-public class AbstractBeanMap
-{
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java (from rev 738, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java 2008-12-26 23:07:16 UTC (rev 739)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.contexts;
+
+public class AbstractBeanMapAdaptor
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java
___________________________________________________________________
Name: svn:mergeinfo
+
15 years, 11 months
[webbeans-commits] Webbeans SVN: r738 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: contexts and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-26 17:53:34 -0500 (Fri, 26 Dec 2008)
New Revision: 738
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java
Log:
ngh, messy. rename and move
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMap.java 2008-12-26 22:53:34 UTC (rev 738)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.contexts;
+
+public class AbstractBeanMap
+{
+
+}
15 years, 11 months