https://jira.jboss.org/jira/browse/JBMICROCONT-407
After talking to Ales I have come up with a new version of the visitor
| private boolean hasInjectedBeans(BeanMetaData beanMetaData)
| {
| DependencyMetaDataVisitor visitor = new
DependencyMetaDataVisitor(beanMetaData);
| List<ValueMetaData> dependencies = visitor.getDependencies();
|
| for (ValueMetaData dep : dependencies)
| {
| //Ignore the dependencies from the kernel objects
|
if(!((String)dep.getUnderlyingValue()).startsWith("jboss.kernel:service="))
| {
| return true;
| }
| }
| return false;
| }
|
| private static class DependencyMetaDataVisitor extends JBossObject implements
MetaDataVisitor
| {
| MetaDataVisitorNode node;
| List<ValueMetaData> dependencies = new ArrayList<ValueMetaData>();
| protected Stack<MetaDataVisitorNode> visitorNodeStack = new
Stack<MetaDataVisitorNode>();
|
| public DependencyMetaDataVisitor(MetaDataVisitorNode node)
| {
| this.node = node;
| describeVisit(node);
| }
|
| public List<ValueMetaData> getDependencies()
| {
| return dependencies;
| }
|
| public void addDependency(DependencyItem dependency)
| {
| }
|
| public <T> void addInstallCallback(CallbackItem<T> callback)
| {
| }
|
| public <T> void addUninstallCallback(CallbackItem<T> callback)
| {
| }
|
| public ControllerState getContextState()
| {
| return null;
| }
|
| public KernelControllerContext getControllerContext()
| {
| return null;
| }
|
| public void initialVisit(MetaDataVisitorNode node)
| {
| throw new NotImplementedException("Not implemented");
| }
|
| public void describeVisit(MetaDataVisitorNode node)
| {
| visitorNodeStack.push(node);
| try
| {
| internalDescribeVisit(node);
| }
| finally
| {
| visitorNodeStack.pop();
| }
| }
|
| private void internalDescribeVisit(MetaDataVisitorNode node)
| {
| if (node instanceof AbstractDependencyValueMetaData)
| {
| dependencies.add((AbstractDependencyValueMetaData)node);
| }
| Iterator<? extends MetaDataVisitorNode> children = node.getChildren();
| if (children != null)
| {
| while (children.hasNext())
| {
| MetaDataVisitorNode child = children.next();
| child.describeVisit(this);
| }
| }
| }
|
| public void setContextState(ControllerState contextState)
| {
| }
|
| public Stack<MetaDataVisitorNode> visitorNodeStack()
| {
| return visitorNodeStack;
| }
|
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209007#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...