Package org.sd_network.util

Examples of org.sd_network.util.Config


    ////////////////////////////////////////////////////////////
    // Constructors, Initializations and Finalizations.

    public DBUtilTest(String name) {
        super(name);
        Config config = Config.getInstance();
        ConnectionPool pool = ConnectionPool.getInstance();
    }
View Full Code Here


            return;
        }

        try {
            // setup configurations.
            Config config = Config.load(propertyFilePath);

            // setup database connection information.
            ConnectionPool pool = ConnectionPool.getInstance("vfs");
            pool.setJDBCDriver(
                    config.getProperty("org.sd_network.vfs.db.JDBCDriver"));
            pool.setDatabaseURL(
                    config.getProperty("org.sd_network.vfs.db.URL"));
            pool.setDatabaseUserName(
                    config.getProperty("org.sd_network.vfs.db.UserName"));
            pool.setDatabasePassword(
                    config.getProperty("org.sd_network.vfs.db.Password"));

            // setup database schema.
            Schema.setup();

            // SectorDriverManager initialization.
            SectorDriverManager.setSectorDriver(
                    config.getProperty("org.sd_network.vfs.SectorDriver"));

            _service = new VfsService();

        } catch (Throwable t) {
            _log.log(Level.SEVERE, t.getMessage(), t);
View Full Code Here

    // Constructors.

    UserSession(String userSessionID, User user) {
        _userSessionID = userSessionID;
        _user = user;
        Config config = Config.getInstance();
        try {
            _maxFileSession = Integer.parseInt(
                    config.getProperty("org.sd_network.vfs.FileSession.Max"));
        } catch (NumberFormatException e) {
            throw new InvalidConfigException(
                    "org.sd_network.vfs.FileSession.Max", e);
        }
    }
View Full Code Here

     * @return  Instance of SystemInfo.
     */
    public SystemInfo getSystemInfo()
        throws VfsIOException
    {
        Config config = Config.getInstance();

        long bytesPerRead = 0;
        try {
            bytesPerRead = Long.parseLong(
                    config.getProperty("org.sd_network.vfs.BytesPerRead"));
        } catch (NumberFormatException e) {
            throw new VfsIOException(
                "Invalid property [org.sd_network.vfs.BytesPerRead].");
        }

        long bytesPerWrite = 0;
        try {
            bytesPerWrite = Long.parseLong(
                config.getProperty("org.sd_network.vfs.BytesPerWrite"));
        } catch (NumberFormatException e) {
            throw new VfsIOException(
                "Invalid property [org.sd_network.vfs.BytesPerWrite].");
        }

        int childObjectsPerParent = 0;
        try {
            childObjectsPerParent = Integer.parseInt(
                config.getProperty("org.sd_network.vfs.ChildObjectsPerParent"));
        } catch (NumberFormatException e) {
            throw new VfsIOException(
                "Invalid property [org.sd_network.vfs.ChildObjectsPerParent].");
        }

        int hierarchicalDepth = 0;
        try {
            hierarchicalDepth = Integer.parseInt(
                config.getProperty("org.sd_network.vfs.HierarchicalDepth"));
        } catch (NumberFormatException e) {
            throw new VfsIOException(
                "Invalid property [org.sd_network.vfs.HierarchicalDepth].");
        }

        int fileNameLength = 0;
        try {
            fileNameLength = Integer.parseInt(
                config.getProperty("org.sd_network.vfs.FileNameLength"));
        } catch (NumberFormatException e) {
            throw new VfsIOException(
                "Invalid property [org.sd_network.vfs.FileNameLength].");
        }

View Full Code Here

    /**
     * A default constructor
     * Set maximum of session number.
     */
    private UserSessionManager() {
        Config config = Config.getInstance();
        try {
            _maxUserSession = Integer.parseInt(
                    config.getProperty("org.sd_network.vfs.UserSession.Max"));
        } catch (NumberFormatException e) {
            throw new InvalidConfigException(
                    "org.sd_network.vfs.UserSession.Max", e);
        }
    }
View Full Code Here

            throw new SectorException(
                    "Database error occurred. " + e.getMessage(), e);
        }

        // setup etc.
        Config config = Config.getInstance();
        try {
            _availableBytes = Long.parseLong(
                    config.getProperty(_PROP_AVAILABLEBYTES));
        } catch (NumberFormatException e) {
            throw new SectorException(
                    "Invalid property " + _PROP_AVAILABLEBYTES + "]. " +
                    e.getMessage(), e);
        }
View Full Code Here

            new HashMap<String, Properties>();
        int prefixLength = _PROP_PREFIX.length();

        // �v���p�e�B�ɐݒ肳�ꂽConnectionParameter�֘A�v���p�e�B��
        // �������āA�O���[�v����Properties�Ƃ���groupMap�ɕۑ�����B
        Config config = Config.getInstance();
        Enumeration<?> names = config.propertyNames();
        while (names.hasMoreElements()) {
            String name = (String) names.nextElement();

            if (!name.startsWith(_PROP_PREFIX))
                continue;

            int groupNameEndIdx = name.indexOf('.', prefixLength + 1);
            if (groupNameEndIdx == -1) {
                _log.warning("Invalid format:" + name);
                continue;
            }
            if (name.indexOf('.', groupNameEndIdx + 1) != -1) {
                _log.warning("Invalid format:" + name);
                continue;
            }

            String groupName =
                name.substring(prefixLength + 1, groupNameEndIdx);
            _log.fine("Group name is " + groupName);

            String value = config.getProperty(name);
            Properties props = groupMap.get(groupName);
            if (props == null)
                props = new Properties();
            String paramName = name.substring(groupNameEndIdx + 1);
            props.setProperty(paramName, value);
View Full Code Here

TOP

Related Classes of org.sd_network.util.Config

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.