Examples of engageConnection()


Examples of org.sd_network.db.ConnectionPool.engageConnection()

            throw new IllegalArgumentException("loginName is empty.");
        if (password == null || password.length() == 0)
            throw new IllegalArgumentException("password is empty.");

        ConnectionPool pool = ConnectionPool.getInstance("vfs");
        Connection con = pool.engageConnection(10);
        try {
            PreparedStatement stmt = con.prepareStatement(
                    "SELECT user_id, login_name, is_admin FROM user " +
                    " WHERE login_name = ? AND password = ?");
            stmt.setString(1, loginName);
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

     */
    public static final User create(String loginName, String password,
            boolean isAdmin)
    {
        ConnectionPool pool = ConnectionPool.getInstance("vfs");
        Connection con = pool.engageConnection(10);
        try {
            con.setAutoCommit(true);
            return create(con, loginName, password, isAdmin);
        } catch (SQLException e) {
            throw new DBException(e);
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

        if (!user.isAdmin())
            throw new PermissionException(
                    "You have not permission as an Administrator.");

        ConnectionPool pool = ConnectionPool.getInstance("vfs");
        Connection con = pool.engageConnection(10);
        try {
            con.setAutoCommit(false);
            User newUser = UserDB.create(con, loginName, password, isAdmin);

            // If new user is not administrator, create HOME directory of user.
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

    public byte[] getContent() {
        if (_content != null)
            return _content;

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "SELECT content FROM sector WHERE sector_id=?");
            stmt.setString(1, _sectorID);
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

        if (content.length < size || size <= 0)
            throw new IllegalArgumentException("invalid size.");

        String sectorID = UUID.randomUUID().toString();
        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "INSERT INTO sector " +
                    " (sector_id, file_id, seq_num, size, content) " +
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

    public static final byte[] getContent(String sectorID) {
        if (sectorID == null)
            throw new NullPointerException("sectorID");

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "SELECT content FROM sector WHERE sector_id=?");
            stmt.setString(1, sectorID);
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

            throw new IllegalArgumentException("content was empty.");
        if (content.length < size || size <= 0)
            throw new IllegalArgumentException("invalid size.");

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "UPDATE sector SET size=?, content=? " +
                    "WHERE sector_id=?");
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

    public static final Sector getLastSector(String fileID) {
        if (fileID == null)
            throw new NullPointerException("fileID.");

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "SELECT sector_id, file_id, seq_num, size " +
                    "FROM " +
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

    public static final long getFileSize(String fileID) {
        if (fileID == null)
            throw new NullPointerException("fileID.");

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "SELECT sum(size) as total_bytes " +
                    "FROM sector " +
View Full Code Here

Examples of org.sd_network.db.ConnectionPool.engageConnection()

    public static final long getTotalSectorNumber(String fileID) {
        if (fileID == null)
            throw new NullPointerException("fileID");

        ConnectionPool pool = ConnectionPool.getInstance("vfssector");
        Connection con = pool.engageConnection(10);
        PreparedStatement stmt = null;
        try {
            stmt = con.prepareStatement(
                    "SELECT count(*) as total_sector_number " +
                    "FROM sector " +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.