| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 649 人关注过本帖
标题:求助--Documents in BLOBs
取消只看楼主 加入收藏
dali0125
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2009-11-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
求助--Documents in BLOBs
在公司实习,突然让我JAVA编程,只懂JAVA基础,其他一概不知! 求助!!!
如何将文件存在BLOB中,并设定一个OFFSET之类的,使最长缓存时间3小时,和缓存大小100MB之类的。
希望高手能帮帮我,可能说的不太清楚,大家凑乎理解把,因为我也不是很明白,到底要作什么?
搜索更多相关主题的帖子: BLOBs Documents 
2009-11-10 17:58
dali0125
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2009-11-10
收藏
得分:0 

多谢斑竹,,有没有例子帮我推荐一下,,或者资料,,,我是毫无头绪!!
2009-11-10 20:25
dali0125
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2009-11-10
收藏
得分:0 
应该和这个文件有联系的,能帮忙解释一下么?

import ff.il.internal.datasource.*;
import ff.il.internal.doctype.DocumentOperationManager;
import ff.il.internal.doctype.DocumentType;
import ff.il.internal.utils.RMIInputStreamImpl;
import ff.pl.apps.ffapp.utils.mapper.MimeTypeMapper;
import ff.tools.extern.DatasourceFactoryClient;
import ff.util.IdCreator;

import
import
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Properties;


public class TestArchive extends DatasourceFactoryClient
{
    private Datasource ds;

    private DocumentOperationManager fdom;

    public TestArchive(final Properties props)
    {
        super(props);
    }

    /**
     * {@inheritDoc}
     */
    public void run() throws Exception
    {
        final String file = "D:\\testdata\\Winter.jpg";
        final FileInputStream in = new FileInputStream(file);
        in.available();
        final String filename = new File(file).getName();
        final String mimetype = MimeTypeMapper.getMimeTypeByFileName(filename);
        final String language = uc.getLanguage();
        
        
        int count = ds.count(DatasourceUtils.EMPTY_SELECTION);
        int documents = 1;

        Record record = new Record ();
        final Collection<Selection> what = new ArrayList<Selection>(1);
        for (int i = count; i < (count + documents); i++)
        {
            record.clear();
            what.clear();
            record.put("LFDNR", i);
            record.put("STRING_1", "String_1_" + i);
            record.put("STRING_2", "String_2_" + i);
            record.put("STRING_3", "String_3_" + i);

            ds.insert(record);

            what.add(new Selection("LFDNR", BigInteger.valueOf(i)));
            final CRecord cr = (CRecord) ds.select(DatasourceUtils.EMPTY_ATTRIBUTES, what, DatasourceUtils.EMPTY_ORDER).iterator().next();

            fdom.addDocument(new RMIInputStreamImpl(new FileInputStream(file)), mimetype,
                                                    filename, cr, null, null, language, null, null);
        }
    }

    /**
     * {@inheritDoc}
     */
    protected void initObjects() throws Exception
    {
        super.initObjects();
        ds = dsf.getDatasource(uc, new IdCreator(cid, project_name, version_id, "DATA"));
        
        final DocumentType fdt = dtf.getDocumentType(new IdCreator(cid, project_name, version_id), "DOCTYPE");
        fdom = fdt.getDocumentOperationManager(uc, dsf);
    }

    public static void main(final String[] args)
    {
        try
        {
            final Properties props = new Properties();
            props.setProperty(PROP_LOGPATH, "../log2");
            props.setProperty(PROP_LOGFILENAME_PREFIX_FROM_CLASS, String.valueOf(true));
            props.setProperty(PROP_LOGLEVEL, String.valueOf(8));
            props.setProperty(PROP_RMI_PORT, String.valueOf(16100));
            
            props.setProperty(PROP_CID, String.valueOf(10));
            props.setProperty(PROP_CLIENT, DatasourceConstants.DEFAULT_CLIENT);
            props.setProperty(PROP_LOGIN_USER, "root");
            props.setProperty(PROP_LOGIN_PWD, "rootroot");
            props.setProperty(PROP_PROJECT_NAME, "MASTER");
            final TestArchive impl = new TestArchive(props);
            impl.init(args);
            int count;
            try
            {
                count = Integer.parseInt(args[0]);
            }
            catch (final Exception ignored)
            {
                count = 1;
            }
            for (int i = 0; i < count; ++i)
            {
                impl.run();
            }
            System.exit(0);
        }
        catch (final Throwable ex)
        {
            ex.printStackTrace(System.err);
            System.exit(1);
        }
    }
}

2009-11-10 21:06
dali0125
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2009-11-10
收藏
得分:0 
如何将Inputstream以BLOB形式存档,并控制字节流的时间和大小?
2009-11-11 16:59
快速回复:求助--Documents in BLOBs
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013304 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved