Example usage for org.jdom2 Element getChildTextTrim

List of usage examples for org.jdom2 Element getChildTextTrim

Introduction

In this page you can find the example usage for org.jdom2 Element getChildTextTrim.

Prototype

public String getChildTextTrim(final String cname) 

Source Link

Document

Returns the trimmed textual content of the named child element, or null if there's no such child.

Usage

From source file:org.jpos.q2.iso.ChannelAdaptor.java

License:Open Source License

protected void initSpaceAndQueues() throws ConfigurationException {
    Element persist = getPersist();
    sp = grabSpace(persist.getChild("space"));
    in = persist.getChildTextTrim("in");
    out = persist.getChildTextTrim("out");
    String s = persist.getChildTextTrim("reconnect-delay");
    delay = s != null ? Long.parseLong(s) : 10000; // reasonable default
    keepAlive = "yes".equalsIgnoreCase(persist.getChildTextTrim("keep-alive"));
    ignoreISOExceptions = "yes".equalsIgnoreCase(persist.getChildTextTrim("ignore-iso-exceptions"));
    writeOnly = "yes".equalsIgnoreCase(getPersist().getChildTextTrim("write-only"));
    String t = persist.getChildTextTrim("timeout");
    timeout = t != null && t.length() > 0 ? Long.parseLong(t) : 0l;
    ready = getName() + ".ready";
    reconnect = getName() + ".reconnect";
    waitForWorkersOnStop = "yes".equalsIgnoreCase(persist.getChildTextTrim("wait-for-workers-on-stop"));
}

From source file:org.jpos.q2.iso.DailyTaskAdaptor.java

License:Open Source License

protected void initService() throws Exception {
    QFactory factory = getServer().getFactory();
    Element e = getPersist();
    task = (Runnable) factory.newInstance(e.getChildTextTrim("class"));
    factory.setLogger(task, e);/*from w  w w . ja v  a 2  s. c o  m*/
}

From source file:org.jpos.q2.iso.MultiSessionChannelAdaptor.java

License:Open Source License

@Override
protected void initSpaceAndQueues() throws ConfigurationException {
    super.initSpaceAndQueues();
    Element persist = getPersist();
    String s = persist.getChildTextTrim("sessions");
    setSessions(s != null && s.length() > 0 ? Integer.parseInt(s) : 1);
}

From source file:org.jpos.q2.iso.MUXPool.java

License:Open Source License

public void initService() throws ConfigurationException {
    Element e = getPersist();
    muxName = toStringArray(e.getChildTextTrim("muxes"));
    strategy = getStrategy(e.getChildTextTrim("strategy"));
    overrideMTIs = toStringArray(e.getChildTextTrim("follower-override"));
    originalChannelField = e.getChildTextTrim("original-channel-field");
    splitField = e.getChildTextTrim("split-field");
    checkEnabled = cfg.getBoolean("check-enabled");
    sp = grabSpace(e.getChild("space"));
    mux = new MUX[muxName.length];
    try {/*w w w .j a v  a2s. c  o  m*/
        for (int i = 0; i < mux.length; i++)
            mux[i] = QMUX.getMUX(muxName[i]);
    } catch (NameRegistrar.NotFoundException ex) {
        throw new ConfigurationException(ex);
    }
    NameRegistrar.register("mux." + getName(), this);
}

From source file:org.jpos.q2.iso.OneShotChannelAdaptor.java

License:Open Source License

public void initAdaptor() {
    Element persist = getPersist();
    sp = grabSpace(persist.getChild("space"));
    in = persist.getChildTextTrim("in");
    out = persist.getChildTextTrim("out");
    delay = 5000;/*from  w  ww  . j  a  va 2  s.c  om*/

    String s = persist.getChildTextTrim("max-connections");
    maxConnections = s != null ? Integer.parseInt(s) : 1; // reasonable default
    s = persist.getChildTextTrim("max-connect-attempts");
    maxConnectAttempts = s != null ? Integer.parseInt(s) : 15; // reasonable default
}

