Examples of IFileProcessor


Examples of org.jresearch.gossip.dao.file.IFileProcessor

        }
        return instance;
    }

    private IFileProcessor getFileProcessor(String fileProcessorName) throws SystemException {
      IFileProcessor fileProcessor = (IFileProcessor)fileProcessors.get(fileProcessorName);
        if (fileProcessor == null) {
          synchronized(fileProcessors) {
                if (fileProcessor == null) {
                fileProcessor = FileProcessorFactory.getInstance()
                        .getFileProcessor(fileProcessorName);
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

     * @throws SystemException
     */
    public FileData getAttachment(int id) throws SQLException, SystemException {
        FileData fd = new FileData();
        fd.setInfo(getAttachmentInfo(id));
        IFileProcessor fProc = getFileProcessor(IFileProcConst.ATTACH_FILE_PROCESSOR);
        byte[] data = fProc.getFileData(IFileProcConst.ATTACH_KEY_PREFIX + id);
        if (data == null) {
            data = new byte[0];
        }
        fd.setData(data);
        return fd;
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

    public void saveAttachments(FileData[] files) throws SQLException,
            SystemException {
        Connection connection = this.dataSource.getConnection();
        PreparedStatement st = connection.prepareStatement(dbDriver
                .getQueries().getForumQueries().getSql_ADD_ATTACH_INFO());
        IFileProcessor fProc = getFileProcessor(IFileProcConst.ATTACH_FILE_PROCESSOR);
        try {
            for (int i = 0; i < files.length; i++) {
                int id = ((Integer) keyGen.generateKey(
                        IKeyGenConst.KEY_NAMES[IKeyGenConst.KEY_ATTACH],
                        connection)).intValue();
                FileData fd = files[i];
                st.setInt(1, id);
                st.setString(2, fd.getInfo().getContentType());
                st.setString(3, fd.getInfo().getName());
                st.setString(4, fd.getInfo().getDescription());
                st.setInt(5, fd.getInfo().getSize());
                st.setInt(6, fd.getInfo().getMessageId());
                st.execute();

                fProc.saveFileData(fd.getData(),
                        IFileProcConst.ATTACH_KEY_PREFIX + id);
            }
        } finally {
            st.close();
            connection.close();
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

     */
    public void removeAttachment(int id) throws SQLException, SystemException {
        Connection connection = this.dataSource.getConnection();
        PreparedStatement st = connection.prepareStatement(dbDriver
                .getQueries().getForumQueries().getSql_DELETE_ATTACH());
        IFileProcessor fProc = getFileProcessor(IFileProcConst.ATTACH_FILE_PROCESSOR);
        try {
            st.setInt(1, id);
            st.execute();
            fProc.removeFileData(IFileProcConst.ATTACH_KEY_PREFIX + id);
        } finally {
            st.close();
            connection.close();
        }
    }
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

     * @param user
     * @param data
     * @throws SystemException
     */
    public void saveAvatar(User user, byte[] data) throws SystemException {
        IFileProcessor fProc = getFileProcessor(IFileProcConst.AVATAR_PROCESSOR);
        fProc.saveFileData(data, IFileProcConst.AVATAR_KEY_PREFIX
                + user.getName());
    }
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

     * @param uid
     * @return @throws
     *         SystemException
     */
    public byte[] getAvatar(String uid) throws SystemException {
        IFileProcessor fProc = getFileProcessor(IFileProcConst.AVATAR_PROCESSOR);
        byte[] data = fProc.getFileData(IFileProcConst.AVATAR_KEY_PREFIX + uid);
        if (data == null) {
            data = IConst.VALUES.BLANK_GIF;
        }
        return data;
    }
View Full Code Here

Examples of org.jresearch.gossip.dao.file.IFileProcessor

    /**
     * @param uid
     * @throws SystemException
     */
    public void removeAvatar(String uid) throws SystemException {
        IFileProcessor fProc = getFileProcessor(IFileProcConst.AVATAR_PROCESSOR);
        fProc.removeFileData(IFileProcConst.AVATAR_KEY_PREFIX + uid);
    }
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.