View Javadoc

1   /* $Id: DatabaseConfigurationBean.java,v 1.2 2004/06/14 23:08:52 jdt Exp $
2    * Created on 13-Feb-2004 by John Taylor jdt@roe.ac.uk .
3    * 
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file. 
9    */
10  package org.astrogrid.mySpace.webapp;
11  
12  import java.util.Vector;
13  
14  import org.astrogrid.mySpace.mySpaceManager.RegistryManager;
15  import org.astrogrid.mySpace.mySpaceManager.ServerDetails;
16  
17  /***
18   * @author jdt
19   *
20   *  Bean for use in JSP pages to simplify creation of the mySpace database
21   */
22  public class DatabaseConfigurationBean {
23  	private String pathToRegistry="";
24  	private String tomcatRoot="";
25  	private String host="";
26  	private String folderName="mySpaceConfig";
27  	private String serverName="serv1";
28  	private int expiry=30;
29  	
30  	public String getURL() {
31  		return host+"/" + folderName+"/";
32  	}
33  	public String getDirectory() {
34  		return tomcatRoot+"/webapps/ROOT/"+folderName+"/";
35  	}
36  	
37  	public void createRegistry() {
38  		ServerDetails server = new ServerDetails(serverName,expiry, getURL(), getDirectory());
39  		Vector servers = new Vector();
40  		servers.add(server);
41  		new RegistryManager(pathToRegistry, servers);
42  	}
43  	/***
44  	 * @return Returns the expiry.
45  	 */
46  	public int getExpiry() {
47  		return expiry;
48  	}
49  
50  	/***
51  	 * @param expiry The expiry to set.
52  	 */
53  	public void setExpiry(int expiry) {
54  		this.expiry = expiry;
55  	}
56  
57  	/***
58  	 * @return Returns the host.
59  	 */
60  	public String getHost() {
61  		return host;
62  	}
63  
64  	/***
65  	 * @param host The host to set.
66  	 */
67  	public void setHost(String host) {
68  		this.host = host;
69  	}
70  
71  	/***
72  	 * @return Returns the pathToRegistry.
73  	 */
74  	public String getPathToRegistry() {
75  		return pathToRegistry;
76  	}
77  
78  	/***
79  	 * @param pathToRegistry The pathToRegistry to set.
80  	 */
81  	public void setPathToRegistry(String pathToRegistry) {
82  		this.pathToRegistry = pathToRegistry;
83  	}
84  
85  	/***
86  	 * @return Returns the serverName.
87  	 */
88  	public String getServerName() {
89  		return serverName;
90  	}
91  
92  	/***
93  	 * @param serverName The serverName to set.
94  	 */
95  	public void setServerName(String serverName) {
96  		this.serverName = serverName;
97  	}
98  
99  	/***
100 	 * @return Returns the tomcatRoot.
101 	 */
102 	public String getTomcatRoot() {
103 		return tomcatRoot;
104 	}
105 
106 	/***
107 	 * @param tomcatRoot The tomcatRoot to set.
108 	 */
109 	public void setTomcatRoot(String tomcatRoot) {
110 		this.tomcatRoot = tomcatRoot;
111 	}
112 
113 	/***
114 	 * @return Returns the folderName.
115 	 */
116 	public String getFolderName() {
117 		return folderName;
118 	}
119 
120 	/***
121 	 * @param folderName The folderName to set.
122 	 */
123 	public void setFolderName(String webAppName) {
124 		this.folderName = webAppName;
125 	}
126 
127 }