本文整理汇总了Java中org.apache.tapestry5.ioc.annotations.Startup类的典型用法代码示例。如果您正苦于以下问题:Java Startup类的具体用法?Java Startup怎么用?Java Startup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Startup类属于org.apache.tapestry5.ioc.annotations包,在下文中一共展示了Startup类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scheduleJobs
import org.apache.tapestry5.ioc.annotations.Startup; //导入依赖的package包/类
@Startup
public static void scheduleJobs(ParallelExecutor executor,
final IMemoryDB memoryDb,
@Inject @Symbol(USE_MEMDB_PARAMETER) final String useMemoryDB,
@Inject @Symbol(MAX_MEMDB_ROWS_PARAMETER) final String maxRecords) {
System.out.println(USE_MEMDB_PARAMETER + "=" + useMemoryDB);
System.out.println(MAX_MEMDB_ROWS_PARAMETER + "=" + maxRecords);
if ("true".equalsIgnoreCase(useMemoryDB)) {
System.out
.println("Scheduling parallel job to load in-memory database.");
executor.invoke(IMemoryDB.class, new Invokable<IMemoryDB>() {
@Override
public IMemoryDB invoke() {
memoryDb.initialize(FastNumberUtils
.parseIntWithCheck(maxRecords));
return memoryDb;
}
});
}
}
示例2: initApplication
import org.apache.tapestry5.ioc.annotations.Startup; //导入依赖的package包/类
@Startup
public static void initApplication(final HibernateSessionManager hsm)
{
final Session session = hsm.getSession();
//
// final Work workClearDB = new Work() {
// public void execute(final Connection connection) throws SQLException
// {
// final Statement statement = connection.createStatement();
// statement.execute("TRUNCATE SCHEMA PUBLIC RESTART IDENTITY AND COMMIT NO CHECK");
// }
// };
//
// try {
// session.doWork(workClearDB);
// } catch (final Throwable e) {
// e.printStackTrace();
// }
// create sample data
for (int i = 0;i<100;++i) {
final String iv = String.valueOf(i);
saveOrUpdate(session, new PHEUser("user"+iv, "user"+iv+"@user"+iv, "password_"+iv));
}
hsm.commit();
}
示例3: initApplication
import org.apache.tapestry5.ioc.annotations.Startup; //导入依赖的package包/类
@Startup
public static void initApplication(RegistryShutdownHub shutdownHub, ConfigurationService service, EpgDataService epgService, UserService userService, VdrDataService vdrService,
ComponentClassResolver componentClassResolver, ComponentSource componentSource) {
shutdownHub.addRegistryShutdownListener(new Runnable() {
public void run() {
service.shutdown();
}
});
service.triggerInitialization();
if (!service.isUseEpgd() && (service.getEpgVdrUuuid() != null)) {
// Update database periodically (2 times a day)
scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
epgService.updateInternalEpgData(service.getEpgVdrUuuid());
}
}, 0, 12, TimeUnit.HOURS);
}
// create default admin user, if he does not exists
User user = new User();
if (!userService.existsUser("admin")) {
user.setUsername("admin");
user.setPassword("jonglisto");
user = userService.createUser(user);
}
// set default permission. Permission to do everything
userService.addIndividualPermission("admin", "*", "admin_permission");
// get all channel groups and update the permission
service.getConfiguredViews().values() //
.stream() //
.forEach(v -> {
System.err.println("Check View: " + v.getDisplayName());
try {
vdrService.getGroups(v.getChannelVdr().get()).get() //
.stream() //
.forEach(g -> {
System.err.println("Check Group: " + g);
userService.addPermission("channel:group:" + g, "perm_channel_group");
});
} catch (Exception e) {
System.err.println(e);
// do nothing
}
});
componentClassResolver.getPageNames().stream().forEach(s -> {
// preload all pages
componentSource.getPage(s);
});
}