• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CouchDbProperties类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.lightcouch.CouchDbProperties的典型用法代码示例。如果您正苦于以下问题:Java CouchDbProperties类的具体用法?Java CouchDbProperties怎么用?Java CouchDbProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CouchDbProperties类属于org.lightcouch包,在下文中一共展示了CouchDbProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Configures the DatabaseService singleton, must be called before the crawling process starts.
 *
 * @param downloadMedia true, if media downloader enabled, false to disable media downloads
 * @param dbProperties  CouchDB properties for the Crawcial Twitter Database
 * @param imgSize       requested image size (thumb, small, medium, large)
 * @param mediaHttps    true if https should be used for media downloads
 */
public synchronized void init(boolean downloadMedia, CouchDbProperties dbProperties, String imgSize, boolean mediaHttps) {
    DatabaseService.downloadMedia = downloadMedia;
    this.mediaHttps = mediaHttps;
    this.imgSize = imgSize;
    warningCnt = 0;
    this.dbProperties = dbProperties;
    CouchDbClient dbClient = new CouchDbCloneClient(dbProperties);
    DesignDocument designDoc = dbClient.design().getFromDesk("crawcial");
    dbClient.design().synchronizeWithDb(designDoc);
    dbClient.shutdown();

    attachmentExecutors = new LinkedBlockingQueue<>();
    if (downloadMedia) {
        es = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                Runtime.getRuntime().availableProcessors() * 2, 30, TimeUnit.SECONDS, attachmentExecutors);
    }
    writeExecutor = new WriteExecutor(jsonObjectVector, bufferLimit);
    writeExecutorThread = new Thread(writeExecutor);
    writeExecutorThread.setName("writer-executor-thread-0");
    writeExecutorThread.start();
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:30,代码来源:DatabaseService.java


示例2: setConfig

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Sets the configuration for this TwitterStreaming instance, is required to be called in order to run a TwitterStreamer.
 *
 * @param auth          OAuth authentication data
 * @param terms         List of filter terms
 * @param downloadMedia true, if media downloader enabled, false to disable media downloads
 * @param properties    CouchDB properties for the Crawcial Twitter Database
 * @param imgSize       requested imgSize (thumb, small, medium, large)
 * @param mediaHttps    true if https should be used for media downloads
 * @param location      A geo location filter (optional)
 * @throws IllegalArgumentException If your configuration is invalid
 */
