Example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR

List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Prototype

String LINE_SEPARATOR

To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Click Source Link

Document

The line.separator System Property.

Usage

From source file:org.apache.ojb.broker.locking.LockManagerCommonsImpl.java

public String getLockInfo() {
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer msg = new StringBuffer("Class: " + LockManagerCommonsImpl.class.getName() + eol);
    msg.append("lock timeout: " + getLockTimeout() + " [ms]" + eol);
    msg.append("block timeout: " + getBlockTimeout() + " [ms]" + eol);
    msg.append("commons-tx lock-manger info ==> " + eol);
    msg.append(lm);//w  ww.j  ava2  s  .c o  m
    return msg.toString();
}

From source file:org.apache.ojb.broker.locking.LockManagerInMemoryImpl.java

public String getLockInfo() {
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer msg = new StringBuffer("Class: " + LockManagerInMemoryImpl.class.getName() + eol);
    msg.append("lock timeout: " + getLockTimeout() + " [ms]" + eol);
    msg.append("concurrent lock owners: " + locktable.size() + eol);
    msg.append("timed out write locks: " + timeoutCounterWrite + eol);
    msg.append("timed out read locks: " + timeoutCounterRead + eol);
    return msg.toString();
}

From source file:org.apache.ojb.broker.metadata.CollectionDescriptor.java

public String toXML() {
    RepositoryTags tags = RepositoryTags.getInstance();
    String eol = SystemUtils.LINE_SEPARATOR;

    // write opening tag
    String result = "      " + tags.getOpeningTagNonClosingById(COLLECTION_DESCRIPTOR) + eol;

    // write attributes
    // name// w w  w  .  j  a  v a2 s.  com
    result += "        " + tags.getAttribute(FIELD_NAME, this.getAttributeName()) + eol;

    // collection class is optional
    if (getCollectionClassName() != null) {
        result += "        " + tags.getAttribute(COLLECTION_CLASS, this.getCollectionClassName()) + eol;
    }

    // element-class-ref
    result += "        " + tags.getAttribute(ITEMS_CLASS, this.getItemClassName()) + eol;

    // indirection-table is optional
    if (isMtoNRelation()) {
        result += "        " + tags.getAttribute(INDIRECTION_TABLE, getIndirectionTable()) + eol;
    }

    // proxyReference is optional, disabled by default
    if (isLazy()) {
        result += "        " + tags.getAttribute(PROXY_REFERENCE, "true") + eol;
        result += "        " + tags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit())
                + eol;
    }

    //reference refresh is optional, disabled by default
    if (isRefresh()) {
        result += "        " + tags.getAttribute(REFRESH, "true") + eol;
    }

    //auto retrieve
    result += "        " + tags.getAttribute(AUTO_RETRIEVE, "" + getCascadeRetrieve()) + eol;

    //auto update
    result += "        " + tags.getAttribute(AUTO_UPDATE, getCascadeAsString(getCascadingStore())) + eol;

    //auto delete
    result += "        " + tags.getAttribute(AUTO_DELETE, getCascadeAsString(getCascadingDelete())) + eol;

    //otm-dependent is optional, disabled by default
    if (getOtmDependent()) {
        result += "        " + tags.getAttribute(OTM_DEPENDENT, "true") + eol;
    }

    // close opening tag
    result += "      >" + eol;

    // write elements
    // inverse fk elements
    for (int i = 0; i < getForeignKeyFields().size(); i++) {
        Object obj = getForeignKeyFields().get(i);
        if (obj instanceof Integer) {
            String fkId = obj.toString();
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
            result += tags.getAttribute(FIELD_ID_REF, fkId) + "/>" + eol;
        } else {
            String fk = (String) obj;
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
            result += tags.getAttribute(FIELD_REF, fk) + "/>" + eol;
        }
    }

    // write optional M:N elements
    // m:n relationship settings, optional
    if (isMtoNRelation()) {
        // foreign keys to this class
        for (int i = 0; i < getFksToThisClass().length; i++) {
            String fkId = getFksToThisClass()[i];
            result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_THIS_CLASS) + " ";
            result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
        }

        // foreign keys to item class
        for (int i = 0; i < getFksToItemClass().length; i++) {
            String fkId = getFksToItemClass()[i];
            result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_ITEMS_CLASS) + " ";
            result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
        }
    }

    // closing tag
    result += "      " + tags.getClosingTagById(COLLECTION_DESCRIPTOR) + eol;
    return result;
}

