Subversion Repositories XServices

Rev

Rev 153 | Rev 168 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 153 Rev 167
Line 19... Line 19...
19
import java.io.FileInputStream;
19
import java.io.FileInputStream;
20
import java.io.FileNotFoundException;
20
import java.io.FileNotFoundException;
21
import java.io.IOException;
21
import java.io.IOException;
22
import java.io.StringWriter;
22
import java.io.StringWriter;
23
import java.math.BigInteger;
23
import java.math.BigInteger;
-
 
24
import java.net.MalformedURLException;
-
 
25
import java.net.URL;
24
import java.text.SimpleDateFormat;
26
import java.text.SimpleDateFormat;
25
import java.util.ArrayList;
27
import java.util.ArrayList;
-
 
28
import java.util.HashMap;
26
import java.util.Iterator;
29
import java.util.Iterator;
27
import java.util.List;
30
import java.util.List;
-
 
31
import java.util.Map;
28
import java.util.UUID;
32
import java.util.UUID;
Line 29... Line 33...
29
 
33
 
30
import javax.xml.bind.JAXBContext;
34
import javax.xml.bind.JAXBContext;
31
import javax.xml.bind.JAXBElement;
35
import javax.xml.bind.JAXBElement;
Line 54... Line 58...
54
import net.brutex.sbm.sbmappservices72.api.MultipleResponseItemOptions;
58
import net.brutex.sbm.sbmappservices72.api.MultipleResponseItemOptions;
55
import net.brutex.sbm.sbmappservices72.api.ObjectFactory;
59
import net.brutex.sbm.sbmappservices72.api.ObjectFactory;
56
import net.brutex.sbm.sbmappservices72.api.SectionsOption;
60
import net.brutex.sbm.sbmappservices72.api.SectionsOption;
57
import net.brutex.sbm.sbmappservices72.api.TTItemList;
61
import net.brutex.sbm.sbmappservices72.api.TTItemList;
58
import net.brutex.sbm.sbmappservices72.api.TableIdentifier;
62
import net.brutex.sbm.sbmappservices72.api.TableIdentifier;
-
 
63
import net.brutex.svn.SVNAdminCommand;
-
 
64
import net.brutex.svn.SVNAdminExecutor;
59
import net.brutex.svn.SVNCommitInfo;
65
import net.brutex.svn.SVNCommitInfo;
60
import net.brutex.svn.SVNLookExecutor;
66
import net.brutex.svn.SVNLookExecutor;
Line 61... Line 67...
61
 
67
 
62
import org.apache.axiom.om.OMAbstractFactory;
68
import org.apache.axiom.om.OMAbstractFactory;
Line 86... Line 92...
86
import org.apache.cxf.message.Message;
92
import org.apache.cxf.message.Message;
87
import org.apache.http.client.ClientProtocolException;
93
import org.apache.http.client.ClientProtocolException;
88
import org.apache.log4j.Logger;
94
import org.apache.log4j.Logger;
89
import org.jaxen.JaxenException;
95
import org.jaxen.JaxenException;
Line -... Line 96...
-
 
96
 
-
 
97
import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
Line 90... Line 98...
90
 
98
 
91
 
99
 
