1 package org
.argeo
.slc
.core
.test
.context
;
3 import java
.util
.Collection
;
5 import java
.util
.Vector
;
7 import org
.argeo
.slc
.runtime
.test
.ContextUtils
;
8 import org
.argeo
.slc
.test
.context
.ContextAware
;
9 import org
.argeo
.slc
.test
.context
.ParentContextAware
;
10 import org
.springframework
.beans
.factory
.InitializingBean
;
12 public class SimpleParentContextAware
extends SimpleContextAware
implements
13 ParentContextAware
, InitializingBean
{
14 private List
<ContextAware
> children
= new Vector
<ContextAware
>();
16 public Collection
<ContextAware
> getChildContexts() {
20 public void addChildContext(ContextAware contextAware
) {
21 children
.add(contextAware
);
25 public void afterPropertiesSet() throws Exception
{
26 if (getParentContext() != null) {
27 // If has a parent, sync it.
28 super.afterPropertiesSet();
30 if (children
.size() > 0) {
31 // No need to synchronize if no children
32 ContextUtils
.synchronize(this);