Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SingletonContext, remove a couple of uneeded checks, add atinject…
… tck runner module git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@3818 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
29 changed files
with
439 additions
and
205 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
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
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
111 changes: 111 additions & 0 deletions
111
impl/src/main/java/org/jboss/webbeans/context/AbstractApplicationContext.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,111 @@ | ||
/* | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
* | ||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. | ||
* | ||
* Use is subject to license terms. | ||
* | ||
* 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.concurrent.atomic.AtomicBoolean; | ||
|
||
import org.jboss.webbeans.context.api.BeanStore; | ||
|
||
/** | ||
* The Application context | ||
* | ||
* @author Nicklas Karlsson | ||
* | ||
* @see org.jboss.webbeans.context.AbstractApplicationContext | ||
*/ | ||
public abstract class AbstractApplicationContext extends AbstractMapContext | ||
{ | ||
|
||
// The beans | ||
private BeanStore beanStore; | ||
// Is the context active? | ||
private final AtomicBoolean active; | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public AbstractApplicationContext(Class<? extends Annotation> scope) | ||
{ | ||
super(scope); | ||
this.active = new AtomicBoolean(false); | ||
} | ||
|
||
/** | ||
* Gets the bean store | ||
* | ||
* @return The bean store | ||
*/ | ||
@Override | ||
public BeanStore getBeanStore() | ||
{ | ||
return this.beanStore; | ||
} | ||
|
||
/** | ||
* Sets the bean store | ||
* | ||
* @param applicationBeanStore The bean store | ||
*/ | ||
public void setBeanStore(BeanStore applicationBeanStore) | ||
{ | ||
this.beanStore = applicationBeanStore; | ||
} | ||
|
||
/** | ||
* 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 beanStoreInfo = getBeanStore() == null ? "" : getBeanStore().toString(); | ||
return active + "application context " + beanStoreInfo; | ||
} | ||
|
||
@Override | ||
protected boolean isCreationLockRequired() | ||
{ | ||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.