當前位置: 首頁>>代碼示例>>Java>>正文


Java EnvironmentConfig.getReadOnly方法代碼示例

本文整理匯總了Java中com.sleepycat.je.EnvironmentConfig.getReadOnly方法的典型用法代碼示例。如果您正苦於以下問題:Java EnvironmentConfig.getReadOnly方法的具體用法?Java EnvironmentConfig.getReadOnly怎麽用?Java EnvironmentConfig.getReadOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sleepycat.je.EnvironmentConfig的用法示例。


在下文中一共展示了EnvironmentConfig.getReadOnly方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupRepConfig

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * @hidden
 * For internal use only.
 *
 * Validate and resolve replication configuration params, and extract a
 * ReplicationConfig with those params for passing into environment
 * creation. Note that a copy of the ReplicationConfig argument is created
 * to insulate the application from changes made by the replication
 * implementation and vice versa.
 */
@Override
protected RepConfigProxy setupRepConfig(File envHome,
                                        RepConfigProxy repConfigProxy,
                                        EnvironmentConfig envConfig) {

    /**
     * If the user specified a null object, use the default. Apply the
     * je.properties file to the replication config object.
     */
    if (envConfig.getReadOnly()) {
        throw new IllegalArgumentException
            ("A replicated environment may not be opened read-only");
    }

    ReplicationConfig repConfig = (ReplicationConfig) repConfigProxy;
    ReplicationConfig baseConfig =
        (repConfig == null) ? ReplicationConfig.DEFAULT : repConfig;
    ReplicationConfig useConfig = baseConfig.clone();
    DbConfigManager.applyFileConfig(envHome,
                                    useConfig.getProps(),
                                    true); /* forReplication */
    this.handleRepConfig = useConfig;
    return handleRepConfig;
}
 
開發者ID:prat0318,項目名稱:dbms,代碼行數:35,代碼來源:ReplicatedEnvironment.java

示例2: getAttribute

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * Get an attribute value for the given environment. Check
 * JEMBeanHelper.getNeedReset() after this call because the helper may
 * detect that the environment has changed and that the MBean metadata
 * should be reset.
 *
 * @param targetEnv The target JE environment. May be null if the
 * environment is not open.
 * @param attributeName attribute name.
 * @return attribute value.
 */
