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