Search in sources :

Example 1 with RedisTicketService

use of com.gitblit.tickets.RedisTicketService 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();
}
Also used : ITicketService(com.gitblit.tickets.ITicketService) BranchTicketService(com.gitblit.tickets.BranchTicketService) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) CmdLineException(org.kohsuke.args4j.CmdLineException) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RedisTicketService(com.gitblit.tickets.RedisTicketService) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) FileTicketService(com.gitblit.tickets.FileTicketService) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 2 with RedisTicketService

use of com.gitblit.tickets.RedisTicketService in project gitblit by gitblit.

the class RedisTicketServiceTest 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();
    RedisTicketService service = (RedisTicketService) new RedisTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) RedisTicketService(com.gitblit.tickets.RedisTicketService) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 3 with RedisTicketService

use of com.gitblit.tickets.RedisTicketService 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;
}
Also used : ITicketService(com.gitblit.tickets.ITicketService) RedisTicketService(com.gitblit.tickets.RedisTicketService) BranchTicketService(com.gitblit.tickets.BranchTicketService) FileTicketService(com.gitblit.tickets.FileTicketService)

Aggregations

RedisTicketService (com.gitblit.tickets.RedisTicketService)3 IRepositoryManager (com.gitblit.manager.IRepositoryManager)2 IRuntimeManager (com.gitblit.manager.IRuntimeManager)2 RepositoryManager (com.gitblit.manager.RepositoryManager)2 RuntimeManager (com.gitblit.manager.RuntimeManager)2 BranchTicketService (com.gitblit.tickets.BranchTicketService)2 FileTicketService (com.gitblit.tickets.FileTicketService)2 ITicketService (com.gitblit.tickets.ITicketService)2 XssFilter (com.gitblit.utils.XssFilter)2 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)2 IStoredSettings (com.gitblit.IStoredSettings)1 INotificationManager (com.gitblit.manager.INotificationManager)1 IPluginManager (com.gitblit.manager.IPluginManager)1 IUserManager (com.gitblit.manager.IUserManager)1 NotificationManager (com.gitblit.manager.NotificationManager)1 PluginManager (com.gitblit.manager.PluginManager)1 UserManager (com.gitblit.manager.UserManager)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1