- compile 'commons-codec:commons-codec:1.7' :war
- compile 'redis.clients:jedis:2.6.2' :war
- compile 'ro.fortsoft.pf4j:pf4j:0.9.0' :war
-- compile 'org.apache.tika:tika-core:1.5' :war
+- compile 'org.apache.tika:tika-core:1.12' :war
+- compile 'org.apache.tika:tika-parsers:1.12' :war
- compile 'org.jsoup:jsoup:1.7.3' :war
- test 'junit'
# Dependencies for Selenium web page testing
RuntimeManager runtime = new RuntimeManager(settings, xssFilter, baseFolder).start();
NoopNotificationManager notifications = new NoopNotificationManager().start();
UserManager users = new UserManager(runtime, null).start();
- RepositoryManager repositories = new RepositoryManager(runtime, null, users).start();
+ RepositoryManager repositories = new RepositoryManager(runtime, null, users, null).start();
FederationManager federation = new FederationManager(runtime, notifications, repositories).start();
IGitblit gitblit = new GitblitManager(null, null, runtime, null, notifications, users, null, repositories, null, federation, null);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter, baseFolder).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null, null).start();
String inputServiceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName());
if (StringUtils.isEmpty(inputServiceName)) {
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter, baseFolder).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null, null).start();
String serviceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName());
if (StringUtils.isEmpty(serviceName)) {
private final IRuntimeManager runtimeManager;
- private final IRepositoryManager repositoryManager;
-
private final IStoredSettings settings;
public static final int UNDEFINED_SIZE = -1;
@Inject
- FilestoreManager(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager) {
+ public FilestoreManager(IRuntimeManager runtimeManager) {
this.runtimeManager = runtimeManager;
- this.repositoryManager = repositoryManager;
this.settings = runtimeManager.getSettings();
}
}
@Override
- public List<FilestoreModel> getAllObjects(UserModel user) {
+ public List<FilestoreModel> getAllObjects(List<RepositoryModel> viewableRepositories) {
- final List<RepositoryModel> viewableRepositories = repositoryManager.getRepositoryModels(user);
List<String> viewableRepositoryNames = new ArrayList<String>(viewableRepositories.size());
for (RepositoryModel repository : viewableRepositories) {
}
@Override
- public List<FilestoreModel> getAllObjects(UserModel user) {
- return filestoreManager.getAllObjects(user);
+ public List<FilestoreModel> getAllObjects(List<RepositoryModel> viewableRepositories) {
+ return filestoreManager.getAllObjects(viewableRepositories);
}
@Override
FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut );
- List<FilestoreModel> getAllObjects(UserModel user);
+ List<FilestoreModel> getAllObjects(List<RepositoryModel> viewableRepositories);
File getStorageFolder();
private final IPluginManager pluginManager;
private final IUserManager userManager;
+
+ private final IFilestoreManager filestoreManager;
private File repositoriesFolder;
public RepositoryManager(
IRuntimeManager runtimeManager,
IPluginManager pluginManager,
- IUserManager userManager) {
+ IUserManager userManager,
+ IFilestoreManager filestoreManager) {
this.settings = runtimeManager.getSettings();
this.runtimeManager = runtimeManager;
this.pluginManager = pluginManager;
this.userManager = userManager;
+ this.filestoreManager = filestoreManager;
}
@Override
}
protected void configureLuceneIndexing() {
- luceneExecutor = new LuceneService(settings, this);
+ luceneExecutor = new LuceneService(settings, this, filestoreManager);
String frequency = settings.getString(Keys.web.luceneFrequency, "2 mins");
int mins = TimeUtils.convertFrequencyToMinutes(frequency, 2);
scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, mins, TimeUnit.MINUTES);
\r
import java.io.ByteArrayOutputStream;\r
import java.io.File;\r
+import java.io.FileInputStream;\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.text.MessageFormat;\r
import org.apache.lucene.store.Directory;\r
import org.apache.lucene.store.FSDirectory;\r
import org.apache.lucene.util.Version;\r
+import org.apache.tika.metadata.Metadata;\r
+import org.apache.tika.parser.AutoDetectParser;\r
+import org.apache.tika.parser.ParseContext;\r
+import org.apache.tika.parser.pdf.PDFParser;\r
+import org.apache.tika.sax.BodyContentHandler;\r
import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
import org.eclipse.jgit.lib.Constants;\r
import org.eclipse.jgit.lib.FileMode;\r
import org.slf4j.LoggerFactory;\r
\r
import com.gitblit.Constants.SearchObjectType;\r
+import com.gitblit.GitBlit;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
+import com.gitblit.manager.FilestoreManager;\r
+import com.gitblit.manager.IFilestoreManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.models.PathModel.PathChangeModel;\r
import com.gitblit.models.RefModel;\r
\r
private final IStoredSettings storedSettings;\r
private final IRepositoryManager repositoryManager;\r
+ private final IFilestoreManager filestoreManager;\r
+ \r
private final File repositoriesFolder;\r
\r
private final Map<String, IndexSearcher> searchers = new ConcurrentHashMap<String, IndexSearcher>();\r
\r
public LuceneService(\r
IStoredSettings settings,\r
- IRepositoryManager repositoryManager) {\r
+ IRepositoryManager repositoryManager, \r
+ IFilestoreManager filestoreManager) {\r
\r
this.storedSettings = settings;\r
this.repositoryManager = repositoryManager;\r
+ this.filestoreManager = filestoreManager;\r
this.repositoriesFolder = repositoryManager.getRepositoriesFolder();\r
String exts = luceneIgnoreExtensions;\r
if (settings != null) {\r
if (!paths.containsKey(path)) {\r
continue;\r
}\r
-\r
+//TODO: Figure out filestore oid the path - bit more involved than updating the index\r
+ \r
// remove path from set\r
ObjectId blobId = paths.remove(path);\r
result.blobCount++;\r
}\r
\r
if (StringUtils.isEmpty(ext) || !excludedExtensions.contains(ext)) {\r
+ String str = "";\r
// read the blob content\r
- String str = JGitUtils.getStringContent(repository, commit.getTree(),\r
+ if (path.isFilestoreItem()) {\r
+ //Get file from filestore\r
+ BodyContentHandler handler = new BodyContentHandler();\r
+ Metadata metadata = new Metadata();\r
+ PDFParser parser = new PDFParser();\r
+ \r
+ ParseContext parseContext = new ParseContext();\r
+ File lfsFile = filestoreManager.getStoragePath(path.getFilestoreOid());\r
+ FileInputStream inputstream = new FileInputStream(lfsFile);\r
+ parser.parse(inputstream, handler, metadata, parseContext);\r
+ str = handler.toString();\r
+ } else {\r
+ str = JGitUtils.getStringContent(repository, commit.getTree(),\r
path.path, encodings);\r
+ }\r
+ \r
if (str != null) {\r
doc.add(new Field(FIELD_CONTENT, str, TextField.TYPE_STORED));\r
writer.addDocument(doc);\r
import com.gitblit.Constants.FeedObjectType;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.models.FeedEntryModel;\r
-import com.sun.syndication.feed.synd.SyndCategory;\r
-import com.sun.syndication.feed.synd.SyndCategoryImpl;\r
-import com.sun.syndication.feed.synd.SyndContent;\r
-import com.sun.syndication.feed.synd.SyndContentImpl;\r
-import com.sun.syndication.feed.synd.SyndEntry;\r
-import com.sun.syndication.feed.synd.SyndEntryImpl;\r
-import com.sun.syndication.feed.synd.SyndFeed;\r
-import com.sun.syndication.feed.synd.SyndFeedImpl;\r
-import com.sun.syndication.feed.synd.SyndImageImpl;\r
-import com.sun.syndication.io.FeedException;\r
-import com.sun.syndication.io.SyndFeedInput;\r
-import com.sun.syndication.io.SyndFeedOutput;\r
-import com.sun.syndication.io.XmlReader;\r
+import com.rometools.rome.feed.synd.SyndCategory;\r
+import com.rometools.rome.feed.synd.SyndCategoryImpl;\r
+import com.rometools.rome.feed.synd.SyndContent;\r
+import com.rometools.rome.feed.synd.SyndContentImpl;\r
+import com.rometools.rome.feed.synd.SyndEntry;\r
+import com.rometools.rome.feed.synd.SyndEntryImpl;\r
+import com.rometools.rome.feed.synd.SyndFeed;\r
+import com.rometools.rome.feed.synd.SyndFeedImpl;\r
+import com.rometools.rome.feed.synd.SyndImageImpl;\r
+import com.rometools.rome.io.FeedException;\r
+import com.rometools.rome.io.SyndFeedInput;\r
+import com.rometools.rome.io.SyndFeedOutput;\r
+import com.rometools.rome.io.XmlReader;\r
\r
/**\r
* Utility class for RSS feeds.\r
final UserModel user = (GitBlitWebSession.get().getUser() == null) ? UserModel.ANONYMOUS : GitBlitWebSession.get().getUser();
final long nBytesUsed = app().filestore().getFilestoreUsedByteCount();
final long nBytesAvailable = app().filestore().getFilestoreAvailableByteCount();
- List<FilestoreModel> files = app().filestore().getAllObjects(user);
+ List<FilestoreModel> files = app().filestore().getAllObjects(app().repositories().getRepositoryModels(user));
if (files == null) {
files = new ArrayList<FilestoreModel>();
package com.gitblit.tests;
import com.gitblit.IStoredSettings;
+import com.gitblit.manager.FilestoreManager;
+import com.gitblit.manager.IFilestoreManager;
import com.gitblit.manager.INotificationManager;
import com.gitblit.manager.IPluginManager;
import com.gitblit.manager.IRepositoryManager;
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();
+ IRepositoryManager repositoryManager = new RepositoryManager(
+ runtimeManager, pluginManager, userManager, null).start();
BranchTicketService service = new BranchTicketService(
runtimeManager,
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();
+ IRepositoryManager repositoryManager = new RepositoryManager(
+ runtimeManager, pluginManager, userManager, null).start();
FileTicketService service = new FileTicketService(
runtimeManager,
import org.junit.Test;\r
\r
import com.gitblit.Keys;\r
+import com.gitblit.manager.FilestoreManager;\r
import com.gitblit.manager.RepositoryManager;\r
import com.gitblit.manager.RuntimeManager;\r
import com.gitblit.manager.UserManager;\r
XssFilter xssFilter = new AllowXssFilter();\r
RuntimeManager runtime = new RuntimeManager(settings, xssFilter, GitBlitSuite.BASEFOLDER).start();\r
UserManager users = new UserManager(runtime, null).start();\r
- RepositoryManager repos = new RepositoryManager(runtime, null, users);\r
- return new LuceneService(settings, repos);\r
+ RepositoryManager repos = new RepositoryManager(runtime, null, users, null);\r
+ //TODO: May need filestore\r
+ return new LuceneService(settings, repos, null);\r
}\r
\r
private RepositoryModel newRepositoryModel(Repository repository) {\r
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();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager, null).start();
RedisTicketService service = new RedisTicketService(
runtimeManager,
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();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager, null).start();
BranchTicketService service = new BranchTicketService(
runtimeManager,