You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/10/17 22:42:11 UTC

svn commit: r826306 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: context/SingletonContext.java portable/creation/DefaultInjectionTargetImpl.java

Author: gerdogdu
Date: Sat Oct 17 20:42:11 2009
New Revision: 826306

URL: http://svn.apache.org/viewvc?rev=826306&view=rev
Log:
Adding singleton context.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java   (with props)

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java?rev=826306&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java Sat Oct 17 20:42:11 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.context;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.context.type.ContextTypes;
+
+/**
+ * Application context implementation.
+ * 
+ */
+public class SingletonContext extends AbstractContext
+{
+    protected SingletonContext()
+    {
+        super(ContextTypes.SINGLETON);
+    }
+
+    @Override
+    public void setComponentInstanceMap()
+    {
+        this.componentInstanceMap = new ConcurrentHashMap<Contextual<?>, Object>();
+
+    }
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java?rev=826306&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java Sat Oct 17 20:42:11 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.portable.creation;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.config.ManagedBeanConfigurator;
+
+public class DefaultInjectionTargetImpl<T> implements InjectionTarget<T>
+{
+    private InjectionTargetProducer<T> target;
+    
+    private DefaultInjectionTargetImpl(AnnotatedType<T> annotatedType)
+    {
+        target = new InjectionTargetProducer<T>(ManagedBeanConfigurator.defineFromAnnotatedType(annotatedType));
+    }
+
+    @Override
+    public void inject(T instance, CreationalContext<T> ctx)
+    {
+        this.target.inject(instance, ctx);
+    }
+
+    @Override
+    public void postConstruct(T instance)
+    {
+        this.target.postConstruct(instance);
+    }
+
+    @Override
+    public void preDestroy(T instance)
+    {
+        this.target.preDestroy(instance);
+    }
+
+    @Override
+    public void dispose(T instance)
+    {
+        this.target.dispose(instance);
+    }
+
+    @Override
+    public Set<InjectionPoint> getInjectionPoints()
+    {
+        return this.target.getInjectionPoints();
+    }
+
+    @Override
+    public T produce(CreationalContext<T> creationalContext)
+    {
+        return this.target.produce(creationalContext);
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/DefaultInjectionTargetImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native