public class RemoteJackRabbitFileStore extends AbstractFileStore implements FileStore
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
DEFAULT_PASS |
protected static String |
DEFAULT_USER |
protected static org.slf4j.Logger |
logger |
protected String |
password |
protected javax.jcr.Repository |
repository |
protected String |
rootNodeName |
protected String |
user |
DEFAULT_STORE_NAME| 构造器和说明 |
|---|
RemoteJackRabbitFileStore(String url)
使用缺省账号,创建一个远程JackRabbit仓库的连接,实例名采用缺省名。
|
RemoteJackRabbitFileStore(String url,
String storeName)
用指定的命名,创建一个远程JackRabbit仓库的连接
|
RemoteJackRabbitFileStore(String url,
String storeName,
String userName,
String password)
用指定的命名和访问账号,创建一个远程JackRabbit仓库的连接
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
deleteFile(String uuid)
删除指定uuid的文件
|
boolean |
exist(String uuid)
判断文件是否存在
|
FileInfo |
getFile(String uuid)
从内容仓库获取文件。
|
InputStream |
getFileAsStream(String uuid)
从内容仓库获取文件流。
|
long |
getFileSize(String uuid)
获取文件大小
|
protected void |
init(javax.jcr.Repository repository,
String storeName)
创建一个JackRabbit实例对象,使用缺省账号admin/admin。
|
protected void |
init(javax.jcr.Repository repository,
String storeName,
String username,
String password)
创建一个JackRabbit实例对象。
|
FileInfo |
putFile(File file,
String realName,
String relativePath)
向内容仓库存储一个文件。
|
FileInfo |
putFileAsStream(InputStream inputStream,
String realName,
String relativePath)
向内容仓库存储一个文件。
|
List<String> |
searchFullText(String keyword)
全文检索 检索出所有匹配关键字的uuid
|
Map<String,String> |
searchFullTextWithExcerpt(String keyword)
全文检索并显示摘要。
|
void |
setLoginAccount(String user,
String password)
设定访问账号和密码,必须与仓库实际一致。
|
boolean |
supportFullTextSearch() |
checkName, putFile, putFile, putFileAsStream, putFileAsStreamclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeleteFile, exist, getFile, getFileAsStream, getFileSize, putFile, putFile, putFile, putFileAsStream, putFileAsStream, putFileAsStream, searchFullText, searchFullTextWithExcerpt, setLoginAccount, supportFullTextSearchprotected static org.slf4j.Logger logger
protected static String DEFAULT_USER
protected static String DEFAULT_PASS
protected javax.jcr.Repository repository
protected String rootNodeName
protected String user
protected String password
public RemoteJackRabbitFileStore(String url) throws FileStoreException
url - 必须。远程仓库的URL,例如http://localhost:8082/rmi。FileStoreExceptionpublic RemoteJackRabbitFileStore(String url, String storeName) throws FileStoreException
url - 必须。远程仓库的URL,例如http://localhost:8082/rmi。storeName - 必须。给仓库起个名字,后面需要根据这个名字来获取仓库实例。该名字也会成为仓库的根节点目录名。
文字中不能含有特殊字符如斜杠等。FileStoreExceptionpublic RemoteJackRabbitFileStore(String url, String storeName, String userName, String password) throws FileStoreException
url - 必须。远程仓库的URL,例如http://localhost:8082/rmi。storeName - 给仓库实例起的名字,后面需要根据这个名字来获取仓库实例。该名字也会成为仓库的根节点目录名。 文字中不能含有特殊字符如斜杠等。username - 用于访问仓库的用户名。password - 用于访问仓库的密码。注意用户名和密码的设置是在JackRabbit的配置文件中,这里设置的只能用于访问仓库,不能用于创建仓库账户。FileStoreExceptionprotected void init(javax.jcr.Repository repository,
String storeName)
throws FileStoreException
repository - JackRabbit仓库对象storeName - 存储名,对应该仓库中根目录下的一个子目录。
一个JackRabbit仓库的根目录下可以有多个子目录,一个JackRabbitFileStore实例只操作一个特定子目录。FileStoreExceptionprotected void init(javax.jcr.Repository repository,
String storeName,
String username,
String password)
throws FileStoreException
repository - JackRabbit仓库对象storeName - 存储名,对应该仓库中根目录下的一个子目录。
一个JackRabbit仓库的根目录下可以有多个子目录,一个JackRabbitFileStore实例只操作一个特定子目录。username - 访问仓库的用户名password - 访问仓库的密码FileStoreExceptionpublic void setLoginAccount(String user, String password)
setLoginAccount 在接口中 FileStoreuser - 用户名password - 密码public FileInfo putFile(File file, String realName, String relativePath) throws FileStoreException
需要注意不能往一个节点位置放置太多(几万以上)平行文件,而应该用文件夹分开存放,否则影响性能。
putFile 在接口中 FileStorefile - 文件对象realName - 存储库中使用的文件名。如果为null或空,则使用file参数所含的文件名。relativePath - 存储相对路径。如放在根目录为"",要放在"根目录/a/b/c"目录下则参数为"a/b/c",以此类推。目录如果不存在,会自动创建。FileStoreExceptionpublic FileInfo putFileAsStream(InputStream inputStream, String realName, String relativePath) throws FileStoreException
需要注意的时不能往一个节点位置放置太多(几万以上)平行文件,而应该用文件夹分开存放,否则影响性能。
putFileAsStream 在接口中 FileStoreinputStream - 文件流对象realName - 存储库中使用的文件名。如果为null或空,则使用file参数所含的文件名。relativePath - 存储相对路径。如放在根目录为"",要放在"根目录/a/b/c"目录下则参数为"a/b/c",以此类推。目录如果不存在,会自动创建。FileStoreExceptionpublic FileInfo getFile(String uuid) throws FileStoreException
getFile 在接口中 FileStoreuuid - 文件uuidFileStoreExceptionpublic InputStream getFileAsStream(String uuid) throws FileStoreException
FileStoregetFileAsStream 在接口中 FileStoreuuid - 在往内容仓库存放文件时获得的文件key。FileStoreExceptionpublic long getFileSize(String uuid) throws FileStoreException
getFileSize 在接口中 FileStoreuuid - 文件uuidFileStoreExceptionpublic boolean exist(String uuid) throws FileStoreException
exist 在接口中 FileStoreuuid - 文件uuidFileStoreExceptionpublic boolean deleteFile(String uuid) throws FileStoreException
deleteFile 在接口中 FileStoreuuid - FileStoreExceptionpublic List<String> searchFullText(String keyword) throws FileStoreException
searchFullText 在接口中 FileStorekeyword - 需要检索的关键字FileStoreExceptionExceptionpublic Map<String,String> searchFullTextWithExcerpt(String keyword) throws FileStoreException
searchFullTextWithExcerpt 在接口中 FileStorekeyword - 需要检索的关键字FileStoreExceptionpublic boolean supportFullTextSearch()
supportFullTextSearch 在接口中 FileStoreCopyright © 2018. All rights reserved.