92
/**
100
/**
93
 * The Class ALFEmitter.
101
 * The Class ALFEmitter.
Line 102... Line 110...
102
	
110
	
103
	//
111
	//
104
	// Keys to read from the configuration file.
112
	// Keys to read from the configuration file.
105
	//
113
	//
-
 
114
	private static final String OPTION_SVNLOOK = "svnlook";
106
	private static final String OPTION_SVNLOOK = "svnlook";
115
	private static final String OPTION_SVNADMIN = "svnadmin";
107
	private static final String OPTION_LOCALE = "env.LANG";
116
	private static final String OPTION_LOCALE = "env.LANG";
108
	private static final String OPTION_ENCODING = "env.encoding";
117
	private static final String OPTION_ENCODING = "env.encoding";
Line 109... Line 118...
109
	private static final String OPTION_ISSUEPATTERN = "issuepattern";
118
	private static final String OPTION_ISSUEPATTERN = "issuepattern";
Line 132... Line 141...
132
	
141
	
133
	private static final String OPTION_IS_SOAPENABLED = "isSoapEnabled";
142
	private static final String OPTION_IS_SOAPENABLED = "isSoapEnabled";
134
	private static final String OPTION_IS_DROPENABLED = "isDropResponse";
143
	private static final String OPTION_IS_DROPENABLED = "isDropResponse";
135
	private static final String OPTION_IS_FORCEFAILENABLED = "forcefail";
144
	private static final String OPTION_IS_FORCEFAILENABLED = "forcefail";
-
 
145
	private static final String OPTION_IS_VERIFICATIONENABLED = "isWithVerification";
136
	private static final String OPTION_IS_VERIFICATIONENABLED = "isWithVerification";
146
	private static final String OPTION_IS_UPDATECOMMITMESSAGE = "isWithMessageUpdate";
137
	private static final String OPTION_IS_WSTRACE = "trace";
147
	private static final String OPTION_IS_WSTRACE = "trace";
Line 138... Line 148...
138
	private static final String OPTION_IS_XMLPROCESSINGENABLED = "isXmlProcessingEnabled";
148
	private static final String OPTION_IS_XMLPROCESSINGENABLED = "isXmlProcessingEnabled";
139
 
149
 
Line 164... Line 174...
164
	private final String querytable;
174
	private final String querytable;
165
	private final String query;
175
	private final String query;
Line 166... Line 176...
166
 
176
 
-
 
177
	
-
 
178
	private final List<String> internalissues = new ArrayList<String>();
Line 167... Line 179...
167
	
179
	//SBM IssueTypePrefix+IssueId, Title
168
	private final List<String> internalissues = new ArrayList<String>();
180
	private final Map<String, String> issues_titles = new HashMap<String, String>();
169
	
181
	
170
	/**
182
	/**
Line 185... Line 197...
185
		}
197
		}
186
		try {
198
		try {
187
			ALFEmitter emitter = new ALFEmitter(cmd, startTime);
199
			ALFEmitter emitter = new ALFEmitter(cmd, startTime);
188
		} catch (ConfigurationException e) {
200
		} catch (ConfigurationException e) {
189
			System.exit(1);
201
			System.exit(1);
-
 
202
		} catch (MalformedURLException e) {
-
 
203
			logger.error("Could not find/ load wsdl url.", e);
-
 
204
			System.exit(1);
190
		}
205
		}
191
		long endTime = System.currentTimeMillis();
206
		long endTime = System.currentTimeMillis();
192
		logger.debug("Total execution took '"+(endTime-startTime)+"' milliseconds.");
207
		logger.debug("Total execution took '"+(endTime-startTime)+"' milliseconds.");
193
		System.exit(0);
208
		System.exit(0);
194
	}
209
	}
Line 260... Line 275...
260
	private boolean readConfPropertyAsBoolean(String key, boolean defaultValue, boolean isRequired, String logmessage) throws ConfigurationException {
275
	private boolean readConfPropertyAsBoolean(String key, boolean defaultValue, boolean isRequired, String logmessage) throws ConfigurationException {
261
		Boolean b =  (Boolean) readConfProperty(key, defaultValue, isRequired, PropertyType.BOOLEAN, logmessage);
276
		Boolean b =  (Boolean) readConfProperty(key, defaultValue, isRequired, PropertyType.BOOLEAN, logmessage);
262
		return b.booleanValue();
277
		return b.booleanValue();
263
	}
278
	}
Line 264... Line 279...
264
		
279
		
265
	private ALFEmitter(CommandLine cmd, long startTime) throws ConfigurationException {
280
	private ALFEmitter(CommandLine cmd, long startTime) throws ConfigurationException, MalformedURLException {
266
		this.startTime = startTime;
281
		this.startTime = startTime;
267
		repos = cmd.getOptionValue(PARAM_REPOS);
282
		repos = cmd.getOptionValue(PARAM_REPOS);
268
		txn = cmd.getOptionValue(PARAM_TXN);
283
		txn = cmd.getOptionValue(PARAM_TXN);
269
		rev = cmd.getOptionValue(PARAM_REV);
284
		rev = cmd.getOptionValue(PARAM_REV);
Line 275... Line 290...
275
		config = null;
290
		config = null;
276
		try {
291
		try {
277
			config = new PropertiesConfiguration(config_file);
292
			config = new PropertiesConfiguration(config_file);
278
		} catch (ConfigurationException e) {
293
		} catch (ConfigurationException e) {
279
			logger.error("Could not find/ load '"+config_file+"' file.", e);
294
			logger.error("Could not find/ load '"+config_file+"' file.", e);
280
			System.exit(1);
295
			this.exit(1);
281
		}
296
		}
Line 282... Line 297...
282
		
297
		
283
		/*
298
		/*
284
		 * Load Properties from Configuration file
299
		 * Load Properties from Configuration file
Line 298... Line 313...
298
			// Flags to indicate what should be done
313
			// Flags to indicate what should be done
299
			final boolean isSoapEnabled 	= readConfPropertyAsBoolean(OPTION_IS_SOAPENABLED, true, true, null);
314
			final boolean isSoapEnabled 	= readConfPropertyAsBoolean(OPTION_IS_SOAPENABLED, true, true, null);
300
			final boolean isXmlProcessingEnabled 	= readConfPropertyAsBoolean(OPTION_IS_XMLPROCESSINGENABLED, true, true, null);
315
			final boolean isXmlProcessingEnabled 	= readConfPropertyAsBoolean(OPTION_IS_XMLPROCESSINGENABLED, true, true, null);
301
			final boolean isWithVerification= readConfPropertyAsBoolean(OPTION_IS_VERIFICATIONENABLED, false, true, null);
316
			final boolean isWithVerification= readConfPropertyAsBoolean(OPTION_IS_VERIFICATIONENABLED, false, true, null);
302
			final boolean isRemoveIssues	= readConfPropertyAsBoolean(OPTION_REMOVE_ISSUES_FROM_COMMIT, false, true, "");
317
			final boolean isRemoveIssues	= readConfPropertyAsBoolean(OPTION_REMOVE_ISSUES_FROM_COMMIT, false, true, "");
-
 
318
			final boolean isWithCommitUpdate= readConfPropertyAsBoolean(OPTION_IS_UPDATECOMMITMESSAGE, false, true, "");
Line 303... Line 319...
303
			
319
			
304
			/*
320
			/*
305
			 * SVNLook phase
321
			 * SVNLook phase
306
			 * Use svnlook to obtain information from SVN
322
			 * Use svnlook to obtain information from SVN
Line 336... Line 352...
336
			
352
			
337
				logger.debug(String.format("Starting verification for '%s' issues in the list.", info.getIssues().size()));
353
				logger.debug(String.format("Starting verification for '%s' issues in the list.", info.getIssues().size()));
338
				boolean isOK = verify(info.getIssues(), isTrace);
354
				boolean isOK = verify(info.getIssues(), isTrace);
339
				if(! isOK ) {
355
				if(! isOK ) {
340
					logger.error("Verification of issue failed. No matching issue was found.");
356
					logger.error("Verification of issue failed. No matching issue was found.");
341
					System.exit(1);
357
					this.exit(1);
342
				}
358
				}
343
			} else {
359
			} else {
344
				sbm_user = null; sbm_pass=null; endpoint=null; querytable=null; query=null;
360
				sbm_user = null; sbm_pass=null; endpoint=null; querytable=null; query=null;
Line 345... Line 361...
345
			}
361
			}
-
 
362
 
-
 
363
			/*
-
 
364
			 * Modify original commit message
-
 
365
			 * using svnadmin command
-
 
366
			 */
