Package org.apache.oodt.cas.pushpull.expressions

Examples of org.apache.oodt.cas.pushpull.expressions.Variable


                                    || (ch <= '9' && ch >= '0') || ch == '_')
                                variable.append(ch);
                            else
                                break;
                        }
                        Variable v = GlobalVariables.hashMap.get(variable
                                .toString());
                        input = input.replaceFirst("${" + variable + "}", v
                                .toString());
                        i = i + v.toString().length();
                    }
                } catch (Exception e) {
                }
                break;
            case '%':
View Full Code Here


            if (node.getNodeName().equals("variable")) {
                NodeList children = node.getChildNodes();

                // create Variable Object
                String variableName = ((Element) node).getAttribute("name");
                Variable variable = new Variable(variableName);

                // loop through to fill Variable
                String type = null, value = null;
                for (int j = 0; j < children.getLength(); j++) {
                    Node child = children.item(j);

                    // get the Variable's name
                    if (child.getNodeName().equals("type")) {
                        type = child.getTextContent().toLowerCase();

                        // get the Variable's value
                    } else if (child.getNodeName().equals("value")) {
                        value = PathUtils.doDynamicReplacement(child
                                .getTextContent());

                        // get the Variable's value's precision infomation
                    } else if (child.getNodeName().equals("precision")) {
                        NodeList grandChildren = child.getChildNodes();
                        for (int k = 0; k < grandChildren.getLength(); k++) {
                            Node grandChild = grandChildren.item(k);
                            // get the precision
                            if (grandChild.getNodeName().equals("locations")) {
                                variable.setPrecision(Integer
                                        .parseInt(grandChild.getTextContent()));
                                // get the fill character to meet the precision
                                // [optional]
                            } else if (grandChild.getNodeName().equals("fill")) {
                                variable.setFillString(grandChild
                                        .getTextContent());
                                // get the side for which the fill character
                                // will be applied [optional]
                            } else if (grandChild.getNodeName().equals("side")) {
                                variable.setFillSide((grandChild
                                        .getTextContent().toLowerCase()
                                        .equals("front")) ? variable.FILL_FRONT
                                        : variable.FILL_BACK);
                            }
                        }
                    }
                }
                // determine if variable is an Integer or a String
                if (type.equals("int")) {
                    variable.setValue(new Integer(value));
                } else
                    variable.setValue(value);

                // store Variable in list of Variables
                GlobalVariables.hashMap.put(variable.getName(), variable);
            }
        }
    }
View Full Code Here

                                    || ch == '_')
                                variable.append(ch);
                            else
                                break;
                        }
                        Variable v = GlobalVariables.hashMap.get(variable
                                .toString());
                        if (v == null)
                          throw new Exception("No variable defined with name '" + variable.toString() + "'");
                        input = input.replaceFirst("\\$\\{" + variable + "\\}", v.toString());
                        i = i + v.toString().length();
                    }
                } catch (Exception e) {
                  LOG.log(Level.WARNING, "Failed to replace variable in '" + input + " for i = '" + i + "' : " + e.getMessage(), e);
                }
                break;
View Full Code Here

            if (node.getNodeName().equals("variable")) {
                NodeList children = node.getChildNodes();

                // create Variable Object
                String variableName = ((Element) node).getAttribute("name");
                Variable variable = new Variable(variableName);

                // loop through to fill Variable
                String type = null, value = null;
                for (int j = 0; j < children.getLength(); j++) {
                    Node child = children.item(j);

                    // get the Variable's name
                    if (child.getNodeName().equals("type")) {
                        type = XMLUtils.getSimpleElementText((Element) child,
                                true).toLowerCase();

                        // get the Variable's value
                    } else if (child.getNodeName().equals("value")) {
                        value = PathUtils.doDynamicReplacement(XMLUtils
                                .getSimpleElementText((Element) child, false));

                        // get the Variable's value's precision infomation
                    } else if (child.getNodeName().equals("precision")) {
                        NodeList grandChildren = child.getChildNodes();
                        for (int k = 0; k < grandChildren.getLength(); k++) {
                            Node grandChild = grandChildren.item(k);
                            // get the precision
                            if (grandChild.getNodeName().equals("locations")) {
                                variable.setPrecision(Integer.parseInt(XMLUtils
                                        .getSimpleElementText((Element) grandChild, true)));
                                // get the fill character to meet the precision
                                // [optional]
                            } else if (grandChild.getNodeName().equals("fill")) {
                                variable.setFillString(
                                    XMLUtils.getSimpleElementText((Element) grandChild, false));
                                // get the side for which the fill character
                                // will be applied [optional]
                            } else if (grandChild.getNodeName().equals("side")) {
                                variable.setFillSide(
                                        (XMLUtils.getSimpleElementText((Element) grandChild, true)
                                            .toLowerCase().equals("front"))
                                                ? variable.FILL_FRONT
                                                : variable.FILL_BACK);
                            }
                        }
                    }
                }
                // determine if variable is an Integer or a String
                if (type.equals("int")) {
                    variable.setValue(new Integer(value));
                } else
                    variable.setValue(value);

                // store Variable in list of Variables
                GlobalVariables.hashMap.put(variable.getName(), variable);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.expressions.Variable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.