From source file:org.jpos.q2.iso.OneShotChannelAdaptorMK2.java

License:Open Source License

@Override
protected void initService() throws Exception {
    Element persist = getPersist();
    channelElement = persist.getChild("channel");
    if (channelElement == null) {
        throw new ConfigurationException("channel element missing");
    }//  w  ww. ja va 2 s .  c  om
    sp = grabSpace(persist.getChild("space"));
    in = persist.getChildTextTrim("in");
    out = persist.getChildTextTrim("out");
    ready = getName() + ".ready";

    String s = persist.getChildTextTrim("max-connections");
    maxConnections = s != null ? Integer.parseInt(s) : 1;
    handbackFields = cfg.getInts("handback-field");

    s = persist.getChildTextTrim("delay");
    delay = s != null ? Integer.valueOf(s) : 2500;

    s = persist.getChildTextTrim("check-interval");
    checkInterval = s != null ? Integer.valueOf(s) : 60000;

    NameRegistrar.register(getName(), this);
}

From source file:org.jpos.q2.iso.QMUX.java

License:Open Source License

public void initService() throws ConfigurationException {
    Element e = getPersist();
    sp = grabSpace(e.getChild("space"));
    isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace();
    in = e.getChildTextTrim("in");
    out = e.getChildTextTrim("out");
    ignorerc = e.getChildTextTrim("ignore-rc");
    key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY);
    ready = toStringArray(e.getChildTextTrim("ready"));
    mtiMapping = toStringArray(e.getChildTextTrim("mtimapping"));
    if (mtiMapping == null || mtiMapping.length != 3)
        mtiMapping = new String[] { nomap, nomap, "0022446789" };
    addListeners();//  w  w w .j  a  v a2  s  .c  o m
    unhandled = e.getChildTextTrim("unhandled");
    NameRegistrar.register("mux." + getName(), this);
}

From source file:org.jpos.q2.iso.TaskAdaptor.java

License:Open Source License

protected void initService() throws Exception {
    QFactory factory = getServer().getFactory();
    Element e = getPersist();
    task = factory.newInstance(e.getChildTextTrim("class"));
    factory.setLogger(task, e);//from w ww.  j a  v  a 2  s.  c  om
}

From source file:org.mycore.datamodel.metadata.MCRMetaAddress.java

License:Open Source License

/**
 * This method reads the XML input stream part from a DOM part for the
 * metadata of the document.//from  ww w  . j a  va2  s  .  com
 * 
 * @param element
 *            a relevant JDOM element for the metadata
 */
@Override
public final void setFromDOM(final org.jdom2.Element element) {
    super.setFromDOM(element);
    country = element.getChildTextTrim("country");
    state = element.getChildTextTrim("state");
    zipCode = element.getChildTextTrim("zipcode");
    city = element.getChildTextTrim("city");
    street = element.getChildTextTrim("street");
    number = element.getChildTextTrim("number");
}

From source file:org.mycore.datamodel.metadata.MCRMetaHistoryDate.java

License:Open Source License

/**
 * This method reads the XML input stream part from a DOM part for the
 * metadata of the document./*from  www .  j av  a2  s.com*/
 * 
 * @param element
 *            a relevant JDOM element for the metadata
 */
@Override
public void setFromDOM(org.jdom2.Element element) {
    super.setFromDOM(element);
    texts.clear(); // clear

    for (Element textElement : (Collection<Element>) element.getChildren("text")) {
        String text = textElement.getText();
        String lang = textElement.getAttributeValue("lang", Namespace.XML_NAMESPACE);
        if (lang != null) {
            setText(text, lang);
        } else {
            setText(text);
        }
    }
    setCalendar(element.getChildTextTrim("calendar"));
    setVonDate(element.getChildTextTrim("von"), calendar);
    setBisDate(element.getChildTextTrim("bis"), calendar);
}