From d73aa0c21a345d2b16c2e6bafa219c5b2e216a01 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Mon, 31 Oct 2011 14:13:06 +0100 Subject: [PATCH] FXOLAT-243: backport the clean-up of third party libraries to OpenOLAT (remove HSQLDB from WAR, cluster libs if not wanted...) --- pom.xml | 87 ++++++++++++----- .../olat/jfreechart/JFreeChartController.java | 62 ------------ .../jfreechart/JFreeChartMediaResource.java | 95 ------------------- .../persistence/HsqldbDatabaseManagerGUI.java | 89 ----------------- .../_spring/databaseCorecontext.xml | 7 -- .../SetupPropertiesController.java | 14 +-- .../core/configuration/_content/setup.html | 3 - .../org/olat/properties/PropertyTest.java | 1 - 8 files changed, 65 insertions(+), 293 deletions(-) delete mode 100644 src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartController.java delete mode 100644 src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartMediaResource.java delete mode 100644 src/main/java/org/olat/core/commons/persistence/HsqldbDatabaseManagerGUI.java diff --git a/pom.xml b/pom.xml index 82424928030..582d35cb12a 100644 --- a/pom.xml +++ b/pom.xml @@ -831,7 +831,38 @@ <cargo.container.wait>true</cargo.container.wait> </properties> </profile> - + + <profile> + <id>cluster</id> + <activation> + <property> + <name>cluster</name> + </property> + </activation> + <dependencies> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jboss-common-core</artifactId> + <version>2.2.8.GA</version> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging-spi</artifactId> + <version>2.0.5.GA</version> + </dependency> + <dependency> + <groupId>org.jboss.cache</groupId> + <artifactId>jbosscache-core</artifactId> + <version>3.2.2.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-jbosscache2</artifactId> + <version>3.3.2.GA</version> + <scope>runtime</scope> + </dependency> + </dependencies> + </profile> <profile> <!-- activate this profile to run Selenium based Integration Tests against a cluster running locally @@ -1300,6 +1331,30 @@ </plugin> </plugins> </build> + + <dependencies> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jboss-common-core</artifactId> + <version>2.2.8.GA</version> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging-spi</artifactId> + <version>2.0.5.GA</version> + </dependency> + <dependency> + <groupId>org.jboss.cache</groupId> + <artifactId>jbosscache-core</artifactId> + <version>3.2.2.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-jbosscache2</artifactId> + <version>3.3.2.GA</version> + <scope>runtime</scope> + </dependency> + </dependencies> </profile> </profiles> @@ -2022,21 +2077,7 @@ <version>0.6.0</version> </dependency> <!-- fxdiff: FXOLAT-243 remove dependency to jbosscache (only for cluster + deprecated by JBoss) --> - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jboss-common-core</artifactId> - <version>2.2.8.GA</version> - </dependency> - <dependency> - <groupId>org.jboss.logging</groupId> - <artifactId>jboss-logging-spi</artifactId> - <version>2.0.5.GA</version> - </dependency> - <dependency> - <groupId>org.jboss.cache</groupId> - <artifactId>jbosscache-core</artifactId> - <version>3.2.2.GA</version> - </dependency> + <!-- cluster --> <dependency> <groupId>reload-diva</groupId> <artifactId>reload-diva</artifactId> @@ -2196,6 +2237,12 @@ <groupId>org.apache.woden</groupId> <artifactId>woden-api</artifactId> <version>1.0M8</version> + <exclusions> + <exclusion> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + </exclusion> + </exclusions> </dependency> <!-- /Dependencys for onyx plugin --> <dependency> @@ -2269,12 +2316,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-jbosscache2</artifactId> - <version>3.3.2.GA</version> - <scope>runtime</scope> - </dependency> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> @@ -2385,6 +2426,7 @@ <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>2.0.0-rc8</version> + <scope>test</scope> </dependency> <!-- Spring dependencies --> <dependency> @@ -2668,7 +2710,6 @@ <groupId>org.codehaus.mojo</groupId> <artifactId>jdepend-maven-plugin</artifactId> <version>2.0-beta-2</version> - </plugin> </plugins> </reporting> diff --git a/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartController.java b/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartController.java deleted file mode 100644 index 3c539d58a27..00000000000 --- a/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartController.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * JGS goodsolutions GmbH<br> - * http://www.goodsolutions.ch - * <p> - * This software is protected by the goodsolutions software license.<br> - * <p> - * Copyright (c) 2005-2006 by JGS goodsolutions GmbH, Switzerland.<br> - * All rights reserved. - * <p> - */ -package ch.goodsolutions.olat.jfreechart; - -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.components.Component; -import org.olat.core.gui.components.image.ImageComponent; -import org.olat.core.gui.control.DefaultController; -import org.olat.core.gui.control.Event; -import org.olat.core.gui.control.WindowControl; - -/** - * Description:<br> - * This is a simple Controller wrapper to JFreeChart charts. Drop in a JFreeChart chart, set its width - * and height and the Controller's initial component will render the chart as a PNG. - * - * For JFreeChart reference please see http://www.jfree.org/jfreechart/index.php - * <P> - * Initial Date: 18.04.2006 <br> - * - * @author Mike Stock - */ -public class JFreeChartController extends DefaultController { - - ImageComponent imgComponent; - - /** - * @param wControl - */ - public JFreeChartController(Object chart, Long height, Long width, WindowControl wControl) { - super(wControl); - imgComponent = new ImageComponent("jfreechartwrapper"); - imgComponent.setWidth(width); - imgComponent.setHeight(height); - imgComponent.setMediaResource(new JFreeChartMediaResource(chart, width, height)); - setInitialComponent(imgComponent); - } - - /** - * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) - */ - public void event(UserRequest ureq, Component source, Event event) { - // nothing to do... - - } - - /** - * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) - */ - protected void doDispose() { - // nothing to do... - } - -} diff --git a/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartMediaResource.java b/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartMediaResource.java deleted file mode 100644 index e0fa01b97df..00000000000 --- a/src/main/java/ch/goodsolutions/olat/jfreechart/JFreeChartMediaResource.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * JGS goodsolutions GmbH<br> - * http://www.goodsolutions.ch - * <p> - * This software is protected by the goodsolutions software license.<br> - * <p> - * Copyright (c) 2005-2006 by JGS goodsolutions GmbH, Switzerland.<br> - * All rights reserved. - * <p> - */ -package ch.goodsolutions.olat.jfreechart; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -import javax.servlet.http.HttpServletResponse; - -import org.olat.core.gui.media.MediaResource; - -/** - * Description:<br> - * TODO: Mike Stock Class Description for JFreeChartMediaResource - * - * <P> - * Initial Date: 18.04.2006 <br> - * - * @author Mike Stock - */ -public class JFreeChartMediaResource implements MediaResource { - - private static final String CONTENT_TYPE = "image/png"; - private static final Long UNDEF_SIZE = new Long(-1); - private static final Long UNDEF_LAST_MODIFIED = new Long(-1); - - private Object chart; - private Long width, height; - - public JFreeChartMediaResource(Object chart, Long width, Long height) { - this.chart = chart; - this.width = width; - this.height = height; - } - - /** - * @see org.olat.core.gui.media.MediaResource#getContentType() - */ - public String getContentType() { - return CONTENT_TYPE; - } - - /** - * @see org.olat.core.gui.media.MediaResource#getSize() - */ - public Long getSize() { - return UNDEF_SIZE; - } - - /** - * @see org.olat.core.gui.media.MediaResource#getInputStream() - */ - public InputStream getInputStream() { - ByteArrayInputStream pIn = null; - try { - ByteArrayOutputStream pOut = new ByteArrayOutputStream(); - //ChartUtilities.writeChartAsPNG(pOut, chart, width.intValue(), height.intValue()); - pIn = new ByteArrayInputStream(pOut.toByteArray()); - } catch (Exception e) { - // bummer... - } - return pIn; - } - - /** - * @see org.olat.core.gui.media.MediaResource#getLastModified() - */ - public Long getLastModified() { - return UNDEF_LAST_MODIFIED; - } - - /** - * @see org.olat.core.gui.media.MediaResource#prepare(javax.servlet.http.HttpServletResponse) - */ - public void prepare(HttpServletResponse hres) { - // nothing to do... - } - - /** - * @see org.olat.core.gui.media.MediaResource#release() - */ - public void release() { - // nothing to do... - } - -} diff --git a/src/main/java/org/olat/core/commons/persistence/HsqldbDatabaseManagerGUI.java b/src/main/java/org/olat/core/commons/persistence/HsqldbDatabaseManagerGUI.java deleted file mode 100644 index 371fd1f0221..00000000000 --- a/src/main/java/org/olat/core/commons/persistence/HsqldbDatabaseManagerGUI.java +++ /dev/null @@ -1,89 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <p> -*/ -package org.olat.core.commons.persistence; - -import org.hsqldb.util.DatabaseManagerSwing; -import org.olat.core.configuration.Destroyable; -import org.olat.core.configuration.Initializable; - -/** - * Description:<br> - * opens a GUI for accessing the database - * see http://hsqldb.org/web/hsqlDocsFrame.html for more documentation about this feature - * - * Usage: java DatabaseManagerSwing [--options] - where options include: - --help show this message - --driver <classname> jdbc driver class - --url <name> jdbc url - --user <name> username used for connection - --password <password> password for this user - --urlid <urlid> use url/user/password/driver in rc file - --rcfile <file> (defaults to 'dbmanager.rc' in home dir) - --dir <path> default directory - --script <file> reads from script file - --noexit do not call system.exit() - * - * <P> - * Initial Date: 02.03.2010 <br> - * @author guido - */ -public class HsqldbDatabaseManagerGUI implements Initializable, Destroyable{ - - private Thread thread; - private String dbVendor; - private String datasourceUrl; - private boolean debug; - - public HsqldbDatabaseManagerGUI(String dbVendor, final String datasourceUrl, boolean debug) { - this.dbVendor = dbVendor; - this.datasourceUrl = datasourceUrl; - this.debug = debug; - } - - @Override - public void destroy() { - thread.interrupt(); - } - - @Override - public void init() { - if (dbVendor.equals("hsqldb") && debug) { - Runnable r = new Runnable() { - @Override - public void run() { - System.out.println("LAUNCHING HSQL DBMANAGERSWING"); - String[] args = {"--user", "SA", "--url", datasourceUrl}; - try { - DatabaseManagerSwing.main(args); - } catch (Exception e) { - System.out.println("Could not start hsqldb database manager GUI: "+e.getMessage()); - } - } - }; - - thread = new Thread(r); - thread.start(); - - } - } - -} diff --git a/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml b/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml index e1a495980e8..f79e4beaa4f 100644 --- a/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml +++ b/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml @@ -260,13 +260,6 @@ <property name="password"><value></value></property> </bean> - - <bean id="hsqldbDatabaseManagerGUI" class="org.olat.core.commons.persistence.HsqldbDatabaseManagerGUI" init-method="init" destroy-method="destroy" lazy-init="true"> - <constructor-arg value="${db.vendor}" /> - <constructor-arg><value>jdbc:hsqldb:file:${java.io.tmpdir}/olatdata/database/${db.name}</value></constructor-arg> - <constructor-arg value="${olat.debug}"/> - </bean> - <!-- The mysql datasource checks upon startup whether the tables are of type InnoDB, if not it will not start. If you have an other type of transactional tables just switch back the spring config to the normal org.springframework.jdbc.datasource.DriverManagerDataSource and the check is gone.--> <bean id="mysqlDataSource" class="org.olat.core.commons.persistence.InnoDBAwareDriverManagerDataSource" lazy-init="true" init-method="init"> diff --git a/src/main/java/org/olat/core/configuration/SetupPropertiesController.java b/src/main/java/org/olat/core/configuration/SetupPropertiesController.java index 1d9a9aa9340..a5f4f2abf23 100644 --- a/src/main/java/org/olat/core/configuration/SetupPropertiesController.java +++ b/src/main/java/org/olat/core/configuration/SetupPropertiesController.java @@ -33,8 +33,6 @@ import org.olat.core.CoreSpringFactory; import org.olat.core.commons.persistence.OLATLocalSessionFactoryBean; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; -import org.olat.core.gui.components.link.Link; -import org.olat.core.gui.components.link.LinkFactory; import org.olat.core.gui.components.panel.Panel; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Event; @@ -59,7 +57,6 @@ public class SetupPropertiesController extends BasicController { VelocityContainer content = createVelocityContainer("setup"); private List<OLATProperty> defaultProps = new ArrayList<OLATProperty>(); private List<OLATProperty> overwriteProps = new ArrayList<OLATProperty>(); - private Link showDBManager; /** * @@ -95,11 +92,6 @@ public class SetupPropertiesController extends BasicController { String hibernateConnectionURL = getHibernateConnectionUrl(); content.contextPut("hibernateConnectionUrl",hibernateConnectionURL); content.contextPut("userDataRoot",WebappHelper.getUserDataRoot()); - - //add button to start hsqldbmanager gui when hsqldb is in use - if (hibernateConnectionURL.contains("hsqldb")) { - showDBManager = LinkFactory.createButton("show.hsqldb", content, this); - } main.setContent(content); @@ -198,11 +190,7 @@ public class SetupPropertiesController extends BasicController { @Override @SuppressWarnings("unused") protected void event(UserRequest ureq, Component source, Event event) { - if (source == showDBManager) { - //accessing the bean will create it - CoreSpringFactory.getBean("hsqldbDatabaseManagerGUI"); - } - + // } public class OLATProperty implements Comparable<OLATProperty> { diff --git a/src/main/java/org/olat/core/configuration/_content/setup.html b/src/main/java/org/olat/core/configuration/_content/setup.html index 36c055ad852..e43aff5aa58 100644 --- a/src/main/java/org/olat/core/configuration/_content/setup.html +++ b/src/main/java/org/olat/core/configuration/_content/setup.html @@ -1,7 +1,4 @@ Database Url: <span style=color:blue>$hibernateConnectionUrl</span> -#if ($r.available("show.hsqldb")) - <span style="padding-left:10px">$r.render("show.hsqldb")</span> -#end <br/> Userdata are stored under: <span style=color:blue>$userDataRoot</span> <hr/> diff --git a/src/test/java/org/olat/properties/PropertyTest.java b/src/test/java/org/olat/properties/PropertyTest.java index fc5c981f866..1f16a9f698d 100644 --- a/src/test/java/org/olat/properties/PropertyTest.java +++ b/src/test/java/org/olat/properties/PropertyTest.java @@ -29,7 +29,6 @@ import static org.junit.Assert.assertTrue; import java.util.List; import org.apache.log4j.Logger; -import org.hsqldb.util.DatabaseManagerSwing; import org.junit.After; import org.junit.Before; import org.junit.Test; -- GitLab