-
 
367
			if(isWithCommitUpdate) {
-
 
368
				String svnadmin = readConfPropertyAsString(OPTION_SVNADMIN, null, true, null);
-
 
369
				EmitterUtil.verifyFile(svnadmin, false, true);
-
 
370
				/* If verification was turned on, we do already have the titles
-
 
371
				 * so only try to load the items when verification was off
-
 
372
				 */
-
 
373
				if(! isWithVerification) {
-
 
374
					verify(info.getIssues(), isTrace);
-
 
375
				}
-
 
376
				/* Append associated items information and change log message */
-
 
377
				StringBuffer newmessage = new StringBuffer();
-
 
378
				newmessage.append(info.getLogmessage());
-
 
379
				newmessage.append("\n\n Associated SBM items:\n");
-
 
380
				for(String s : issues_titles.keySet()) {
-
 
381
					newmessage.append(s+": ");
-
 
382
					newmessage.append(issues_titles.get(s));
-
 
383
					newmessage.append("\n");
-
 
384
				}
-
 
385
				postCommitUpdate(new File(svnadmin), repos, locale, encoding, rev, newmessage.toString());
-
 
386
			}
346
 
387
			
347
			/*
388
			/*
348
			 * XML processing phase
389
			 * XML processing phase
Line 349... Line 390...
349
			 */			
