Skip to content

Commit

Permalink
doc updates
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@418 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
nickarls committed Dec 5, 2008
1 parent 80d869e commit 6bbbe9d
Show file tree
Hide file tree
Showing 36 changed files with 126 additions and 51 deletions.
Expand Up @@ -107,8 +107,6 @@ public static Class<? extends Annotation> getDeploymentType(List<Class<? extends

/**
* Constructor
*
* @param manager The Web Beans manager
*/
public AbstractBean()
{
Expand Down
Expand Up @@ -59,7 +59,6 @@ public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>>
*
* @param annotatedItem Annotations read from java classes
* @param xmlAnnotatedItem Annotations read from XML
* @param manager The Web Beans manager
*/
public AbstractClassBean(Class<T> type)
{
Expand Down
Expand Up @@ -56,7 +56,6 @@ public class EnterpriseBean<T> extends AbstractClassBean<T>
* Constructor
*
* @param type The type of the bean
* @param manager The Web Beans manager
*/
public EnterpriseBean(Class<T> type)
{
Expand Down
Expand Up @@ -52,8 +52,6 @@ public class EventBean<T> extends AbstractBean<Event<T>, Field>
* Constructor
*
* @param field The underlying field abstraction
* @param declaringBean
* @param manager The Web Beans manager
*/
@SuppressWarnings("unchecked")
public EventBean(AnnotatedField<T> field)
Expand Down
Expand Up @@ -48,7 +48,6 @@ public class MergedStereotypes<T, E>
* Constructor
*
* @param stereotypeAnnotations The stereotypes to merge
* @param manager The Web Beans manager
*/
public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
{
Expand All @@ -63,7 +62,6 @@ public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
* Perform the merge
*
* @param stereotypeAnnotations The stereotype annotations
* @param manager The Web Beans manager
*/
protected void merge(Set<Annotation> stereotypeAnnotations)
{
Expand Down
Expand Up @@ -56,7 +56,6 @@ public class ProducerMethodBean<T> extends AbstractBean<T, Method>
*
* @param method The producer method
* @param declaringBean The declaring bean instance
* @param manager The Web Beans manager
*/
public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean)
{
Expand All @@ -68,7 +67,6 @@ public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean)
*
* @param method The producer method abstraction
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
public ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?> declaringBean)
{
Expand Down
Expand Up @@ -58,7 +58,6 @@ public class SimpleBean<T> extends AbstractClassBean<T>
* Constructor
*
* @param type The type of the bean
* @param manager The Web Beans manager
*/
public SimpleBean(Class<T> type)
{
Expand Down
Expand Up @@ -32,7 +32,6 @@ public class XmlEnterpriseBean<T> extends EnterpriseBean<T>
* Constructor
*
* @param type The type of the bean
* @param manager The Web Beans manager
*/
public XmlEnterpriseBean(Class<T> type)
{
Expand Down
Expand Up @@ -32,7 +32,6 @@ public class XmlSimpleBean<T> extends SimpleBean<T>
* Constructor
*
* @param type The type of the bean
* @param manager The Web Beans manager
*/
public XmlSimpleBean(Class<T> type)
{
Expand Down
Expand Up @@ -49,7 +49,6 @@ public class ProxyMethodHandler implements MethodHandler, Serializable
*
* @param bean The bean to proxy
* @param beanIndex The index to the bean in the manager bean list
* @param manager The manager implementation
*/
public ProxyMethodHandler(Bean<?> bean, int beanIndex)
{
Expand Down
@@ -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 org.jboss.webbeans.contexts;

import javax.webbeans.manager.Contextual;
Expand All @@ -7,6 +24,11 @@
public abstract class AbstractBeanMapAdaptor implements BeanMap
{

/**
* Gets a key prefix that should be prefixed to names
*
* @return The prefix
*/
protected abstract String getKeyPrefix();

/**
Expand Down
Expand Up @@ -125,11 +125,20 @@ public void setActive(boolean active)
this.active.set(Boolean.valueOf(active));
}

/**
* 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())
Expand Down
Expand Up @@ -32,38 +32,67 @@
*/
public class ApplicationContext extends AbstractContext
{

// The beans
private BeanMap beanMap;
// Is the context active?
private AtomicBoolean active;

/**
* Constructor
*/
public 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;
}

/**
* Helper method for accessing context
*
* @return The application context
*/
public static ApplicationContext instance()
{
return (ApplicationContext) ManagerImpl.instance().getBuiltInContext(ApplicationScoped.class);
}

/**
* 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)
{
Expand Down
Expand Up @@ -34,8 +34,14 @@
*/
public abstract class BasicContext extends AbstractContext
{
// The beans
protected ThreadLocal<BeanMap> beans;

/**
* Constructor
*
* @param scopeType The scope types
*/
public BasicContext(Class<? extends Annotation> scopeType)
{
super(scopeType);
Expand Down
Expand Up @@ -73,7 +73,14 @@ public AbstractContext getBuiltInContext(Class<? extends Annotation> scopeType)
}
}
}


/**
* 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;
Expand Down Expand Up @@ -122,12 +129,12 @@ 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);
}
Expand Down
Expand Up @@ -27,6 +27,9 @@
public class ConversationContext extends BasicContext
{

/**
* Constructor
*/
public ConversationContext()
{
super(ConversationScoped.class);
Expand Down
Expand Up @@ -29,6 +29,9 @@
public class DependentContext extends BasicContext
{

/**
* Constructor
*/
public DependentContext()
{
super(Dependent.class);
Expand Down
Expand Up @@ -29,11 +29,19 @@
public class RequestContext extends BasicContext
{

/**
* Constructor
*/
public RequestContext()
{
super(RequestScoped.class);
}

/**
* Helper method for accessing context
*
* @return The request context
*/
public static RequestContext instance()
{
return (RequestContext) ManagerImpl.instance().getBuiltInContext(RequestScoped.class);
Expand Down
Expand Up @@ -48,7 +48,6 @@ public class SessionBeanMap implements BeanMap
/**
* Constructor
*
* @param manager The Web Beans manager
* @param keyPrefix The storage names prefix
*/
public SessionBeanMap(String keyPrefix)
Expand Down
Expand Up @@ -30,28 +30,46 @@
*/
public class SessionContext extends AbstractContext
{

private static LogProvider log = Logging.getLogProvider(SessionContext.class);

// The beans
private ThreadLocal<BeanMap> beanMap;

/**
* Constructor
*/
public SessionContext()
{
super(SessionScoped.class);
log.trace("Created session context");
}


/**
* Gets the bean map
*
* @returns The bean map
* @see org.jboss.webbeans.contexts.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);
}


/**
* Helper method for accessing context
*
* @return The session context
*/
public static SessionContext instance()
{
return (SessionContext) ManagerImpl.instance().getBuiltInContext(SessionScoped.class);
Expand Down
Expand Up @@ -43,7 +43,6 @@ public class DeferredEventNotification<T> implements Synchronization
/**
* Creates a new deferred event notifier.
*
* @param manager The Web Beans manager
* @param observer The observer to be notified
* @param event The event being fired
*/
Expand Down
Expand Up @@ -53,7 +53,6 @@ public class EventImpl<T> implements Event<T>
/**
* Constructor
*
* @param manager The Web Beans manager
* @param bindingTypes The binding types
*/
public EventImpl(Annotation... bindingTypes)
Expand Down
Expand Up @@ -139,8 +139,6 @@ public String toString()

/**
* Initializes a new instance of the EventManager.
*
* @param manager The Web Beans manager
*/
public EventManager()
{
Expand Down
Expand Up @@ -51,7 +51,6 @@ public interface AnnotatedConstructor<T> extends AnnotatedItem<T, Constructor<T>
/**
* Creates a new instance of the class, using this constructor
*
* @param manager The Web Beans manager
* @return The created instance
*/
public T newInstance();
Expand Down

0 comments on commit 6bbbe9d

Please sign in to comment.