/* (non-Javadoc)
@see nz.co.senanque.schemaparser.SchemaParserInterface#findOperandInScope(java.lang.String, java.lang.String)
183164
@Override
	public FieldDescriptor findOperandInScope(String scope, String operand)
    {
        ObjectDescriptor currentScope = m_classes.get(scope);
        StringTokenizer st = new StringTokenizer(operand,".");
        FieldDescriptor ret = null;
        while(st.hasMoreTokens())
        {
            if (currentScope == null)
            {
                return null;
            }
            String token = st.nextToken();
            ret = currentScope.get(token);
            if (ret == null)
            {
                if (currentScope.getParent() != null)
                {
                    return findOperandInScope(currentScope.getParent(),operand);
                }
                return null;
            }
            currentScope = m_classes.get(ret.getType());
        }
        return ret;
    }
1086405
public T visitOperandDef(OperandDef elm, C context) {
        if (elm.getOperandTypeSpecifier() != null) {
            visitElement(elm.getOperandTypeSpecifier(), context);
        }
        return null;
    }
1282528
@Override
	public String getOperationMode() {
		String mode = getNode().getOperationMode();
		if(mode != null && NORMAL.equals(mode.toUpperCase())) {
			mode = NORMAL;
		}
		return mode;
	}
968308
public void setScope(String strScope) throws ApplicationException {
	strScope = strScope.trim().toLowerCase();
	if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE;
	else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE;
	else if (strScope.equals("subtree")) scope = SearchControls.SUBTREE_SCOPE;
	else throw new ApplicationException("invalid value for attribute scope [" + strScope + "], valid values are [oneLevel,base,subtree]");
    }
1092032
public static String getOperationName(final ModelNode op) {
        if (op.hasDefined(OP)) {
            return op.get(OP).asString();
        }
        throw ControllerClientLogger.ROOT_LOGGER.operationNameNotFound();
    }
878561
private List<MBeanOperationInfo> discoverOperations(Map<String, JmxOperationInfo> attributeOperationInfoMap) {
		Set<MethodSignature> methodSignatureSet = new HashSet<MethodSignature>();
		List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>(operationMethodMap.size());
		for (Class<?> clazz = target.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {
			discoverOperations(attributeOperationInfoMap, methodSignatureSet, operations, clazz);
		}
		return operations;
	}
267275
private static Map<Method, OperationId> findMethods(Class<?> type) {
    Map<Method, OperationId> operations = new HashMap<>();
    for (Method method : type.getDeclaredMethods()) {
      OperationId operationId = getOperationId(method);
      if (operationId != null) {
        if (operations.values().stream().anyMatch(operation -> operation.id().equals(operationId.id()))) {
          throw new IllegalStateException("Duplicate operation name '" + operationId.id() + "'");
        }
        operations.put(method, operationId);
      }
    }
    for (Class<?> iface : type.getInterfaces()) {
      operations.putAll(findMethods(iface));
    }
    return operations;
  }
276209
private <T> InjectScope<T> findScope(AnnotatedElement annElement)
  {
    for (Annotation ann : annElement.getAnnotations()) {
      Class<? extends Annotation> annType = ann.annotationType();

      if (annType.isAnnotationPresent(Scope.class)) {
        Supplier<InjectScope<T>> scopeGen = (Supplier) _scopeMap.get(annType);

        if (scopeGen != null) {
          return scopeGen.get();
        }
        else {
          log.fine(L.l("@{0} is an unknown scope", annType.getSimpleName()));
        }
      }
    }

    return new InjectScopeFactory<>();
  }
130569
public final UnresolvedReferenceExpression mergeOperand(UnresolvedReferenceExpression aggBuffer) {
		String name = String.valueOf(Arrays.asList(aggBufferAttributes()).indexOf(aggBuffer));
		validateOperandName(name);
		return new UnresolvedReferenceExpression(name);
	}
633209
public static boolean hasOperationType(Operation operation, Class<? extends Operation> operationType)
    {
        if (operation == null)
            return false;

        if (operationType.isAssignableFrom(operation.getClass()))
            return true;

        if (operation instanceof CompositeOperation)
        {
            List<Operation> operations = ((CompositeOperation) operation).getOperations();
            for (Operation childOperation : operations)
            {
                if (hasOperationType(childOperation, operationType))
                    return true;
            }
        }

        return false;
    }
1112794
private void scanOperator() {
        while (true) {
            reader.putChar(false);
            Name newname = reader.name();
            TokenKind tk1 = tokens.lookupKind(newname);
            if (tk1 == TokenKind.IDENTIFIER) {
                reader.sp--;
                break;
            }
            tk = tk1;
            reader.scanChar();
            if (!isSpecial(reader.ch)) break;
        }
    }
666845
public List<JvmTypeReference> findTypeValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) {
		final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType);
		if (reference != null) {
			return findTypeValues(reference);
		}
		return null;
	}
889285
public com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomer getOperand() {
        return operand;
    }
664793
public ComponentModel scan(Class<?> rulesClass, SwitchYardNamespace switchyardNamespace) throws IOException {
        if (switchyardNamespace == null) {
            switchyardNamespace = SwitchYardNamespace.DEFAULT;
        }
        Rules rules = rulesClass.getAnnotation(Rules.class);
        Class<?> rulesInterface = rules.value();
        if (Rules.UndefinedRulesInterface.class.equals(rulesInterface)) {
            rulesInterface = rulesClass;
        }
        if (!rulesInterface.isInterface()) {
            throw RulesMessages.MESSAGES.rulesInterfaceGetNameIsAClassRulesOnlyAllowedOnInterfaces(rulesInterface.getName());
        }
        String rulesName = Strings.trimToNull(rules.name());
        if (rulesName == null) {
            rulesName = rulesInterface.getSimpleName();
        }
        ComponentModel componentModel = new V1ComponentModel();
        componentModel.setName(rulesName);
        RulesNamespace rulesNamespace = RulesNamespace.fromUri(rules.namespace());
        if (rulesNamespace == null) {
            rulesNamespace = RulesNamespace.DEFAULT;
            for (RulesNamespace value : RulesNamespace.values()) {
                if (value.versionMatches(switchyardNamespace)) {
                    rulesNamespace = value;
                    break;
                }
            }
        }
        RulesComponentImplementationModel componentImplementationModel = new V1RulesComponentImplementationModel(rulesNamespace.uri());
        OperationsModel operationsModel = new V1OperationsModel(rulesNamespace.uri());
        JavaService javaService = JavaService.fromClass(rulesInterface);
        for (Method method : rulesClass.getDeclaredMethods()) {
            RulesOperationType operationType = null;
            String eventId = null;
            Global[] globalMappingAnnotations = null;
            Input[] inputMappingAnnotations = null;
            Output[] outputMappingAnnotations = null;
            Fault[] faultMappingAnnotations = null;
            if (EXECUTE_FILTER.matches(method)) {
                operationType = RulesOperationType.EXECUTE;
                Execute executeAnnotation = method.getAnnotation(Execute.class);
                globalMappingAnnotations = executeAnnotation.globals();
                inputMappingAnnotations = executeAnnotation.inputs();
                outputMappingAnnotations = executeAnnotation.outputs();
                faultMappingAnnotations = executeAnnotation.faults();
            } else if (INSERT_FILTER.matches(method)) {
                operationType = RulesOperationType.INSERT;
                Insert insertAnnotation = method.getAnnotation(Insert.class);
                globalMappingAnnotations = insertAnnotation.globals();
                inputMappingAnnotations = insertAnnotation.inputs();
                outputMappingAnnotations = insertAnnotation.outputs();
                faultMappingAnnotations = insertAnnotation.faults();
            } else if (FIRE_ALL_RULES_FILTER.matches(method)) {
                operationType = RulesOperationType.FIRE_ALL_RULES;
                FireAllRules fireAllRulesAnnotation = method.getAnnotation(FireAllRules.class);
                globalMappingAnnotations = fireAllRulesAnnotation.globals();
                inputMappingAnnotations = fireAllRulesAnnotation.inputs();
                outputMappingAnnotations = fireAllRulesAnnotation.outputs();
                faultMappingAnnotations = fireAllRulesAnnotation.faults();
            } else if (FIRE_UNTIL_HALT_FILTER.matches(method)) {
                operationType = RulesOperationType.FIRE_UNTIL_HALT;
                FireUntilHalt fireUntilHaltAnnotation = method.getAnnotation(FireUntilHalt.class);
                eventId = Strings.trimToNull(fireUntilHaltAnnotation.eventId());
                globalMappingAnnotations = fireUntilHaltAnnotation.globals();
                inputMappingAnnotations = fireUntilHaltAnnotation.inputs();
                outputMappingAnnotations = fireUntilHaltAnnotation.outputs();
                faultMappingAnnotations = fireUntilHaltAnnotation.faults();
            }
            if (operationType != null) {
                ServiceOperation serviceOperation = javaService.getOperation(method.getName());
                if (serviceOperation != null) {
                    OperationModel operationModel = new V1RulesOperationModel(rulesNamespace.uri());
                    operationModel.setEventId(eventId);
                    operationModel.setName(serviceOperation.getName());
                    operationModel.setType(operationType);
                    operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, rulesNamespace));
                    operationModel.setInputs(toInputsModel(inputMappingAnnotations, rulesNamespace));
                    operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, rulesNamespace));
                    operationModel.setFaults(toFaultsModel(faultMappingAnnotations, rulesNamespace));
                    operationsModel.addOperation(operationModel);
                }
            }
        }
        if (!operationsModel.getOperations().isEmpty()) {
            componentImplementationModel.setOperations(operationsModel);
        }
        componentImplementationModel.setChannels(toChannelsModel(rules.channels(), rulesNamespace, componentModel, switchyardNamespace));
        componentImplementationModel.setListeners(toListenersModel(rules.listeners(), rulesNamespace));
        componentImplementationModel.setLoggers(toLoggersModel(rules.loggers(), rulesNamespace));
        componentImplementationModel.setManifest(toManifestModel(rules.manifest(), rulesNamespace));
        componentImplementationModel.setProperties(toPropertiesModel(rules.properties(), rulesNamespace));
        componentModel.setImplementation(componentImplementationModel);
        ComponentServiceModel componentServiceModel = new V1ComponentServiceModel(switchyardNamespace.uri());
        InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA);
        interfaceModel.setInterface(rulesInterface.getName());
        componentServiceModel.setInterface(interfaceModel);
        componentServiceModel.setName(rulesName);
        componentModel.addService(componentServiceModel);
        return componentModel;
    }
41498
protected boolean isTargetUriInScope(String uri) {
		if (uri == null) {
			return false;
		}
		return getModel().getSession().isInScope(uri);
	}
666968
public Operations getOperationsFor(final PMContext ctx, Object instance, Operation operation) throws PMException {
        final Operations result = new Operations();
        final List<Operation> r = new ArrayList<Operation>();
        if (operation != null) {
            for (Operation op : getOperations()) {
                if (op.isDisplayed(operation.getId()) && op.isEnabled() && !op.equals(operation)) {
                    if (op.getCondition() == null || op.getCondition().check(ctx, instance, op, operation.getId())) {
                        if (instance != null || OperationScope.GENERAL.is(op.getScope()) || OperationScope.SELECTED.is(op.getScope())) {
                            r.add(op);
                        }
                    }
                }
            }
        }
        result.setOperations(r);
        return result;
    }
712219
public MBeanOperationInfo[] getOperationsInfo(String domainName, String beanName) throws JMException {
		return getOperationsInfo(ObjectNameUtil.makeObjectName(domainName, beanName));
	}