patch-supose-0.6.1-385.txt

Sandro Frenzel, 10/05/2009 02:55 PM

Download (5 KB)

 
1
diff -u -r -N c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/cli/ScanCommand.java c:\NetbeansProjects\supoSElib\src/com/soebes/supose/cli/ScanCommand.java
2
--- c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/cli/ScanCommand.java	2009-09-24 15:29:23.351375000 +0200
3
+++ c:\NetbeansProjects\supoSElib\src/com/soebes/supose/cli/ScanCommand.java	2009-09-25 11:45:14.598125000 +0200
4
@@ -43,6 +43,7 @@
5
     private Option optionToRev = null;
6
     private Option optionIndexDir = null;
7
     private Option optionCreate = null;
8
+    private Option optionWithoutContent = null;
9
 
10
 	public ScanCommand() {
11
 		setCommand(createCommand());
12
@@ -129,7 +130,15 @@
13
 	    	.withLongName("create")
14
 	    	.withDescription("If given it means that the index will be create or overwritten if exists. Otherwise it will be used.")
15
 	    	.create();
16
-    	
17
+
18
+
19
+
20
+        
21
+        optionWithoutContent = obuilder
22
+             .withLongName("withoutcontent")             
23
+             .withDescription("If given it means that the content of the files will not be indexed.")
24
+             .create();
25
+
26
     	Group scanOptionIndex = gbuilder
27
     		.withOption(optionURL)
28
     		.withOption(optionUsername)
29
@@ -138,6 +147,7 @@
30
     		.withOption(optionToRev)
31
     		.withOption(optionIndexDir)
32
     		.withOption(optionCreate)
33
+            .withOption(optionWithoutContent)
34
     		.create();
35
     	
36
     	return cbuilder
37
@@ -176,6 +186,10 @@
38
 		return optionCreate;
39
 	}
40
 
41
+    public Option getOptionWithoutContent() {
42
+        return optionWithoutContent;
43
+    }
44
+
45
 	public boolean getCreate(CommandLine cline) {
46
 		return cline.hasOption((getOptionCreate()));
47
 	}
48
@@ -258,6 +272,9 @@
49
 		}
50
 		return result;
51
 	}
52
-	
53
+
54
+    public boolean getWithoutContent (CommandLine cline) {
55
+        return cline.hasOption((getOptionWithoutContent()));
56
+    }
57
 	
58
 }
59
60
diff -u -r -N c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/scan/FileExtensionHandler.java c:\NetbeansProjects\supoSElib\src/com/soebes/supose/scan/FileExtensionHandler.java
61
--- c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/scan/FileExtensionHandler.java	2009-09-24 15:29:22.960750000 +0200
62
+++ c:\NetbeansProjects\supoSElib\src/com/soebes/supose/scan/FileExtensionHandler.java	2009-09-25 09:23:21.877500000 +0200
63
@@ -46,7 +46,7 @@
64
 
65
 	private static Logger LOGGER = Logger.getLogger(FileExtensionProperty.class);
66
 
67
-	public void execute(Repository repository, SVNDirEntry dirEntry, String path, long revision) {
68
+	public void execute(Repository repository, SVNDirEntry dirEntry, String path, long revision, boolean withOutContent) {
69
 		FileName fn = new FileName(path);
70
 
71
 		//Check if we have an extension...
72
@@ -58,7 +58,11 @@
73
 					AScanDocument dh = (AScanDocument) handlerClass.newInstance();
74
 					dh.setProperties(getFileProperties());
75
 					dh.setDocument(doc);
76
-					dh.indexDocument(repository, dirEntry, path, revision);
77
+                    // Check if we should index the file content
78
+                    if(!withOutContent) {
79
+                        dh.indexDocument(repository, dirEntry, path, revision);
80
+                    }
81
+					//dh.indexDocument(repository, dirEntry, path, revision);
82
 				} catch (ClassNotFoundException e) {
83
 					LOGGER.error("Cannot create instance of : " + className, e);
84
 				} catch (InstantiationException e) {
85
@@ -84,7 +88,7 @@
86
 		 AScanDocument dh = new ScanDefaultDocument();
87
 		 dh.setProperties(getFileProperties());
88
 		 dh.setDocument(doc);
89
-		 dh.indexDocument(repository, dirEntry, path, revision);
90
+		 //dh.indexDocument(repository, dirEntry, path, revision);
91
 	}
92
 
93
 	 public Document getDoc() {
94
diff -u -r -N c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/scan/ScanRepository.java c:\NetbeansProjects\supoSElib\src/com/soebes/supose/scan/ScanRepository.java
95
--- c:\NetbeansProjects\supoSElib\src_old/com/soebes/supose/scan/ScanRepository.java	2009-09-24 15:29:22.960750000 +0200
96
+++ c:\NetbeansProjects\supoSElib\src/com/soebes/supose/scan/ScanRepository.java	2009-09-25 09:20:30.049375000 +0200
97
@@ -78,6 +78,8 @@
98
 
99
 	private Repository repository = null;
100
 
101
+    private boolean withoutContent = false;
102
+
103
 	public ScanRepository() {
104
 		super();
105
 		setStartRevision(0);
106
@@ -85,6 +87,7 @@
107
 		setRepository(null);
108
 		setName("");
109
 		setAbbort(false);
110
+        setWithOutContent(false);
111
 		logEntries = new ArrayList<SVNLogEntry>();
112
 	}
113
 
114
@@ -358,7 +361,7 @@
115
 				FileExtensionHandler feh = new FileExtensionHandler();
116
 				feh.setFileProperties(fileProperties);
117
 				feh.setDoc(doc);
118
-				feh.execute(repository, dirEntry, entryPath.getPath(), logEntry.getRevision());
119
+				feh.execute(repository, dirEntry, entryPath.getPath(), logEntry.getRevision(), withoutContent);
120
 			}
121
 
122
 			indexWriter.addDocument(doc);
123
@@ -423,4 +426,12 @@
124
 		this.abbort = abbort;
125
 	}
126
 
127
+    public void setWithOutContent(boolean withoutContent) {
128
+        this.withoutContent = withoutContent;
129
+    }
130
+
131
+    public boolean getWithOutContent() {
132
+        return withoutContent;
133
+    }
134
+
135
 }