use of com.gitblit.tickets.FileTicketService in project gitblit by gitblit.
the class ReindexTickets method reindex.
/**
* Reindex all tickets
*
* @param settings
*/
protected void reindex(File baseFolder, IStoredSettings settings) {
// disable some services
settings.overrideSetting(Keys.web.allowLuceneIndexing, false);
settings.overrideSetting(Keys.git.enableGarbageCollection, false);
settings.overrideSetting(Keys.git.enableMirroring, false);
settings.overrideSetting(Keys.web.activityCacheDays, 0);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter, baseFolder).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start();
String serviceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName());
if (StringUtils.isEmpty(serviceName)) {
System.err.println(MessageFormat.format("Please define a ticket service in \"{0}\"", Keys.tickets.service));
System.exit(1);
}
ITicketService ticketService = null;
try {
Class<?> serviceClass = Class.forName(serviceName);
if (RedisTicketService.class.isAssignableFrom(serviceClass)) {
// Redis ticket service
ticketService = new RedisTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else if (BranchTicketService.class.isAssignableFrom(serviceClass)) {
// Branch ticket service
ticketService = new BranchTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else if (FileTicketService.class.isAssignableFrom(serviceClass)) {
// File ticket service
ticketService = new FileTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else {
System.err.println("Unknown ticket service " + serviceName);
System.exit(1);
}
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
ticketService.reindex();
ticketService.stop();
repositoryManager.stop();
runtimeManager.stop();
}
use of com.gitblit.tickets.FileTicketService in project gitblit by gitblit.
the class MigrateTickets method getService.
protected ITicketService getService(String serviceName, IRuntimeManager runtimeManager, IRepositoryManager repositoryManager) throws Exception {
ITicketService service = null;
Class<?> serviceClass = Class.forName(serviceName);
if (RedisTicketService.class.isAssignableFrom(serviceClass)) {
// Redis ticket service
service = new RedisTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else if (BranchTicketService.class.isAssignableFrom(serviceClass)) {
// Branch ticket service
service = new BranchTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else if (FileTicketService.class.isAssignableFrom(serviceClass)) {
// File ticket service
service = new FileTicketService(runtimeManager, null, null, null, repositoryManager).start();
} else {
System.err.println("Unknown ticket service " + serviceName);
}
return service;
}
use of com.gitblit.tickets.FileTicketService in project gitblit by gitblit.
the class FileTicketServiceTest method getService.
@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
IStoredSettings settings = getSettings(deleteAll);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
FileTicketService service = (FileTicketService) new FileTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(getRepository());
}
return service;
}
Aggregations