public Object internalExecute(ControllerContext context) { // todo - change to actual id when impl return context.getName(); } }
public Object internalExecute(ControllerContext context) { return context.getName(); } }
public Object getName() { return delegate.getName(); }
public String[] getBeanDefinitionNames() { List<String> result = new ArrayList<String>(); ControllerStateModel stateModel = kernelController.getStates(); for (ControllerState state : stateModel) { Set<ControllerContext> byState = kernelController.getContextsByState(state); for (ControllerContext context : byState) { result.add(context.getName().toString()); } } return result.toArray(new String[result.size()]); }
public void install(ControllerContext context) throws Throwable { boolean trace = log.isTraceEnabled(); if (context == null) throw new IllegalArgumentException("Null context"); Object name = context.getName(); if (name == null) throw new IllegalArgumentException("Null name " + context.toShortString()); install(context, trace); }
public void initialVisit(MetaDataVisitor visitor) { ControllerContext context = visitor.getControllerContext(); if (context instanceof WeldKernelControllerContext == false) throw new IllegalStateException("Context is not a WeldKernelControllerContext " + context.getName()); this.context = (WeldKernelControllerContext)context; visitor.addDependency(new WeldDependencyItem(context.getName())); }
private ObjectName createObjectName(ControllerContext context, JMX jmx) throws Exception { ObjectName objectName = null; if (jmx != null) { String jmxName = jmx.name(); if (jmxName != null && jmxName.length() > 0) objectName = new ObjectName(jmxName); } if (objectName == null) { // try to build one from the bean name String name = (String) context.getName(); if (name.contains(":")) { objectName = new ObjectName(name); } else { objectName = new ObjectName("test:name='" + name + "'"); } } return objectName; } }
protected DependencyItem createDependencyItem(ControllerContext owner) { if (cardinality != null) return new CallbackDependencyItem(owner.getName(), getIDependOn(), whenRequired, dependentState, cardinality); else return null; } }
public void install(ControllerContext ctx) throws Exception { log.trace("Invoking install callback '" + installMethod + "' on " + bean + " for target " + bean + " at " + whenRequired); installed = true; Controller controller = ctx.getController(); ControllerContext callbackContext = controller.getContext(bean, dependentState); if (callbackContext instanceof InvokeDispatchContext) { try { ((InvokeDispatchContext)callbackContext).invoke(installMethod, new Object[]{ctx}, new String[]{ControllerContext.class.getName()}); } catch(Throwable t) { throw new Exception("Error calling callback " + bean + " for target context " + ctx.getName(), t); } } else { throw new IllegalArgumentException("Cannot install " + ctx.getName() + ". Lifecycle callback context " + bean + " does not implement InvokeDispatchContext"); } }
protected DependencyItem createDependencyItem(ControllerContext owner) { if (cardinality != null) return new CallbackDependencyItem(owner.getName(), getIDependOn(), whenRequired, dependentState, cardinality); else return null; }
protected DependencyItem createDependencyItem(ControllerContext owner) { if (cardinality != null) return new CallbackDependencyItem(owner.getName(), getIDependOn(), whenRequired, dependentState, cardinality); else return null; } }
public Map<String, Object> getBeansWithAnnotation(final Class<? extends Annotation> annotationType) throws BeansException { Set<ControllerContext> controllerContexts = kernelController.filter(kernelController.getContextsByState(ControllerState.INSTALLED), new ContextFilter() { public boolean accepts(ControllerContext context) { Set<AnnotationMetaData> annotationMetaDataSet = ((KernelControllerContext) context).getBeanMetaData().getAnnotations(); for (AnnotationMetaData annotationMetaData : annotationMetaDataSet) { if (annotationType.isAssignableFrom(annotationMetaData.getAnnotationInstance().annotationType())) { return true; } } return false; } }); Map<String, Object> returnedObjects = new HashMap<String, Object>(); for (ControllerContext controllerContext : controllerContexts) { returnedObjects.put((String) controllerContext.getName(), controllerContext.getTarget()); } return returnedObjects; }
public Object getControllerContextName() { ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class); if (controllerContext != null) { return controllerContext.getName(); } else { DeploymentContext parent = getParent(); if (parent == null) throw new IllegalStateException("Deployment ControllerContext has not been set"); return parent.getControllerContextName(); } }
public void describeVisit(MetaDataVisitor visitor) { Object name = context.getName(); Object iDependOn = getUnderlyingValue(); ControllerState whenRequired = visitor.getContextState(); ControllerState dependentState = state; if (dependentState == null) dependentState = ControllerState.INSTALLED; DependencyItem item = new SearchDependencyItem(name, iDependOn, whenRequired, dependentState, search); visitor.addDependency(item); super.describeVisit(visitor); }
public boolean resolve(Controller controller) { ControllerContext context = getControllerContext(controller); if (context != null) { setIDependOn(context.getName()); addDependsOnMe(controller, context); setResolved(true); } else { setResolved(false); } return isResolved(); }
/** * Add optional dependency. * * @param controller the controller * @param lookup the lookup context */ protected void addOptionalDependency(Controller controller, ControllerContext lookup) { OptionalDependencyItem dependency = new OptionalDependencyItem(context.getName(), lookup.getName(), lookup.getState()); context.getDependencyInfo().addIDependOn(dependency); lookup.getDependencyInfo().addDependsOnMe(dependency); }
public void initialVisit(MetaDataVisitor visitor) { context = visitor.getControllerContext(); setValue(context.getName()); ControllerState whenRequired = visitor.getContextState(); DependencyItem item = new AbstractDependencyItem(getUnderlyingValue(), getUnderlyingValue(), whenRequired, ControllerState.INSTANTIATED); visitor.addDependency(item); super.initialVisit(visitor); }
public boolean resolve(Controller controller) { Object iDependOn = module.resolve(controller, requirement); if (iDependOn != null) { ControllerContext context = controller.getContext(iDependOn, CLASSLOADER); if (context != null) { setIDependOn(context.getName()); addDependsOnMe(controller, context); setResolved(true); } else { setResolved(false); } } return isResolved(); }
public boolean resolve(Controller controller) { Object name = getDemandObject(); ControllerContext context; if (targetState == null) context = controller.getInstalledContext(name); else context = controller.getContext(name, targetState); if (context != null) { setIDependOn(context.getName()); addDependsOnMe(controller, context); setResolved(true); } else { setResolved(false); } return isResolved(); }
public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); buffer.append(" dependsOn=").append(iDependOn); ControllerState whenRequired = getWhenRequired(); if (whenRequired != null) buffer.append(" whenRequired=").append(whenRequired.getStateString()); ControllerState dependentState = getDependentState(); if (dependentState != null) buffer.append(" dependentState=").append(dependentState.getStateString()); ControllerContext semiResolvedContext = getSemiResolvedContext(); if (semiResolvedContext != null) buffer.append(" semi-resolved=" + semiResolvedContext.getName()); buffer.append(" resolved=").append(resolved); }