Example usage for org.dom4j Element elementText

List of usage examples for org.dom4j Element elementText

Introduction

In this page you can find the example usage for org.dom4j Element elementText.

Prototype

String elementText(QName qname);

Source Link

Usage

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

@SuppressWarnings("unchecked")
private static List<INodeInfo> getViewNodeInfo(Element root) throws TitanComponentException {

    List<Element> viewNodeElements = root.elements(KEY_NODETYPE_VIEW);
    List<INodeInfo> viewNodeInfos = new ArrayList<INodeInfo>(viewNodeElements.size());

    for (Element baseComponentElement : viewNodeElements) {

        String id = baseComponentElement.attributeValue(KEY_NODE_ID);
        String name = baseComponentElement.elementText(KEY_NODE_NAME);
        String description = baseComponentElement.elementText(KEY_NODE_DESCRIPTION);
        String location = baseComponentElement.elementText(KEY_NODE_LOCATION);
        String type = baseComponentElement.elementText(KEY_NODE_TYPE);

        logger.debug("load view component id = \"" + id + "\"");
        logger.debug("load view component name = \"" + name + "\"");
        logger.debug("load view component description = \"" + description + "\"");
        logger.debug("load view component location = \"" + location + "\"");
        logger.debug("load view component type = \"" + type + "\"");

        ViewNodeInfo baseComponentNodeInfo = new ViewNodeInfo(id, name, description, location, type);

        viewNodeInfos.add(baseComponentNodeInfo);
    }/*from  ww  w. jav a2 s  . c o m*/

    return viewNodeInfos;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

private static TitanActionComponentInfo createActionComponentInfo(Bundle bundle, Element root)
        throws TitanComponentException {
    Element information = root.element(KEY_INFORMATION);

    String key = information.elementText(KEY_MODULE_KEY);
    String name = information.elementText(KEY_MODULE_NAME);
    String description = information.elementText(KEY_MODULE_DESCRIPTION);

    logger.debug("load action component symbolicName = \"" + bundle.getSymbolicName() + "\"");
    logger.debug("load action component key = \"" + key + "\"");
    logger.debug("load action component name = \"" + name + "\"");
    logger.debug("load action component description = \"" + description + "\"");

    TitanActionComponentInfo titanActionComponentInfo = new TitanActionComponentInfo(bundle.getSymbolicName(),
            key, name, description);// www.  java 2  s .  c  om

    return titanActionComponentInfo;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

private static TitanLogicComponentInfo createLogicComponentInfo(Bundle bundle, Element root)
        throws TitanComponentException {

    Element information = root.element(KEY_INFORMATION);
    String key = information.elementText(KEY_MODULE_KEY);
    String name = information.elementText(KEY_MODULE_NAME);
    String description = information.elementText(KEY_MODULE_DESCRIPTION);

    logger.debug("load logic component symbolicName = \"" + bundle.getSymbolicName() + "\"");
    logger.debug("load logic component key = \"" + key + "\"");
    logger.debug("load logic component name = \"" + name + "\"");
    logger.debug("load logic component description = \"" + description + "\"");

    TitanLogicComponentInfo titanLogicComponentInfo = new TitanLogicComponentInfo(bundle.getSymbolicName(), key,
            name, description);// ww w .  jav  a 2 s  .  c o  m

    return titanLogicComponentInfo;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

private static INodeInfo getStartNodeInfo(Bundle bundle, Element root) throws TitanComponentException {

    Element start = root.element(KEY_NODETYPE_START);

    String name = start.elementText(KEY_NODE_NAME);
    String description = start.elementText(KEY_NODE_DESCRIPTION);
    String nextId = start.attributeValue(KEY_NODE_NEXT);
    List<IParameterInfo> parameters = getParameterInfos(bundle, start.element(KEY_PARAMETER_LIST));

    logger.debug("load start node name = \"" + name + "\"");
    logger.debug("load start node description = \"" + description + "\"");
    logger.debug("load start node nextId = \"" + nextId + "\"");

    return new StartNodeInfo(name, description, nextId, parameters);
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

@SuppressWarnings("unchecked")
private static List<INodeInfo> getBaseComponentNodeInfo(Bundle bundle, Element root)
        throws TitanComponentException {

    List<Element> baseComponentElements = root.elements(KEY_NODETYPE_COMPONENT);
    List<INodeInfo> baseComponentNodeInfos = new ArrayList<INodeInfo>(baseComponentElements.size());

    for (Element baseComponentElement : baseComponentElements) {
        List<IParameterInfo> parameters = getParameterInfos(bundle,
                baseComponentElement.element(KEY_PARAMETER_LIST));

        String id = baseComponentElement.attributeValue(KEY_NODE_ID);
        String name = baseComponentElement.elementText(KEY_NODE_NAME);
        String description = baseComponentElement.elementText(KEY_NODE_DESCRIPTION);
        String nextId = baseComponentElement.attributeValue(KEY_NODE_NEXT);
        String key = baseComponentElement.elementText(KEY_NODE_KEY);

        logger.debug("load component node id = \"" + id + "\"");
        logger.debug("load component node key = \"" + key + "\"");
        logger.debug("load component node name = \"" + name + "\"");
        logger.debug("load component node description = \"" + description + "\"");
        logger.debug("load component node nextId = \"" + nextId + "\"");

        BaseComponentNodeInfo baseComponentNodeInfo = new BaseComponentNodeInfo(id, name, description, nextId,
                parameters, key);/*from  w  w w  .ja  va  2 s  .  c o m*/

        baseComponentNodeInfos.add(baseComponentNodeInfo);
    }

    return baseComponentNodeInfos;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

@SuppressWarnings("unchecked")
private static List<INodeInfo> getLogicComponentNodeInfo(Bundle bundle, Element root)
        throws TitanComponentException {
    List<Element> logicComponentElements = root.elements(KEY_NODETYPE_LOGIC);
    List<INodeInfo> logicComponentNodeInfos = new ArrayList<INodeInfo>(logicComponentElements.size());

    for (Element logicComponentElement : logicComponentElements) {
        String id = logicComponentElement.attributeValue(KEY_NODE_ID);
        String name = logicComponentElement.elementText(KEY_NODE_NAME);
        String description = logicComponentElement.elementText(KEY_NODE_DESCRIPTION);
        String nextId = logicComponentElement.attributeValue(KEY_NODE_NEXT);
        String key = logicComponentElement.elementText(KEY_NODE_KEY);

        logger.debug("load logic node id = \"" + id + "\"");
        logger.debug("load logic node key = \"" + key + "\"");
        logger.debug("load logic node name = \"" + name + "\"");
        logger.debug("load logic node description = \"" + description + "\"");
        logger.debug("load logic node nextId = \"" + nextId + "\"");

        List<IParameterInfo> parameters = getParameterInfos(bundle,
                logicComponentElement.element(KEY_PARAMETER_LIST));

        LogicComponentNodeInfo endNodeInfo = new LogicComponentNodeInfo(id, name, description, nextId,
                parameters, key);/*from   w  ww  .j ava 2s. c  om*/

        logicComponentNodeInfos.add(endNodeInfo);
    }

    return logicComponentNodeInfos;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

@SuppressWarnings("unchecked")
private static List<INodeInfo> getEndNodeInfo(Bundle bundle, Element root) throws TitanComponentException {

    List<Element> endElements = root.elements(KEY_NODETYPE_END);
    List<INodeInfo> endNodeInfos = new ArrayList<INodeInfo>(endElements.size());

    for (Element endElement : endElements) {
        String id = endElement.attributeValue(KEY_NODE_ID);
        String name = endElement.elementText(KEY_NODE_NAME);
        String description = endElement.elementText(KEY_NODE_DESCRIPTION);

        logger.debug("load end node id = \"" + id + "\"");
        logger.debug("load end node name = \"" + name + "\"");
        logger.debug("load end node description = \"" + description + "\"");

        EndNodeInfo logicComponentNodeInfo = new EndNodeInfo(id, name, description);

        endNodeInfos.add(logicComponentNodeInfo);
    }//  w  w w .j a  v a 2 s  .co  m

    return endNodeInfos;
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

private static IBaseComponentInfo createBaseComponentInfo(Bundle bundle, Element component)
        throws TitanComponentException {

    String componetClass = component.attributeValue(KEY_COMPONENT_CLASS);

    String key = component.attributeValue(KEY_MODULE_KEY);
    String name = component.attributeValue(KEY_MODULE_NAME);
    String description = component.elementText(KEY_MODULE_DESCRIPTION);
    Class<?> componentType = loadClass(bundle, componetClass);

    logger.debug("load base component symbolicName = \"" + bundle.getSymbolicName() + "\"");
    logger.debug("load base component key = \"" + key + "\"");
    logger.debug("load base component name = \"" + name + "\"");
    logger.debug("load base component description = \"" + description + "\"");
    logger.debug("load base component componentType = \"" + componentType + "\"");

    return new TitanBaseComponentInfo(bundle.getSymbolicName(), key, name, description, componentType,
            getParameterInfos(bundle, component.element(KEY_PARAMETER_LIST)));
}

From source file:edu.ccut.titan.component.loader.ComponentLoader.java

License:Apache License

private static IParameterInfo createParameterInfo(Bundle bundle, Element parameter)
        throws TitanComponentException {
    String parameterClass = parameter.attributeValue(KEY_PARAMETER_CLASS_TYPE);

    Class<?> parameterType = loadClass(bundle, parameterClass);

    int scope = IParameterInfo.SCOPE_LOGIC;

    try {//from   w  ww .  j  a  v a  2s.c  om
        scope = Integer.parseInt(parameter.elementText(KEY_PARAMETER_SCOPE));
    } catch (NumberFormatException e) {
        e.printStackTrace();
    }

    String id = parameter.attributeValue(KEY_PARAMETER_ID);
    String name = parameter.attributeValue(KEY_PARAMETER_NAME);
    String passingType = parameter.attributeValue(KEY_PARAMETER_PASSING_TYPE);
    String valueKey = parameter.elementText(KEY_PARAMETER_VALUE_KEY);
    String description = parameter.elementText(KEY_PARAMETER_DECRRIPTION);

    logger.debug("     load parameter id = \"" + id + ", name = \"" + name + ", parameterType = \""
            + parameterClass + ", passingType = \"" + passingType + ", valueKey = \"" + valueKey
            + ", description = \"" + description + ", scope = \"" + scope);

    return new TitanParameterInfo(id, name, parameterType, passingType, valueKey, description, scope);
}

From source file:edu.ccut.titan.component.loader.DirectoryInfoLoader.java

License:Apache License

private static IDirectoryInfo loadDirectoryInfo(InputStream in) throws TitanComponentException {

    Document document = Dom4jUtils.getDocment(in);

    Element root = document.getRootElement();

    String version = root.elementText(KEY_VERSION);
    String description = root.elementText(KEY_DESCRIPTION);
    String type = root.elementText(KEY_TYPE);
    String time = root.elementText(KEY_TIME);

    logger.debug("load root directory version = \"" + version + "\"");
    logger.debug("load root directory description = \"" + description + "\"");
    logger.debug("load root directory type = \"" + type + "\"");
    logger.debug("load root directory time = \"" + time + "\"");

    IDirectoryInfo directoryInfo = TitanDirectoryFactory.getInstance().createDirectory(version, description,
            type, time);//  w  w w.  j  av  a 2s  . c  om

    return directoryInfo;
}