public Object getAttribute(Environment targetEnv,
                           String attributeName)
    throws AttributeNotFoundException,
           MBeanException {

    /* Sanity check. */
    if (attributeName == null) {
        throw new AttributeNotFoundException(
                                        "Attribute name cannot be null");
    }

    /* These attributes are available regardless of environment state. */
    try {
        if (attributeName.equals(ATT_ENV_HOME)) {
            return environmentHome.getCanonicalPath();
        } else if (attributeName.equals(ATT_OPEN)) {
            boolean envIsOpen = (targetEnv != null);
            resetIfOpenStateChanged(envIsOpen);
            return new Boolean(envIsOpen);
        } else if (attributeName.equals(ATT_SET_READ_ONLY)) {
            return new Boolean(openConfig.getReadOnly());
        } else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
            return new Boolean(openConfig.getTransactional());
        } else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
            return new Boolean(openConfig.getTxnSerializableIsolation());
        } else {
            /* The rest are JE environment attributes. */
            if (targetEnv != null) {

                EnvironmentConfig config = targetEnv.getConfig();

                if (attributeName.equals(ATT_IS_READ_ONLY)) {
                    return new Boolean(config.getReadOnly());
                } else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
                    return new Boolean(config.getTransactional());
                } else if (attributeName.equals(ATT_CACHE_SIZE)) {
                    return new Long(config.getCacheSize());
                } else if (attributeName.equals(ATT_CACHE_PERCENT)) {
                    return new Integer(config.getCachePercent());
                } else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
                    return new Long(config.getLockTimeout());
                } else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
                    return new
                        Boolean(config.getTxnSerializableIsolation());
                } else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
                    return new Long(config.getTxnTimeout());
                } else {
                    throw new AttributeNotFoundException("attribute " +
                                                         attributeName +
                                                         " is not valid.");
                }
            }
            return null;
        }
    } catch (Exception e) {
        /*
         * Add both the message and the exception for easiest deciphering
         * of the problem. Sometimes the original exception stacktrace gets
         * hidden in server logs.
         */
        throw new MBeanException(e, e.getMessage());
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:75,代碼來源:JEMBeanHelper.java

示例3: getAttribute

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * Get an attribute value for the given environment. Check
 * JEMBeanHelper.getNeedReset() after this call because the helper may
 * detect that the environment has changed and that the MBean metadata
 * should be reset.
 *
 * @param targetEnv The target JE environment. May be null if the
 * environment is not open.
 * @param attributeName attribute name.
 * @return attribute value.
 */
public Object getAttribute(Environment targetEnv,
                           String attributeName) 
    throws AttributeNotFoundException,
           MBeanException {

    /* Sanity check. */
    if (attributeName == null) {
        throw new AttributeNotFoundException(
                                        "Attribute name cannot be null");
    }

    /* These attributes are available regardless of environment state. */
    try {
        if (attributeName.equals(ATT_ENV_HOME)) {
            return environmentHome.getCanonicalPath();
        } else if (attributeName.equals(ATT_OPEN)) {
            boolean envIsOpen = (targetEnv != null);
            resetIfOpenStateChanged(envIsOpen);
            return new Boolean(envIsOpen);
        } else if (attributeName.equals(ATT_SET_READ_ONLY)) {
            return new Boolean(openConfig.getReadOnly());
        } else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
            return new Boolean(openConfig.getTransactional());
        } else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
            return new Boolean(openConfig.getTxnSerializableIsolation());
        } else {
            /* The rest are JE environment attributes. */
            if (targetEnv != null) {

                EnvironmentConfig config = targetEnv.getConfig();

                if (attributeName.equals(ATT_IS_READ_ONLY)) {
                    return new Boolean(config.getReadOnly());
                } else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
                    return new Boolean(config.getTransactional());
                } else if (attributeName.equals(ATT_CACHE_SIZE)) {
                    return new Long(config.getCacheSize());
                } else if (attributeName.equals(ATT_CACHE_PERCENT)) {
                    return new Integer(config.getCachePercent());
                } else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
                    return new Long(config.getLockTimeout());
                } else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
                    return new
                        Boolean(config.getTxnSerializableIsolation());
                } else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
                    return new Long(config.getTxnTimeout());
                } else {
                    throw new AttributeNotFoundException("attribute " +
                                                         attributeName +
                                                         " is not valid.");
                }
            } 
            return null; 
        }
    } catch (Exception e) {
        /*
         * Add both the message and the exception for easiest deciphering
         * of the problem. Sometimes the original exception stacktrace gets
         * hidden in server logs.
         */
        throw new MBeanException(e, e.getMessage());
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:75,代碼來源:JEMBeanHelper.java

示例4: getAttribute

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * Get an attribute value for the given environment. Check
 * JEMBeanHelper.getNeedReset() after this call because the helper may
 * detect that the environment has changed and that the MBean metadata
 * should be reset.
 *
 * @param targetEnv The target JE environment. May be null if the
 * environment is not open.
 * @param attributeName attribute name.
 * @return attribute value.
 */
public Object getAttribute(Environment targetEnv, String attributeName)
    throws AttributeNotFoundException,
           MBeanException {

    /* Sanity check. */
    if (attributeName == null) {
        throw new AttributeNotFoundException
            ("Attribute name cannot be null");
    }

    /* These attributes are available regardless of environment state. */
    try {
        if (attributeName.equals(ATT_ENV_HOME)) {
            return environmentHome.getCanonicalPath();
        } else if (attributeName.equals(ATT_OPEN)) {
            boolean envIsOpen = (targetEnv != null);
            resetIfOpenStateChanged(envIsOpen);
            return new Boolean(envIsOpen);
        } else if (attributeName.equals(ATT_SET_READ_ONLY)) {
            return new Boolean(openConfig.getReadOnly());
        } else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
            return new Boolean(openConfig.getTransactional());
        } else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
            return new Boolean(openConfig.getTxnSerializableIsolation());
        } else {
            /* The rest are JE environment attributes. */
            if (targetEnv != null) {

                EnvironmentConfig config = targetEnv.getConfig();

                if (attributeName.equals(ATT_IS_READ_ONLY)) {
                    return new Boolean(config.getReadOnly());
                } else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
                    return new Boolean(config.getTransactional());
                } else if (attributeName.equals(ATT_CACHE_SIZE)) {
                    return new Long(config.getCacheSize());
                } else if (attributeName.equals(ATT_CACHE_PERCENT)) {
                    return new Integer(config.getCachePercent());
                } else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
                    return new Long(config.getLockTimeout());
                } else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
                    return new
                        Boolean(config.getTxnSerializableIsolation());
                } else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
                    return new Long(config.getTxnTimeout());
                } else {
                    throw new AttributeNotFoundException
                        ("attribute " + attributeName + " is not valid.");
                }
            }
            return null;
        }
    } catch (Exception e) {

        /*
         * Add both the message and the exception for easiest deciphering
         * of the problem. Sometimes the original exception stacktrace gets
         * hidden in server logs.
         */
        throw new MBeanException(e, e.getMessage());
    }
}
 
開發者ID:prat0318,項目名稱:dbms,代碼行數:74,代碼來源:JEMBeanHelper.java


注:本文中的com.sleepycat.je.EnvironmentConfig.getReadOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。