390
			 */			
Line 350... Line -...
350
			if(isXmlProcessingEnabled) {
-
 
351
				
391
			if(isXmlProcessingEnabled) {
352
				
392
				
353
			}
393
				
354
			
394
			}
355
			
395
			
Line 398... Line 438...
398
			}
438
			}
Line 399... Line 439...
399
			
439
			
400
			
440
			
401
		} catch (FileNotFoundException e) {
441
		} catch (FileNotFoundException e) {
402
			logger.error(e.getMessage(), e);
442
			logger.error(e.getMessage(), e);
403
			System.exit(1);
443
			this.exit(1);
404
		} catch (ClientProtocolException e) {
444
		} catch (ClientProtocolException e) {
405
			logger.error(e.getMessage(), e);
445
			logger.error(e.getMessage(), e);
406
			System.exit(1);
446
			this.exit(1);
407
		} catch (IOException e) {
447
		} catch (IOException e) {
408
			logger.error(e.getMessage(), e);
448
			logger.error(e.getMessage(), e);
409
			System.exit(1);
449
			this.exit(1);
410
		} catch (XMLStreamException e) {
450
		} catch (XMLStreamException e) {
411
			logger.error(e.getMessage(), e);
451
			logger.error(e.getMessage(), e);
412
			System.exit(1);
452
			this.exit(1);
413
		} catch (JaxenException e) {
453
		} catch (JaxenException e) {
414
			logger.error(e.getMessage(), e);
454
			logger.error(e.getMessage(), e);
415
			System.exit(1);
-
 
416
		} finally {
455
			this.exit(1);
417
			logger.debug("Total execution took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
456
		} finally {
418
			String forcefail = config.getString(OPTION_IS_FORCEFAILENABLED, "");
457
			String forcefail = config.getString(OPTION_IS_FORCEFAILENABLED, "");
419
			if(forcefail.length()>0) {
458
			if(forcefail.length()>0) {
420
				logger.warn("Force fail is active. All commits will be blocked.");
459
				logger.warn("Force fail is active. All commits will be blocked.");
Line 421... Line 460...
421
				System.exit(1);
460
				this.exit(1);
Line 422... Line 461...
422
			}
461
			}
Line 488... Line 527...
488
			try {
527
			try {
489
				template = OMXMLBuilderFactory.createOMBuilder(new FileInputStream(new File(eventtemplate)))
528
				template = OMXMLBuilderFactory.createOMBuilder(new FileInputStream(new File(eventtemplate)))
490
						.getDocument().getOMDocumentElement();
529
						.getDocument().getOMDocumentElement();
491
			} catch (FileNotFoundException e1) {
530
			} catch (FileNotFoundException e1) {
492
				logger.error(String.format("Could not load XML event template from file '%s'.", eventtemplate), e1);
531
				logger.error(String.format("Could not load XML event template from file '%s'.", eventtemplate), e1);
493
				System.exit(1);
532
				this.exit(1);
494
			}
533
			}
495
			nss 	= 	readConfPropertyAsString(OPTION_EVENTNAMESPACE, "http://www.eclipse.org/alf/schema/EventBase/1", true, null);
534
			nss 	= 	readConfPropertyAsString(OPTION_EVENTNAMESPACE, "http://www.eclipse.org/alf/schema/EventBase/1", true, null);
496
			final String marker_logmessage 	= 	readConfPropertyAsString(OPTION_MARKER_LOGMESSAGE, "@@logmessage@@", true, null);
535
			final String marker_logmessage 	= 	readConfPropertyAsString(OPTION_MARKER_LOGMESSAGE, "@@logmessage@@", true, null);
497
			final String marker_author 		= 	readConfPropertyAsString(OPTION_MARKER_AUTHOR, "@@author@@", true, null);
536
			final String marker_author 		= 	readConfPropertyAsString(OPTION_MARKER_AUTHOR, "@@author@@", true, null);
498
			final String marker_revision	= 	readConfPropertyAsString(OPTION_MARKER_REVISION, "@@revision@@", true, null);
537
			final String marker_revision	= 	readConfPropertyAsString(OPTION_MARKER_REVISION, "@@revision@@", true, null);
Line 520... Line 559...
520
			addElements(marker_issues, info.getIssues(), marker_issueselementname);
559
			addElements(marker_issues, info.getIssues(), marker_issueselementname);
521
			addElements(marker_internalissues, internalissues, marker_issueselementname);
560
			addElements(marker_internalissues, internalissues, marker_issueselementname);
Line 522... Line 561...
522
			
561
			
Line 523... Line 562...
523
		}
562
		}