public void setConfig(Authentication auth, List<String> terms, boolean downloadMedia,
                      CouchDbProperties properties, String imgSize, boolean mediaHttps, Location location) throws IllegalArgumentException {
    if (!downloadMedia ^ Arrays.asList(imgSizes).contains(imgSize)) {
        // Receive OAuth params
        this.auth = auth;

        if (location != null) {
            locations = Arrays.asList(location);
        } else {
            locations = null;
        }

        // Reset DatabaseService & set download mode
        ds.init(downloadMedia, properties, imgSize, mediaHttps);

        // Terms for filtering
        this.terms = terms;
        logger.info("Filtering tweets with terms {}", terms.toString());
        lowMemory = false;
        configSet = true;
    } else {
        configSet = false;
        throw new IllegalArgumentException("Invalid imgSize");
    }
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:38,代码来源:TwitterStreamer.java


示例3: performMapReduce

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private Stream<JsonObject> performMapReduce(String dbIP, String tableName, String mapRedDir)
{
  MapReduceSources mrs = MapReduceSources.fromDir(mapRedDir);
  CouchDbProperties properties = new CouchDbProperties(tableName.toLowerCase(), true, "http", dbIP, 5984, null, null);
  CouchDbClient dbClient = new CouchDbClient(properties);
  MapReduce mapRedObj = new MapReduce();
  mapRedObj.setMap(mrs.getMapJSCode());
  mapRedObj.setReduce(mrs.getReduceJSCode());
  List<JsonObject> list = dbClient.view("_temp_view").tempView(mapRedObj).group(true)
      .includeDocs(false).reduce(true).query(JsonObject.class);

  // This step will apply some custom rules to the elements...
  return adapter.adaptStream(list);
}
 
开发者ID:catedrasaes-umu,项目名称:NoSQLDataEngineering,代码行数:15,代码来源:CouchDBImport.java


示例4: createDBProperties

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private CouchDbProperties createDBProperties(String path) throws MalformedURLException
{

	String localDBUrl = getInternalLocalDBURL();
	ISecurePreferences secPrefs = SecurePreferencesFactory.getDefault().node("org.bbaw.bts.app");
	ISecurePreferences auth = secPrefs.node("auth");
	String username = null;
	String password = null;
	try {
		username = auth.get("username", null);
		password = auth.get("password", null);
	} catch (StorageException e) {
		logger.error(e);
	}
	URL url = new URL(localDBUrl + "/");

	logger.info("CouchDbProperties createDBProperties: " + localDBUrl);
	CouchDbProperties properties = new CouchDbProperties().setDbName(path).setCreateDbIfNotExist(true)
			.setProtocol(url.getProtocol()).setHost(url.getHost()).setPort(url.getPort());
	if (username != null && password != null)
	{
		properties.setUsername(username).setPassword(password);
	}
	properties.setMaxConnections(100).setConnectionTimeout(0);
	
	

	return properties;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:30,代码来源:DBConnectionProviderImpl.java


示例5: getCouchDbProperties

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Returns the current database properties from a properties file with a specified database name.
 *
 * @param sc     the servlet context
 * @param dbName the database name
 * @return current database properties with a specified database name
 */
@SuppressWarnings("ConstantConditions")
public static CouchDbProperties getCouchDbProperties(ServletContext sc, String dbName) {
    try {
        return new CouchDbProperties(dbName, false, getProperty(sc, "dbprotocol"), getProperty(sc, "dbhost"),
                Integer.valueOf(getProperty(sc, "dbport")), getProperty(sc, "dbusername"), getProperty(sc, "dbpassword"));
    } catch (NumberFormatException | NullPointerException e) {
        return null;
    }
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:17,代码来源:CrawcialWebUtils.java


示例6: cloneProperties

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * This works around an issue with the LightCouch client, CouchDbProperties are mutable and cannot be reused safely.
 *
 * @param src CouchDbProperties to be cloned
 * @return cloned CouchDbProperties
 */
public static CouchDbProperties cloneProperties(CouchDbProperties src) {
    // (String dbName, boolean createDbIfNotExist, String protocol, String host, int port, String username, String password)
    CouchDbProperties ret = new CouchDbProperties(src.getDbName(), src.isCreateDbIfNotExist(), src.getProtocol(), src.getHost(), src.getPort(), src.getUsername(), src.getPassword());
    ret.setPath(src.getPath());
    ret.setSocketTimeout(src.getSocketTimeout());
    ret.setConnectionTimeout(src.getConnectionTimeout());
    ret.setMaxConnections(src.getMaxConnections());
    ret.setProxyHost(src.getProxyHost());
    ret.setProxyPort(src.getProxyPort());
    return ret;
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:18,代码来源:CouchDbPropertiesSource.java


示例7: CouchDBDHCalcDatabase

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private CouchDBDHCalcDatabase() {
	this.dbName = DHCalcProperties.getInstance().getDbName();
	try {
		CouchDbProperties props = new CouchDbProperties()
				.setDbName(dbName)
				.setCreateDbIfNotExist(true)
				.setProtocol("http")
				.setHost(DHCalcProperties.getInstance().getDb())
				.setPort(5984).setMaxConnections(100)
				.setConnectionTimeout(0);

		dbClient = new CouchDbClient(props);

		DesignDocument designDoc = dbClient.design().getFromDesk(dbName);

		dbClient.design().synchronizeWithDb(designDoc);

		String old = this
				.getParameter(CouchDBDHCalcParameters.SCHEMA_VERSION);

		if (old == null)
			old = "0";

		int oldVersion = Integer.parseInt(old);

		log.info("Database Version = " + oldVersion);

		if (oldVersion != VERSION) {
			log.info("Migrating Database to Version = " + VERSION);
			migrateSchema(oldVersion);
		}
	}

	catch (Exception e) {
		log.log(Level.SEVERE, e.getMessage(), e);
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:38,代码来源:CouchDBDHCalcDatabase.java


示例8: couchDbClient

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
@Bean(destroyMethod = "shutdown")
public CouchDbClient couchDbClient() {

    CouchDbProperties properties = new CouchDbProperties();
    properties.setProtocol("http");
    properties.setHost("localhost");
    properties.setPort(5984);
    properties.setDbName("lightcouch-integration-tests");

    CouchDbClient client = new CouchDbClient(properties);
    // we adjust the date format so that it is equal to the format used by Ektorp
    client.setGsonBuilder(new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
    return client;
}
 
开发者ID:rwitzel,项目名称:CouchRepository,代码行数:15,代码来源:LightCouchTestConfiguration.java


示例9: getCommonConfig

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private CouchDbProperties getCommonConfig(String dbName) {
	CouchDbProperties config = new CouchDbProperties();
	config.setHost(host)
		.setPort(port)
		.setProtocol(protocol)
		.setDbName(dbPrefix + "-" + dbName)
		.setCreateDbIfNotExist(createDbIfNotExist);
	if (!path.isEmpty())
		config.setPath(path);
	if (!username.isEmpty()) {
		config.setUsername(username)
			.setPassword(password);
	}
	return config;				
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:16,代码来源:PersistenceConfig.java


示例10: couchDbSessionClient

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
@Bean(destroyMethod = "shutdown")
public CouchDbClient couchDbSessionClient(){
    CouchDbProperties couchDbProperties = new CouchDbProperties();
    couchDbProperties.setHost(couchDbHostname);
    couchDbProperties.setPort(couchDbHostPort);
    couchDbProperties.setCreateDbIfNotExist(couchDbCreateIfNotExist);
    couchDbProperties.setProtocol(couchDbProtocol);
    couchDbProperties.setMaxConnections(couchDbMaxConnections);
    couchDbProperties.setDbName(sessionDatabaseName);
    couchDbProperties.setUsername(couchDbAdminUser);
    couchDbProperties.setPassword(couchDbAdminPassword);
    return new CouchDbClient(couchDbProperties);
}
 
开发者ID:wieden-kennedy,项目名称:composite-framework,代码行数:14,代码来源:RootConfig.java


示例11: getLib

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
@Override
public Object getLib(Datastore datastore) {
    CouchDbProperties properties = new CouchDbProperties();
    properties.setDbName(datastore.getDataUnit());
    properties.setHost(datastore.getHost());
    properties.setPort(datastore.getPort());
    properties.setCreateDbIfNotExist(false);
    properties.setProtocol(DatastoreProperties.DEFAULT_PROTOCOL_TYPE.toString());
    return new CouchDbClient(properties);
}
 
开发者ID:xLeitix,项目名称:jcloudscale,代码行数:11,代码来源:LightCouchWrapper.java


示例12: getDBProperties

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
@Override
protected CouchDbProperties getDBProperties() {
    return new CouchDbProperties("sitemap-data-anime_flv_last_series",
            false, "http", "104.155.73.101" , 5984, "admin", "cCx5pnv0" );
}
 
开发者ID:gsanguinetti,项目名称:Stedroids,代码行数:6,代码来源:SampleCouchDBUseCase.java


示例13: getEntityPersistenceConfig

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
public CouchDbProperties getEntityPersistenceConfig() {
	return getCommonConfig("entity");
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:4,代码来源:PersistenceConfig.java


示例14: getEntityTypePersistenceConfig

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
public CouchDbProperties getEntityTypePersistenceConfig() {
	return getCommonConfig("entity_type");
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:4,代码来源:PersistenceConfig.java


示例15: initDatabase

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private void initDatabase(CouchDbProperties config) {
	openEntityDatabase(config);
	syncEntityDesignDocs();
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:5,代码来源:EntityPersistence.java


示例16: openEntityDatabase

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private void openEntityDatabase(CouchDbProperties config) {
	db = new CouchDbClient(config);
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:4,代码来源:EntityPersistence.java


示例17: initDatabase

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
private void initDatabase(CouchDbProperties config) {
	openEntityDatabase(config);
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:4,代码来源:EntityTypePersistence.java


示例18: downloadPage

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Invokes the download process.
 *
 * @param pageId       the page ID
 * @param dbProperties CouchDbProperties pointing to the Crawcial Facebook database
 * @throws FacebookException if an error occurred during accessing Facebook
 */
public synchronized void downloadPage(String pageId, CouchDbProperties dbProperties) throws FacebookException {
    Thread t = new Thread(new LoaderThread(pageId, dbProperties));
    t.start();
    fb.setOAuthAccessToken(token);

}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:14,代码来源:FacebookStaticLoader.java


示例19: getDbProperties

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Returns the current database connection properties.
 *
 * @return current CouchDB connection properties
 */
public CouchDbProperties getDbProperties() {
    return dbProperties;
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:9,代码来源:DatabaseService.java


示例20: LoaderThread

import org.lightcouch.CouchDbProperties; //导入依赖的package包/类
/**
 * Constructor sets the Facebook page ID and CouchDbProperties.
 *
 * @param pageId       the page ID
 * @param dbProperties CouchDbProperties pointing to the Crawcial Facebook database
 */
public LoaderThread(String pageId, CouchDbProperties dbProperties) {
    this.pageId = pageId;
    this.dbProperties = dbProperties;
}
 
开发者ID:slauber,项目名称:Crawcial,代码行数:11,代码来源:FacebookStaticLoader.java



注:本文中的org.lightcouch.CouchDbProperties类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamTask类代码示例发布时间:2022-05-22
下一篇:
Java ReplicaAlreadyExistsException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap