Subversion Repositories XServices

Rev

Rev 170 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 170 Rev 196
Line 13... Line 13...
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
package net.brutex.emitter;
16
package net.brutex.emitter;
Line 17... Line -...
17
 
-
 
18
import java.io.File;
-
 
19
import java.io.FileInputStream;
-
 
20
import java.io.FileNotFoundException;
-
 
21
import java.io.IOException;
-
 
22
import java.io.StringWriter;
-
 
23
import java.math.BigInteger;
-
 
24
import java.net.MalformedURLException;
-
 
25
import java.text.SimpleDateFormat;
-
 
26
import java.util.ArrayList;
-
 
27
import java.util.HashMap;
-
 
28
import java.util.List;
-
 
29
import java.util.Map;
-
 
30
 
-
 
31
import javax.xml.stream.XMLStreamException;
-
 
32
 
17
 
33
import net.brutex.emitter.util.EmitterUtil;
18
import net.brutex.emitter.util.EmitterUtil;
34
import net.brutex.emitter.util.PasswordEncrypter;
19
import net.brutex.emitter.util.PasswordEncrypter;
35
import net.brutex.sbm.sbmappservices72.AEWebservicesFaultFault;
20
import net.brutex.sbm.sbmappservices72.AEWebservicesFaultFault;
36
import net.brutex.sbm.sbmappservices72.Sbmappservices72PortType;
21
import net.brutex.sbm.sbmappservices72.Sbmappservices72PortType;
37
import net.brutex.sbm.sbmappservices72.api.Auth;
-
 
38
import net.brutex.sbm.sbmappservices72.api.MultipleResponseItemOptions;
-
 
39
import net.brutex.sbm.sbmappservices72.api.ObjectFactory;
-
 
40
import net.brutex.sbm.sbmappservices72.api.SectionsOption;
-
 
41
import net.brutex.sbm.sbmappservices72.api.TTItemList;
-
 
42
import net.brutex.sbm.sbmappservices72.api.TableIdentifier;
22
import net.brutex.sbm.sbmappservices72.api.*;
43
import net.brutex.svn.SVNAdminCommand;
23
import net.brutex.svn.SVNAdminCommand;
44
import net.brutex.svn.SVNAdminExecutor;
24
import net.brutex.svn.SVNAdminExecutor;
45
import net.brutex.svn.SVNCommitInfo;
25
import net.brutex.svn.SVNCommitInfo;
46
import net.brutex.svn.SVNLookExecutor;
-
 
47
 
-
 
48
import org.apache.axiom.om.OMAbstractFactory;
-
 
49
import org.apache.axiom.om.OMComment;
-
 
50
import org.apache.axiom.om.OMElement;
-
 
51
import org.apache.axiom.om.OMFactory;
-
 
52
import org.apache.axiom.om.OMNamespace;
26
import net.brutex.svn.SVNLookExecutor;
53
import org.apache.axiom.om.OMNode;
-
 
54
import org.apache.axiom.om.OMText;
-
 
55
import org.apache.axiom.om.OMXMLBuilderFactory;
27
import org.apache.axiom.om.*;
56
import org.apache.axiom.om.xpath.AXIOMXPath;
-
 
57
import org.apache.commons.cli.CommandLine;
-
 
58
import org.apache.commons.cli.CommandLineParser;
-
 
59
import org.apache.commons.cli.HelpFormatter;
-
 
60
import org.apache.commons.cli.Option;
-
 
61
import org.apache.commons.cli.OptionBuilder;
28
import org.apache.axiom.om.xpath.AXIOMXPath;
62
import org.apache.commons.cli.Options;
29
import org.apache.commons.cli.Options;
63
import org.apache.commons.cli.BasicParser;
-
 
64
import org.apache.commons.cli.ParseException;
30
import org.apache.commons.cli.*;
65
import org.apache.commons.configuration.Configuration;
31
import org.apache.commons.configuration.Configuration;
66
import org.apache.commons.configuration.ConfigurationException;
32
import org.apache.commons.configuration.ConfigurationException;
67
import org.apache.commons.configuration.PropertiesConfiguration;
33
import org.apache.commons.configuration.PropertiesConfiguration;
68
import org.apache.cxf.endpoint.Client;
34
import org.apache.cxf.endpoint.Client;
Line 72... Line 38...
72
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
38
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
73
import org.apache.http.client.ClientProtocolException;
39
import org.apache.http.client.ClientProtocolException;
74
import org.apache.log4j.Logger;
40
import org.apache.log4j.Logger;
75
import org.jaxen.JaxenException;
41
import org.jaxen.JaxenException;
Line -... Line 42...
-
 
42
 
-
 
43
import javax.xml.stream.XMLStreamException;
-
 
44
import java.io.*;
-
 
45
import java.math.BigInteger;
-
 
46
import java.net.MalformedURLException;
-
 
47
import java.text.SimpleDateFormat;
-
 
48
import java.util.ArrayList;
-
 
49
import java.util.HashMap;
-
 
50
import java.util.List;
-
 
51
import java.util.Map;
Line 76... Line 52...
76
 
52
 
77
 
53
 
78
/**
54
/**
79
 * The Class ALFEmitter.
55
 * The Class ALFEmitter.
80
 *
56
 *
81
 * @author Brian Rosenberger, bru(at)brutex.de
57
 * @author Brian Rosenberger, bru(at)brutex.de
82
 * @since 0.1
58
 * @since 0.1
83
 */
59
 */
84
public class ALFEmitter {
60
public class ALFEmitter {
85
	
61
 
86
	public static final String VERSION = "0.1";
62
	public static final String VERSION = "0.2";
87
	private static Logger logger = Logger.getRootLogger();
63
	private static Logger logger = Logger.getRootLogger();
88
	
64
 
89
	//
65
	//
90
	// Keys to read from the configuration file.
66
	// Keys to read from the configuration file.
91
	//
67
	//
Line 683... Line 659...
683
	private void exit(int errorCode) {
659
	private void exit(int errorCode) {
684
		long endTime = System.currentTimeMillis();
660
		long endTime = System.currentTimeMillis();
685
		logger.debug("Total execution took '"+(endTime-startTime)+"' milliseconds.");
661
		logger.debug("Total execution took '"+(endTime-startTime)+"' milliseconds.");
686
		System.exit(errorCode);
662
		System.exit(errorCode);
687
	}
663
	}
688
	
664
 
689
	@SuppressWarnings("static-access")
-
 
-
 
665
 
690
	private static Options getOptions() {
666
	private static Options getOptions() {
691
		Option repository = OptionBuilder.withArgName( "repository" )
667
		Option repository = Option.builder(PARAM_REPOS)
692
											.hasArg()
-
 
693
											.withLongOpt("repository")
668
				.argName("repository")
694
											.withDescription(  "Path or URL to the SVN repository." )
-
 
695
											.create( PARAM_REPOS );
-
 
696
		repository.setRequired(true);
-
 
697
		
-
 
698
		Option txn = OptionBuilder.withArgName( "transactionid" )
-
 
699
											.hasArg()
-
 
700
											.withLongOpt("transaction")
-
 
701
											.withDescription(  "The SVN transaction id to examine (TXN). You cannot combine txn with -rev. "
-
 
702
													+ "When a txn is given, the repository path must be a local path.")
-
 
703
											.create( PARAM_TXN );
-
 
704
		Option rev = OptionBuilder.withArgName( "revision" )
-
 
705
				.hasArg()
669
				.hasArg()
-
 
670
				.longOpt("repository")
706
				.withDescription(  "A revision to examine. You cannot combine revision with -txn." )
671
				.desc("Path or Url to the SVN repository")
707
				.create( PARAM_REV );
672
				.required()
-
 
673
				.build();
-
 
674
 
708
		Option config = OptionBuilder.withArgName( "config_file" )
675
		Option txn = Option.builder(PARAM_TXN)
-
 
676
				.argName("transactionid")
709
				.hasArg()
677
				.hasArg()
-
 
678
				.longOpt("transaction")
-
 
679
				.desc("The SVN transaction id to examine (TXN). You cannot combine txn with -rev. "
-
 
680
						+ "When a txn is given, the repository path must be a local path.")
-
 
681
				.build();
-
 
682
 
-
 
683
		Option rev = Option.builder(PARAM_REV)
-
 
684
				.argName("revision")
-
 
685
				.hasArg()
-
 
686
				.desc("A revision to examine. You cannot combine revision with -txn.")
-
 
687
				.build();
-
 
688
 
-
 
689
		OptionGroup group = new OptionGroup()
-
 
690
				.addOption(txn)
-
 
691
				.addOption(rev);
-
 
692
 
-
 
693
		Option config = Option.builder(PARAM_CONFIG)
-
 
694
				.argName("config_file")
-
 
695
				.hasArg()
710
				.withLongOpt("config")
696
				.longOpt("config")
711
				.withDescription(  "The configuration file to use. Defaults to 'emitter.properties'.")
697
				.desc("The configuration file to use. Defaults to 'emitter.properties'.")
712
				.create( PARAM_CONFIG );
698
				.build();
713
		
699
 
714
		Options options = new Options();
700
		Options options = new Options();
715
		options.addOption(repository);
701
		options.addOption(repository);
716
		options.addOption(txn);
-
 
717
		options.addOption(rev);
-
 
718
		options.addOption(config);
702
		options.addOption(config);
-
 
703
		options.addOptionGroup(group);
719
		return options;
704
		return options;
720
	}
705
	}
Line 721... Line 706...
721
	
706
	
722
	private static void printHelp() {
707
	private static void printHelp() {
723
		// automatically generate the help statement
708
		// automatically generate the help statement
724
		HelpFormatter formatter = new HelpFormatter();
709
		HelpFormatter formatter = new HelpFormatter();
-
 
710
		String header = "\nSVN-ALFEventEmitter " + VERSION + ", a SVN hook implemented in Java to emit Eclipse ALFEvents on commit.\n\n";
725
		String header = "\nSVN-ALFEventEmitter " + VERSION +", a SVN hook implemented in Java to emit Eclipse ALFEvents on commit.\n\n";
711
 
-
 
712
		String footer = "Please send bug reports to bru@brutex.de.\n(c)2020 Brian Rosenberger";
726
		String footer = "Please send bug reports to bru@brutex.de.\n(c)2014 Brian Rosenberger";
713
		formatter.setWidth(80);
727
		formatter.printHelp("java -jar SVN-ALFEventEmitter", header, getOptions(), footer, true);
714
		formatter.printHelp("java -jar SVN-ALFEventEmitter", header, getOptions(), footer, true);