private Object getPropertyObject(String variable, EvaluationContext context, boolean ignoreWarnings, boolean useEnvironment) throws ConfigEvaluatorException {
        Object realValue = null;

        // checked if we already looked up the value
        if (context.containsValue(variable)) {
            // get it from cache
            realValue = context.getValue(variable);
        } else if (XMLConfigConstants.CFG_SERVICE_PID.equals(variable)) {
            try {
                realValue = configEvaluator.getPid(context.getConfigElement().getConfigID());
                context.putValue(XMLConfigConstants.CFG_SERVICE_PID, realValue);
            } catch (ConfigNotFoundException ex) {
                throw new ConfigEvaluatorException("Could not obtain PID for configID", ex);
            }
        } else {
            // evaluate the variable

            context.push(variable);

            realValue = lookupVariableFromRegistry(variable);

            if (realValue == null) {
                // Try checking the properties. This will pick up already evaluated attributes, including flattened config
                realValue = context.getProperties().get(variable);

                if (realValue == null) {
                    // check if this is an metatype attribute
                    ExtendedAttributeDefinition attributeDef = context.getAttributeDefinition(variable);
                    if (attributeDef != null) {

                        String currentAttribute = context.getAttributeName();
                        // Get the nested info here, then set it later so that evaluating the
                        // metatype attribute here doesn't affect it
                        Set<NestedInfo> nestedInfo = context.getNestedInfo();
                        String flatPrefix = "";
                        try {
                            realValue = configEvaluator.evaluateMetaTypeAttribute(variable, context, attributeDef, flatPrefix, ignoreWarnings);
                        } finally {
                            context.setAttributeName(currentAttribute);
                            context.setNestedInfo(nestedInfo);
                        }

                    } else {
                        // check if this is just an attribute
                        ConfigElement configElement = context.getConfigElement();
                        Object rawValue = configElement.getAttribute(variable);
                        if (rawValue != null) {

                            String currentAttribute = context.getAttributeName();
                            Set<NestedInfo> nestedInfo = context.getNestedInfo();
                            try {
                                realValue = configEvaluator.evaluateSimpleAttribute(variable, rawValue, context, "", ignoreWarnings);
                            } finally {
                                context.setAttributeName(currentAttribute);
                                context.setNestedInfo(nestedInfo);
                            }

                        }
                    }
                }

                if (realValue == null) {
                    // Check if this variable points to an unevaluated flattened config
                    Map<String, ExtendedAttributeDefinition> attributeMap = context.getAttributeMap();
                    if (attributeMap != null) {
                        for (Map.Entry<String, ExtendedAttributeDefinition> entry : attributeMap.entrySet()) {
                            if (!context.isProcessed(entry.getKey()) && entry.getValue().isFlat()) {
                                try {
                                    configEvaluator.evaluateMetaTypeAttribute(entry.getKey(), context, entry.getValue(), "", true);
                                } catch (ConfigEvaluatorException ex) {
                                    // Ignore -- errors should be generated during main line processing
                                }

                            }

                        }
                        // Try again now that everything should be evaluated
                        realValue = context.getProperties().get(variable);
                    }
                }

                // Try to get an environment variable ( env.MYVAR )
                if (realValue == null && useEnvironment) {
                    realValue = lookupEnvironmentVariable(variable);
                }

                // Try to get a default value (<variable name="var" default="defaultValue"/>)
                if (realValue == null) {
                    realValue = lookupDefaultVariable(variable);
                }

                if (realValue == null) {
                    // If the value is null, add it to the context so that we don't try to evaluate it again.
                    // If the value is not null here, this is a variable that points to a configuration attribute,
                    // so we don't want to add it to the variable registry.
                    context.addDefinedVariable(variable, null);
                }
            } else {
                // Only add the variable to the context if this is a user defined variable
                context.addDefinedVariable(variable, realValue);
            }

            context.pop();

            context.putValue(variable, realValue);
        }

        return realValue;
    }
private Object getPropertyObject ( String variable , EvaluationContext context , boolean ignoreWarnings , boolean useEnvironment ) throws ConfigEvaluatorException { Object realValue = null ; if ( context . containsValue ( variable ) ) { realValue = context . getValue ( variable ) ; } else if ( XMLConfigConstants . CFG_SERVICE_PID . equals ( variable ) ) { try { realValue = configEvaluator . getPid ( context . getConfigElement ( ) . getConfigID ( ) ) ; context . putValue ( XMLConfigConstants . CFG_SERVICE_PID , realValue ) ; } catch ( ConfigNotFoundException ex ) { throw new ConfigEvaluatorException ( "Could not obtain PID for configID" , ex ) ; } } else { context . push ( variable ) ; realValue = lookupVariableFromRegistry ( variable ) ; if ( realValue == null ) { realValue = context . getProperties ( ) . get ( variable ) ; if ( realValue == null ) { ExtendedAttributeDefinition attributeDef = context . getAttributeDefinition ( variable ) ; if ( attributeDef != null ) { String currentAttribute = context . getAttributeName ( ) ; Set < NestedInfo > nestedInfo = context . getNestedInfo ( ) ; String flatPrefix = "" ; try { realValue = configEvaluator . evaluateMetaTypeAttribute ( variable , context , attributeDef , flatPrefix , ignoreWarnings ) ; } finally { context . setAttributeName ( currentAttribute ) ; context . setNestedInfo ( nestedInfo ) ; } } else { ConfigElement configElement = context . getConfigElement ( ) ; Object rawValue = configElement . getAttribute ( variable ) ; if ( rawValue != null ) { String currentAttribute = context . getAttributeName ( ) ; Set < NestedInfo > nestedInfo = context . getNestedInfo ( ) ; try { realValue = configEvaluator . evaluateSimpleAttribute ( variable , rawValue , context , "" , ignoreWarnings ) ; } finally { context . setAttributeName ( currentAttribute ) ; context . setNestedInfo ( nestedInfo ) ; } } } } if ( realValue == null ) { Map < String , ExtendedAttributeDefinition > attributeMap = context . getAttributeMap ( ) ; if ( attributeMap != null ) { for ( Map . Entry < String , ExtendedAttributeDefinition > entry : attributeMap . entrySet ( ) ) { if ( ! context . isProcessed ( entry . getKey ( ) ) && entry . getValue ( ) . isFlat ( ) ) { try { configEvaluator . evaluateMetaTypeAttribute ( entry . getKey ( ) , context , entry . getValue ( ) , "" , true ) ; } catch ( ConfigEvaluatorException ex ) { } } } realValue = context . getProperties ( ) . get ( variable ) ; } } if ( realValue == null && useEnvironment ) { realValue = lookupEnvironmentVariable ( variable ) ; } if ( realValue == null ) { realValue = lookupDefaultVariable ( variable ) ; } if ( realValue == null ) { context . addDefinedVariable ( variable , null ) ; } } else { context . addDefinedVariable ( variable , realValue ) ; } context . pop ( ) ; context . putValue ( variable , realValue ) ; } return realValue ; }
Returns the raw value object of the variable, or null if the property
does not exist.

@param variable the variable name