| | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Type; |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | |
| | | import com.gitblit.Constants.AccessPermission; |
| | | import com.gitblit.Constants.FederationRequest; |
| | | import com.gitblit.Constants.FederationToken; |
| | | import com.gitblit.Constants.Role; |
| | | import com.gitblit.GitBlitException; |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.extensions.RepositoryLifeCycleListener; |
| | | import com.gitblit.models.FederationModel; |
| | | import com.gitblit.models.FederationProposal; |
| | | import com.gitblit.models.FederationSet; |
| | | import com.gitblit.models.FilestoreModel; |
| | | import com.gitblit.models.ForkModel; |
| | | import com.gitblit.models.GitClientApplication; |
| | | import com.gitblit.models.Mailing; |
| | |
| | | import com.gitblit.transport.ssh.IPublicKeyManager; |
| | | import com.gitblit.transport.ssh.SshKey; |
| | | import com.gitblit.utils.ArrayUtils; |
| | | import com.gitblit.utils.HttpUtils; |
| | | import com.gitblit.utils.JsonUtils; |
| | | import com.gitblit.utils.ObjectCache; |
| | | import com.gitblit.utils.StringUtils; |
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.google.inject.Inject; |
| | | import com.google.inject.Injector; |
| | | import com.google.inject.Singleton; |
| | | import com.google.inject.Provider; |
| | | import com.google.inject.Singleton; |
| | | |
| | | /** |
| | | * GitblitManager is an aggregate interface delegate. It implements all the manager |
| | |
| | | |
| | | protected final IFederationManager federationManager; |
| | | |
| | | protected final IFilestoreManager filestoreManager; |
| | | |
| | | @Inject |
| | | public GitblitManager( |
| | | Provider<IPublicKeyManager> publicKeyManagerProvider, |
| | |
| | | IAuthenticationManager authenticationManager, |
| | | IRepositoryManager repositoryManager, |
| | | IProjectManager projectManager, |
| | | IFederationManager federationManager) { |
| | | IFederationManager federationManager, |
| | | IFilestoreManager filestoreManager) { |
| | | |
| | | this.publicKeyManagerProvider = publicKeyManagerProvider; |
| | | this.ticketServiceProvider = ticketServiceProvider; |
| | |
| | | this.repositoryManager = repositoryManager; |
| | | this.projectManager = projectManager; |
| | | this.federationManager = federationManager; |
| | | this.filestoreManager = filestoreManager; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | // add this clone to the cached model |
| | | repositoryManager.addToCachedRepositoryList(cloneModel); |
| | | |
| | | if (pluginManager != null) { |
| | | for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) { |
| | | try { |
| | | listener.onFork(repository, cloneModel); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin onFork %s", repository.name), t); |
| | | } |
| | | } |
| | | } |
| | | return cloneModel; |
| | | } |
| | | |
| | |
| | | // Read bundled Gitblit properties to extract setting descriptions. |
| | | // This copy is pristine and only used for populating the setting |
| | | // models map. |
| | | InputStream is = GitblitManager.class.getResourceAsStream("/reference.properties"); |
| | | InputStream is = GitblitManager.class.getResourceAsStream("/defaults.properties"); |
| | | BufferedReader propertiesReader = new BufferedReader(new InputStreamReader(is)); |
| | | StringBuilder description = new StringBuilder(); |
| | | SettingModel setting = new SettingModel(); |
| | |
| | | } |
| | | propertiesReader.close(); |
| | | } catch (NullPointerException e) { |
| | | logger.error("Failed to find resource copy of gitblit.properties"); |
| | | logger.error("Failed to find classpath resource 'defaults.properties'"); |
| | | } catch (IOException e) { |
| | | logger.error("Failed to load resource copy of gitblit.properties"); |
| | | logger.error("Failed to load classpath resource 'defaults.properties'"); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | |
| | | @Override |
| | | public UserModel authenticate(String username, char[] password) { |
| | | return authenticationManager.authenticate(username, password); |
| | | public UserModel authenticate(String username, char[] password, String remoteIP) { |
| | | return authenticationManager.authenticate(username, password, remoteIP); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public UserModel authenticate(String username, SshKey key) { |
| | | return authenticationManager.authenticate(username, key); |
| | | } |
| | | |
| | | @Override |
| | | public UserModel authenticate(String username) { |
| | | return authenticationManager.authenticate(username); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public boolean supportsTeamMembershipChanges(TeamModel team) { |
| | | return authenticationManager.supportsTeamMembershipChanges(team); |
| | | } |
| | | |
| | | @Override |
| | | public boolean supportsRoleChanges(UserModel user, Role role) { |
| | | return authenticationManager.supportsRoleChanges(user, role); |
| | | } |
| | | |
| | | @Override |
| | | public boolean supportsRoleChanges(TeamModel team, Role role) { |
| | | return authenticationManager.supportsRoleChanges(team, role); |
| | | } |
| | | |
| | | /* |
| | |
| | | } |
| | | |
| | | /* |
| | | * FILE STORAGE MANAGER |
| | | */ |
| | | |
| | | @Override |
| | | public boolean isValidOid(String oid) { |
| | | return filestoreManager.isValidOid(oid); |
| | | } |
| | | |
| | | @Override |
| | | public FilestoreModel.Status addObject(String oid, long size, UserModel user, RepositoryModel repo) { |
| | | return filestoreManager.addObject(oid, size, user, repo); |
| | | } |
| | | |
| | | @Override |
| | | public FilestoreModel getObject(String oid, UserModel user, RepositoryModel repo) { |
| | | return filestoreManager.getObject(oid, user, repo); |
| | | }; |
| | | |
| | | @Override |
| | | public FilestoreModel.Status uploadBlob(String oid, long size, UserModel user, RepositoryModel repo, InputStream streamIn ) { |
| | | return filestoreManager.uploadBlob(oid, size, user, repo, streamIn); |
| | | } |
| | | |
| | | @Override |
| | | public FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut ) { |
| | | return filestoreManager.downloadBlob(oid, user, repo, streamOut); |
| | | } |
| | | |
| | | @Override |
| | | public List<FilestoreModel> getAllObjects(UserModel user) { |
| | | return filestoreManager.getAllObjects(user); |
| | | } |
| | | |
| | | @Override |
| | | public File getStorageFolder() { |
| | | return filestoreManager.getStorageFolder(); |
| | | } |
| | | |
| | | @Override |
| | | public File getStoragePath(String oid) { |
| | | return filestoreManager.getStoragePath(oid); |
| | | } |
| | | |
| | | @Override |
| | | public long getMaxUploadSize() { |
| | | return filestoreManager.getMaxUploadSize(); |
| | | }; |
| | | |
| | | @Override |
| | | public void clearFilestoreCache() { |
| | | filestoreManager.clearFilestoreCache(); |
| | | }; |
| | | |
| | | @Override |
| | | public long getFilestoreUsedByteCount() { |
| | | return filestoreManager.getFilestoreUsedByteCount(); |
| | | }; |
| | | |
| | | @Override |
| | | public long getFilestoreAvailableByteCount() { |
| | | return filestoreManager.getFilestoreAvailableByteCount(); |
| | | }; |
| | | |
| | | /* |
| | | * PLUGIN MANAGER |
| | | */ |
| | | |
| | |
| | | public PluginRelease lookupRelease(String pluginId, String version) { |
| | | return pluginManager.lookupRelease(pluginId, version); |
| | | } |
| | | |
| | | } |