Subversion Repositories XServices

Rev

Rev 170 | Show entire file | Regard 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
Line 83... Line 59...
83
 */
59
 */
84
public class ALFEmitter {
60
public class ALFEmitter {
Line 85... Line 61...
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();
Line 684... Line 660...
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
	}
Line 688... Line -...
688
	
-
 
-
 
664
 
689
	@SuppressWarnings("static-access")
665
 
690
	private static Options getOptions() {
666
	private static Options getOptions() {
-
 
667
		Option repository = Option.builder(PARAM_REPOS)
691
		Option repository = OptionBuilder.withArgName( "repository" )
668
				.argName("repository")
692
											.hasArg()
669
				.hasArg()
693
											.withLongOpt("repository")
670
				.longOpt("repository")
694
											.withDescription(  "Path or URL to the SVN repository." )
671
				.desc("Path or Url to the SVN repository")
695
											.create( PARAM_REPOS );
672
				.required()
Line 696... Line 673...
696
		repository.setRequired(true);
673
				.build();
-
 
674
 
697
		
675
		Option txn = Option.builder(PARAM_TXN)
698
		Option txn = OptionBuilder.withArgName( "transactionid" )
676
				.argName("transactionid")
699
											.hasArg()
677
				.hasArg()
700
											.withLongOpt("transaction")
678
				.longOpt("transaction")
701
											.withDescription(  "The SVN transaction id to examine (TXN). You cannot combine txn with -rev. "
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.")
702
													+ "When a txn is given, the repository path must be a local path.")
681
				.build();
-
 
682
 
703
											.create( PARAM_TXN );
683
		Option rev = Option.builder(PARAM_REV)
704
		Option rev = OptionBuilder.withArgName( "revision" )
684
				.argName("revision")
-
 
685
				.hasArg()
-
 
686
				.desc("A revision to examine. You cannot combine revision with -txn.")
-
 
687
				.build();
-
 
688
 
705
				.hasArg()
689
		OptionGroup group = new OptionGroup()
-
 
690
				.addOption(txn)
706
				.withDescription(  "A revision to examine. You cannot combine revision with -txn." )
691
				.addOption(rev);
-
 
692
 
707
				.create( PARAM_REV );
693
		Option config = Option.builder(PARAM_CONFIG)
708
		Option config = OptionBuilder.withArgName( "config_file" )
694
				.argName("config_file")
709
				.hasArg()
695
				.hasArg()
710
				.withLongOpt("config")
696
				.longOpt("config")
Line 711... Line 697...
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
		
-
 
714
		Options options = new Options();
-
 
715
		options.addOption(repository);
699
 
-
 
700
		Options options = new Options();
716
		options.addOption(txn);
701
		options.addOption(repository);
717
		options.addOption(rev);
702
		options.addOption(config);
Line 718... Line 703...
718
		options.addOption(config);
703
		options.addOptionGroup(group);
719
		return options;
704
		return options;
720
	}
705
	}
721
	
706
	
-
 
707
	private static void printHelp() {
722
	private static void printHelp() {
708
		// automatically generate the help statement
-
 
709
		HelpFormatter formatter = new HelpFormatter();
723
		// automatically generate the help statement
710
		String header = "\nSVN-ALFEventEmitter " + VERSION + ", a SVN hook implemented in Java to emit Eclipse ALFEvents on commit.\n\n";
724
		HelpFormatter formatter = new HelpFormatter();
711