Mercurial > hg > release > thermostat-0.5
changeset 809:e5cc3eac6fec
Move MongoStorageProvider into exported package.
This is an emergency fix, since this breaks bundle resolution and the Eclipse
build.
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Thu, 29 Nov 2012 19:47:42 +0100 |
parents | 897b836d5b2c |
children | e5ff501704ab |
files | storage/mongo/pom.xml storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/MongoStorageProvider.java storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/internal/Activator.java storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/internal/MongoStorageProvider.java web/cmd/src/main/java/com/redhat/thermostat/web/cmd/WebServiceLauncher.java web/common/src/main/java/com/redhat/thermostat/web/common/StorageWrapper.java web/war/src/main/webapp/WEB-INF/web.xml |
diffstat | 7 files changed, 72 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/storage/mongo/pom.xml Tue Nov 27 14:29:35 2012 +0100 +++ b/storage/mongo/pom.xml Thu Nov 29 19:47:42 2012 +0100 @@ -62,6 +62,9 @@ <Bundle-SymbolicName>com.redhat.thermostat.storage.mongodb</Bundle-SymbolicName> <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor> <Bundle-Activator>com.redhat.thermostat.storage.mongodb.internal.Activator</Bundle-Activator> + <Export-Package> + com.redhat.thermostat.storage.mongodb + </Export-Package> <Private-Package> com.redhat.thermostat.storage.mongodb.internal </Private-Package>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/MongoStorageProvider.java Thu Nov 29 19:47:42 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.storage.mongodb; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +import com.redhat.thermostat.storage.config.StartupConfiguration; +import com.redhat.thermostat.storage.core.Storage; +import com.redhat.thermostat.storage.core.StorageProvider; +import com.redhat.thermostat.storage.mongodb.internal.MongoStorage; + +public class MongoStorageProvider implements StorageProvider { + + private StartupConfiguration configuration; + + public void setConfig(StartupConfiguration configuration) { + this.configuration = configuration; + } + + @Override + public Storage createStorage() { + return new MongoStorage(configuration); + } + + @Override + public boolean canHandleProtocol() { + return configuration.getDBConnectionString().startsWith("mongodb://"); + } + +}
--- a/storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/internal/Activator.java Tue Nov 27 14:29:35 2012 +0100 +++ b/storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/internal/Activator.java Thu Nov 29 19:47:42 2012 +0100 @@ -5,6 +5,7 @@ import org.osgi.framework.ServiceRegistration; import com.redhat.thermostat.storage.core.StorageProvider; +import com.redhat.thermostat.storage.mongodb.MongoStorageProvider; public class Activator implements BundleActivator {
--- a/storage/mongo/src/main/java/com/redhat/thermostat/storage/mongodb/internal/MongoStorageProvider.java Tue Nov 27 14:29:35 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2012 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.mongodb.internal; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; - -import com.redhat.thermostat.storage.config.StartupConfiguration; -import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.core.StorageProvider; - -public class MongoStorageProvider implements StorageProvider { - - private StartupConfiguration configuration; - - public void setConfig(StartupConfiguration configuration) { - this.configuration = configuration; - } - - @Override - public Storage createStorage() { - return new MongoStorage(configuration); - } - - @Override - public boolean canHandleProtocol() { - return configuration.getDBConnectionString().startsWith("mongodb://"); - } - -}
--- a/web/cmd/src/main/java/com/redhat/thermostat/web/cmd/WebServiceLauncher.java Tue Nov 27 14:29:35 2012 +0100 +++ b/web/cmd/src/main/java/com/redhat/thermostat/web/cmd/WebServiceLauncher.java Thu Nov 29 19:47:42 2012 +0100 @@ -54,7 +54,7 @@ import org.eclipse.jetty.webapp.WebAppContext; import com.redhat.thermostat.common.config.InvalidConfigurationException; -import com.redhat.thermostat.storage.mongodb.internal.MongoStorageProvider; +import com.redhat.thermostat.storage.mongodb.MongoStorageProvider; import com.redhat.thermostat.web.server.IpPortPair; import com.redhat.thermostat.web.server.WebStorageEndPoint;
--- a/web/common/src/main/java/com/redhat/thermostat/web/common/StorageWrapper.java Tue Nov 27 14:29:35 2012 +0100 +++ b/web/common/src/main/java/com/redhat/thermostat/web/common/StorageWrapper.java Thu Nov 29 19:47:42 2012 +0100 @@ -37,7 +37,7 @@ package com.redhat.thermostat.web.common; -import com.redhat.thermostat.storage.mongodb.internal.MongoStorageProvider; +import com.redhat.thermostat.storage.mongodb.MongoStorageProvider; import com.redhat.thermostat.storage.config.StartupConfiguration; import com.redhat.thermostat.storage.core.Storage; import com.redhat.thermostat.storage.core.StorageProvider;
--- a/web/war/src/main/webapp/WEB-INF/web.xml Tue Nov 27 14:29:35 2012 +0100 +++ b/web/war/src/main/webapp/WEB-INF/web.xml Thu Nov 29 19:47:42 2012 +0100 @@ -9,7 +9,7 @@ <servlet> <init-param> <param-name>storage.class</param-name> - <param-value>com.redhat.thermostat.storage.mongodb.internal.MongoStorageProvider</param-value> + <param-value>com.redhat.thermostat.storage.mongodb.MongoStorageProvider</param-value> </init-param> <init-param> <param-name>storage.endpoint</param-name>