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


Java ServerConfig.setName方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: ebeanServerConfig

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
@SuppressWarnings("SpringJavaAutowiringInspection")
@Bean
public ServerConfig ebeanServerConfig(DataSource dataSource) {
    ServerConfig config = new ServerConfig();
    config.setName("ebeanServer");
    config.setDefaultServer(true);
    config.setDataSource(dataSource);
    config.addPackage("com.clevergang.dbtests.repository.impl.ebean.entities");
    config.setExternalTransactionManager(new SpringAwareJdbcTransactionManager());
    config.setAutoCommitMode(false);
    config.setExpressionNativeIlike(true);

    return config;
}
 
开发者ID:bwajtr,项目名称:java-persistence-frameworks-comparison,代码行数:15,代码来源:DbTestsApplication.java

示例5: init

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
    this.loader = loader;
    this.server = server;
    this.file = file;
    this.description = description;
    this.dataFolder = dataFolder;
    this.classLoader = classLoader;
    this.configFile = new File(dataFolder, "config.yml");
    this.logger = new PluginLogger(this);

    if (description.isDatabaseEnabled()) {
        ServerConfig db = new ServerConfig();

        db.setDefaultServer(false);
        db.setRegister(false);
        db.setClasses(getDatabaseClasses());
        db.setName(description.getName());
        server.configureDbConfig(db);

        DataSourceConfig ds = db.getDataSourceConfig();

        ds.setUrl(replaceDatabaseString(ds.getUrl()));
        dataFolder.mkdirs();

        ClassLoader previous = Thread.currentThread().getContextClassLoader();

        Thread.currentThread().setContextClassLoader(classLoader);
        ebean = EbeanServerFactory.create(db);
        Thread.currentThread().setContextClassLoader(previous);
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:32,代码来源:JavaPlugin.java

示例6: initialize

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
/**
 * Initializes this plugin with the given variables.
 * <p>
 * This method should never be called manually.
 *
 * @param loader PluginLoader that is responsible for this plugin
 * @param server Server instance that is running this plugin
 * @param description PluginDescriptionFile containing metadata on this plugin
 * @param dataFolder Folder containing the plugin's data
 * @param file File containing this plugin
 * @param classLoader ClassLoader which holds this plugin
 */
protected final void initialize(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
    if (!initialized) {
        this.initialized = true;
        this.loader = loader;
        this.server = server;
        this.file = file;
        this.description = description;
        this.dataFolder = dataFolder;
        this.classLoader = classLoader;
        this.configFile = new File(dataFolder, "config.yml");
        this.logger = new PluginLogger(this);

        if (description.isDatabaseEnabled()) {
            ServerConfig db = new ServerConfig();

            db.setDefaultServer(false);
            db.setRegister(false);
            db.setClasses(getDatabaseClasses());
            db.setName(description.getName());
            server.configureDbConfig(db);

            DataSourceConfig ds = db.getDataSourceConfig();

            ds.setUrl(replaceDatabaseString(ds.getUrl()));
            dataFolder.mkdirs();

            ClassLoader previous = Thread.currentThread().getContextClassLoader();

            Thread.currentThread().setContextClassLoader(classLoader);
            ebean = EbeanServerFactory.create(db);
            Thread.currentThread().setContextClassLoader(previous);
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-API,代码行数:47,代码来源:JavaPlugin.java

示例7: findAsOf_given_intersectionWithNoHistory_then_joinNormalAndNoEffectiveDatePredicate

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
@Test
public void findAsOf_given_intersectionWithNoHistory_then_joinNormalAndNoEffectiveDatePredicate() {

  ServerConfig serverConfig = new ServerConfig();
  serverConfig.setName("pg");
  serverConfig.setDefaultServer(true);
  serverConfig.loadFromProperties();
  serverConfig.addClass(CustomerExcludeM2M.class);
  serverConfig.addClass(FeatureExcludeM2M.class);
  serverConfig.addClass(ContactExcludeM2M.class);
  serverConfig.addClass(Address.class);
  serverConfig.addClass(Country.class);

  EbeanServer localServer = EbeanServerFactory.create(serverConfig);

  long epochMilli = OffsetDateTime.now().minusHours(3).toInstant().toEpochMilli();
  Timestamp asOf = new Timestamp(epochMilli);

  LoggedSql.start();

  localServer.find(CustomerExcludeM2M.class)
      .asOf(asOf)
      .fetch("features")
      .where().eq("name", "jack")
      .findUnique();

  List<String> loggedSql = LoggedSql.stop();
  assertThat(loggedSql).hasSize(1);

  String sqlSelect = loggedSql.get(0);

  assertThat(sqlSelect.contains(" --bind(jack asOf ")).isTrue();
  assertThat(sqlSelect.contains(" from customer_with_history t0 ")).isTrue();
  assertThat(sqlSelect.contains(" join customer_feature t1z_ ")).isTrue();
  assertThat(sqlSelect.contains(" t0.sys_period @> ?::timestamptz")).isTrue();
  assertThat(!sqlSelect.contains(" t1z_.sys_period @> ?::timestamptz")).isTrue();

}
 
开发者ID:ebean-orm-examples,项目名称:avaje-ebeanorm-examples,代码行数:39,代码来源:CustomerFindWithManyToMany.java

示例8: 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


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