Changeset 717 for extensions
- Timestamp:
- Jun 3, 2008, 9:19:40 AM (15 years ago)
- Location:
- extensions/net.sf.basedb.ftp/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.ftp/trunk/README
r715 r717 23 23 2. Unpack the downloaded file to a directory of your choice. 24 24 3. Copy the `ftp.config` file to `WEB-INF/classes` directory. 25 4. The default `ftp.config` file creates a regular FTP service on port 2121. 26 If you want to use a different port, and/or change other settings edit 27 the `ftp.config` file. For more information about configuration options see: 25 4. The default `ftp.config` file creates a regular FTP service with the 26 control connection on port 2121 accepting connections from the local 27 host only. To allow extenal connections the three settings listed 28 below needs to be changed. It should work to change the 127.0.0.1 value 29 to the ip number (using names doesn't seem to work) of your BASE server. 30 For more information about configuration options see: 28 31 http://mina.apache.org/ftpserver-documentation.html 32 33 * config.listeners.default.address 34 * config.listeners.default.data-connection.passive.address 35 * config.listeners.default.data-connection.passive.external-address 36 29 37 5. Copy the `base-ftpserver.jar` file and the `lib` directory, including sub- 30 38 directories and files, to your BASE extensions directory, `WEB-INF/extensions`. 31 6. Run the 'Extensions -> Manual scan'command to install the extension. If you39 6. Run the `Extensions -> Manual scan` command to install the extension. If you 32 40 have enabled automatic installation, just sit back and wait for it to find 33 41 the FTP server extension. … … 45 53 in the `ftp.config` file. Those settings will be replaced by BASE-specific 46 54 options. 55 56 * BASE allows that a directory has the same name as a file. This may confuse 57 FTP clients since that is normally not allowed. The result for certain 58 operations is undefined for files and directories that has the same name. 47 59 48 60 == Compiling == -
extensions/net.sf.basedb.ftp/trunk/RELEASE
r714 r717 3 3 =================================================== 4 4 5 TODO 5 Follow these instructions to release version A.B of 6 this package. Please update the instructions if you 7 find anything that is not correct or missing. 8 9 1. Make sure that all changes have been committed to 10 the trunk. Check with other developers if not 11 sure. 12 13 2. Update the version number. 14 15 * In build.xml: <property name="version" value="A.B" /> 16 * In META-INF/extensions.xml: <version>A.B</version> 17 18 3. Make sure that the code compiles and can be packaged. 19 20 ant package 21 22 will create the file 'base-ftpserver-A.B.tar.gz' in 23 the project directory. 24 25 4. Make sure that the installation of the FTP Server works 26 and that the installation instructions are up to date. 27 28 5. When everything is OK, commit any changes to subversion. 29 30 6. Create a tag in subversion: 31 32 svn copy http://baseplugins.thep.lu.se/svn/extensions/net.sf.basedb.ftp/trunk \ 33 http://baseplugins.thep.lu.se/svn/extensions/net.sf.basedb.ftp/tags/A.B \ 34 -m "Tagging release A.B" 35 36 7. Upload the packaged release as an attachment to: 37 http://baseplugins.thep.lu.se/wiki/net.sf.basedb.ftp 38 39 8. Edit the http://baseplugins.thep.lu.se/wiki/net.sf.basedb.examples.ftp 40 page: 41 42 * Add a new entry to the Download table 43 * Change the README link to point to the tagged release. Use 44 the following wiki code: 45 [source:/extensions/net.sf.basedb.ftp/tags/A.B/README README] 46 47 9. Create a new milestone: 'FTP Server vA.B+1' 48 49 10. Close the 'FTP Server A.B' milestone. Move 50 any remaining tickets to the newly create milestone. 51 52 11. Update the version number in build.xml. 53 54 <property name="version" value="A.B+1pre" /> 55 56 Commit the change to subversion: 57 58 svn commit -m "Preparing for future release A.B+1" 6 59 -
extensions/net.sf.basedb.ftp/trunk/ftp.config
r716 r717 45 45 ##----------------------------------------------------------------------------- 46 46 config.listeners.default.class=org.apache.ftpserver.listener.mina.MinaListener 47 config.listeners.default.address= localhost48 config.listeners.default.port=2121 047 config.listeners.default.address=127.0.0.1 48 config.listeners.default.port=2121 49 49 config.listeners.default.implicit-ssl=false 50 50 #config.listeners.default.ssl.class=org.apache.ftpserver.ssl.DefaultSsl … … 64 64 config.listeners.default.data-connection.idle-time=10 65 65 config.listeners.default.data-connection.active.enable=true 66 config.listeners.default.data-connection.active.local-address= localhost67 config.listeners.default.data-connection.active.local-port= 2020066 config.listeners.default.data-connection.active.local-address= 67 config.listeners.default.data-connection.active.local-port=0 68 68 config.listeners.default.data-connection.active.ip-check=false 69 config.listeners.default.data-connection.passive.address= localhost69 config.listeners.default.data-connection.passive.address=127.0.0.1 70 70 config.listeners.default.data-connection.passive.ports=0 71 71 config.listeners.default.data-connection.passive.external-address=127.0.0.1 -
extensions/net.sf.basedb.ftp/trunk/src/net/sf/basedb/clients/ftp/BaseFileSystemView.java
r716 r717 176 176 log.debug(" user=" + user); 177 177 } 178 boolean preferDirectory = fileName.endsWith("/"); 178 179 if (fileName.startsWith("./")) 179 180 { … … 195 196 196 197 // Check if the path represents a file 197 try 198 { 199 Path filePath = new Path(fileName, Path.Type.FILE); 200 File file = File.getByPath(dc, filePath, false); 201 fo = new BaseFileObject(user, file); 202 } 203 catch (Exception ex) 204 { 205 if (log.isDebugEnabled()) 206 { 207 log.debug("Not a file: " + fileName, ex); 208 } 209 } 210 211 if (fo == null) 212 { 213 // Check if the path represents a directory 214 try 215 { 216 Path dirPath = new Path(fileName, Path.Type.DIRECTORY); 217 Directory dir = Directory.getByPath(dc, dirPath); 218 fo = new BaseFileObject(user, dir); 219 } 220 catch (Exception ex) 221 { 222 if (log.isDebugEnabled()) 223 { 224 log.debug("Not a directory: " + fileName, ex); 225 } 226 } 227 } 198 if (preferDirectory) fo = getDirectory(dc, fileName); 199 if (fo == null) fo = getFile(dc, fileName); 200 if (fo == null && !preferDirectory) fo = getDirectory(dc, fileName); 228 201 } 229 202 finally … … 247 220 // ---------------------------------------- 248 221 222 /** 223 Try to load the given path as a BASE File object. 224 */ 225 private BaseFileObject getFile(DbControl dc, String path) 226 { 227 BaseFileObject fo = null; 228 try 229 { 230 Path filePath = new Path(path, Path.Type.FILE); 231 File file = File.getByPath(dc, filePath, false); 232 fo = new BaseFileObject(user, file); 233 } 234 catch (Exception ex) 235 { 236 if (log.isDebugEnabled()) 237 { 238 log.debug("Not a file: " + path, ex); 239 } 240 } 241 return fo; 242 } 243 244 /** 245 Try to load the given path as a BASE Directory object. 246 */ 247 private BaseFileObject getDirectory(DbControl dc, String path) 248 { 249 BaseFileObject fo = null; 250 try 251 { 252 Path dirPath = new Path(path, Path.Type.DIRECTORY); 253 Directory dir = Directory.getByPath(dc, dirPath); 254 fo = new BaseFileObject(user, dir); 255 } 256 catch (Exception ex) 257 { 258 if (log.isDebugEnabled()) 259 { 260 log.debug("Not a directory: " + path, ex); 261 } 262 } 263 return fo; 264 } 265 266 249 267 /** 250 268 Concatenate two paths to create a full path. The concatenation makes -
extensions/net.sf.basedb.ftp/trunk/src/net/sf/basedb/clients/ftp/FtpServiceController.java
r716 r717 24 24 package net.sf.basedb.clients.ftp; 25 25 26 import java.io.InputStream; 27 import java.net.URL; 28 import java.util.Properties; 29 30 import org.slf4j.Logger; 31 import org.slf4j.LoggerFactory; 32 26 33 import net.sf.basedb.clients.web.extensions.service.ServiceControllerAction; 34 import net.sf.basedb.core.ConfigurationException; 27 35 28 36 /** … … 39 47 implements ServiceControllerAction 40 48 { 49 private static final Logger log = LoggerFactory.getLogger(FtpServiceController.class); 41 50 42 private final BaseFtpServer server; 51 private final String config; 52 private BaseFtpServer server; 43 53 44 54 /** … … 47 57 @param server The server to control with this action 48 58 */ 49 public FtpServiceController( BaseFtpServer server)59 public FtpServiceController(String config) 50 60 { 51 this. server = server;61 this.config = config == null ? "/ftp.config" : config; 52 62 } 53 63 … … 59 69 public boolean isRunning() 60 70 { 61 return server .isRunning();71 return server != null && server.isRunning(); 62 72 } 63 73 … … 65 75 public void start() 66 76 { 67 server.start();77 getServer().start(); 68 78 } 69 79 … … 71 81 public void stop() 72 82 { 73 server.stop(); 83 if (server != null) 84 { 85 server.stop(); 86 server = null; 87 } 74 88 } 75 89 // ---------------------------------------------- … … 77 91 /* 78 92 From the Object class 79 --------------------- 93 --------------------------------------------- 80 94 */ 81 95 @Override … … 86 100 // ---------------------------------------------- 87 101 88 102 /** 103 Get or create the {@link BaseFtpServer}. A controller can only be associated 104 with a single ftp server. 105 */ 106 private BaseFtpServer getServer() 107 { 108 if (server == null) 109 { 110 log.info("Creating BASE FTP Server"); 111 try 112 { 113 log.debug("config=" + config); 114 URL configUrl = BaseFtpServer.class.getResource(config); 115 InputStream is = configUrl == null ? null : configUrl.openStream(); 116 if (is == null) 117 { 118 throw new ConfigurationException("Can't find the properties file. " + 119 "Make sure '" + config + "' is in the CLASSPATH."); 120 } 121 Properties config = new Properties(); 122 config.load(is); 123 is.close(); 124 server = new BaseFtpServer(config); 125 log.info("BASE FTP Server created successfully"); 126 } 127 catch (RuntimeException ex) 128 { 129 log.error("Could not create BASE FTP Server", ex); 130 throw ex; 131 } 132 catch (Exception ex) 133 { 134 log.error("Could not create BASE FTP Server", ex); 135 throw new RuntimeException(ex); 136 } 137 } 138 return server; 139 } 89 140 90 141 } -
extensions/net.sf.basedb.ftp/trunk/src/net/sf/basedb/clients/ftp/FtpServiceControllerFactory.java
r716 r717 24 24 package net.sf.basedb.clients.ftp; 25 25 26 import java.io.InputStream;27 import java.net.URL;28 import java.util.Properties;29 30 26 import org.slf4j.Logger; 31 27 import org.slf4j.LoggerFactory; 32 28 33 29 import net.sf.basedb.clients.web.extensions.service.ServiceControllerAction; 34 import net.sf.basedb.core.ConfigurationException;35 30 import net.sf.basedb.util.extensions.ActionFactory; 36 31 import net.sf.basedb.util.extensions.InvokationContext; … … 57 52 58 53 private FtpServiceController[] controller; 59 private BaseFtpServer server;60 54 private String config; 61 55 … … 101 95 { 102 96 controller = new FtpServiceController[1]; 103 controller[0] = new FtpServiceController( getServer());97 controller[0] = new FtpServiceController(config); 104 98 } 105 99 return controller; 106 100 } 107 101 108 /**109 Get or create the {@link BaseFtpServer}. A factory can only be associated110 with a single ftp server.111 */112 private BaseFtpServer getServer()113 {114 if (server == null)115 {116 log.info("Creating BASE FTP Server");117 try118 {119 if (config == null) config = "/ftp.config";120 log.debug("config=" + config);121 URL configUrl = BaseFtpServer.class.getResource(config);122 InputStream is = configUrl == null ? null : configUrl.openStream();123 if (is == null)124 {125 throw new ConfigurationException("Can't find the properties file. " +126 "Make sure '" + config + "' is in the CLASSPATH.");127 }128 Properties config = new Properties();129 config.load(is);130 is.close();131 server = new BaseFtpServer(config);132 log.info("BASE FTP Server created successfully");133 }134 catch (RuntimeException ex)135 {136 log.error("Could not create BASE FTP Server", ex);137 throw ex;138 }139 catch (Exception ex)140 {141 log.error("Could not create BASE FTP Server", ex);142 throw new RuntimeException(ex);143 }144 }145 return server;146 }147 148 149 102 }
Note: See TracChangeset
for help on using the changeset viewer.