From source file:org.apache.ojb.broker.metadata.ConnectionPoolDescriptor.java

public String toXML() {
    RepositoryTags tags = RepositoryTags.getInstance();
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer buf = new StringBuffer();
    //opening tag + attributes
    buf.append("      ").append(tags.getOpeningTagById(CONNECTION_POOL)).append(eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_MAX_ACTIVE, "" + getMaxActive()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_MAX_IDLE, "" + getMaxIdle()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_MAX_WAIT, "" + getMaxWait()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_MIN_EVICTABLE_IDLE_TIME_MILLIS,
            "" + getMinEvictableIdleTimeMillis()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_NUM_TESTS_PER_EVICTION_RUN,
            "" + getNumTestsPerEvictionRun()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_TEST_ON_BORROW, "" + isTestOnBorrow())
            + eol);/* w w  w .j av a 2 s .  c o  m*/
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_TEST_ON_RETURN, "" + isTestOnReturn())
            + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_TEST_WHILE_IDLE, "" + isTestWhileIdle())
            + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
            "" + getTimeBetweenEvictionRunsMillis()) + eol);
    buf.append("         "
            + tags.getAttribute(RepositoryElements.CON_WHEN_EXHAUSTED_ACTION, "" + getWhenExhaustedAction())
            + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.VALIDATION_QUERY, "" + getValidationQuery())
            + eol);

    buf.append(
            "         " + tags.getAttribute(RepositoryElements.CON_LOG_ABANDONED, "" + isLogAbandoned()) + eol);
    buf.append("         "
            + tags.getAttribute(RepositoryElements.CON_REMOVE_ABANDONED, "" + isRemoveAbandoned()) + eol);
    buf.append("         " + tags.getAttribute(RepositoryElements.CON_REMOVE_ABANDONED_TIMEOUT,
            "" + getRemoveAbandonedTimeout()) + eol);

    buf.append("         <!-- ");
    buf.append(eol);
    buf.append("         Add JDBC-level properties here, like fetchSize.");
    buf.append("         Attributes with name prefix \"jdbc.\" are passed directly to the JDBC driver.");
    buf.append(eol);
    buf.append("         e.g. <attribute attribute-name=\"fetchSize\" attribute-value=\"100\"/>");
    buf.append(eol);
    buf.append("         -->");
    XmlHelper.appendSerializedAttributes(buf, "         ", this);

    buf.append("      ").append(tags.getClosingTagById(CONNECTION_POOL)).append(eol);
    return buf.toString();
}

From source file:org.apache.ojb.broker.metadata.ConnectionRepository.java

public String toXML() {
    String eol = SystemUtils.LINE_SEPARATOR;
    // use copy to avoid sync problems
    HashMap map = (HashMap) jcdMap.clone();
    StringBuffer buf = new StringBuffer();
    Iterator it = map.values().iterator();
    while (it.hasNext()) {
        JdbcConnectionDescriptor jcd = (JdbcConnectionDescriptor) it.next();
        buf.append(jcd.toXML());/*from  w  ww  .j  a v a 2s  . com*/
        buf.append(eol);
    }
    return buf.toString();
}

From source file:org.apache.ojb.broker.metadata.DescriptorRepository.java

public String toXML() {
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer buf = new StringBuffer();

    // write all ClassDescriptors
    Iterator i = this.iterator();
    while (i.hasNext()) {
        buf.append(((XmlCapable) i.next()).toXML() + eol);
    }/*from   w  ww. j a  va  2 s. co m*/
    return buf.toString();
}

