1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.services.vcs;
16
17 import org.apache.tools.ant.taskdefs.PumpStreamHandler;
18 import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
19 /**
20 * Support implementation of VCSAccessor.
21 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
22 * @version $Revision: 1.2 $
23 */
24 public abstract class AbstractVCSAccessor implements VCSAccessor{
25
26
27
28 /** User for connecting to VCS */
29 protected String user = null;
30 /** Password for connecting to VCS */
31 protected String password = null;
32
33 /** VCS module to connect to */
34 protected String module = null;
35 /** Protocol used for connection */
36 protected String protocol = null;
37 /** VCS remote root repository to connect */
38 protected String rootRepository = null;
39
40
41
42
43 /** @return The user for connecting to VCS implementation */
44 public String getUser(){
45 return user;
46 }
47 /** @param user The user for connecting to VCS implementation */
48 public void setUser(String user){
49 this.user = user;
50 }
51
52 /** @return The password for user who is connecting to VCS */
53 public String getPassword(){
54 return password;
55 }
56 /** @param password The password for uer who is connecting to VCS */
57 public void setPassword(String password){
58 this.password = password;
59 }
60
61 /**
62 * Module of version and configuration management system used by this accessor
63 * @return The VCS implementation module name (ex: module for CVS, "trunk" for Subversion, ...)
64 */
65 public String getModule(){
66 return module;
67 }
68 /**
69 * Set the VCS module to used. This property has different meaning depending
70 * on the VCS implementation. It really describes a module in CVS but should be
71 * the trunk of a Subversion repository. Check the implementation documentation.
72 * @param module Module of VCS used by this accessor
73 */
74 public void setModule(String module){
75 this.module = module;
76 }
77
78 /** @return The protocol used for connecting VCS */
79 public String getProtocol(){
80 return protocol;
81 }
82 /** @param protocol The protocole used for connecting VCS */
83 public void setProtocol(String protocol){
84 this.protocol = protocol;
85 }
86
87 /**
88 * The root remote repository path of VCS. This property has different meaning
89 * depending on the VCS implemnetation. Typically, it is the valur of CVSROOT
90 * for CVS and an URL for Subversion. Check the implementation documentation.
91 * @return The VCS remote repository path
92 */
93 public String getRootRepository(){
94 return rootRepository;
95 }
96 /**
97 * Check <code>getRootRepository()</code> comments for details.
98 * @param repository The VCS remote repository path
99 */
100 public void setRootRepository(String repository){
101 this.rootRepository = repository;
102 }
103
104
105
106
107 /**
108 * This method is useful for extensions that want to use the Jakarta Ant
109 * command line interface for native executables. This CLI needs some handler
110 * for the execution streams and that is just what this method is prodviding !
111 * <br/>
112 * Get a default ExecuteStreamHandler which is the PumpStreamHandler
113 * constructs with no arguments. This means that output stream handler
114 * is System.out and error stream handler is System.err.
115 * @return A default ExecuteStreamHandler that uses System.out and System.err streams
116 */
117 protected ExecuteStreamHandler getExecuteStreamHandler(){
118 return new PumpStreamHandler();
119 }
120 }