
package blade.migrate.core;

import blade.migrate.api.FileMigrator;
import blade.migrate.api.Problem;

import java.io.File;

import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;

import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
public abstract class XMLFileMigrator implements FileMigrator {

	@Activate
	public void activate(ComponentContext ctx) {
		this._context = ctx;

		final Dictionary<String, Object> properties =
			this._context.getProperties();

		this._problemTitle = (String)properties.get("problem.title");
		this._problemUrl = (String)properties.get("problem.url");
		this._problemSummary = (String)properties.get("problem.summary");
		this._problemType = (String)properties.get("file.extensions");
		this._problemTickets = (String)properties.get("problem.tickets");
	}

	@Override
	public List<Problem> analyzeFile(File file) {
		final List<Problem> problems = new ArrayList<>();

		final List<SearchResult> searchResults = searchXMLFile(file);

		if (searchResults != null) {
			for (SearchResult searchResult : searchResults) {
				problems.add(
					new Problem(
						this._problemTitle,
						this._problemUrl,
						this._problemSummary,
						this._problemType,
						this._problemTickets,
						file,
						searchResult.startLine,
						searchResult.startOffset, searchResult.endOffset));
			}
		}

		return problems;
	}

	protected abstract List<SearchResult> searchXMLFile(File file);

	private ComponentContext _context;
	private String _problemSummary;
	private String _problemTickets;
	private String _problemTitle;
	private String _problemType;
	private String _problemUrl;

}
@@ -118,17 +118,16 @@
 o.File;%0A
-%0A
 import j
@@ -431,21 +431,16 @@
 tx) %7B%0A%09%09
-this.
 _context
@@ -499,21 +499,16 @@
 es =%0A%09%09%09
-this.
 _context
@@ -528,21 +528,16 @@
 s();%0A%0A%09%09
-this.
 _problem
@@ -583,29 +583,24 @@
 .title%22);%0A%09%09
-this.
 _problemUrl 
@@ -638,29 +638,24 @@
 em.url%22);%0A%09%09
-this.
 _problemSumm
@@ -701,29 +701,24 @@
 ummary%22);%0A%09%09
-this.
 _problemType
@@ -765,21 +765,16 @@
 ns%22);%0A%09%09
-this.
 _problem
@@ -1128,29 +1128,24 @@
 blem(%0A%09%09%09%09%09%09
-this.
 _problemTitl
@@ -1145,37 +1145,32 @@
 lemTitle,%0A%09%09%09%09%09%09
-this.
 _problemUrl,%0A%09%09%09
@@ -1164,37 +1164,32 @@
 oblemUrl,%0A%09%09%09%09%09%09
-this.
 _problemSummary,
@@ -1187,37 +1187,32 @@
 mSummary,%0A%09%09%09%09%09%09
-this.
 _problemType,%0A%09%09
@@ -1219,13 +1219,8 @@
 %09%09%09%09
-this.
 _pro

remove "this" prefix