use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class BranchTicketServiceTest 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();
BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(getRepository());
}
return service;
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class IPublicKeyManagerProvider method get.
@Override
public synchronized IPublicKeyManager get() {
if (manager != null) {
return manager;
}
IStoredSettings settings = runtimeManager.getSettings();
String clazz = settings.getString(Keys.git.sshKeysManager, FileKeyManager.class.getName());
if (StringUtils.isEmpty(clazz)) {
clazz = FileKeyManager.class.getName();
}
try {
Class<? extends IPublicKeyManager> mgrClass = (Class<? extends IPublicKeyManager>) Class.forName(clazz);
manager = runtimeManager.getInjector().getInstance(mgrClass);
} catch (Exception e) {
logger.error("failed to create public key manager", e);
manager = new NullKeyManager();
}
return manager;
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class ITicketServiceProvider method get.
@Override
public synchronized ITicketService get() {
if (service != null) {
return service;
}
IStoredSettings settings = runtimeManager.getSettings();
String clazz = settings.getString(Keys.tickets.service, NullTicketService.class.getName());
if (StringUtils.isEmpty(clazz)) {
clazz = NullTicketService.class.getName();
}
try {
Class<? extends ITicketService> serviceClass = (Class<? extends ITicketService>) Class.forName(clazz);
service = runtimeManager.getInjector().getInstance(serviceClass);
} catch (Exception e) {
logger.error("failed to create ticket service", e);
service = runtimeManager.getInjector().getInstance(NullTicketService.class);
}
return service;
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class SshDaemon method formatUrl.
public String formatUrl(String gituser, String servername, String repository) {
IStoredSettings settings = gitblit.getSettings();
int port = sshd.getPort();
int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port);
String displayServername = settings.getString(Keys.git.sshAdvertisedHost, "");
if (displayServername.isEmpty()) {
displayServername = servername;
}
if (displayPort == DEFAULT_PORT) {
// standard port
return MessageFormat.format("ssh://{0}@{1}/{2}", gituser, displayServername, repository);
} else {
// non-standard port
return MessageFormat.format("ssh://{0}@{1}:{2,number,0}/{3}", gituser, displayServername, displayPort, repository);
}
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class SshCommand method getRepositoryUrl.
protected String getRepositoryUrl(String repository) {
String username = getContext().getClient().getUsername();
IStoredSettings settings = getContext().getGitblit().getSettings();
String displayHostname = settings.getString(Keys.git.sshAdvertisedHost, "");
if (displayHostname.isEmpty()) {
displayHostname = getHostname();
}
int port = settings.getInteger(Keys.git.sshPort, 0);
int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port);
if (displayPort == 22) {
// standard port
return MessageFormat.format("{0}@{1}/{2}.git", username, displayHostname, repository);
} else {
// non-standard port
return MessageFormat.format("ssh://{0}@{1}:{2,number,0}/{3}", username, displayHostname, displayPort, repository);
}
}
Aggregations