From: <ro...@us...> - 2011-08-27 00:46:52
|
Revision: 3869 http://ninan.svn.sourceforge.net/ninan/?rev=3869&view=rev Author: rotvel Date: 2011-08-27 00:46:45 +0000 (Sat, 27 Aug 2011) Log Message: ----------- logback Modified Paths: -------------- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ApplicationEventReceiver.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ConfigEditor.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/NinanLauncher.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/SessionFacade.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IOverviewService.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IThreadService.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/OverviewService.java trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/ThreadService.java Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ApplicationEventReceiver.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ApplicationEventReceiver.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ApplicationEventReceiver.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,33 +1,35 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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 dk.team.ninan.frontend; +import org.slf4j.Logger; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import dk.team.ninan.backend.configuration.ConfigUpdatedEvent; import dk.team.ninan.backend.configuration.DownloadListChangedEvent; +import dk.team.ninan.backend.util.LogUtil; /** - * This class allows non springbean classes to hook into the ApplicationEvent - * infrastructure + * This class allows non springbean classes to hook into the ApplicationEvent infrastructure * * @author max - * */ public class ApplicationEventReceiver implements ApplicationListener { + private final static Logger logger = LogUtil.getLogger(); private static volatile long lastConfigUpdate = 0; @@ -57,8 +59,7 @@ @Override public void onApplicationEvent(ApplicationEvent evt) { - Log.debug("Got " + evt.getClass().getSimpleName() + " at " - + evt.getTimestamp()); + logger.debug("Got " + evt.getClass().getSimpleName() + " at " + evt.getTimestamp()); if (evt instanceof DownloadListChangedEvent) { lastDownloadListChange = evt.getTimestamp(); } else if (evt instanceof ConfigUpdatedEvent) { Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ConfigEditor.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ConfigEditor.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/ConfigEditor.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,7 +1,9 @@ /* - * Copyright 2010 Ninan Developers Licensed 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 + * Copyright 2010 Ninan Developers. + * + * Licensed 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 * @@ -26,10 +28,8 @@ import dk.team.ninan.backend.util.User; /** - * This class holds an editable copy of the current Config values. Any changes - * to to these values through this class are not persisted until save() is - * called. (and thus not available to other parts of Ninan through Config until - * then). + * This class holds an editable copy of the current Config values. Any changes to to these values through this class are not persisted until save() is + * called. (and thus not available to other parts of Ninan through Config until then). * * @author max */ @@ -53,8 +53,7 @@ } /** - * Get a Config singleton instance for reflection lookup of Config - * properties. + * Get a Config singleton instance for reflection lookup of Config properties. * * @return */ @@ -79,8 +78,7 @@ /** * This methods saves the configuration to disk. * - * @throws java.io.IOException - * Throws exception on unexpected failure + * @throws java.io.IOException Throws exception on unexpected failure */ public static synchronized void save() throws IOException { cfgIsDirty = false; @@ -173,6 +171,7 @@ cfgIsDirty = true; doc.setNewzbinUsername(s); } + public static String getNzbMatrixUsername() { return doc.getNzbMatrixUsername(); } @@ -181,10 +180,12 @@ cfgIsDirty = true; doc.setNzbMatrixUsername(s); } + public static void setNzbMatrixKey(String s) { cfgIsDirty = true; doc.setNzbMatrixKey(s); } + public static String getNzbMatrixKey() { return doc.getNzbMatrixKey(); } Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/NinanLauncher.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/NinanLauncher.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/NinanLauncher.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,18 +1,18 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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 dk.team.ninan.frontend; import org.eclipse.jetty.server.Connector; @@ -27,60 +27,61 @@ import ch.qos.logback.core.util.StatusPrinter; /** - * @author Murat Yucel - * Date: 2007-03-08 20:02:32 + * @author Murat Yucel Date: 2007-03-08 20:02:32 */ public class NinanLauncher { - /** - * Main function, starts the jetty server. - * - * @param args arguments - */ - public static void main(String[] args) { - Server jettyServer = null; - try { - // init logging - // assume SLF4J is bound to logback in the current environment - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - try { - JoranConfigurator configurator = new JoranConfigurator(); - configurator.setContext(lc); - // the context was probably already configured by default configuration rules + /** + * Main function, starts the jetty server. + * + * @param args arguments + */ + public static void main(String[] args) { + Server jettyServer = null; + try { + // init logging + // assume SLF4J is bound to logback in the current environment + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + try { + JoranConfigurator configurator = new JoranConfigurator(); + configurator.setContext(lc); + // the context was probably already configured by default configuration rules // lc.reset(); - configurator.doConfigure("../ninan-parent/templates/log4j.xml"); - } catch (JoranException je) { - // StatusPrinter will handle this - } - StatusPrinter.printInCaseOfErrorsOrWarnings(lc); - - //DOMConfigurator.configure("../ninan-parent/templates/log4j.xml"); + configurator.doConfigure("../ninan-parent/templates/log4j.xml"); + } catch (JoranException je) { + // StatusPrinter will handle this + } + StatusPrinter.printInCaseOfErrorsOrWarnings(lc); - jettyServer = new Server(); + //DOMConfigurator.configure("../ninan-parent/templates/log4j.xml"); - SocketConnector conn = new SocketConnector(); - conn.setPort(9091); - jettyServer.setConnectors(new Connector[]{conn}); + jettyServer = new Server(); - WebAppContext wicketcontext = new WebAppContext(); - wicketcontext.setContextPath("/"); + SocketConnector conn = new SocketConnector(); + conn.setPort(9091); + jettyServer.setConnectors(new Connector[] { + conn + }); - String war = args.length > 0 ? args[0] : "src/main/webapp"; - wicketcontext.setWar(war); + WebAppContext wicketcontext = new WebAppContext(); + wicketcontext.setContextPath("/"); - jettyServer.setHandler(wicketcontext); - jettyServer.start(); - } catch (Exception e) { - System.out.println("Could not start the Jetty server: " + e.toString()); - e.printStackTrace(); - if (jettyServer != null) { - try { - jettyServer.stop(); - } catch (Exception e1) { - System.out.println("Unable to stop the jetty server: " + e.toString()); - e.printStackTrace(); - } - } - } - } + String war = args.length > 0 ? args[0] : "src/main/webapp"; + wicketcontext.setWar(war); + + jettyServer.setHandler(wicketcontext); + jettyServer.start(); + } catch (Exception e) { + System.out.println("Could not start the Jetty server: " + e.toString()); + e.printStackTrace(); + if (jettyServer != null) { + try { + jettyServer.stop(); + } catch (Exception e1) { + System.out.println("Unable to stop the jetty server: " + e.toString()); + e.printStackTrace(); + } + } + } + } } Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/SessionFacade.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/SessionFacade.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/SessionFacade.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,21 +1,18 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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. */ - -/** - * @author sprice - */ package dk.team.ninan.frontend; import javax.servlet.http.HttpServletRequest; @@ -24,19 +21,19 @@ public class SessionFacade { - private SessionFacade() { - } + private SessionFacade() { + } - public static User getUser(HttpServletRequest req) { - try { - return (User) req.getSession().getAttribute(User.class.getName()); - } catch (IllegalStateException e) { - return null; - } - } + public static User getUser(HttpServletRequest req) { + try { + return (User) req.getSession().getAttribute(User.class.getName()); + } catch (IllegalStateException e) { + return null; + } + } - public static void setUser(HttpServletRequest req, User user) { - req.getSession().setAttribute(User.class.getName(), user); - } + public static void setUser(HttpServletRequest req, User user) { + req.getSession().setAttribute(User.class.getName(), user); + } } Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IOverviewService.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IOverviewService.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IOverviewService.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,16 +1,17 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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 dk.team.ninan.frontend.services; @@ -26,8 +27,7 @@ public interface IOverviewService { - public Iterator<NzbVO> getVOIterator(int first, int count, - String order, boolean asc); + public Iterator<NzbVO> getVOIterator(int first, int count, String order, boolean asc); /** * Get total number of vos (both NZBCollections and NZBDownloads) @@ -53,12 +53,11 @@ public String getOrderSize(); - public Iterator<NewsFile> getNewsfiles(long nzbId, int first, int count, - String order, boolean asc); + public Iterator<NewsFile> getNewsfiles(long nzbId, int first, int count, String order, boolean asc); public int getNumNewsfiles(long nzbId); public List<HistoricNzbVO> getHistoricList(); - public List<String> emptyBookMarks(); + public List<String> emptyBookMarks(); } \ No newline at end of file Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IThreadService.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IThreadService.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/IThreadService.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,16 +1,17 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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 dk.team.ninan.frontend.services; @@ -20,6 +21,6 @@ public interface IThreadService { - public List<DownloadThreadVO> getDownloadThreadVOList(); + public List<DownloadThreadVO> getDownloadThreadVOList(); } \ No newline at end of file Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/OverviewService.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/OverviewService.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/OverviewService.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -23,28 +23,30 @@ import java.util.List; import java.util.Locale; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; + import dk.team.ninan.backend.bookmarks.BookmarkChecker; import dk.team.ninan.backend.configuration.DownloadAddedEvent; -import org.apache.commons.lang.StringUtils; - import dk.team.ninan.backend.db.AbstractDAO; import dk.team.ninan.backend.db.DownloadTotals; +import dk.team.ninan.backend.db.INewsFileDAO; import dk.team.ninan.backend.db.INzbDAO; -import dk.team.ninan.backend.db.INewsFileDAO; import dk.team.ninan.backend.db.Nzb; import dk.team.ninan.backend.db.NzbStatus; import dk.team.ninan.backend.newsfile.NewsFile; import dk.team.ninan.backend.siteintegration.NzbSites; +import dk.team.ninan.backend.util.LogUtil; import dk.team.ninan.backend.valueobjects.HistoricNzbVO; import dk.team.ninan.backend.valueobjects.NzbVO; import dk.team.ninan.backend.valueobjects.OverviewCache; import dk.team.ninan.backend.valueobjects.VOFactory; -import dk.team.ninan.frontend.Log; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; - public class OverviewService implements IOverviewService, Serializable, ApplicationListener { + private final static Logger logger = LogUtil.getLogger(); + private static final long serialVersionUID = 7229002564684850655L; private INzbDAO nzbDAO; @@ -92,7 +94,7 @@ List<NzbVO> voList = makeVoList(nzbCollections); overviewCache.updateVoCache(voList); - Log.debug("Loaded " + nzbVoCache.length + " nzbs, " + voList.size() + " collections"); + logger.debug("Loaded " + nzbVoCache.length + " nzbs, " + voList.size() + " collections"); if (nzbVoCache.length > 0) { ArrayList<NzbVO> nzbVoList = new ArrayList<NzbVO>(nzbVoCache.length + voList.size()); Collections.addAll(nzbVoList, nzbVoCache); Modified: trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/ThreadService.java =================================================================== --- trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/ThreadService.java 2011-08-27 00:02:42 UTC (rev 3868) +++ trunk/ninan-frontend/src/main/java/dk/team/ninan/frontend/services/ThreadService.java 2011-08-27 00:46:45 UTC (rev 3869) @@ -1,16 +1,17 @@ /* - * Copyright 2010 Ninan Developers - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * Copyright 2010 Ninan Developers. + * + * Licensed 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. + * 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 dk.team.ninan.frontend.services; @@ -48,10 +49,11 @@ vo.setDownloadedSize(downloader.getDownloadedSoFar()); NewsFile file = downloader.getNewsFile(); - if (file != null) + if (file != null) { vo.setFilename(file.getSubject()); - else + } else { vo.setFilename(""); + } vo.setDownloadErrorVO(populateDownloadErrorVO(downloader)); vo.setConnection(downloader.getConnection()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |