Author: solomax
Date: Thu May 17 03:07:25 2012
New Revision: 1339461

URL: http://svn.apache.org/viewvc?rev=1339461&view=rev
Log:
OPENMEETINGS-194 --force parameter is added, DB properties are being read from 
existent config if not specified, NPE in TestSetupCleanupJob is fixed

Modified:
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionProperties.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionPropertiesPatcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Db2Patcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/DerbyPatcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/MysqlPatcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmHelpFormatter.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmOption.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OraclePatcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/PostgresPatcher.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
 Thu May 17 03:07:25 2012
@@ -967,7 +967,12 @@ public class ImportInitvalues {
        }
        // 
------------------------------------------------------------------------------
 
-       public void loadSystem(String filePath, InstallationConfig cfg) throws 
Exception {
+       public void loadSystem(String filePath, InstallationConfig cfg, boolean 
force) throws Exception {
+               //FIXME dummy check if installation was performed before
+               if(!force && usersDao.getAllUsers().size() > 0) {
+                       log.debug("System contains users, no need to install 
data one more time.");
+                       return;
+               }
                loadMainMenu();
                loadErrorMappingsFromXML(filePath);
                loadInitLanguages(filePath);
@@ -984,13 +989,13 @@ public class ImportInitvalues {
        }
        
        public void loadAll(String filePath, InstallationConfig cfg, String 
username,
-                       String userpass, String useremail, String groupame, 
String timeZone) throws Exception {
+                       String userpass, String useremail, String groupame, 
String timeZone, boolean force) throws Exception {
                //FIXME dummy check if installation was performed before
-               if(usersDao.getAllUsers().size() > 0) {
+               if(!force && usersDao.getAllUsers().size() > 0) {
                        log.debug("System contains users, no need to install 
data one more time.");
                        return;
                }
-               loadSystem(filePath, cfg);
+               loadSystem(filePath, cfg, force);
                loadInitUserAndOrganisation(username,
                                userpass, useremail, groupame, timeZone, 
cfg.defaultLangId);
                

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java
 Thu May 17 03:07:25 2012
@@ -35,18 +35,21 @@ public class TestSetupCleanupJob {
                try {
                        //FIXME need to move all these staff to helper
                        File streams = new 
File(ScopeApplicationAdapter.batchFileFir);
-                       for (File folder : streams.listFiles()) {
-                               if (folder.isDirectory()) {
-                                       //TODO need to rework this and remove 
hardcodings
-                                       for (File file : folder.listFiles(new 
FileFilter() {
-                                               public boolean accept(File 
file) {
-                                                       return 
file.getName().startsWith("TEST_SETUP_");
-                                               }
-                                       }))
-                                       {
-                                               if (file.isFile() && 
file.lastModified() + expirationInterval < System.currentTimeMillis()) {
-                                                       log.debug("expired TEST 
SETUP found: " + file.getAbsolutePath());
-                                                       file.delete();
+                       File[] folders = streams.listFiles();
+                       if (folders != null) {
+                               for (File folder : folders) {
+                                       if (folder.isDirectory()) {
+                                               //TODO need to rework this and 
remove hardcodings
+                                               for (File file : 
folder.listFiles(new FileFilter() {
+                                                       public boolean 
accept(File file) {
+                                                               return 
file.getName().startsWith("TEST_SETUP_");
+                                                       }
+                                               }))
+                                               {
+                                                       if (file.isFile() && 
file.lastModified() + expirationInterval < System.currentTimeMillis()) {
+                                                               
log.debug("expired TEST SETUP found: " + file.getAbsolutePath());
+                                                               file.delete();
+                                                       }
                                                }
                                        }
                                }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java 
(original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java 
Thu May 17 03:07:25 2012
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 import java.io.BufferedReader;
@@ -280,7 +298,7 @@ public class Admin {
                                                System.out.println("Please 
specify even 'file' option or 'admin user'.");
                                                System.exit(1);
                                        }
-                                       //TODO commented for now, since not in 
use boolean force = cmdl.hasOption("force");
+                                       boolean force = cmdl.hasOption("force");
                                        if 
(cmdl.hasOption("skip-default-rooms")) {
                                                cfg.createDefaultRooms = "0";
                                        }
@@ -307,13 +325,13 @@ public class Admin {
                                        }
                                        String langPath = new File(omHome, 
ImportInitvalues.languageFolderName).getAbsolutePath(); //FIXME need to be 
moved to helper
                                        ConnectionProperties 
connectionProperties = new ConnectionProperties();
-                                       if (cmdl.hasOption("db-type") || 
cmdl.hasOption("db-host") || cmdl.hasOption("db-port") || 
cmdl.hasOption("db-name") || cmdl.hasOption("db-user") || 
cmdl.hasOption("db-pass")) {
+                                       File conf = new File(omHome, 
"WEB-INF/classes/META-INF/persistence.xml");
+                                       if (!conf.exists() || 
cmdl.hasOption("db-type") || cmdl.hasOption("db-host") || 
cmdl.hasOption("db-port") || cmdl.hasOption("db-name") || 
cmdl.hasOption("db-user") || cmdl.hasOption("db-pass")) {
                                                String dbType = 
cmdl.getOptionValue("db-type", "derby");
                                                File srcConf = new File(omHome, 
"WEB-INF/classes/META-INF/" + dbType + "_persistence.xml");
-                                               File destConf = new 
File(omHome, "WEB-INF/classes/META-INF/persistence.xml");
                                                
ConnectionPropertiesPatcher.getPatcher(dbType).patch(
                                                                srcConf
-                                                               , destConf
+                                                               , conf
                                                                , 
cmdl.getOptionValue("db-host", "localhost")
                                                                , 
cmdl.getOptionValue("db-port", null)
                                                                , 
cmdl.getOptionValue("db-name", null)
@@ -321,6 +339,9 @@ public class Admin {
                                                                , 
cmdl.getOptionValue("db-pass", null)
                                                                , 
connectionProperties
                                                                );
+                                       } else {
+                                               //get properties from existent 
persistence.xml
+                                               connectionProperties = 
ConnectionPropertiesPatcher.getConnectionProperties(conf);
                                        }
                                        if (cmdl.hasOption("file")) {
                                                File backup = 
checkRestoreFile(file);
@@ -328,7 +349,7 @@ public class Admin {
                                                
                                                shutdownScheduledJobs(ctxName);
                                                ImportInitvalues importInit = 
getApplicationContext(ctxName).getBean(ImportInitvalues.class);
-                                               importInit.loadSystem(langPath, 
cfg); 
+                                               importInit.loadSystem(langPath, 
cfg, force); 
                                                restoreOm(ctxName, backup);
                                        } else {
                                                AdminUserDetails admin = 
checkAdminDetails(ctxName, langPath);
@@ -336,7 +357,7 @@ public class Admin {
                                                
                                                shutdownScheduledJobs(ctxName);
                                                ImportInitvalues importInit = 
getApplicationContext(ctxName).getBean(ImportInitvalues.class);
-                                               importInit.loadAll(langPath, 
cfg, admin.login, admin.pass, admin.email, admin.group, admin.tz);
+                                               importInit.loadAll(langPath, 
cfg, admin.login, admin.pass, admin.email, admin.group, admin.tz, force);
                                        }                                       
                                        
                                        File installerFile = new File(new 
File(omHome, ScopeApplicationAdapter.configDirName), 
InstallationDocumentHandler.installFileName);
@@ -485,15 +506,14 @@ public class Admin {
        }
        
        private void dropDB(ConnectionProperties props) throws Exception {
-               //FIXME drop will not work unless any of the --db-* option is 
specified
                if(cmdl.hasOption("drop")) {    
                        String[] args = {
                                        "-schemaAction", "retain,drop"
                                        , "-properties", 
omHome.getAbsolutePath() + "/WEB-INF/classes/META-INF/persistence.xml"
-                                       , "-connectionDriverName", 
props.getDriverName()
-                                       , "-connectionURL", 
props.getConnectionURL()
-                                       , "-connectionUserName", 
props.getConnectionLogin()
-                                       , "-connectionPassword", 
props.getConnectionPass()
+                                       , "-connectionDriverName", 
props.getDriver()
+                                       , "-connectionURL", props.getURL()
+                                       , "-connectionUserName", 
props.getLogin()
+                                       , "-connectionPassword", 
props.getPassword()
                                        , "-ignoreErrors", "true"};
                        MappingTool.main(args);
                }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionProperties.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionProperties.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionProperties.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionProperties.java
 Thu May 17 03:07:25 2012
@@ -1,41 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class ConnectionProperties {
 
-       private String driverName = "org.apache.derby.jdbc.ClientDriver";
-       private String connectionURL = "jdbc:derby:openmeetings";
-       private String connectionLogin = "user";
-       private String connectionPass = "secret";
+       private String driver = "org.apache.derby.jdbc.ClientDriver";
+       private String url = "jdbc:derby:openmeetings";
+       private String login = "user";
+       private String password = "secret";
 
-       public String getDriverName() {
-               return driverName;
+       public String getDriver() {
+               return driver;
        }
 
-       public void setDriverName(String driverName) {
-               this.driverName = driverName;
+       public void setDriver(String driverName) {
+               this.driver = driverName;
        }
 
-       public String getConnectionURL() {
-               return connectionURL;
+       public String getURL() {
+               return url;
        }
 
-       public void setConnectionURL(String connectionURL) {
-               this.connectionURL = connectionURL;
+       public void setURL(String connectionURL) {
+               this.url = connectionURL;
        }
 
-       public String getConnectionLogin() {
-               return connectionLogin;
+       public String getLogin() {
+               return login;
        }
 
-       public void setConnectionLogin(String connectionLogin) {
-               this.connectionLogin = connectionLogin;
+       public void setLogin(String connectionLogin) {
+               this.login = connectionLogin;
        }
 
-       public String getConnectionPass() {
-               return connectionPass;
+       public String getPassword() {
+               return password;
        }
 
-       public void setConnectionPass(String connectionPass) {
-               this.connectionPass = connectionPass;
+       public void setPassword(String connectionPass) {
+               this.password = connectionPass;
+       }
+
+       @Override
+       public String toString() {
+               return "ConnectionProperties [driver=" + driver + ", url=" + url
+                               + ", login=" + login + ", password=" + password 
+ "]";
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionPropertiesPatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionPropertiesPatcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionPropertiesPatcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/ConnectionPropertiesPatcher.java
 Thu May 17 03:07:25 2012
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 import java.io.File;
@@ -20,8 +38,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 public abstract class ConnectionPropertiesPatcher {
-       
-       ConnectionProperties connectionProperties;
+       protected static final String URL_PREFIX = "Url=";
+       protected ConnectionProperties connectionProperties;
        
        public enum PatcherType {
                db2
@@ -55,18 +73,36 @@ public abstract class ConnectionProperti
                return patcher;
        }
        
-       public void patch(File srcXml, File destXml, String host, String port, 
String db, String user, String pass, ConnectionProperties connectionProperties) 
throws Exception {
-               this.connectionProperties = connectionProperties;
+       static ConnectionProperties getConnectionProperties(File conf) throws 
Exception {
+               ConnectionProperties connectionProperties = new 
ConnectionProperties();
+               Document doc = getDocument(conf);
+               Attr attr = getConnectionProperties(doc);
+               String[] tokens = attr.getValue().split(",");
+               processBasicProperties(tokens, null, null, 
connectionProperties);
+               
+               return connectionProperties;
+       }
+       
+       private static Document getDocument(File xml) throws Exception {
                DocumentBuilderFactory dbFactory = 
DocumentBuilderFactory.newInstance();
                //dbFactory.setNamespaceAware(true);
                DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-               Document doc = dBuilder.parse(srcXml);
-               
+               return dBuilder.parse(xml);
+       }
+       
+       private static Attr getConnectionProperties(Document doc) throws 
Exception {
                XPath xPath = XPathFactory.newInstance().newXPath();
                XPathExpression expr = 
xPath.compile("/persistence/persistence-unit/properties/property[@name='openjpa.ConnectionProperties']");
 
                Element element = (Element)expr.evaluate(doc, 
XPathConstants.NODE);
-               Attr val = element.getAttributeNode("value");
+               return element.getAttributeNode("value");
+       }
+       
+       public void patch(File srcXml, File destXml, String host, String port, 
String db, String user, String pass, ConnectionProperties connectionProperties) 
throws Exception {
+               this.connectionProperties = connectionProperties;
+               Document doc = getDocument(srcXml);
+               
+               Attr val = getConnectionProperties(doc);
                val = patchAttribute(val, host, port, db, user, pass);
                
                TransformerFactory transformerFactory = 
TransformerFactory.newInstance();
@@ -77,13 +113,13 @@ public abstract class ConnectionProperti
        
        protected Attr patchAttribute(Attr attr, String host, String port, 
String db, String user, String pass) {
                String[] tokens = attr.getValue().split(",");
-               patchUserPassDriver(tokens, user, pass);
+               processBasicProperties(tokens, user, pass, 
connectionProperties);
                patchDb(tokens, host, port, db);
                attr.setValue(StringUtils.join(tokens, ","));
                return attr;
        }
 
-       protected void patchProp(String[] tokens, int idx, String name, String 
value) {
+       protected static void patchProp(String[] tokens, int idx, String name, 
String value) {
                String prop = tokens[idx].trim();
                if (prop.startsWith(name)) {
                        prop = name + "=" + StringEscapeUtils.escapeXml(value);
@@ -91,35 +127,42 @@ public abstract class ConnectionProperti
                }
        }
        
-       protected void patchUserPassDriver(String[] tokens, String user,
-                       String pass) {
+       private static void processBasicProperties(String[] tokens, String user,
+                       String pass, ConnectionProperties connectionProperties) 
{
                String prop;
                for (int i = 0; i < tokens.length; ++i) {
                        prop = getPropFromPersistence(tokens, i, 
"DriverClassName");
-                       if (prop != null)
-                               connectionProperties.setDriverName(prop);
+                       if (prop != null) {
+                               connectionProperties.setDriver(prop);
+                       }
                        
                        if (user != null) {
                                patchProp(tokens, i, "Username", user);
-                               connectionProperties.setConnectionLogin(user);
+                               connectionProperties.setLogin(user);
                        } else {
                                prop = getPropFromPersistence(tokens, i, 
"Username");
-                               if (prop != null)
-                                       
connectionProperties.setConnectionLogin(prop);
+                               if (prop != null) {
+                                       connectionProperties.setLogin(prop);
+                               }
                        }
                        
                        if (pass != null) {
                                patchProp(tokens, i, "Password", pass);
-                               connectionProperties.setConnectionPass(pass);
+                               connectionProperties.setPassword(pass);
                        } else {
                                prop = getPropFromPersistence(tokens, i, 
"Password");
-                               if (prop != null)
-                                       
connectionProperties.setConnectionPass(prop);
+                               if (prop != null) {
+                                       connectionProperties.setPassword(prop);
+                               }
+                       }
+                       prop = getPropFromPersistence(tokens, i, "Url");
+                       if (prop != null) {
+                               connectionProperties.setURL(prop);
                        }
                }
        }
        
-       protected String getPropFromPersistence(String[] tokens, int idx, 
String name){
+       protected static String getPropFromPersistence(String[] tokens, int 
idx, String name){
                String prop = tokens[idx].trim();
                if (prop.startsWith(name)) {
                        //From "Username=root" getting only "root"
@@ -128,5 +171,17 @@ public abstract class ConnectionProperti
                return null;
        }
        
-       protected abstract void patchDb(String[] tokens, String host, String 
port, String db);
+       private void patchDb(String[] tokens, String host, String _port, String 
_db) {
+               for (int i = 0; i < tokens.length; ++i) {
+                       String prop = tokens[i].trim();
+                       if (prop.startsWith(URL_PREFIX)) {
+                               String url = 
getUrl(prop.substring(URL_PREFIX.length()), host, _port, _db);
+                               connectionProperties.setURL(url);
+                               tokens[i] = URL_PREFIX + url;
+                               break;
+                       }
+               }
+       }
+       
+       protected abstract String getUrl(String url, String host, String port, 
String db);
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Db2Patcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Db2Patcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Db2Patcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Db2Patcher.java
 Thu May 17 03:07:25 2012
@@ -1,18 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class Db2Patcher extends ConnectionPropertiesPatcher {
        @Override
-       protected void patchDb(String[] tokens, String host, String _port, 
String _db) {
+       protected String getUrl(String _url, String host, String _port, String 
_db) {
                String port = (_port == null) ? "50000" : _port;
                String db = (_db == null) ? "openmeet" : _db;
-               for (int i = 0; i < tokens.length; ++i) {
-                       String prop = tokens[i].trim();
-                       if (prop.startsWith("Url")) {
-                               String connectionURL = "jdbc:db2://" + host + 
":" + port + "/" + db; 
-                               
connectionProperties.setConnectionURL(connectionURL);
-                               String url = "Url=" + connectionURL;
-                               tokens[i] = url;
-                       }
-               }
+               return "jdbc:db2://" + host + ":" + port + "/" + db; 
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/DerbyPatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/DerbyPatcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/DerbyPatcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/DerbyPatcher.java
 Thu May 17 03:07:25 2012
@@ -1,18 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class DerbyPatcher extends ConnectionPropertiesPatcher {
        @Override
-       protected void patchDb(String[] tokens, String host, String _port, 
String _db) {
+       protected String getUrl(String _url, String host, String _port, String 
_db) {
                String db = (_db == null) ? "openmeetings" : _db;
-               for (int i = 0; i < tokens.length; ++i) {
-                       String prop = tokens[i].trim();
-                       if (prop.startsWith("Url")) {
-                               String suffix = 
prop.substring(prop.indexOf(';'));
-                               String connectionURL = "jdbc:derby" + ":" + db; 
-                               
connectionProperties.setConnectionURL(connectionURL);
-                               String url = "Url=" + connectionURL + suffix;
-                               tokens[i] = url;
-                       }
-               }
+               String suffix = _url.substring(_url.indexOf(';'));
+               return "jdbc:derby" + ":" + db + suffix; 
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/MysqlPatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/MysqlPatcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/MysqlPatcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/MysqlPatcher.java
 Thu May 17 03:07:25 2012
@@ -1,19 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class MysqlPatcher extends ConnectionPropertiesPatcher {
        @Override
-       protected void patchDb(String[] tokens, String host, String _port, 
String _db) {
+       protected String getUrl(String _url, String host, String _port, String 
_db) {
                String port = (_port == null) ? "3306" : _port;
                String db = (_db == null) ? "openmeetings" : _db;
-               for (int i = 0; i < tokens.length; ++i) {
-                       String prop = tokens[i].trim();
-                       if (prop.startsWith("Url")) {
-                               String suffix = 
prop.substring(prop.indexOf('?'));
-                               String connectionURL = "jdbc:mysql://" + host + 
":" + port + "/" + db;
-                               
connectionProperties.setConnectionURL(connectionURL);
-                               String url = "Url=" + connectionURL + suffix;
-                               tokens[i] = url;
-                       }
-               }
+               String suffix = _url.substring(_url.indexOf('?'));
+               return "jdbc:mysql://" + host + ":" + port + "/" + db + suffix;
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmHelpFormatter.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmHelpFormatter.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmHelpFormatter.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmHelpFormatter.java
 Thu May 17 03:07:25 2012
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 import java.io.PrintWriter;

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmOption.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmOption.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmOption.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OmOption.java
 Thu May 17 03:07:25 2012
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 import java.util.HashMap;

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OraclePatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OraclePatcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OraclePatcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/OraclePatcher.java
 Thu May 17 03:07:25 2012
@@ -1,18 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class OraclePatcher extends ConnectionPropertiesPatcher {
        @Override
-       protected void patchDb(String[] tokens, String host, String _port, 
String _db) {
+       protected String getUrl(String _url, String host, String _port, String 
_db) {
                String port = (_port == null) ? "1521" : _port;
                String db = (_db == null) ? "openmeetings" : _db;
-               for (int i = 0; i < tokens.length; ++i) {
-                       String prop = tokens[i].trim();
-                       if (prop.startsWith("Url")) {
-                               String connectionURL = "jdbc:oracle:thin:@" + 
host + ":" + port + ":" + db; 
-                               
connectionProperties.setConnectionURL(connectionURL);
-                               String url = "Url=" + connectionURL;
-                               tokens[i] = url;
-                       }
-               }
+               return "jdbc:oracle:thin:@" + host + ":" + port + ":" + db; 
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/PostgresPatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/PostgresPatcher.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/PostgresPatcher.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/PostgresPatcher.java
 Thu May 17 03:07:25 2012
@@ -1,18 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.openmeetings.cli;
 
 public class PostgresPatcher extends ConnectionPropertiesPatcher {
        @Override
-       protected void patchDb(String[] tokens, String host, String _port, 
String _db) {
+       protected String getUrl(String _url, String host, String _port, String 
_db) {
                String port = (_port == null) ? "5432" : _port;
                String db = (_db == null) ? "openmeetings" : _db;
-               for (int i = 0; i < tokens.length; ++i) {
-                       String prop = tokens[i].trim();
-                       if (prop.startsWith("Url")) {
-                               String connectionURL = "jdbc:postgresql://" + 
host + ":" + port + "/" + db; 
-                               
connectionProperties.setConnectionURL(connectionURL);
-                               String url = "Url=" + connectionURL;
-                               tokens[i] = url;
-                       }
-               }
+               return "jdbc:postgresql://" + host + ":" + port + "/" + db; 
        }
 }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
 Thu May 17 03:07:25 2012
@@ -307,7 +307,7 @@ public class Install extends VelocityVie
                                                        "url_feed2");
                                        
                                        getImportInitvalues().loadAll(filePath, 
cfg, username,
-                                                       userpass, useremail, 
orgname, timeZone);
+                                                       userpass, useremail, 
orgname, timeZone, false);
 
                                        // update to next step
                                        log.debug("add level to install file");

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java?rev=1339461&r1=1339460&r2=1339461&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
 Thu May 17 03:07:25 2012
@@ -131,6 +131,6 @@ public abstract class AbstractOpenmeetin
                                + ImportInitvalues.languageFolderName;
 
                importInitvalues.loadAll(filePath, new InstallationConfig(), 
username, userpass,
-                               useremail, orgname, timeZone);
+                               useremail, orgname, timeZone, false);
        }
 }


Reply via email to