当前位置: 首页>>代码示例>>Java>>正文


Java ServerConfig.setDataSourceConfig方法代码示例

本文整理汇总了Java中com.avaje.ebean.config.ServerConfig.setDataSourceConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ServerConfig.setDataSourceConfig方法的具体用法?Java ServerConfig.setDataSourceConfig怎么用?Java ServerConfig.setDataSourceConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avaje.ebean.config.ServerConfig的用法示例。


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

示例1: configureDbConfig

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
@Override
public void configureDbConfig(ServerConfig config) {
    Validate.notNull(config, "Config cannot be null");

    DataSourceConfig ds = new DataSourceConfig();
    ds.setDriver(configuration.getString("database.driver"));
    ds.setUrl(configuration.getString("database.url"));
    ds.setUsername(configuration.getString("database.username"));
    ds.setPassword(configuration.getString("database.password"));
    ds.setIsolationLevel(TransactionIsolation.getLevel(configuration.getString("database.isolation")));

    if (ds.getDriver().contains("sqlite")) {
        config.setDatabasePlatform(new SQLitePlatform());
        config.getDatabasePlatform().getDbDdlSyntax().setIdentity("");
    }

    config.setDataSourceConfig(ds);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:19,代码来源:CraftServer.java

示例2: SQLOfflineTeamHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineTeamHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicTeam.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicTeam.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:19,代码来源:SQLOfflineTeamHandler.java

示例3: SQLOfflineGameHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineGameHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicGame.class);
    config.addClass(MapScalarTypeConverter.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicGame.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:20,代码来源:SQLOfflineGameHandler.java

示例4: SQLOfflineUserHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineUserHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicUser.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicUser.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:19,代码来源:SQLOfflineUserHandler.java

示例5: adaptFrom

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public ServerConfig adaptFrom(SqlDbServiceConfig actConfig, act.db.sql.DataSourceConfig dsConfig,  SqlDbService svc) {
    ServerConfig config = new ServerConfig();

    config.setName(svc.id());
    config.setDataSourceConfig(adaptFrom(dsConfig, svc));

    config.setDdlGenerate(actConfig.ddlGeneratorConfig.create);
    config.setDdlRun(actConfig.ddlGeneratorConfig.create);
    config.setDdlCreateOnly(!actConfig.ddlGeneratorConfig.drop);

    config.setNamingConvention(namingConvention(actConfig));

    Set<Class> modelClasses = svc.modelClasses();
    if (null != modelClasses && !modelClasses.isEmpty()) {
        for (Class modelClass : modelClasses) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(S.concat("add model class into Ebean config: ", modelClass.getName()));
            }
            config.addClass(modelClass);
        }
    }

    return config;
}
 
开发者ID:actframework,项目名称:act-ebean,代码行数:25,代码来源:EbeanConfigAdaptor.java

示例6: configureDbConfig

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public void configureDbConfig(ServerConfig config) {
    Validate.notNull(config, "Config cannot be null");

    DataSourceConfig ds = new DataSourceConfig();
    ds.setDriver(configuration.getString("database.driver"));
    ds.setUrl(configuration.getString("database.url"));
    ds.setUsername(configuration.getString("database.username"));
    ds.setPassword(configuration.getString("database.password"));
    ds.setIsolationLevel(TransactionIsolation.getLevel(configuration.getString("database.isolation")));

    if (ds.getDriver().contains("sqlite")) {
        config.setDatabasePlatform(new SQLitePlatform());
        config.getDatabasePlatform().getDbDdlSyntax().setIdentity("");
    }

    config.setDataSourceConfig(ds);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:18,代码来源:CraftServer.java

示例7: InMemoryEbeanServer

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public InMemoryEbeanServer() {
    // Create in-memory database configuration.
    DataSourceConfig dbConfig = new DataSourceConfig();
    dbConfig.setUsername("sa");
    dbConfig.setPassword("");
    dbConfig.setUrl("jdbc:h2:mem:tests2;DB_CLOSE_DELAY=-1");
    dbConfig.setDriver("org.h2.Driver");

    ServerConfig config = new ServerConfig();
    config.setName("h2");
    config.setDataSourceConfig(dbConfig);
    config.setDefaultServer(true);

    for (Class<?> entity : EbeanEntities.getEntities()) {
        config.addClass(entity);
    }

    config.setDdlGenerate(true);
    config.setDdlRun(true);

    server = EbeanServerFactory.create(config);
    ddl = ((SpiEbeanServer) server).getDdlGenerator();
}
 
开发者ID:Lugribossk,项目名称:dropwizard-experiment,代码行数:24,代码来源:InMemoryEbeanServer.java

示例8: createEbeanServerInstance

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public EbeanServer createEbeanServerInstance(PluginDataResolver pluginDataResolver) {
	File myDataDir;
	try {
		myDataDir = new File(pluginDataResolver.getPluginDatabaseDirectory());
	} catch (IOException e) {
		Loggers.SERVER.error("tcDebRepository EbeanServerProvider : Failed to get database directory location");
		Loggers.SERVER.debug(e);
		return null;
	}

	if (myDataDir.exists() && myDataDir.isDirectory() && myDataDir.canWrite()) {
		ServerConfig config = new ServerConfig();
		config.setName("db");
		config.loadFromProperties();

		DataSourceConfig dsConfig = config.getDataSourceConfig();
		dsConfig.setUrl(
				"jdbc:h2:file:" + myDataDir.getAbsolutePath() + File.separator + "tcDebRepositoryDB;DB_CLOSE_ON_EXIT=FALSE");

		config.setDataSourceConfig(dsConfig);

		Loggers.SERVER.debug(config.getDataSourceConfig().getUsername());

		// set as default and register so that Model can be
		// used if desired for save() and update() etc
		config.setDefaultServer(true);
		config.setRegister(true);
		config.addPackage("debrepo.teamcity.ebean");
		
		Loggers.SERVER.debug("EbeanServerProvider :: ebean Properties are: " + config.getProperties().toString());

		return EbeanServerFactory.create(config);
	}
	return null;
}
 
开发者ID:tcplugins,项目名称:tcDebRepository,代码行数:36,代码来源:EbeanServerProvider.java

示例9: createServerConfig

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public static ServerConfig createServerConfig(DataSourceFactory dbConfig) {
    ServerConfig config = new ServerConfig();
    config.setName("main");
    config.setDataSourceConfig(createDataSourceConfig(dbConfig));
    config.setDefaultServer(true);

    EbeanEntities.getEntities().forEach(config::addClass);

    return config;
}
 
开发者ID:Lugribossk,项目名称:dropwizard-experiment,代码行数:11,代码来源:EbeanConfigUtils.java

示例10: configureDbConfig

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public void configureDbConfig(ServerConfig config) {
    DataSourceConfig ds = new DataSourceConfig();
    ds.setDriver(configuration.getString("database.driver"));
    ds.setUrl(configuration.getString("database.url"));
    ds.setUsername(configuration.getString("database.username"));
    ds.setPassword(configuration.getString("database.password"));
    ds.setIsolationLevel(TransactionIsolation.getLevel(configuration.getString("database.isolation")));

    if (ds.getDriver().contains("sqlite")) {
        config.setDatabasePlatform(new SQLitePlatform());
        config.getDatabasePlatform().getDbDdlSyntax().setIdentity("");
    }

    config.setDataSourceConfig(ds);
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:16,代码来源:CraftServer.java


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