From source file:org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase.java

/**
 * Build a String representation of given arguments.
 */// w w  w .ja  va2s .  co  m
protected String buildErrorSetMsg(Object obj, Object value, Field aField) {
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer buf = new StringBuffer();
    buf.append(eol + "[try to set 'object value' in 'target object'")
            .append(eol + "target obj class: " + (obj != null ? obj.getClass().getName() : null))
            .append(eol + "target field name: " + (aField != null ? aField.getName() : null))
            .append(eol + "target field type: " + (aField != null ? aField.getType() : null))
            .append(eol + "target field declared in: "
                    + (aField != null ? aField.getDeclaringClass().getName() : null))
            .append(eol + "object value class: " + (value != null ? value.getClass().getName() : null))
            .append(eol + "object value: " + (value != null ? value : null)).append(eol + "]");
    return buf.toString();
}

From source file:org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase.java

/**
 * Build a String representation of given arguments.
 *///from  w w  w . ja v  a 2  s  . c  o m
protected String buildErrorGetMsg(Object obj, Field aField) {
    String eol = SystemUtils.LINE_SEPARATOR;
    StringBuffer buf = new StringBuffer();
    buf.append(eol + "[try to read from source object")
            .append(eol + "source obj class: " + (obj != null ? obj.getClass().getName() : null))
            .append(eol + "target field name: " + (aField != null ? aField.getName() : null))
            .append(eol + "target field type: " + (aField != null ? aField.getType() : null))
            .append(eol + "target field declared in: "
                    + (aField != null ? aField.getDeclaringClass().getName() : null))
            .append(eol + "]");
    return buf.toString();
}

From source file:org.apache.ojb.broker.metadata.FieldDescriptor.java

/**
 * determines the JDBC type (represented as an int value as specified
 * by java.sql.Types) of a FIELDDESCRIPTOR.
 *
 * @return int the int value representing the Type according to
 * java.sql.Types./*  ww w.  j  a  v a  2s  .  c o  m*/
 */
private JdbcType lookupJdbcType() {
    JdbcType result = null;
    String columnType = getColumnType();
    // if sql type was not set in metadata we use reflection
    // to determine sql type by reflection
    if (columnType == null) {
        try {
            result = JdbcTypesHelper.getJdbcTypeByReflection(m_PersistentField.getType().getName());
        } catch (Exception e) {
            String eol = SystemUtils.LINE_SEPARATOR;
            throw new OJBRuntimeException("Can't automatically assign a jdbc field-type for field: " + eol
                    + this.toXML() + eol + "in class: " + eol + getClassDescriptor(), e);
        }
    } else {
        try {
            result = JdbcTypesHelper.getJdbcTypeByName(columnType);
        } catch (Exception e) {
            String eol = SystemUtils.LINE_SEPARATOR;
            throw new OJBRuntimeException("Can't assign the specified jdbc field-type '" + columnType
                    + "' for field: " + eol + this.toXML() + eol + "in class: " + eol + getClassDescriptor(),
                    e);
        }
    }
    return result;
}

From source file:org.apache.ojb.broker.metadata.FieldDescriptor.java

/**
 * Returns a string representation of this class.
 *///from   w w  w  .  ja  v  a2s . com
public String toString() {
    ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
    buf.append("columnName", m_ColumnName);
    buf.append("columnType", m_ColumnType);
    buf.append("isPrimaryKey", m_IsKeyField);
    buf.append("isLocking", m_locking);
    buf.append("isAutoincrement", m_autoIncrement);
    buf.append("access", m_access);
    buf.append("sequenceName", m_sequenceName);
    buf.append("jdbcType", m_jdbcType);
    buf.append("super_class_fields ", "=> " + super.toString());
    buf.append(SystemUtils.LINE_SEPARATOR);
    return buf.toString();
}