Line -... Line 563...
-
 
563
	
-
 
564
		private boolean verify(List<String> issues, boolean isTrace) throws MalformedURLException {
-
 
565
		
-
 
566
			for(String issueid : issues) {
-
 
567
				TTItemList items = getTTItems(issueid, isTrace);
-
 
568
				if(items == null) {
-
 
569
					return false;
-
 
570
				}
-
 
571
			}
-
 
572
			return true;			
-
 
573
	}
-
 
574
		
-
 
575
		
-
 
576
		private TTItemList getTTItems(String issueid, boolean isTrace) throws MalformedURLException {
524
	
577
			
-
 
578
			long startTime = System.currentTimeMillis();
-
 
579
			/* -- */
525
		private boolean verify(List<String> issues, boolean isTrace) {
580
			Sbmappservices72 ss = new Sbmappservices72(ClassLoader.getSystemResource("sbmappservices72.wsdl") );
Line 526... Line 581...
526
		
581
						
527
			Sbmappservices72 ss = new Sbmappservices72(ClassLoader.getSystemResource("sbmappservices72.wsdl") );
582
			logger.debug("Total execution of sbmappservices72 wsdl read took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
528
			Sbmappservices72PortType port = ss.getSbmappservices72();
583
			Sbmappservices72PortType port = ss.getSbmappservices72();
529
			
584
			
530
			Client client = ClientProxy.getClient(port);
585
			Client client = ClientProxy.getClient(port);
531
			if(isTrace) {
586
			if(isTrace) {
532
		        client.getInInterceptors().add(new LoggingInInterceptor());
587
		        client.getInInterceptors().add(new LoggingInInterceptor());
533
		        client.getOutInterceptors().add(new LoggingOutInterceptor());
588
		        client.getOutInterceptors().add(new LoggingOutInterceptor());
-
 
589
			}
-
 
590
			BindingProvider bindingProvider = (BindingProvider) port;
Line 534... Line 591...
534
			}
591
	        bindingProvider.getRequestContext().put(
535
			BindingProvider bindingProvider = (BindingProvider) port;
592
	        BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
536
	        bindingProvider.getRequestContext().put(
593
	        /* -- */
537
	        BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
594
	        logger.debug("Total execution of sbmappservices72 initialisation took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
Line 538... Line 595...
538
			
595
	        
539
			ObjectFactory fac = new ObjectFactory();
596
			ObjectFactory fac = new ObjectFactory();
Line 540... Line 597...
540
			Auth auth = fac.createAuth();
597
			Auth auth = fac.createAuth();
-
 
598
			auth.setUserId(fac.createAuthUserId(sbm_user));
541
			auth.setUserId(fac.createAuthUserId(sbm_user));
599
			auth.setPassword(fac.createAuthPassword(sbm_pass));
Line 542... Line -...
542
			auth.setPassword(fac.createAuthPassword(sbm_pass));
-
 
543
			
600
			
544
			TableIdentifier table = fac.createTableIdentifier();
601
			TableIdentifier table = fac.createTableIdentifier();
545
			table.setDbName(fac.createTableIdentifierDbName(querytable));
602
			table.setDbName(fac.createTableIdentifierDbName(querytable));
-
 
603
			
546
			
604
			MultipleResponseItemOptions options = fac.createMultipleResponseItemOptions();
547
			MultipleResponseItemOptions options = fac.createMultipleResponseItemOptions();
605
			options.setSpecifiedSections(fac.createResponseItemOptionsSpecifiedSections("SECTION:FIXED"));
-
 
606
			options.setSections(SectionsOption.SECTIONS_SPECIFIED);
548
			options.setSections(SectionsOption.SECTIONS_NONE);
607
			
-
 
608
			issueid = issueid.replaceAll("[^0-9]", "");
Line 549... Line 609...
549
			
609
			String queryWhereClause = "TS_ISSUEID = '"+issueid+"'";
550
			for(String issue : issues) {
610
			if(query!=null && query.length()>0) queryWhereClause = queryWhereClause + " And " + query;
551
				issue = issue.replaceAll("[^0-9]", "");
611
			TTItemList items = null;
Line 552... Line 612...
552
				String queryWhereClause = "TS_ISSUEID = '"+issue+"'";
612
			logger.debug(String.format("Using query against table '%s'. Query where clause: '%s'", querytable, queryWhereClause ));
553
				if(query!=null && query.length()>0) queryWhereClause = queryWhereClause + " And " + query;
613
			try {
554
				logger.debug(String.format("Using query against table '%s'. Query where clause: '%s'", querytable, queryWhereClause ));
614
					startTime = System.currentTimeMillis();
555
				try {
615
					items = port.getItemsByQuery(auth, table, queryWhereClause, "", null, BigInteger.valueOf(1), options);
556
					TTItemList items = port.getItemsByQuery(auth, table, queryWhereClause, "", null, BigInteger.valueOf(1), options);
616
					logger.debug("Total execution of sbmappservices72 GetItems took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
557
					
617
					
558
					//Marshaller m = JAXBContext.newInstance(TTItemList.class).createMarshaller();
618
					//Marshaller m = JAXBContext.newInstance(TTItemList.class).createMarshaller();
-
 
619
					//m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
559
					//m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
620
					//m.marshal( new JAXBElement<TTItemList>(new QName("uri","local"), TTItemList.class, items), System.err);
-
 
621
					
-
 
622
					logger.debug(String.format("Got Response from getItemsByQuery"));
-
 
623
					if(items!=null) {
-
 
624
						logger.debug(String.format("Verification query matched '%s' item(s) for issue '%s.'",items.getTotalCount(), issueid));
560
					//m.marshal( new JAXBElement<TTItemList>(new QName("uri","local"), TTItemList.class, items), System.err);
625
					}
Line 561... Line 626...
561
					
626
					if(items.getTotalCount().intValue()<=0) {
562
					logger.debug(String.format("Got Response from getItemsByQuery"));
627
						return null;
563
					if(items!=null) {
628
					} else {
564
						logger.debug(String.format("Verification query matched '%s' item(s) for issue '%s.'",items.getTotalCount(), issue));
629
						/* store internal ids (tableid:itemid) */
565
					}
630
						internalissues.add(items.getItem().get(0).getId().getValue().getTableIdItemId().getValue());
-
 
631
						/* Store a map entry with internal id and title */
566
					if(items.getTotalCount().intValue()<=0) {
632
						issues_titles.put(items.getItem().get(0).getId().getValue().getDisplayName().getValue(), 
567
						return false;
-
 
Line -... Line 633...
-
 
633
											items.getItem().get(0).getTitle().getValue());
-
 
634
						
-
 
635
					}
-
 
636
					
-
 
637
			} catch (AEWebservicesFaultFault e) {
-
 
638
					logger.debug("Web service fault: " + e.getFaultInfo());
-
 
639
			} catch (Exception e) {
568
					} else {
640
					logger.debug("Unknown Exception", e);
Line 569... Line 641...
569
						internalissues.add(items.getItem().get(0).getId().getValue().getTableIdItemId().getValue());
641
			}
570
					}
642
			return items;	
571
					
643
		}
Line 617... Line 689...
617
			if(n!=null) return n;
689
			if(n!=null) return n;
618
			logger.warn("Comment '"+pattern+"' was not found in the XML template.");
690
			logger.warn("Comment '"+pattern+"' was not found in the XML template.");
619
			return null;
691
			return null;
620
		}
692
		}
Line -... Line 693...
-
 
693
		
-
 
694
	private void exit(int errorCode) {
-
 
695
		long endTime = System.currentTimeMillis();
-
 
696
		logger.debug("Total execution took '"+(endTime-startTime)+"' milliseconds.");
-
 
697
		System.exit(errorCode);
-
 
698
	}
621
	
699
	
622
	@SuppressWarnings("static-access")
700
	@SuppressWarnings("static-access")
623
	private static Options getOptions() {
701
	private static Options getOptions() {
624
		Option repository = OptionBuilder.withArgName( "repository" )
702
		Option repository = OptionBuilder.withArgName( "repository" )
625
											.hasArg()
703
											.hasArg()
Line 654... Line 732...
654
	
732
	
655
	private static void printHelp() {
733
	private static void printHelp() {
656
		// automatically generate the help statement
734
		// automatically generate the help statement
657
		HelpFormatter formatter = new HelpFormatter();
735
		HelpFormatter formatter = new HelpFormatter();
658
		String header = "\nSVN-ALFEventEmitter " + VERSION +", a SVN hook implemented in Java to emit Eclipse ALFEvents on commit.\n\n";
736
		String header = "\nSVN-ALFEventEmitter " + VERSION +", a SVN hook implemented in Java to emit Eclipse ALFEvents on commit.\n\n";
659
		String footer = "Please send bug reports to bru@brutex.de.\n(c)2013 Brian Rosenberger";
737
		String footer = "Please send bug reports to bru@brutex.de.\n(c)2014 Brian Rosenberger";
660
		formatter.printHelp("java -jar SVN-ALFEventEmitter", header, getOptions(), footer, true);
738
		formatter.printHelp("java -jar SVN-ALFEventEmitter", header, getOptions(), footer, true);